别名设置
This commit is contained in:
parent
0b9e6ad0fd
commit
ead209ddad
@ -640,12 +640,12 @@ return JSON.stringify(code);
|
|||||||
*/;
|
*/;
|
||||||
|
|
||||||
nameMap_m
|
nameMap_m
|
||||||
: '文件别名设置 此项可对每个素材(背景音乐、音效、使用图片、使用动画)进行一个别名设置,然后可以游戏中使用此别名代替原始文件名。' BGNL? Newline nameMapList+ BEND
|
: '文件别名设置' '(可以游戏中使用此别名代替原始文件名)' BGNL? Newline nameMapList+ BEND
|
||||||
|
|
||||||
/* nameMap_m
|
/* nameMap_m
|
||||||
tooltip : 文件别名设置
|
tooltip : 文件别名设置
|
||||||
helpUrl : /_docs/#/instruction
|
helpUrl : /_docs/#/instruction
|
||||||
var value = doorKeyList_0.trim();
|
var value = nameMapList_0.trim();
|
||||||
if (value.startsWith(',')) value = value.substring(1);
|
if (value.startsWith(',')) value = value.substring(1);
|
||||||
return '{'+value+'}';
|
return '{'+value+'}';
|
||||||
*/;
|
*/;
|
||||||
@ -665,26 +665,32 @@ nameMapBgm
|
|||||||
/* nameMapBgm
|
/* nameMapBgm
|
||||||
tooltip : 映射背景音乐
|
tooltip : 映射背景音乐
|
||||||
default : ['背景音乐', 'bgm.mp3']
|
default : ['背景音乐', 'bgm.mp3']
|
||||||
|
allBgms : ['EvalString_1']
|
||||||
|
material : ["./project/bgms/", "EvalString_1"]
|
||||||
helpUrl : /_docs/#/instruction
|
helpUrl : /_docs/#/instruction
|
||||||
return ',"'+EvalString_0+'":"'+EvalString_1+'"';
|
return ',"'+EvalString_0+'":"'+EvalString_1+'"';
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
nameMapSound1
|
nameMapSoundKnown
|
||||||
: '映射系统音效' '名称' NameMap_List '映射到文件' EvalString BEND
|
: '映射系统音效' '名称' NameMap_List '映射到文件' EvalString BEND
|
||||||
|
|
||||||
/* nameMapSound1
|
/* nameMapSoundKnown
|
||||||
tooltip : 映射系统音效
|
tooltip : 映射系统音效
|
||||||
default : ['确定', 'confirm.mp3']
|
default : ['确定', 'confirm.mp3']
|
||||||
|
allSounds : ['EvalString_0']
|
||||||
|
material : ["./project/sounds/", "EvalString_0"]
|
||||||
helpUrl : /_docs/#/instruction
|
helpUrl : /_docs/#/instruction
|
||||||
return ',"'+NameMap_List_0+'":"'+EvalString_0+'"';
|
return ',"'+NameMap_List_0+'":"'+EvalString_0+'"';
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
nameMapSound2
|
nameMapSoundUnknown
|
||||||
: '映射音效' '名称' EvalString '映射到文件' EvalString BEND
|
: '映射音效' '名称' EvalString '映射到文件' EvalString BEND
|
||||||
|
|
||||||
/* nameMapSound2
|
/* nameMapSoundUnknown
|
||||||
tooltip : 映射音效
|
tooltip : 映射音效
|
||||||
default : ['攻击', 'attack.mp3']
|
default : ['攻击', 'attack.mp3']
|
||||||
|
allSounds : ['EvalString_1']
|
||||||
|
material : ["./project/sounds/", "EvalString_1"]
|
||||||
helpUrl : /_docs/#/instruction
|
helpUrl : /_docs/#/instruction
|
||||||
return ',"'+EvalString_0+'":"'+EvalString_1+'"';
|
return ',"'+EvalString_0+'":"'+EvalString_1+'"';
|
||||||
*/;
|
*/;
|
||||||
@ -695,16 +701,20 @@ nameMapImage
|
|||||||
/* nameMapImage
|
/* nameMapImage
|
||||||
tooltip : 映射图片
|
tooltip : 映射图片
|
||||||
default : ['背景图', 'bg.jpg']
|
default : ['背景图', 'bg.jpg']
|
||||||
|
allImages : ['EvalString_1']
|
||||||
|
material : ["./project/images/", "EvalString_1"]
|
||||||
helpUrl : /_docs/#/instruction
|
helpUrl : /_docs/#/instruction
|
||||||
return ',"'+EvalString_0+'":"'+EvalString_1+'"';
|
return ',"'+EvalString_0+'":"'+EvalString_1+'"';
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
nameMapImage
|
nameMapAnimate
|
||||||
: '映射动画' '名称' EvalString '映射到文件' IdString BEND
|
: '映射动画' '名称' EvalString '映射到文件' IdString BEND
|
||||||
|
|
||||||
/* nameMapImage
|
/* nameMapAnimate
|
||||||
tooltip : 映射图片
|
tooltip : 映射图片
|
||||||
default : ['剑技', 'jianji']
|
default : ['领域', 'zone']
|
||||||
|
allAnimates : ['IdString_0']
|
||||||
|
material : ["./project/animates/", "IdString_0"]
|
||||||
helpUrl : /_docs/#/instruction
|
helpUrl : /_docs/#/instruction
|
||||||
return ',"'+EvalString_0+'":"'+IdString_0+'"';
|
return ',"'+EvalString_0+'":"'+IdString_0+'"';
|
||||||
*/;
|
*/;
|
||||||
@ -714,7 +724,7 @@ nameMapUnknown
|
|||||||
|
|
||||||
/* nameMapUnknown
|
/* nameMapUnknown
|
||||||
tooltip : 未知映射
|
tooltip : 未知映射
|
||||||
default : ['文件名', 'test.jpg']
|
default : ['文件名', 'file.jpg']
|
||||||
helpUrl : /_docs/#/instruction
|
helpUrl : /_docs/#/instruction
|
||||||
return ',"'+EvalString_0+'":"'+EvalString_1+'"';
|
return ',"'+EvalString_0+'":"'+EvalString_1+'"';
|
||||||
*/;
|
*/;
|
||||||
@ -723,7 +733,7 @@ nameMapEmpty
|
|||||||
: Newline
|
: Newline
|
||||||
|
|
||||||
/* nameMapEmpty
|
/* nameMapEmpty
|
||||||
return '';
|
return ' \n';
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
//为了避免关键字冲突,全部加了_s
|
//为了避免关键字冲突,全部加了_s
|
||||||
@ -809,6 +819,7 @@ action
|
|||||||
| loadBgm_s
|
| loadBgm_s
|
||||||
| freeBgm_s
|
| freeBgm_s
|
||||||
| playSound_s
|
| playSound_s
|
||||||
|
| playSound_1_s
|
||||||
| stopSound_s
|
| stopSound_s
|
||||||
| setVolume_s
|
| setVolume_s
|
||||||
| win_s
|
| win_s
|
||||||
@ -2451,6 +2462,20 @@ var code = '{"type": "playSound", "name": "'+EvalString_0+'"'+Bool_0+'},\n';
|
|||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
|
playSound_1_s
|
||||||
|
: '播放系统音效' NameMap_List '停止之前音效' Bool? Newline
|
||||||
|
|
||||||
|
|
||||||
|
/* playSound_1_s
|
||||||
|
tooltip : playSound: 播放系统音效
|
||||||
|
helpUrl : /_docs/#/instruction
|
||||||
|
default : ["确认",false]
|
||||||
|
colour : this.soundColor
|
||||||
|
Bool_0 = Bool_0 ? ', "stop": true' : '';
|
||||||
|
var code = '{"type": "playSound", "name": "'+NameMap_List_0+'"'+Bool_0+'},\n';
|
||||||
|
return code;
|
||||||
|
*/;
|
||||||
|
|
||||||
stopSound_s
|
stopSound_s
|
||||||
: '停止所有音效' Newline
|
: '停止所有音效' Newline
|
||||||
|
|
||||||
|
|||||||
@ -127,18 +127,32 @@ ActionParser.prototype.parse = function (obj,type) {
|
|||||||
if (!obj) obj={};
|
if (!obj) obj={};
|
||||||
var items = Object.keys(obj);
|
var items = Object.keys(obj);
|
||||||
var result = null;
|
var result = null;
|
||||||
for (var ii=items.length,one;one=items[ii];ii--) {
|
for (var ii=items.length-1,one;one=items[ii];ii--) {
|
||||||
|
var value = obj[one];
|
||||||
var knownItems = MotaActionBlocks['NameMap_List'].options.map(function (one) {return one[1];})
|
var knownItems = MotaActionBlocks['NameMap_List'].options.map(function (one) {return one[1];})
|
||||||
if (knownItems.indexOf(one) >= 0) {
|
if (knownItems.indexOf(one) >= 0) {
|
||||||
result = MotaActionBlocks['nameMapSound1'].xmlText([
|
result = MotaActionBlocks['nameMapSoundKnown'].xmlText([one, value, result]);
|
||||||
|
continue;
|
||||||
])
|
|
||||||
}
|
}
|
||||||
var value = obj[ii];
|
if (main.bgms.indexOf(value) >= 0) {
|
||||||
|
result = MotaActionBlocks['nameMapBgm'].xmlText([one, value, result]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (main.sounds.indexOf(value) >= 0) {
|
||||||
|
result = MotaActionBlocks['nameMapSoundUnknown'].xmlText([one, value, result]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (main.images.indexOf(value) >= 0) {
|
||||||
|
result = MotaActionBlocks['nameMapImage'].xmlText([one, value, result]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (main.animates.indexOf(value) >= 0) {
|
||||||
|
result = MotaActionBlocks['nameMapAnimate'].xmlText([one, value, result]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
result = MotaActionBlocks['nameMapUnknown'].xmlText([one, value, result]);
|
||||||
}
|
}
|
||||||
|
return MotaActionBlocks['nameMap_m'].xmlText([result]);
|
||||||
|
|
||||||
case 'shop':
|
case 'shop':
|
||||||
var buildsub = function(obj,parser,next){
|
var buildsub = function(obj,parser,next){
|
||||||
@ -625,8 +639,14 @@ ActionParser.prototype.parseAction = function() {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "playSound":
|
case "playSound":
|
||||||
this.next = MotaActionBlocks['playSound_s'].xmlText([
|
var knownItems = MotaActionBlocks['NameMap_List'].options.map(function (one) {return one[1];});
|
||||||
data.name,data.stop,this.next]);
|
if (knownItems.indexOf(data.name) >= 0) {
|
||||||
|
this.next = MotaActionBlocks['playSound_1_s'].xmlText([
|
||||||
|
data.name,data.stop,this.next]);
|
||||||
|
} else {
|
||||||
|
this.next = MotaActionBlocks['playSound_s'].xmlText([
|
||||||
|
data.name,data.stop,this.next]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "playBgm":
|
case "playBgm":
|
||||||
this.next = MotaActionBlocks['playBgm_s'].xmlText([
|
this.next = MotaActionBlocks['playBgm_s'].xmlText([
|
||||||
|
|||||||
@ -343,14 +343,28 @@ editor_blockly = function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
editor_blockly.selectMaterial = function(b,material){
|
editor_blockly.selectMaterial = function(b,material){
|
||||||
editor.uievent.selectMaterial([b.getFieldValue(material[1])], '请选择素材', material[0], function (one) {
|
var value = b.getFieldValue(material[1]);
|
||||||
if (b.type == 'animate_s' || b.type == 'animate_1_s') {
|
value = main.nameMap[value] || value;
|
||||||
|
editor.uievent.selectMaterial([value], '请选择素材', material[0], function (one) {
|
||||||
|
if (b.type == 'animate_s' || b.type == 'animate_1_s' || b.type == 'nameMapAnimate') {
|
||||||
return /^[-A-Za-z0-9_.]+\.animate$/.test(one) ? one.substring(0, one.length - 8) : null;
|
return /^[-A-Za-z0-9_.]+\.animate$/.test(one) ? one.substring(0, one.length - 8) : null;
|
||||||
}
|
}
|
||||||
return /^[-A-Za-z0-9_.]+$/.test(one) ? one : null;
|
return /^[-A-Za-z0-9_.]+$/.test(one) ? one : null;
|
||||||
}, function (value) {
|
}, function (value) {
|
||||||
if (value instanceof Array && value.length > 0) {
|
if (value instanceof Array && value.length > 0) {
|
||||||
b.setFieldValue(value[0], material[1]);
|
value = value[0];
|
||||||
|
// 检测是否别名替换
|
||||||
|
for (var name in main.nameMap) {
|
||||||
|
if (main.nameMap[name] == value) {
|
||||||
|
if (confirm("检测到该文件存在别名:"+name+"\n是否使用别名进行替换?")) {
|
||||||
|
b.setFieldValue(name, material[1]);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
b.setFieldValue(value, material[1]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -650,7 +664,8 @@ editor_blockly = function () {
|
|||||||
namesObj.allIconIds = namesObj.allIds.concat(Object.keys(core.statusBar.icons).filter(function (x) {
|
namesObj.allIconIds = namesObj.allIds.concat(Object.keys(core.statusBar.icons).filter(function (x) {
|
||||||
return core.statusBar.icons[x] instanceof Image;
|
return core.statusBar.icons[x] instanceof Image;
|
||||||
}));
|
}));
|
||||||
namesObj.allImages = Object.keys(core.material.images.images);
|
namesObj.allImages = Object.keys(core.material.images.images)
|
||||||
|
.concat(Object.keys(main.nameMap).filter(function (one) {return core.material.images.images[main.nameMap[one]];}));
|
||||||
namesObj.allEnemys = Object.keys(core.material.enemys);
|
namesObj.allEnemys = Object.keys(core.material.enemys);
|
||||||
if (MotaActionFunctions && !MotaActionFunctions.disableReplace) {
|
if (MotaActionFunctions && !MotaActionFunctions.disableReplace) {
|
||||||
namesObj.allEnemys = namesObj.allEnemys.concat(MotaActionFunctions.pattern.replaceEnemyList.map(function (x) {
|
namesObj.allEnemys = namesObj.allEnemys.concat(MotaActionFunctions.pattern.replaceEnemyList.map(function (x) {
|
||||||
@ -663,9 +678,12 @@ editor_blockly = function () {
|
|||||||
return x[1];
|
return x[1];
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
namesObj.allAnimates = Object.keys(core.material.animates);
|
namesObj.allAnimates = Object.keys(core.material.animates)
|
||||||
namesObj.allBgms = Object.keys(core.material.bgms);
|
.concat(Object.keys(main.nameMap).filter(function (one) {return core.material.animates[main.nameMap[one]];}));
|
||||||
namesObj.allSounds = Object.keys(core.material.sounds);
|
namesObj.allBgms = Object.keys(core.material.bgms)
|
||||||
|
.concat(Object.keys(main.nameMap).filter(function (one) {return core.material.bgms[main.nameMap[one]];}));
|
||||||
|
namesObj.allSounds = Object.keys(core.material.sounds)
|
||||||
|
.concat(Object.keys(main.nameMap).filter(function (one) {return core.material.sounds[main.nameMap[one]];}));;
|
||||||
namesObj.allShops = Object.keys(core.status.shops);
|
namesObj.allShops = Object.keys(core.status.shops);
|
||||||
namesObj.allFloorIds = core.floorIds;
|
namesObj.allFloorIds = core.floorIds;
|
||||||
namesObj.allColors = ["aqua(青色)", "black(黑色)", "blue(蓝色)", "fuchsia(品红色)", "gray(灰色)", "green(深绿色)", "lime(绿色)",
|
namesObj.allColors = ["aqua(青色)", "black(黑色)", "blue(蓝色)", "fuchsia(品红色)", "gray(灰色)", "green(深绿色)", "lime(绿色)",
|
||||||
|
|||||||
@ -88,8 +88,8 @@ editor_blocklyconfig=(function(){
|
|||||||
MotaActionBlocks['faceIds_m'].xmlText(),
|
MotaActionBlocks['faceIds_m'].xmlText(),
|
||||||
MotaActionBlocks['mainStyle_m'].xmlText(),
|
MotaActionBlocks['mainStyle_m'].xmlText(),
|
||||||
MotaActionFunctions.actionParser.parse({
|
MotaActionFunctions.actionParser.parse({
|
||||||
"背景音乐": "bgm.mp3", "确定": "confirm.mp3", "攻击": "attack.mp3", "背景图": "bg.jpg", "剑技": "jianji"
|
"背景音乐": "bgm.mp3", "确定": "confirm.mp3", "攻击": "attack.mp3", "背景图": "bg.jpg", "领域": "zone", "文件名": "file.jpg"
|
||||||
}, 'nameMap')
|
}, 'nameMap'),
|
||||||
],
|
],
|
||||||
'显示文字':[
|
'显示文字':[
|
||||||
MotaActionBlocks['text_0_s'].xmlText(),
|
MotaActionBlocks['text_0_s'].xmlText(),
|
||||||
@ -209,6 +209,7 @@ editor_blocklyconfig=(function(){
|
|||||||
MotaActionBlocks['loadBgm_s'].xmlText(),
|
MotaActionBlocks['loadBgm_s'].xmlText(),
|
||||||
MotaActionBlocks['freeBgm_s'].xmlText(),
|
MotaActionBlocks['freeBgm_s'].xmlText(),
|
||||||
MotaActionBlocks['playSound_s'].xmlText(),
|
MotaActionBlocks['playSound_s'].xmlText(),
|
||||||
|
MotaActionBlocks['playSound_1_s'].xmlText(),
|
||||||
MotaActionBlocks['stopSound_s'].xmlText(),
|
MotaActionBlocks['stopSound_s'].xmlText(),
|
||||||
MotaActionBlocks['setVolume_s'].xmlText(),
|
MotaActionBlocks['setVolume_s'].xmlText(),
|
||||||
MotaActionBlocks['callBook_s'].xmlText(),
|
MotaActionBlocks['callBook_s'].xmlText(),
|
||||||
|
|||||||
@ -76,7 +76,16 @@ utils.prototype._init = function () {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (typeof Array.prototype.includes != "function") {
|
||||||
|
Array.prototype.includes = function (value) {
|
||||||
|
return this.indexOf(value) >= 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (typeof Object.values != "function") {
|
||||||
|
Object.values = function (obj) {
|
||||||
|
return Object.keys(obj).map(function (one) { return obj[one]; });
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 将文字中的${和}(表达式)进行替换 //////
|
////// 将文字中的${和}(表达式)进行替换 //////
|
||||||
|
|||||||
@ -63,7 +63,11 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
"跳跃": "jump.mp3",
|
"跳跃": "jump.mp3",
|
||||||
"破墙镐": "pickaxe.mp3",
|
"破墙镐": "pickaxe.mp3",
|
||||||
"阻激夹域": "zone.mp3",
|
"阻激夹域": "zone.mp3",
|
||||||
"穿脱装备": "equip.mp3"
|
"穿脱装备": "equip.mp3",
|
||||||
|
"背景音乐": "bgm.mp3",
|
||||||
|
"攻击": "attack.mp3",
|
||||||
|
"背景图": "bg.jpg",
|
||||||
|
"领域": "zone"
|
||||||
},
|
},
|
||||||
"levelChoose": [
|
"levelChoose": [
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user