Commit a067b144 authored by rockyl's avatar rockyl

完成资源分组加载功能

parent ef9e00da
...@@ -6,7 +6,7 @@ export let API_HOST; ...@@ -6,7 +6,7 @@ export let API_HOST;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
//API_HOST = '//10.10.95.74:7777'; //API_HOST = '//10.10.95.74:7777';
//API_HOST = '//192.168.1.16:7777'; //API_HOST = '//192.168.1.16:7777';
API_HOST = '//10.10.94.107:3000'; API_HOST = '//0.0.0.0:3000';
//API_HOST = '//192.168.0.105:7777'; //API_HOST = '//192.168.0.105:7777';
//API_HOST = '//localhost:3002'; //API_HOST = '//localhost:3002';
//API_HOST = window.__data.apiHost; //API_HOST = window.__data.apiHost;
......
...@@ -104,6 +104,7 @@ ...@@ -104,6 +104,7 @@
"Loading view": "加载视图", "Loading view": "加载视图",
"Page title": "页面标题", "Page title": "页面标题",
"Container ID": "容器ID", "Container ID": "容器ID",
"Lazy Load Delay": "懒加载延时",
"Design width": "设计宽度", "Design width": "设计宽度",
"Design height": "设计高度", "Design height": "设计高度",
"Frame Rate": "帧率", "Frame Rate": "帧率",
......
...@@ -34,6 +34,7 @@ const defaultOptions = { ...@@ -34,6 +34,7 @@ const defaultOptions = {
pageTitle: 'no title', pageTitle: 'no title',
entrySceneView: '', entrySceneView: '',
loadingView: '', loadingView: '',
lazyLoadWait: 1000,
containerId: 'game-container', containerId: 'game-container',
designWidth: 750, designWidth: 750,
designHeight: 1334, designHeight: 1334,
...@@ -147,7 +148,7 @@ export const projectStore = { ...@@ -147,7 +148,7 @@ export const projectStore = {
} }
if (view.explicitDepAssets) { if (view.explicitDepAssets) {
view.explicitDepAssets.splice(0); view.explicitDepAssets.splice(0);
}else{ } else {
Vue.set(view, 'explicitDepAssets', []); Vue.set(view, 'explicitDepAssets', []);
} }
explicitDepAssets = view.explicitDepAssets; explicitDepAssets = view.explicitDepAssets;
...@@ -162,7 +163,7 @@ export const projectStore = { ...@@ -162,7 +163,7 @@ export const projectStore = {
let uuid = prop.replace(assetScheme, ''); let uuid = prop.replace(assetScheme, '');
let asset = assets.find(asset => asset.uuid === uuid); let asset = assets.find(asset => asset.uuid === uuid);
if (asset) { if (asset) {
if (!explicitDepAssets.includes(asset.uuid)){ if (!explicitDepAssets.includes(asset.uuid)) {
explicitDepAssets.push(asset.uuid); explicitDepAssets.push(asset.uuid);
} }
} }
...@@ -402,7 +403,7 @@ export const projectStore = { ...@@ -402,7 +403,7 @@ export const projectStore = {
let _node1 = node; let _node1 = node;
console.log(_node1) console.log(_node1)
copyNodeCatch = clonePureObj(_node1) copyNodeCatch = clonePureObj(_node1)
console.log("copyNodeCatch",copyNodeCatch) console.log("copyNodeCatch", copyNodeCatch)
if (copyState == 1) { if (copyState == 1) {
//复制行为 //复制行为
copyNodeCatch.events copyNodeCatch.events
...@@ -411,19 +412,20 @@ export const projectStore = { ...@@ -411,19 +412,20 @@ export const projectStore = {
console.log(this) console.log(this)
deleteChildEvent(copyNodeCatch) deleteChildEvent(copyNodeCatch)
} }
//copy(JSON.stringify(copyNodeCatch)) //copy(JSON.stringify(copyNodeCatch))
function deleteChildEvent(copyNodeCatch){ function deleteChildEvent(copyNodeCatch) {
console.log(123) console.log(123)
delete copyNodeCatch.events; delete copyNodeCatch.events;
if(copyNodeCatch.children){ if (copyNodeCatch.children) {
for(let item of copyNodeCatch.children){ for (let item of copyNodeCatch.children) {
deleteChildEvent(item) deleteChildEvent(item)
} }
} }
} }
}, },
pasteNode(state, {node, parentNode, pasteState}) { pasteNode(state, {node, parentNode, pasteState}) {
let _node1 = copyNodeCatch; let _node1 = copyNodeCatch;
console.log(copyNodeCatch); console.log(copyNodeCatch);
...@@ -529,9 +531,10 @@ export const projectStore = { ...@@ -529,9 +531,10 @@ export const projectStore = {
this.commit('makeProjectDirty'); this.commit('makeProjectDirty');
}, },
modifyViewDepAssets(state, {view, explicitDepAssets, implicitDepAssets}){ modifyViewDepAssets(state, {view, explicitDepAssets, implicitDepAssets, depCustoms}) {
view.explicitDepAssets = explicitDepAssets; view.explicitDepAssets = explicitDepAssets;
view.implicitDepAssets = implicitDepAssets; view.implicitDepAssets = implicitDepAssets;
view.depCustoms = depCustoms;
this.commit('makeProjectDirty'); this.commit('makeProjectDirty');
} }
...@@ -614,11 +617,14 @@ export const projectStore = { ...@@ -614,11 +617,14 @@ export const projectStore = {
assets(state) { assets(state) {
return state.data.assets; return state.data.assets;
}, },
assetDepFlag: state=> uuid => { assetDepFlag: state => uuid => {
return state.data.views.filter(view=> return state.data.views.filter(view =>
view.explicitDepAssets.includes(uuid) || view.implicitDepAssets.includes(uuid) view.explicitDepAssets.includes(uuid) || view.implicitDepAssets.includes(uuid)
).length > 0 ? 0 : -1; ).length > 0 ? 0 : -1;
}, },
customs(state) {
return state.data.customs;
},
getProcess: state => behavior => { getProcess: state => behavior => {
return arrayFind(state.data.processes, process => process.id === behavior.meta); return arrayFind(state.data.processes, process => process.id === behavior.meta);
}, },
......
...@@ -179,35 +179,54 @@ ...@@ -179,35 +179,54 @@
flex-direction: column; flex-direction: column;
height: 50vh; height: 50vh;
.explicit-tags{ .assets-dep {
flex: 1;
height: 0;
display: flex; display: flex;
flex-direction: column;
margin-bottom: 5px;
div+div{ .explicit-tags {
margin-left: 5px;
}
div{
display: flex; display: flex;
align-items: center;
div{ div + div {
width: 10px; margin-left: 10px;
height: 10px;
} }
.explicit{ div {
background-color: $--color-danger; display: flex;
} align-items: center;
.implicit{
background-color: $--color-success; div {
width: 10px;
height: 10px;
margin-right: 2px;
}
.explicit {
background-color: $--color-danger;
}
.implicit {
background-color: $--color-success;
}
} }
} }
.assets-scrollbar {
flex: 1;
border: 1px solid $--border-color-light;
}
} }
.assets-scrollbar { .custom-dep {
flex: 1; display: flex;
border: 1px solid $--border-color-light; align-items: center;
.select{
flex: 1;
}
} }
} }
} }
...@@ -80,7 +80,7 @@ async function packAssets(key, assets) { ...@@ -80,7 +80,7 @@ async function packAssets(key, assets) {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
try { try {
if (asset.file) { if (asset.file) {
uploadSheet(asset).catch(e => { await uploadSheet(asset).catch(e => {
failedList.push(asset); failedList.push(asset);
}); });
} }
......
...@@ -10,35 +10,45 @@ ...@@ -10,35 +10,45 @@
custom-class="asset-dependence-dialog flex-dialog" custom-class="asset-dependence-dialog flex-dialog"
> >
<div class="wrapper"> <div class="wrapper">
<div class="explicit-tags"> <div class="assets-dep">
<div> <div class="explicit-tags">
<div class="explicit"></div> <div>
显式依赖 <div class="explicit"></div>
</div> 显式依赖
<div> </div>
<div class="implicit"></div> <div>
隐式依赖 <div class="implicit"></div>
隐式依赖
</div>
</div> </div>
<el-scrollbar class="assets-scrollbar" wrap-class="wrap-x-hidden"
view-class="scrollbar-view">
<asset-list ref="depAssetList" :editable="false" :selectable="false"
:assets-source="assetsSource"
v-if="view"
@click-item="onClickItem"
:target-view="view"
:explicit-dep-assets="explicitDepAssets"
:implicit-dep-assets="implicitDepAssets"
/>
</el-scrollbar>
</div>
<div class="custom-dep">
<span>自定义模块依赖</span>
<el-select class="select" multiple v-model="depCustoms" size="mini">
<el-option v-for="custom in customs"
:key="custom.id"
:value="custom.id"
:label="custom.name"
>
</el-option>
</el-select>
</div> </div>
<el-scrollbar class="assets-scrollbar" wrap-class="wrap-x-hidden"
view-class="scrollbar-view">
<asset-list ref="depAssetList" :editable="false" :selectable="false"
:assets-source="assetsSource"
v-if="view"
@click-item="onClickItem"
:target-view="view"
:explicit-dep-assets="explicitDepAssets"
:implicit-dep-assets="implicitDepAssets"
/>
</el-scrollbar>
</div> </div>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<div></div> <div></div>
<div> <div>
<el-popconfirm @onConfirm="clickClose" placement="top" <el-button slot="reference" size="mini" @click="clickClose">{{ $t("Close") }}</el-button>
:title="$t('Are you sure to close?')">
<el-button slot="reference" size="mini">{{ $t("Close") }}</el-button>
</el-popconfirm>
<el-button class="save-button" type="primary" size="mini" @click="clickSave">{{ $t("Save") }} <el-button class="save-button" type="primary" size="mini" @click="clickSave">{{ $t("Save") }}
</el-button> </el-button>
</div> </div>
...@@ -47,7 +57,7 @@ ...@@ -47,7 +57,7 @@
</template> </template>
<script> <script>
import {mapMutations} from 'vuex'; import {mapMutations, mapGetters} from 'vuex';
import MonacoEditor from "vue-monaco"; import MonacoEditor from "vue-monaco";
import {clonePureObj, monacoEditorOptions} from "../../../../utils"; import {clonePureObj, monacoEditorOptions} from "../../../../utils";
import AssetList from "../../Assets/AssetList"; import AssetList from "../../Assets/AssetList";
...@@ -67,15 +77,19 @@ ...@@ -67,15 +77,19 @@
view: null, view: null,
explicitDepAssets: [], explicitDepAssets: [],
implicitDepAssets: [], implicitDepAssets: [],
depCustoms: [],
} }
}, },
computed: {}, computed: {
...mapGetters(['customs']),
},
methods: { methods: {
async edit(view) { async edit(view) {
this.view = view; this.view = view;
this.explicitDepAssets = view.explicitDepAssets.concat(); this.explicitDepAssets = view.explicitDepAssets.concat();
this.implicitDepAssets = view.implicitDepAssets.concat(); this.implicitDepAssets = view.implicitDepAssets.concat();
this.depCustoms = view.depCustoms ? view.depCustoms.concat() : [];
this.assetsSource = clonePureObj(this.$store.getters.assets); this.assetsSource = clonePureObj(this.$store.getters.assets);
...@@ -86,6 +100,7 @@ ...@@ -86,6 +100,7 @@
view: this.view, view: this.view,
explicitDepAssets: this.explicitDepAssets, explicitDepAssets: this.explicitDepAssets,
implicitDepAssets: this.implicitDepAssets, implicitDepAssets: this.implicitDepAssets,
depCustoms: this.depCustoms
}); });
this.visible = false; this.visible = false;
}, },
...@@ -103,7 +118,7 @@ ...@@ -103,7 +118,7 @@
let index = implicitDepAssets.indexOf(uuid); let index = implicitDepAssets.indexOf(uuid);
if (index >= 0) { if (index >= 0) {
implicitDepAssets.splice(index, 1); implicitDepAssets.splice(index, 1);
}else{ } else {
implicitDepAssets.push(uuid); implicitDepAssets.push(uuid);
} }
}, },
......
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item prop="lazyLoadWait" :label="$t('Lazy Load Delay')">
<el-input-number v-model="editData.lazyLoadWait" placeholder="1000" controls-position="right"/>
</el-form-item>
<el-form-item prop="containerId" :label="$t('Container ID')"> <el-form-item prop="containerId" :label="$t('Container ID')">
<el-input v-model="editData.containerId"/> <el-input v-model="editData.containerId"/>
</el-form-item> </el-form-item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment