fix bug
可以正确的处理null了
This commit is contained in:
parent
2b069b7614
commit
7c33ce6b1f
@ -1001,6 +1001,7 @@ function ActionParser(){
|
||||
ActionParser.prototype.parse = function (obj,type) {
|
||||
switch (type) {
|
||||
case 'event':
|
||||
if(!obj)obj={};
|
||||
if(typeof(obj)===typeof('')) obj={'data':[obj]};
|
||||
if(obj instanceof Array) obj={'data':obj};
|
||||
return MotaActionBlocks['event_m'].xmlText([
|
||||
@ -1008,12 +1009,14 @@ ActionParser.prototype.parse = function (obj,type) {
|
||||
]);
|
||||
|
||||
case 'changeFloor':
|
||||
if(!obj)obj={};
|
||||
if(!this.isset(obj.loc))obj.loc=[0,0];
|
||||
return MotaActionBlocks['changeFloor_m'].xmlText([
|
||||
obj.floorId,obj.stair||'loc',obj.loc[0],obj.loc[1],this.Direction(obj.direction),obj.time||0,!this.isset(obj.portalWithoutTrigger)
|
||||
]);
|
||||
|
||||
case 'point':
|
||||
if(!obj)obj={};
|
||||
var text_choices = null;
|
||||
for(var ii=obj.choices.length-1,choice;choice=obj.choices[ii];ii--) {
|
||||
text_choices=MotaActionBlocks['choicesContext'].xmlText([
|
||||
|
||||
@ -11,8 +11,8 @@ editor.prototype.init = function(callback){
|
||||
|
||||
editor.reset(function(){
|
||||
editor.drawMapBg();
|
||||
var mapArray = core.maps.getMapArray(core.status.maps[core.status.floorId].blocks);
|
||||
editor.map = mapArray.map(function(v){return v.map(function(v){return editor.ids[[editor.indexs[v][0]]]})});
|
||||
var mapArray = core.maps.save(core.status.maps,core.status.floorId);
|
||||
editor.map = mapArray.map(function(v){return v.map(function(v){return editor.ids[[editor.indexs[parseInt(v)][0]]]})});
|
||||
editor.updateMap();
|
||||
editor.currentFloorId=core.status.floorId;
|
||||
editor.currentFloorData = core.floors[core.status.floorId];
|
||||
@ -35,7 +35,7 @@ editor.prototype.init = function(callback){
|
||||
});
|
||||
core.events.setInitData(hard);
|
||||
}
|
||||
setTimeout(afterMainInit, 300);
|
||||
setTimeout(afterMainInit, 500);
|
||||
}
|
||||
|
||||
editor.prototype.reset = function(callback){
|
||||
@ -298,8 +298,8 @@ editor.prototype.changeFloor = function(floorId,callback) {
|
||||
editor.currentFloorData.map = editor.map.map(function(v){return v.map(function(v){return v.idnum||v||0})});
|
||||
core.changeFloor(floorId, null, core.firstData.hero.loc, null, function(){
|
||||
editor.drawMapBg();
|
||||
var mapArray = core.maps.getMapArray(core.status.maps[core.status.floorId].blocks);
|
||||
editor.map = mapArray.map(function(v){return v.map(function(v){return editor.ids[[editor.indexs[v][0]]]})});
|
||||
var mapArray = core.maps.save(core.status.maps,core.status.floorId);
|
||||
editor.map = mapArray.map(function(v){return v.map(function(v){return editor.ids[[editor.indexs[parseInt(v)][0]]]})});
|
||||
editor.updateMap();
|
||||
editor.currentFloorId=core.status.floorId;
|
||||
editor.currentFloorData = core.floors[core.status.floorId];
|
||||
|
||||
@ -304,6 +304,9 @@ editor_blockly.import = function(id_){
|
||||
|
||||
"['firstData']['shops']":'shop',
|
||||
|
||||
"['firstArrive']":'firstArrive',
|
||||
"['firstData']['startText']":'firstArrive',
|
||||
|
||||
"--point--未完成数据转移":'point',
|
||||
}[field];
|
||||
if(!type)return;
|
||||
@ -311,8 +314,11 @@ editor_blockly.import = function(id_){
|
||||
document.getElementById('codeArea').value = input.value;
|
||||
document.getElementById('entryType').value = type;
|
||||
editor_blockly.parse();
|
||||
editor_blockly.show();
|
||||
}
|
||||
|
||||
editor_blockly.show = function(){}
|
||||
|
||||
editor_blockly.confirm = function (){
|
||||
if(!editor_blockly.id){
|
||||
editor_blockly.id='';
|
||||
@ -346,6 +352,7 @@ editor_blockly.doubleClickBlock = function (blockId){
|
||||
var f=textStringDict[b];
|
||||
if(f){
|
||||
var value = b.getFieldValue(f);
|
||||
//多行编辑
|
||||
//func(value,function(newvalue,b,f){b.setFieldValue(newvalue,f);})
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,6 +123,7 @@
|
||||
<option value="afterBattle">afterBattle</option>
|
||||
<option value="afterGetItem">afterGetItem</option>
|
||||
<option value="afterOpenDoor">afterOpenDoor</option>
|
||||
<option value="firstArrive">firstArrive</option>
|
||||
</select>
|
||||
<button onclick="editor_blockly.parse()">parse</button>
|
||||
<button onclick="editor_blockly.confirm()">confirm</button>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user