parent
39db1cd235
commit
05982bfaf4
@ -18,15 +18,16 @@ editor.file.loadFloorFile
|
|||||||
editor.file.saveFloorFile
|
editor.file.saveFloorFile
|
||||||
editor.file.saveFloorFileAs
|
editor.file.saveFloorFileAs
|
||||||
```
|
```
|
||||||
5个编辑模式有关的查询
|
6个编辑模式有关的查询
|
||||||
```javascript
|
```javascript
|
||||||
editor.file.editItem('redJewel',[],function(a){console.log(a)});
|
editor.file.editItem('redJewel',[],function(a){console.log(a)});
|
||||||
editor.file.editEnemy('redBat',[],function(a){console.log(a)});
|
editor.file.editEnemy('redBat',[],function(a){console.log(a)});
|
||||||
editor.file.editLoc(2,0,[],function(a){console.log(a)});
|
editor.file.editLoc(2,0,[],function(a){console.log(a)});
|
||||||
editor.file.editFloor([],function(a){console.log(a)});
|
editor.file.editFloor([],function(a){console.log(a)});
|
||||||
editor.file.editTower([],function(a){console.log(a)});
|
editor.file.editTower([],function(a){console.log(a)});
|
||||||
|
editor.file.editFunctions([],function(a){console.log(a)});
|
||||||
```
|
```
|
||||||
5个编辑模式有关的编辑
|
6个编辑模式有关的编辑
|
||||||
```javascript
|
```javascript
|
||||||
editor.info={images: "terrains", y: 9};
|
editor.info={images: "terrains", y: 9};
|
||||||
editor.file.changeIdAndIdnum('yellowWall2',16,editor.info,function(a){console.log(a)});
|
editor.file.changeIdAndIdnum('yellowWall2',16,editor.info,function(a){console.log(a)});
|
||||||
@ -35,15 +36,17 @@ editor.file.editEnemy('redBat',[['change',"['atk']",20]],function(a){console.log
|
|||||||
editor.file.editLoc(2,6,[["change","['afterBattle']",null]],function(a){console.log(a)});
|
editor.file.editLoc(2,6,[["change","['afterBattle']",null]],function(a){console.log(a)});
|
||||||
editor.file.editFloor([["change","['title']",'样板 33 层']],function(a){console.log(a)});
|
editor.file.editFloor([["change","['title']",'样板 33 层']],function(a){console.log(a)});
|
||||||
editor.file.editTower([["change","['values']['lavaDamage']",200]],function(a){console.log(a)});
|
editor.file.editTower([["change","['values']['lavaDamage']",200]],function(a){console.log(a)});
|
||||||
|
editor.file.editFunctions(["change","['events']['afterChangeLight']","function(x,y){console.log(x,y)}"],function(a){console.log(a)});
|
||||||
```
|
```
|
||||||
|
|
||||||
### editor_mode.js
|
### editor_mode.js
|
||||||
4个生成表格并绑定事件的函数
|
5个生成表格并绑定事件的函数
|
||||||
```javascript
|
```javascript
|
||||||
editor.mode.loc();
|
editor.mode.loc();
|
||||||
editor.mode.emenyitem();
|
editor.mode.emenyitem();
|
||||||
editor.mode.floor();
|
editor.mode.floor();
|
||||||
editor.mode.tower();
|
editor.mode.tower();
|
||||||
|
editor.mode.functions();
|
||||||
```
|
```
|
||||||
切换模式
|
切换模式
|
||||||
```javascript
|
```javascript
|
||||||
@ -52,6 +55,7 @@ editor.mode.onmode('loc');
|
|||||||
editor.mode.onmode('emenyitem');
|
editor.mode.onmode('emenyitem');
|
||||||
editor.mode.onmode('floor');
|
editor.mode.onmode('floor');
|
||||||
editor.mode.onmode('tower');
|
editor.mode.onmode('tower');
|
||||||
|
editor.mode.onmode('functions');
|
||||||
```
|
```
|
||||||
在切换模式时,改动才会保存到文件,并且需要刷新页面使得`editor`能看到改动
|
在切换模式时,改动才会保存到文件,并且需要刷新页面使得`editor`能看到改动
|
||||||
|
|
||||||
|
|||||||
@ -56,13 +56,29 @@
|
|||||||
|
|
||||||
#left6 #blocklyDiv {height: 480px; width: 940px;float:left;}
|
#left6 #blocklyDiv {height: 480px; width: 940px;float:left;}
|
||||||
#left6 #codeArea {width: 99.5%; height: 15.4em;overflow:y;/* resize:none; */clear:both;}
|
#left6 #codeArea {width: 99.5%; height: 15.4em;overflow:y;/* resize:none; */clear:both;}
|
||||||
#left6 #multiLineDiv {height: 440px; width: 375px;float:left;}
|
|
||||||
#left6 #multiLineDiv .CodeMirror {
|
#left7 {
|
||||||
|
/* height: 440px; width: 375px;float:left; */
|
||||||
|
left: 5px;
|
||||||
|
top: 5px;
|
||||||
|
z-index: 200;
|
||||||
|
position: fixed;
|
||||||
|
background-color: rgb(245, 245, 245);
|
||||||
|
width: 1335px;
|
||||||
|
height: 780px;
|
||||||
|
}
|
||||||
|
#left7 .CodeMirror {
|
||||||
/* border-top: 1px solid black;
|
/* border-top: 1px solid black;
|
||||||
border-bottom: 1px solid black; */
|
border-bottom: 1px solid black; */
|
||||||
border: 1px solid #eee;
|
border: 1px solid #eee;
|
||||||
height: 438px;
|
height: 700px;
|
||||||
width: 373px;
|
width: 940px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#left8 {
|
||||||
|
left: 900px;
|
||||||
|
top: 1290px;
|
||||||
|
width: 440px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.etable table,
|
.etable table,
|
||||||
|
|||||||
@ -22,6 +22,7 @@ editor.prototype.init = function(callback){
|
|||||||
}
|
}
|
||||||
|
|
||||||
var afterMainInit = function(){
|
var afterMainInit = function(){
|
||||||
|
core.floors=JSON.parse(JSON.stringify(core.floors,function(k,v){if(v instanceof Function){return v.toString()}else return v}));
|
||||||
editor.main=main;
|
editor.main=main;
|
||||||
editor.core=core;
|
editor.core=core;
|
||||||
editor.fs=fs;
|
editor.fs=fs;
|
||||||
@ -154,6 +155,7 @@ editor.prototype.mapInit = function(){
|
|||||||
editor.currentFloorData.afterBattle={};
|
editor.currentFloorData.afterBattle={};
|
||||||
editor.currentFloorData.afterGetItem={};
|
editor.currentFloorData.afterGetItem={};
|
||||||
editor.currentFloorData.afterOpenDoor={};
|
editor.currentFloorData.afterOpenDoor={};
|
||||||
|
editor.currentFloorData.cannotMove={};
|
||||||
}
|
}
|
||||||
editor.prototype.drawMapBg = function(img){
|
editor.prototype.drawMapBg = function(img){
|
||||||
var bgc = bg.getContext('2d');
|
var bgc = bg.getContext('2d');
|
||||||
|
|||||||
@ -357,35 +357,6 @@ editor_blockly.confirm = function (){
|
|||||||
setvalue(JSON.stringify(obj));
|
setvalue(JSON.stringify(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
var codeEditor = CodeMirror.fromTextArea(document.getElementById("multiLineCode"), {
|
|
||||||
lineNumbers: true,
|
|
||||||
matchBrackets: true,
|
|
||||||
lineWrapping: true,
|
|
||||||
continueComments: "Enter",
|
|
||||||
extraKeys: {"Ctrl-Q": "toggleComment"}
|
|
||||||
});
|
|
||||||
editor_blockly.showCodeEditor = function(){document.getElementById("multiLineDiv").style='';}
|
|
||||||
editor_blockly.hideCodeEditor = function(){document.getElementById("multiLineDiv").style='z-index:-1;opacity: 0;';}
|
|
||||||
|
|
||||||
var multiLineArgs=[null,null,null];
|
|
||||||
editor_blockly.multiLineEdit = function(value,b,f,callback){
|
|
||||||
editor_blockly.showCodeEditor();
|
|
||||||
codeEditor.setValue(value.split('\\n').join('\n')||'');
|
|
||||||
multiLineArgs[0]=b;
|
|
||||||
multiLineArgs[1]=f;
|
|
||||||
multiLineArgs[2]=callback;
|
|
||||||
}
|
|
||||||
editor_blockly.multiLineDone = function(){
|
|
||||||
editor_blockly.hideCodeEditor();
|
|
||||||
if(!multiLineArgs[0] || !multiLineArgs[1] || !multiLineArgs[2])return;
|
|
||||||
var newvalue = codeEditor.getValue()||'';
|
|
||||||
multiLineArgs[2](newvalue,multiLineArgs[0],multiLineArgs[1])
|
|
||||||
}
|
|
||||||
editor_blockly.multiLineCancel = function(){
|
|
||||||
multiLineArgs=[null,null,null];
|
|
||||||
editor_blockly.hideCodeEditor();
|
|
||||||
}
|
|
||||||
|
|
||||||
editor_blockly.doubleClickBlock = function (blockId){
|
editor_blockly.doubleClickBlock = function (blockId){
|
||||||
var b=editor_blockly.workspace.getBlockById(blockId);
|
var b=editor_blockly.workspace.getBlockById(blockId);
|
||||||
console.log(b);
|
console.log(b);
|
||||||
@ -400,7 +371,7 @@ editor_blockly.doubleClickBlock = function (blockId){
|
|||||||
if(f){
|
if(f){
|
||||||
var value = b.getFieldValue(f);
|
var value = b.getFieldValue(f);
|
||||||
//多行编辑
|
//多行编辑
|
||||||
editor_blockly.multiLineEdit(value,b,f,function(newvalue,b,f){
|
editor_multi.multiLineEdit(value,b,f,function(newvalue,b,f){
|
||||||
if(textStringDict[b.type]!=='RawEvalString_0'){}
|
if(textStringDict[b.type]!=='RawEvalString_0'){}
|
||||||
b.setFieldValue(newvalue.split('\n').join('\\n'),f);
|
b.setFieldValue(newvalue.split('\n').join('\\n'),f);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -3,35 +3,28 @@ editor_file = function(editor, callback){
|
|||||||
var editor_file = {};
|
var editor_file = {};
|
||||||
|
|
||||||
|
|
||||||
|
var commentjs={
|
||||||
(function(){
|
'comment':'comment',
|
||||||
var script = document.createElement('script');
|
'data.comment':'dataComment',
|
||||||
if (window.location.href.indexOf('_server')!==-1)
|
'functions.comment':'functionsComment',
|
||||||
script.src = '../project/comment.js';
|
}
|
||||||
else
|
for(var key in commentjs){
|
||||||
script.src = 'project/comment.js';
|
(function(key){
|
||||||
document.body.appendChild(script);
|
var value = commentjs[key];
|
||||||
script.onload = function () {
|
var script = document.createElement('script');
|
||||||
editor_file.comment=comment_c456ea59_6018_45ef_8bcc_211a24c627dc;
|
if (window.location.href.indexOf('_server')!==-1)
|
||||||
delete(comment_c456ea59_6018_45ef_8bcc_211a24c627dc);
|
script.src = '../project/'+key+'.js';
|
||||||
if (editor_file.comment && editor_file.dataComment && callback)
|
else
|
||||||
callback();
|
script.src = 'project/'+key+'.js';
|
||||||
}
|
document.body.appendChild(script);
|
||||||
})();
|
script.onload = function () {
|
||||||
(function(){
|
editor_file[value]=eval(key.replace('.','_')+'_c456ea59_6018_45ef_8bcc_211a24c627dc');
|
||||||
var script = document.createElement('script');
|
var loaded = Boolean(callback);
|
||||||
if (window.location.href.indexOf('_server')!==-1)
|
for(var key_ in commentjs){loaded = loaded && editor_file[commentjs[key_]]}
|
||||||
script.src = '../project/data.comment.js';
|
if (loaded)callback();
|
||||||
else
|
}
|
||||||
script.src = 'project/data.comment.js';
|
})(key);
|
||||||
document.body.appendChild(script);
|
}
|
||||||
script.onload = function () {
|
|
||||||
editor_file.dataComment=data_comment_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d;
|
|
||||||
delete(data_comment_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d);
|
|
||||||
if (editor_file.comment && editor_file.dataComment && callback)
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|
||||||
|
|
||||||
editor_file.getFloorFileList = function(callback){
|
editor_file.getFloorFileList = function(callback){
|
||||||
@ -396,6 +389,52 @@ editor_file = function(editor, callback){
|
|||||||
}
|
}
|
||||||
//callback([obj,commentObj,err:String])
|
//callback([obj,commentObj,err:String])
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
var fmap = {};
|
||||||
|
var fjson = JSON.stringify(functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a,function(k,v){if(v instanceof Function){var id_ = editor.guid();fmap[id_]=v.toString();return id_;}else return v},4);
|
||||||
|
var fobj = JSON.parse(fjson);
|
||||||
|
editor_file.functionsMap = fmap;
|
||||||
|
editor_file.functionsJSON = fjson;
|
||||||
|
var buildlocobj = function(locObj){
|
||||||
|
for(var key in locObj){
|
||||||
|
if(typeof(locObj[key])!==typeof(''))buildlocobj(locObj[key]);
|
||||||
|
else locObj[key]=fmap[locObj[key]];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
editor_file.editFunctions = function(actionList,callback){
|
||||||
|
/*actionList:[
|
||||||
|
["change","['events']['afterChangeLight']","function(x,y){console.log(x,y)}"],
|
||||||
|
["change","['ui']['drawAbout']","function(){...}"],
|
||||||
|
]
|
||||||
|
为[]时只查询不修改
|
||||||
|
*/
|
||||||
|
if (!isset(callback)) {printe('未设置callback');throw('未设置callback')};
|
||||||
|
if (isset(actionList) && actionList.length > 0){
|
||||||
|
saveSetting('functions',actionList,function (err) {
|
||||||
|
callback([
|
||||||
|
(function(){
|
||||||
|
var locObj=JSON.parse(fjson);
|
||||||
|
buildlocobj(locObj);
|
||||||
|
return locObj;
|
||||||
|
})(),
|
||||||
|
editor_file.functionsComment,
|
||||||
|
err]);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
callback([
|
||||||
|
(function(){
|
||||||
|
var locObj=JSON.parse(fjson);
|
||||||
|
buildlocobj(locObj);
|
||||||
|
return locObj;
|
||||||
|
})(),
|
||||||
|
editor_file.functionsComment,
|
||||||
|
null]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//callback([obj,commentObj,err:String])
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
var isset = function (val) {
|
var isset = function (val) {
|
||||||
@ -422,6 +461,12 @@ editor_file = function(editor, callback){
|
|||||||
}
|
}
|
||||||
return formatArrStr;
|
return formatArrStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var encode = function (str) {
|
||||||
|
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function(match, p1) {
|
||||||
|
return String.fromCharCode(parseInt(p1, 16))
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
var saveSetting = function(file,actionList,callback) {
|
var saveSetting = function(file,actionList,callback) {
|
||||||
console.log(file);
|
console.log(file);
|
||||||
@ -490,6 +535,22 @@ editor_file = function(editor, callback){
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (file=='functions') {
|
||||||
|
actionList.forEach(function (value) {
|
||||||
|
if (value[0]!='change')return;
|
||||||
|
eval("fmap[fobj"+value[1]+']='+JSON.stringify(value[2]));
|
||||||
|
});
|
||||||
|
var fraw = fjson;
|
||||||
|
for(var id_ in fmap){
|
||||||
|
fraw = fraw.replace('"'+id_+'"',fmap[id_])
|
||||||
|
}
|
||||||
|
var datastr='functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = \n';
|
||||||
|
datastr+=fraw;
|
||||||
|
fs.writeFile('project/functions.js',encode(datastr),'base64',function(err, data){
|
||||||
|
callback(err);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (file=='floors') {
|
if (file=='floors') {
|
||||||
actionList.forEach(function (value) {
|
actionList.forEach(function (value) {
|
||||||
if (value[0]!='change')return;
|
if (value[0]!='change')return;
|
||||||
|
|||||||
@ -6,7 +6,8 @@ function editor_mode(){
|
|||||||
'loc':'left2',
|
'loc':'left2',
|
||||||
'emenyitem':'left3',
|
'emenyitem':'left3',
|
||||||
'floor':'left4',
|
'floor':'left4',
|
||||||
'tower':'left5'
|
'tower':'left5',
|
||||||
|
'functions':'left8'
|
||||||
}
|
}
|
||||||
this._ids={}
|
this._ids={}
|
||||||
this.dom={}
|
this.dom={}
|
||||||
@ -74,6 +75,7 @@ editor_mode.prototype.objToTable = function(obj,commentObj){
|
|||||||
}
|
}
|
||||||
input.ondblclick = function(){
|
input.ondblclick = function(){
|
||||||
editor_blockly.import(guid);
|
editor_blockly.import(guid);
|
||||||
|
editor_multi.import(guid);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -164,6 +166,10 @@ editor_mode.prototype.doActionList = function(mode,actionList){
|
|||||||
|
|
||||||
editor.file.editTower(actionList,function(objs_){console.log(objs_);if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')});
|
editor.file.editTower(actionList,function(objs_){console.log(objs_);if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')});
|
||||||
break;
|
break;
|
||||||
|
case 'functions':
|
||||||
|
|
||||||
|
editor.file.editFunctions(actionList,function(objs_){console.log(objs_);if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')});
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -243,6 +249,16 @@ editor_mode.prototype.tower = function(callback){
|
|||||||
if (Boolean(callback))callback();
|
if (Boolean(callback))callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
editor_mode.prototype.functions = function(callback){
|
||||||
|
var objs=[];
|
||||||
|
editor.file.editFunctions([],function(objs_){objs=objs_;console.log(objs_)});
|
||||||
|
//只查询不修改时,内部实现不是异步的,所以可以这么写
|
||||||
|
var tableinfo=editor_mode.objToTable(objs[0],objs[1]);
|
||||||
|
document.getElementById('table_e260a2be_5690_476a_b04e_dacddede78b3').innerHTML=tableinfo.HTML;
|
||||||
|
tableinfo.listen(tableinfo.guids);
|
||||||
|
if (Boolean(callback))callback();
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
editor_mode.prototype.listen = function(callback){
|
editor_mode.prototype.listen = function(callback){
|
||||||
|
|||||||
76
_server/editor_multi.js
Normal file
76
_server/editor_multi.js
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
editor_multi = function(){
|
||||||
|
|
||||||
|
var editor_multi = {};
|
||||||
|
|
||||||
|
var codeEditor = CodeMirror.fromTextArea(document.getElementById("multiLineCode"), {
|
||||||
|
lineNumbers: true,
|
||||||
|
matchBrackets: true,
|
||||||
|
lineWrapping: true,
|
||||||
|
continueComments: "Enter",
|
||||||
|
extraKeys: {"Ctrl-Q": "toggleComment"}
|
||||||
|
});
|
||||||
|
|
||||||
|
editor_multi.id='';
|
||||||
|
|
||||||
|
editor_multi.show = function(){document.getElementById('left7').style='';}
|
||||||
|
editor_multi.hide = function(){document.getElementById('left7').style='z-index:-1;opacity: 0;';}
|
||||||
|
|
||||||
|
|
||||||
|
editor_multi.import = function(id_){
|
||||||
|
var thisTr = document.getElementById(id_);
|
||||||
|
if(!thisTr)return;
|
||||||
|
var input = thisTr.children[2].children[0].children[0];
|
||||||
|
var field = thisTr.children[0].getAttribute('title');
|
||||||
|
var type = input.value && (input.value.slice(0,11)==='"function (');
|
||||||
|
if(!type)return;
|
||||||
|
editor_multi.id=id_;
|
||||||
|
codeEditor.setValue(JSON.parse(input.value)||'');
|
||||||
|
editor_multi.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
editor_multi.cancel = function(){
|
||||||
|
editor_multi.hide();
|
||||||
|
editor_multi.id='';
|
||||||
|
multiLineArgs=[null,null,null];
|
||||||
|
}
|
||||||
|
|
||||||
|
editor_multi.confirm = function (){
|
||||||
|
if(!editor_multi.id){
|
||||||
|
editor_multi.id='';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(editor_multi.id==='callFromBlockly'){
|
||||||
|
editor_multi.id='';
|
||||||
|
editor_multi.multiLineDone();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var setvalue = function(value){
|
||||||
|
var thisTr = document.getElementById(editor_multi.id);
|
||||||
|
editor_multi.id='';
|
||||||
|
var input = thisTr.children[2].children[0].children[0];
|
||||||
|
input.value = JSON.stringify(value);
|
||||||
|
editor_multi.hide();
|
||||||
|
input.onchange();
|
||||||
|
}
|
||||||
|
setvalue(codeEditor.getValue()||'');
|
||||||
|
}
|
||||||
|
|
||||||
|
var multiLineArgs=[null,null,null];
|
||||||
|
editor_multi.multiLineEdit = function(value,b,f,callback){
|
||||||
|
editor_multi.id='callFromBlockly';
|
||||||
|
codeEditor.setValue(value.split('\\n').join('\n')||'');
|
||||||
|
multiLineArgs[0]=b;
|
||||||
|
multiLineArgs[1]=f;
|
||||||
|
multiLineArgs[2]=callback;
|
||||||
|
editor_multi.show();
|
||||||
|
}
|
||||||
|
editor_multi.multiLineDone = function(){
|
||||||
|
editor_multi.hide();
|
||||||
|
if(!multiLineArgs[0] || !multiLineArgs[1] || !multiLineArgs[2])return;
|
||||||
|
var newvalue = codeEditor.getValue()||'';
|
||||||
|
multiLineArgs[2](newvalue,multiLineArgs[0],multiLineArgs[1])
|
||||||
|
}
|
||||||
|
|
||||||
|
return editor_multi;
|
||||||
|
}
|
||||||
|
//editor_multi=editor_multi();
|
||||||
24
editor.html
24
editor.html
@ -125,14 +125,24 @@
|
|||||||
</h3>
|
</h3>
|
||||||
<div>
|
<div>
|
||||||
<div id="blocklyDiv"></div>
|
<div id="blocklyDiv"></div>
|
||||||
<div id="multiLineDiv" style="z-index:-1;opacity: 0;">
|
|
||||||
<textarea id="multiLineCode" name="multiLineCode"></textarea>
|
|
||||||
<button onclick="editor_blockly.multiLineDone()">done</button>
|
|
||||||
<button onclick="editor_blockly.multiLineCancel()">cancel</button>
|
|
||||||
</div>
|
|
||||||
<textarea id="codeArea" spellcheck="false"></textarea>
|
<textarea id="codeArea" spellcheck="false"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div></div>
|
</div></div>
|
||||||
|
<div id="left7" style="z-index:-1;opacity: 0;"><div>
|
||||||
|
<button onclick="editor_multi.confirm()">confirm</button>
|
||||||
|
<button onclick="editor_multi.cancel()">cancel</button>
|
||||||
|
<textarea id="multiLineCode" name="multiLineCode"></textarea>
|
||||||
|
</div></div>
|
||||||
|
<div id="left8" class='leftTab'><div><!-- tower -->
|
||||||
|
<h3>脚本编辑</h3>
|
||||||
|
<div class='etable'>
|
||||||
|
<table>
|
||||||
|
<tbody id='table_e260a2be_5690_476a_b04e_dacddede78b3'>
|
||||||
|
<tr><td>条目</td><td>注释</td><td>值</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div></div>
|
||||||
<div id="mid">
|
<div id="mid">
|
||||||
<table class="col" id='mapColMark'></table>
|
<table class="col" id='mapColMark'></table>
|
||||||
<table class="row" id='mapRowMark'></table>
|
<table class="row" id='mapRowMark'></table>
|
||||||
@ -331,7 +341,9 @@ main.init('editor', function() {
|
|||||||
editor.mode.emenyitem();
|
editor.mode.emenyitem();
|
||||||
editor.mode.floor();
|
editor.mode.floor();
|
||||||
editor.mode.tower();
|
editor.mode.tower();
|
||||||
|
editor.mode.functions();
|
||||||
editor.mode.listen();
|
editor.mode.listen();
|
||||||
|
editor_multi=editor_multi();
|
||||||
editor_blockly=editor_blockly();
|
editor_blockly=editor_blockly();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -341,6 +353,8 @@ main.init('editor', function() {
|
|||||||
//main.listen();
|
//main.listen();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<!-- hightlight textarea -->
|
||||||
|
<script src='_server/editor_multi.js'></script>
|
||||||
<!-- blockly -->
|
<!-- blockly -->
|
||||||
<script src="_server/blockly/Converter.bundle.min.js"></script>
|
<script src="_server/blockly/Converter.bundle.min.js"></script>
|
||||||
<script src="_server/blockly/blockly_compressed.js"></script>
|
<script src="_server/blockly/blockly_compressed.js"></script>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
data_comment_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
||||||
{
|
{
|
||||||
"main": {
|
"main": {
|
||||||
"useCompress": " 是否使用压缩文件 \n 当你即将发布你的塔时,请使用“JS代码压缩工具”将所有js代码进行压缩,然后将这里的useCompress改为true。 \n 请注意,只有useCompress是false时才会读取floors目录下的文件,为true时会直接读取libs目录下的floors.min.js文件。 \n 如果要进行剧本的修改请务必将其改成false。 \n$select({\"values\":[false]})$end",
|
"useCompress": " 是否使用压缩文件 \n 当你即将发布你的塔时,请使用“JS代码压缩工具”将所有js代码进行压缩,然后将这里的useCompress改为true。 \n 请注意,只有useCompress是false时才会读取floors目录下的文件,为true时会直接读取libs目录下的floors.min.js文件。 \n 如果要进行剧本的修改请务必将其改成false。 \n$select({\"values\":[false]})$end",
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
functions_comment_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
||||||
{
|
{
|
||||||
"events" : {
|
"events" : {
|
||||||
"setInitData" : "不同难度分别设置初始属性",
|
"setInitData" : "不同难度分别设置初始属性",
|
||||||
|
|||||||
@ -3,6 +3,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
"events":{
|
"events":{
|
||||||
////// 不同难度分别设置初始属性 //////
|
////// 不同难度分别设置初始属性 //////
|
||||||
"setInitData":function (hard) {
|
"setInitData":function (hard) {
|
||||||
|
// 不同难度分别设置初始属性
|
||||||
if (hard=='Easy') { // 简单难度
|
if (hard=='Easy') { // 简单难度
|
||||||
core.setFlag('hard', 1); // 可以用flag:hard来获得当前难度
|
core.setFlag('hard', 1); // 可以用flag:hard来获得当前难度
|
||||||
// 可以在此设置一些初始福利,比如设置初始生命值可以调用:
|
// 可以在此设置一些初始福利,比如设置初始生命值可以调用:
|
||||||
@ -23,6 +24,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
},
|
},
|
||||||
////// 游戏获胜事件 //////
|
////// 游戏获胜事件 //////
|
||||||
"win" : function(reason) {
|
"win" : function(reason) {
|
||||||
|
// 游戏获胜事件
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
var replaying = core.status.replay.replaying;
|
var replaying = core.status.replay.replaying;
|
||||||
core.stopReplay();
|
core.stopReplay();
|
||||||
@ -38,6 +40,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
},
|
},
|
||||||
////// 游戏失败事件 //////
|
////// 游戏失败事件 //////
|
||||||
"lose" : function(reason) {
|
"lose" : function(reason) {
|
||||||
|
// 游戏失败事件
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
var replaying = core.status.replay.replaying;
|
var replaying = core.status.replay.replaying;
|
||||||
core.stopReplay();
|
core.stopReplay();
|
||||||
@ -51,6 +54,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
},
|
},
|
||||||
////// 转换楼层结束的事件 //////
|
////// 转换楼层结束的事件 //////
|
||||||
"afterChangeFloor" : function (floorId) {
|
"afterChangeFloor" : function (floorId) {
|
||||||
|
// 转换楼层结束的事件
|
||||||
if (core.isset(core.status.event.id)) return; // 当前存在事件
|
if (core.isset(core.status.event.id)) return; // 当前存在事件
|
||||||
|
|
||||||
if (!core.hasFlag("visited_"+floorId)) {
|
if (!core.hasFlag("visited_"+floorId)) {
|
||||||
@ -66,6 +70,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
},
|
},
|
||||||
////// 加点事件 //////
|
////// 加点事件 //////
|
||||||
"addPoint" : function (enemy) {
|
"addPoint" : function (enemy) {
|
||||||
|
// 加点事件
|
||||||
var point = enemy.point;
|
var point = enemy.point;
|
||||||
if (!core.isset(point) || point<=0) return [];
|
if (!core.isset(point) || point<=0) return [];
|
||||||
|
|
||||||
@ -88,6 +93,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
},
|
},
|
||||||
////// 战斗结束后触发的事件 //////
|
////// 战斗结束后触发的事件 //////
|
||||||
"afterBattle" : function(enemyId,x,y,callback) {
|
"afterBattle" : function(enemyId,x,y,callback) {
|
||||||
|
// 战斗结束后触发的事件
|
||||||
|
|
||||||
var enemy = core.material.enemys[enemyId];
|
var enemy = core.material.enemys[enemyId];
|
||||||
|
|
||||||
@ -189,6 +195,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
},
|
},
|
||||||
////// 开一个门后触发的事件 //////
|
////// 开一个门后触发的事件 //////
|
||||||
"afterOpenDoor" : function(doorId,x,y,callback) {
|
"afterOpenDoor" : function(doorId,x,y,callback) {
|
||||||
|
// 开一个门后触发的事件
|
||||||
|
|
||||||
var todo = [];
|
var todo = [];
|
||||||
if (core.isset(x) && core.isset(y)) {
|
if (core.isset(x) && core.isset(y)) {
|
||||||
@ -212,10 +219,12 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
},
|
},
|
||||||
////// 改变亮灯之后,可以触发的事件 //////
|
////// 改变亮灯之后,可以触发的事件 //////
|
||||||
"afterChangeLight" : function(x,y) {
|
"afterChangeLight" : function(x,y) {
|
||||||
|
// 改变亮灯之后,可以触发的事件
|
||||||
|
|
||||||
},
|
},
|
||||||
////// 推箱子后的事件 //////
|
////// 推箱子后的事件 //////
|
||||||
"afterPushBox" : function () {
|
"afterPushBox" : function () {
|
||||||
|
// 推箱子后的事件
|
||||||
|
|
||||||
var noBoxLeft = function () {
|
var noBoxLeft = function () {
|
||||||
// 地图上是否还存在未推到的箱子,如果不存在则返回true,存在则返回false
|
// 地图上是否还存在未推到的箱子,如果不存在则返回true,存在则返回false
|
||||||
@ -239,6 +248,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
},
|
},
|
||||||
////// 使用炸弹/圣锤后的事件 //////
|
////// 使用炸弹/圣锤后的事件 //////
|
||||||
"afterUseBomb" : function () {
|
"afterUseBomb" : function () {
|
||||||
|
// 使用炸弹/圣锤后的事件
|
||||||
|
|
||||||
// 这是一个使用炸弹也能开门的例子
|
// 这是一个使用炸弹也能开门的例子
|
||||||
/*
|
/*
|
||||||
@ -254,10 +264,12 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
},
|
},
|
||||||
////// 即将存档前可以执行的操作 //////
|
////// 即将存档前可以执行的操作 //////
|
||||||
"beforeSaveData" : function(data) {
|
"beforeSaveData" : function(data) {
|
||||||
|
// 即将存档前可以执行的操作
|
||||||
|
|
||||||
},
|
},
|
||||||
////// 读档事件后,载入事件前,可以执行的操作 //////
|
////// 读档事件后,载入事件前,可以执行的操作 //////
|
||||||
"afterLoadData" : function(data) {
|
"afterLoadData" : function(data) {
|
||||||
|
// 读档事件后,载入事件前,可以执行的操作
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,6 +278,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
"ui":{
|
"ui":{
|
||||||
////// 绘制“关于”界面 //////
|
////// 绘制“关于”界面 //////
|
||||||
"drawAbout" : function() {
|
"drawAbout" : function() {
|
||||||
|
// 绘制“关于”界面
|
||||||
|
|
||||||
if (!core.isPlaying()) {
|
if (!core.isPlaying()) {
|
||||||
core.status.event = {'id': null, 'data': null};
|
core.status.event = {'id': null, 'data': null};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user