Merge pull request #70 from zhaouv/v2.0-editor-20180304

editor细节优化
This commit is contained in:
Zhang Chen 2018-03-10 00:34:19 +08:00 committed by GitHub
commit 15c3e17b86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 23 deletions

View File

@ -363,7 +363,7 @@ editor.prototype.listen = function() {
if(!selectBox.isSelected) {
var loc = eToLoc(e);
var pos = locToPos(loc);
editor_mode.onmode('nextChange');//为了强制触发doAction
editor_mode.onmode('nextChange');
editor_mode.onmode('loc');
editor_mode.loc();
tip.whichShow = 1;
@ -521,7 +521,7 @@ editor.prototype.listen = function() {
}
}
tip.infos = JSON.parse(JSON.stringify(editor.info));
editor_mode.onmode('nextChange');//为了强制触发doAction
editor_mode.onmode('nextChange');
editor_mode.onmode('emenyitem');
editor_mode.emenyitem();
}

View File

@ -72,7 +72,7 @@ editor_mode.prototype.objToTable = function(obj,commentObj){
editor_mode.addAction(['change',field,JSON.parse(input.value)]);
//尚未完成,不完善,目前还没做$range的检查
/*临时*/editor_mode.onmode('');/*临时*/
// /*临时*/editor_mode.onmode('');/*临时*/
//临时改为立刻写入文件,删去此句的时,切换模式才会真正写入
//现阶段这样会更实用,20180218
}
@ -149,6 +149,7 @@ editor_mode.prototype.addAction = function(action){
editor_mode.prototype.doActionList = function(mode,actionList){
if (actionList.length==0)return;
printf('修改中...');
switch (mode) {
case 'loc':
@ -182,7 +183,7 @@ editor_mode.prototype.doActionList = function(mode,actionList){
editor_mode.prototype.onmode = function (mode) {
if (editor_mode.mode!=mode) {
console.log('change mode into : '+mode);
editor_mode.doActionList(editor_mode.mode,editor_mode.actionList);
if(mode==='save')editor_mode.doActionList(editor_mode.mode,editor_mode.actionList);
if(editor_mode.mode==='nextChange' && mode)editor_mode.showMode(mode);
editor_mode.mode=mode;
editor_mode.actionList=[];
@ -194,6 +195,7 @@ editor_mode.prototype.showMode = function (mode) {
editor_mode.dom[name].style='z-index:-1;opacity: 0;';
}
editor_mode.dom[mode].style='';
if(editor_mode[mode])editor_mode[mode]();
document.getElementById('editModeSelect').value=mode;
}
@ -216,7 +218,8 @@ editor_mode.prototype.loc = function(callback){
editor_mode.prototype.emenyitem = function(callback){
//editor.info=editor.ids[editor.indexs[201]];
if (!core.isset(editor.info))return;
editor_mode.info=editor.info;//避免editor.info被清空导致无法获得是物品还是怪物
if(Object.keys(editor.info).length!==0)editor_mode.info=editor.info;//避免editor.info被清空导致无法获得是物品还是怪物
if (!core.isset(editor_mode.info.id)){
document.getElementById('table_a3f03d4c_55b8_4ef6_b362_b345783acd72').innerHTML='';
@ -277,7 +280,7 @@ editor_mode.prototype.functions = function(callback){
editor_mode.prototype.listen = function(callback){
var newIdIdnum = document.getElementById('newIdIdnum');
newIdIdnum.children[0].onchange = newIdIdnum.children[1].onchange = function(){
newIdIdnum.children[2].onclick = function(){
if (newIdIdnum.children[0].value && newIdIdnum.children[1].value){
var id = newIdIdnum.children[0].value;
var idnum = parseInt(newIdIdnum.children[1].value);
@ -285,6 +288,8 @@ editor_mode.prototype.listen = function(callback){
if(err){printe(err);throw(err)}
printe('添加id的idnum成功,请F5刷新编辑器');
});
} else {
printe('请输入id和idnum');
}
}

View File

@ -15,7 +15,7 @@ document.body.onmousedown = function(e){
if(eid.indexOf('edit')===-1){
if(eid.indexOf('tip')===-1)selectBox.isSelected = false;
}
editor_mode.onmode('');
//editor.mode.onmode('');
editor.info = {};
}
iconLib.onmousedown = function(e){
@ -198,13 +198,21 @@ var clear = new Vue({
}
})
printf = function(str_,type) {
selectBox.isSelected = false;
if(!type){
tip.msgs[11]=String(str_);
tip.whichShow=12;
} else {
tip.msgs[10]=String(str_);
tip.whichShow=11;
} else {
tip.whichShow=12;
}
setTimeout(function(){
if(!type){
tip.msgs[11]=String(str_);
tip.whichShow=12;
} else {
tip.msgs[10]=String(str_);
tip.whichShow=11;
}
},1);
}
printe = function(str_){printf(str_,'error')}
var tip = new Vue({

View File

@ -23,6 +23,10 @@
<input class='btn' type="button" value="saveAs" id='saveFloorAs'/>
<input class='btn' type="button" value="复制地图" v-on:click="copyMap"/>
</div>
<div style="position: absolute;right: 10px;bottom:70px;">
<input class='btn' id='clear' type="button" value="清除地图" v-on:click="clearMap"/>
<input class='btn' type="button" value="导出地图" id="exportM" v-on:click="exportMap"/>
</div>
</div>
<div id="objDataEditor">
@ -53,7 +57,7 @@
</div>
</div></div>
<div id="left2" class='leftTab' style="z-index:-1;opacity: 0;"><div><!-- loc -->
<h3>地图选点</h3>
<h3>地图选点&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">save</button></h3>
<p id='pos_a6771a78_a099_417c_828f_0a24851ebfce'>0,0</p>
<div class='etable'>
<table>
@ -64,10 +68,11 @@
</div>
</div></div>
<div id="left3" class='leftTab' style="z-index:-1;opacity: 0;"><div><!-- emenyitem -->
<h3>图块属性</h3>
<h3>图块属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">save</button></h3>
<div id='newIdIdnum'><!-- id and idnum -->
<input placeholder="输入新id"/>
<input placeholder="输入新idnum"/>
<button>save</button>
</div>
<div><!-- enemy and item -->
<div class='etable'>
@ -80,7 +85,7 @@
</div>
</div></div>
<div id="left4" class='leftTab' style="z-index:-1;opacity: 0;"><div><!-- floor -->
<h3>楼层属性</h3>
<h3>楼层属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">save</button></h3>
<div class='etable'>
<table>
<tbody id='table_4a3b1b09_b2fb_4bdf_b9ab_9f4cdac14c74'>
@ -90,7 +95,7 @@
</div>
</div></div>
<div id="left5" class='leftTab' style="z-index:-1;opacity: 0;"><div><!-- tower -->
<h3>全塔属性</h3>
<h3>全塔属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">save</button></h3>
<div class='etable'>
<table>
<tbody id='table_b6a03e4c_5968_4633_ac40_0dfdd2c9cde5'>
@ -134,7 +139,7 @@
<textarea id="multiLineCode" name="multiLineCode"></textarea>
</div></div>
<div id="left8" class='leftTab' style="z-index:-1;opacity: 0;"><div><!-- functions -->
<h3>脚本编辑</h3>
<h3>脚本编辑&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">save</button></h3>
<div class='etable'>
<table>
<tbody id='table_e260a2be_5690_476a_b04e_dacddede78b3'>
@ -167,16 +172,15 @@
<p v-if="whichShow" v-bind:class="[ (whichShow%2) ? 'warnText' : 'successText']">{{ mapMsg }}</p>
</div>
</div>
<input class='btn' id='clear' type="button" value="清除地图" v-on:click="clearMap"/>
<input class='btn' type="button" value="导出地图" id="exportM" v-on:click="exportMap"/>
<select id="editModeSelect">
<option value="map">地图编辑</option>
<option value="loc">地图选点</option>
<option value="emenyitem">图块属性</option>
<option value="floor">楼层属性</option>
<option value="tower">全塔属性</option>
<option value="functions">脚本编辑</option>
<option value="map">地图编辑</option>
<option value="appendpic">追加素材</option>
</select>
<!-- -->

View File

@ -27,11 +27,11 @@ data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"money": " 初始金币 ",
"experience": " 初始经验 ",
"items": {
"keys": {
"keys": " 初始道具个数 \n$leaf(true)$end"/* {
"yellowKey": " 初始道具个数 ",
"blueKey": "",
"redKey": ""
},
} */,
"constants": "\n$leaf(true)$end",
"tools": "\n$leaf(true)$end"
},
@ -41,11 +41,11 @@ data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"x": "",
"y": ""
},
"flags": {
"flags": " 游戏过程中的变量或flags \n$leaf(true)$end"/* {
"poison": " 游戏过程中的变量或flags \n 毒 ",
"weak": " 衰 ",
"curse": " 咒 "
},
} */,
"steps": " 行走步数统计 ",
},
"startText": " 游戏开始前剧情。如果无剧情直接留一个空数组即可。 \n$leaf(true)$end",