autoEvent
This commit is contained in:
parent
5305533da9
commit
1fd3bf657d
@ -452,7 +452,8 @@ editor_file = function (editor, callback) {
|
|||||||
checkCallback(callback);
|
checkCallback(callback);
|
||||||
if (isset(actionList) && actionList.length > 0) {
|
if (isset(actionList) && actionList.length > 0) {
|
||||||
actionList.forEach(function (value) {
|
actionList.forEach(function (value) {
|
||||||
value[1] = value[1] + "['" + x + "," + y + "']";
|
if(/\['autoEvent'\]\['\d+'\]$/.test(value[1]))value[1]=value[1].replace(/\['\d+'\]$/,function(v){return "['" + x + "," + y + "']"+v})
|
||||||
|
else value[1] = value[1] + "['" + x + "," + y + "']";
|
||||||
});
|
});
|
||||||
saveSetting('floorloc', actionList, function (err) {
|
saveSetting('floorloc', actionList, function (err) {
|
||||||
callback([err]);
|
callback([err]);
|
||||||
@ -821,7 +822,13 @@ editor_file = function (editor, callback) {
|
|||||||
if (file == 'floorloc') {
|
if (file == 'floorloc') {
|
||||||
actionList.forEach(function (value) {
|
actionList.forEach(function (value) {
|
||||||
// 检测null/undefined
|
// 检测null/undefined
|
||||||
if (value[2]==null)
|
if(/\['autoEvent'\]\['\d+,\d+'\]\['\d+'\]$/.test(value[1])){
|
||||||
|
var tempvalue=value[1].replace(/\['\d+'\]$/,'')
|
||||||
|
tempvalue="editor.currentFloorData" +tempvalue
|
||||||
|
tempvalue=tempvalue+'='+tempvalue+'||{}'
|
||||||
|
eval(tempvalue)
|
||||||
|
}
|
||||||
|
if (value[2]==null && value[0]!=='add')
|
||||||
eval("delete editor.currentFloorData" + value[1]);
|
eval("delete editor.currentFloorData" + value[1]);
|
||||||
else
|
else
|
||||||
eval("editor.currentFloorData" + value[1] + '=' + JSON.stringify(value[2]));
|
eval("editor.currentFloorData" + value[1] + '=' + JSON.stringify(value[2]));
|
||||||
|
|||||||
@ -146,6 +146,9 @@ editor_game_wrapper = function (editor, main, core) {
|
|||||||
});
|
});
|
||||||
editor.currentFloorId = core.status.floorId;
|
editor.currentFloorId = core.status.floorId;
|
||||||
editor.currentFloorData = core.floors[core.status.floorId];
|
editor.currentFloorData = core.floors[core.status.floorId];
|
||||||
|
// 补出缺省的数据
|
||||||
|
editor.currentFloorData.autoEvent = editor.currentFloorData.autoEvent || {};
|
||||||
|
//
|
||||||
for (var ii = 0, name; name = ['bgmap', 'fgmap'][ii]; ii++) {
|
for (var ii = 0, name; name = ['bgmap', 'fgmap'][ii]; ii++) {
|
||||||
var mapArray = editor.currentFloorData[name];
|
var mapArray = editor.currentFloorData[name];
|
||||||
if (!mapArray || JSON.stringify(mapArray) == JSON.stringify([])) {//未设置或空数组
|
if (!mapArray || JSON.stringify(mapArray) == JSON.stringify([])) {//未设置或空数组
|
||||||
|
|||||||
@ -145,6 +145,7 @@ editor_table_wrapper = function (editor) {
|
|||||||
if (key === '_data') continue;
|
if (key === '_data') continue;
|
||||||
if (cobj[key] instanceof Function) cobj[key] = cobj[key](args);
|
if (cobj[key] instanceof Function) cobj[key] = cobj[key](args);
|
||||||
}
|
}
|
||||||
|
vobj = args.vobj;
|
||||||
// 标记为_hide的属性不展示
|
// 标记为_hide的属性不展示
|
||||||
if (cobj._hide) continue;
|
if (cobj._hide) continue;
|
||||||
if (!cobj._leaf) {
|
if (!cobj._leaf) {
|
||||||
@ -340,10 +341,20 @@ editor_table_wrapper = function (editor) {
|
|||||||
var mode = editor.dom.editModeSelect.value;
|
var mode = editor.dom.editModeSelect.value;
|
||||||
|
|
||||||
// 1.输入id
|
// 1.输入id
|
||||||
var newid = prompt('请输入新项的ID(仅公共事件支持中文ID)');
|
var newid = '3';
|
||||||
|
if (mode == 'loc') {
|
||||||
|
var ae = editor.currentFloorData.autoEvent[editor_mode.pos.x + ',' + editor_mode.pos.x];
|
||||||
|
if (ae != null) {
|
||||||
|
var testid;
|
||||||
|
for (testid = 3; Object.hasOwnProperty.call(ae, testid); testid++); // 从3开始是因为comment中设置了始终显示012
|
||||||
|
newid = testid + '';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
newid = prompt('请输入新项的ID(仅公共事件支持中文ID)');
|
||||||
if (newid == null || newid.length == 0) {
|
if (newid == null || newid.length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 检查commentEvents
|
// 检查commentEvents
|
||||||
if (mode !== 'commonevent') {
|
if (mode !== 'commonevent') {
|
||||||
|
|||||||
@ -464,6 +464,23 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
|||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
"_range": "thiseval==null||(thiseval instanceof Array)",
|
"_range": "thiseval==null||(thiseval instanceof Array)",
|
||||||
"_data": "该点不可通行的方向 \n 可以在这里定义该点不能前往哪个方向,可以达到悬崖之类的效果\n例如 [\"up\", \"left\"] 代表该点不能往上和左走"
|
"_data": "该点不可通行的方向 \n 可以在这里定义该点不能前往哪个方向,可以达到悬崖之类的效果\n例如 [\"up\", \"left\"] 代表该点不能往上和左走"
|
||||||
|
},
|
||||||
|
"autoEvent": {
|
||||||
|
"_type": "object",
|
||||||
|
"_leaf": false,
|
||||||
|
"_action": function (args) {
|
||||||
|
args.vobj=args.vobj||{};
|
||||||
|
for(var ii=0;ii<3;ii++){
|
||||||
|
args.vobj[ii]=null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"_data": function (key) {
|
||||||
|
return {
|
||||||
|
"_leaf": true,
|
||||||
|
"_type": "textarea",
|
||||||
|
"_data": "自动事件"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,7 +101,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="left2" class='leftTab' style="z-index:-1;opacity: 0;"><!-- loc -->
|
<div id="left2" class='leftTab' style="z-index:-1;opacity: 0;"><!-- loc -->
|
||||||
<h3 class="leftTabHeader">地图选点 <button onclick="editor.mode.onmode('save')">保存</button> <button onclick="editor_multi.editCommentJs('loc')">配置表格</button>
|
<h3 class="leftTabHeader">地图选点 <button onclick="editor.mode.onmode('save')">保存</button> <button onclick="editor.mode.changeDoubleClickModeByButton('add')">添加</button> <button onclick="editor.mode.changeDoubleClickModeByButton('delete')">删除</button> <button onclick="editor_multi.editCommentJs('loc')">配置表格</button>
|
||||||
</h3>
|
</h3>
|
||||||
<div class="leftTabContent">
|
<div class="leftTabContent">
|
||||||
<p id='pos_a6771a78_a099_417c_828f_0a24851ebfce' style="margin-left: 15px">0,0</p>
|
<p id='pos_a6771a78_a099_417c_828f_0a24851ebfce' style="margin-left: 15px">0,0</p>
|
||||||
|
|||||||
@ -97,7 +97,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="left2" class='leftTab' style="z-index:-1;opacity: 0;"><!-- loc -->
|
<div id="left2" class='leftTab' style="z-index:-1;opacity: 0;"><!-- loc -->
|
||||||
<h3 class="leftTabHeader">地图选点 <button onclick="editor.mode.onmode('save')">保存</button> <button onclick="editor_multi.editCommentJs('loc')">配置表格</button>
|
<h3 class="leftTabHeader">地图选点 <button onclick="editor.mode.onmode('save')">保存</button> <button onclick="editor.mode.changeDoubleClickModeByButton('add')">添加</button> <button onclick="editor.mode.changeDoubleClickModeByButton('delete')">删除</button> <button onclick="editor_multi.editCommentJs('loc')">配置表格</button>
|
||||||
</h3>
|
</h3>
|
||||||
<div class="leftTabContent">
|
<div class="leftTabContent">
|
||||||
<p id='pos_a6771a78_a099_417c_828f_0a24851ebfce' style="margin-left: 15px">0,0</p>
|
<p id='pos_a6771a78_a099_417c_828f_0a24851ebfce' style="margin-left: 15px">0,0</p>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user