editor_file & comment.js
This commit is contained in:
parent
f6f4745b5d
commit
a9835de64a
@ -3,13 +3,13 @@
|
||||
editor_file = {};
|
||||
|
||||
editor_file.getFloorFileList = function(editor,callback){
|
||||
if (isset(callback)) callback(['simple0.js','simple1.js','simple2.js'],null);
|
||||
if (isset(callback)) callback([['simple0.js','simple1.js','simple2.js'],null]);
|
||||
}
|
||||
//callback(Array<String>,err:String)
|
||||
//callback([Array<String>,err:String])
|
||||
editor_file.loadFloorFile = function(editor,filename,callback){
|
||||
if (isset(callback)) callback('',null);
|
||||
if (isset(callback)) callback(null);
|
||||
}
|
||||
//callback(String,err:String)
|
||||
//callback(err:String)
|
||||
editor_file.saveFloorFile = function(editor,callback){
|
||||
if (isset(callback)) callback(null);
|
||||
}
|
||||
@ -25,16 +25,16 @@
|
||||
if (isset(callback)) callback(null);
|
||||
}
|
||||
//callback(err:String)
|
||||
editor_file.editItem = function(editor,id,obj,callback){
|
||||
editor_file.editItem = function(editor,id,actionList,callback){
|
||||
//obj形式同callback的obj,为null或undefined时只查询不修改
|
||||
if (isset(callback)) callback(
|
||||
{'items':{'cls': 'items', 'name': '红宝石'},'itemEffect':'core.status.hero.atk += core.values.redJewel','itemEffectTip':"',攻击+'+core.values.redJewel"},
|
||||
{'items':'','itemEffect':'','itemEffectTip':''},
|
||||
{'items':{'cls': "只能取keys items constants tools\n$range(thiseval in ['keys','items','constants','tools'])$end", 'name': '', 'text': ''},'itemEffect':'','itemEffectTip':''},
|
||||
null);
|
||||
//只有items.cls是items的才有itemEffect和itemEffectTip,keys和constants和tools只有items
|
||||
}
|
||||
//callback(obj,commentObj,err:String)
|
||||
editor_file.editEnemy = function(editor,id,obj,callback){
|
||||
editor_file.editEnemy = function(editor,id,actionList,callback){
|
||||
//obj形式同callback的obj,为null或undefined时只查询不修改
|
||||
if (isset(callback)) callback(
|
||||
{'name': '初级巫师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 16, 'experience': 0, 'special': 15, 'value': 100, "bomb": false},
|
||||
@ -45,7 +45,7 @@
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
editor_file.editLoc = function(editor,x,y,obj,callback){
|
||||
editor_file.editLoc = function(editor,x,y,actionList,callback){
|
||||
//obj形式同callback的obj,为null或undefined时只查询不修改
|
||||
if (isset(callback)) callback(
|
||||
{"events":['\t[老人,man]这些是本样板支持的所有的道具。\n\n道具分为三类:items, constants, tools。\nitems 为即捡即用类道具,例如宝石、血瓶、剑盾等。\nconstants 为永久道具,例如怪物手册、楼层传送器、幸运金币等。\ntools 为消耗类道具,例如破墙镐、炸弹、中心对称飞行器等。\n\n后两类道具在工具栏中可以看到并使用。', '\t[老人,man]有关道具效果,定义在items.js中。\n目前大多数道具已有默认行为,如有自定义的需求则需在items.js中修改代码。', '\t[老人,man]constants 和 tools 各最多只允许12种,多了会导致图标溢出。', '\t[老人,man]拾取道具结束后可触发 afterGetItem 事件。\n\n有关事件的各种信息在下一层会有更为详细的说明。', {'type': 'hide', 'time': 500}],"changeFloor":"","afterBattle":"","afterGetItem":"","afterOpenDoor":""},
|
||||
@ -56,7 +56,7 @@
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
editor_file.editFloor = function(editor,obj,callback){
|
||||
editor_file.editFloor = function(editor,actionList,callback){
|
||||
//obj形式同callback的obj,为null或undefined时只查询不修改
|
||||
if (isset(callback)) callback(
|
||||
{'floorId': 'sample0', 'title': '样板 0 层', 'name': '0', 'canFlyTo': True, 'canUseQuickShop': True, 'defaultGround': 'ground', 'firstArrive': ['\t[样板提示]首次到达某层可以触发 firstArrive 事件,该事件可类似于RMXP中的“自动执行脚本”。\n\n本事件支持一切的事件类型,常常用来触发对话,例如:', '\t[hero]我是谁?我从哪来?我又要到哪去?', '\t[仙子,fairy]你问我...?我也不知道啊...', '本层主要对道具、门、怪物等进行介绍,有关事件的各种信息在下一层会有更为详细的说明。']},
|
||||
@ -69,7 +69,7 @@
|
||||
|
||||
|
||||
|
||||
editor_file.editTower = function(editor,obj,callback){
|
||||
editor_file.editTower = function(editor,actionList,callback){
|
||||
//obj形式同callback的obj,为null或undefined时只查询不修改
|
||||
if (isset(callback)) callback(
|
||||
{'main': {'useCompress': False, 'floorIds': ['sample0', 'sample1', 'sample2', 'test']}, 'firstData': {'title': '魔塔样板', 'name': 'template', 'version': 'Ver 1.0.0 (Beta)', 'floorId': 'sample0', 'hero': {'name': '阳光', 'lv': 1, 'hp': 2000, 'atk': 100, 'def': 100, 'mdef': 100, 'money': 100, 'experience': 0, 'items': {'keys': {'yellowKey': 0, 'blueKey': 0, 'redKey': 0}, 'constants': {}, 'tools': {}}, 'flyRange': [], 'loc': {'direction': 'up', 'x': 6, 'y': 10}, 'flags': {'poison': False, 'weak': False, 'curse': False}}, 'startText': ['Hi,欢迎来到 HTML5 魔塔样板!\n\n本样板由艾之葵制作,可以让你在不会写任何代码\n的情况下也能做出属于自己的H5魔塔!', '这里游戏开始时的剧情。\n定义在data.js的startText处。\n\n你可以在这里写上自己的内容。', '赶快来试一试吧!'], 'shops': {'moneyShop1': {'name': '贪婪之神', 'icon': 'blueShop', 'textInList': '1F金币商店', 'use': 'money', 'need': '20+10*times*(times+1)', 'text': '勇敢的武士啊,给我${need}金币就可以:', 'choices': [{'text': '生命+800', 'effect': 'status:hp+=800'}, {'text': '攻击+4', 'effect': 'status:atk+=4'}, {'text': '防御+4', 'effect': 'status:def+=4'}, {'text': '魔防+10', 'effect': 'status:mdef+=10'}]}, 'expShop1': {'name': '经验之神', 'icon': 'pinkShop', 'textInList': '1F经验商店', 'use': 'experience', 'need': '-1', 'text': '勇敢的武士啊,给我若干经验就可以:', 'choices': [{'text': '等级+1', 'need': '100', 'effect': 'status:lv+=1;status:hp+=1000;status:atk+=7;status:def+=7'}, {'text': '攻击+5', 'need': '30', 'effect': 'status:atk+=5'}, {'text': '防御+5', 'need': '30', 'effect': 'status:def+=5'}]}}, 'levelUp': [{}, {'need': 20, 'name': '第二级', 'effect': 'status:hp+=2*(status:atk+status:def);status:atk+=10;status:def+=10'}, {'need': 40, 'effect': 'function () {\n core.drawText("恭喜升级!");\n core.status.hero.hp *= 2;\n core.status.hero.atk += 100;\n core.status.hero.def += 100;\n }'}]}, 'values': {'HPMAX': 999999, 'lavaDamage': 100, 'poisonDamage': 10, 'weakValue': 20, 'redJewel': 3, 'blueJewel': 3, 'greenJewel': 5, 'redPotion': 100, 'bluePotion': 250, 'yellowPotion': 500, 'greenPotion': 800, 'sword1': 10, 'shield1': 10, 'sword2': 20, 'shield2': 20, 'sword3': 40, 'shield3': 40, 'sword4': 80, 'shield4': 80, 'sword5': 160, 'shield5': 160, 'moneyPocket': 500, 'breakArmor': 0.9, 'counterAttack': 0.1, 'purify': 3, 'hatred': 2, 'animateSpeed': 500}, 'flags': {'enableNegativeDamage': True, 'enableFloor': False, 'enableLv': True, 'enableMDef': True, 'enableMoney': True, 'enableExperience': True, 'enableLevelUp': False, 'enableDebuff': True, 'flyNearStair': True, 'pickaxeFourDirections': True, 'bombFourDirections': True, 'bigKeyIsBox': False, 'startDirectly': False, 'canOpenBattleAnimate': True, 'showBattleAnimateConfirm': True, 'battleAnimate': True, 'displayEnemyDamage': True, 'displayExtraDamage': False, 'enableGentleClick': True, 'portalWithoutTrigger': True, 'potionWhileRouting': False}},
|
||||
|
||||
@ -85,6 +85,7 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw('需要改实现')
|
||||
if (change!=-1 && change!=idnum){//修改idnum
|
||||
core.maps.blocksInfo[idnum] = core.maps.blocksInfo[change];
|
||||
delete(core.maps.blocksInfo[change]);
|
||||
@ -106,37 +107,24 @@
|
||||
callback(null);
|
||||
}
|
||||
//callback(err:String)
|
||||
editor_file.editItem = function(editor,id,obj,callback){
|
||||
//obj形式同callback的obj,为null或undefined时只查询不修改
|
||||
editor_file.editItem = function(editor,id,actionList,callback){
|
||||
/*actionList:[
|
||||
["change","['items']['name']","红宝石的新名字"],
|
||||
["add","['items']['新的和name同级的属性']",123],
|
||||
["change","['itemEffectTip']","',攻击力+'+core.values.redJewel"],
|
||||
]
|
||||
为[]时只查询不修改
|
||||
*/
|
||||
if (!isset(callback)) throw('未设置callback');
|
||||
callback(
|
||||
{'items':{'cls': 'items', 'name': '红宝石'},'itemEffect':'core.status.hero.atk += core.values.redJewel','itemEffectTip':"',攻击+'+core.values.redJewel"},
|
||||
{'items':'','itemEffect':'','itemEffectTip':''},
|
||||
{'items':{'cls': "/*只能取keys items constants tools\\n$range(thiseval in ['keys','items','constants','tools'])\\n*/", 'name': '', 'text': ''},'itemEffect':'','itemEffectTip':''},
|
||||
null);
|
||||
//只有items.cls是items的才有itemEffect和itemEffectTip,keys和constants和tools只有items
|
||||
}
|
||||
/*
|
||||
<<
|
||||
{'items':{'cls': 'items', 'name': '红宝石'},'itemEffect':'core.status.hero.atk += core.values.redJewel','itemEffectTip':"',攻击+'+core.values.redJewel"}
|
||||
==
|
||||
[
|
||||
["change","['items']['name']","红宝石的新名字"],
|
||||
["add","['items']['新的和name同级的属性']",123],
|
||||
["change","['itemEffectTip']","',攻击力+'+core.values.redJewel"],
|
||||
]
|
||||
>>
|
||||
'yellowKey': {'cls': 'keys' \*只能取keys items constants tools\n$range(thiseval in ['keys','items','constants','tools'])\n*\ , 'name': '黄钥匙'}
|
||||
|
||||
$range((function(){typeof(thiseval)==typeof(0)||})())
|
||||
if( 注释.indexof('$range(')!= -1){
|
||||
thiseval = 新值;
|
||||
evalstr = 注释.split('$range')[1].split('\n')[0];
|
||||
if(eval(evalstr) !== true)alert('不在取值范围内')
|
||||
}
|
||||
*/
|
||||
|
||||
//callback(obj,commentObj,err:String)
|
||||
editor_file.editEnemy = function(editor,id,obj,callback){
|
||||
editor_file.editEnemy = function(editor,id,actionList,callback){
|
||||
//obj形式同callback的obj,为null或undefined时只查询不修改
|
||||
if (!isset(callback)) throw('未设置callback');
|
||||
callback(
|
||||
@ -148,7 +136,7 @@
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
editor_file.editLoc = function(editor,x,y,obj,callback){
|
||||
editor_file.editLoc = function(editor,x,y,actionList,callback){
|
||||
//obj形式同callback的obj,为null或undefined时只查询不修改
|
||||
if (!isset(callback)) throw('未设置callback');
|
||||
callback(
|
||||
@ -160,7 +148,7 @@
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
editor_file.editFloor = function(editor,obj,callback){
|
||||
editor_file.editFloor = function(editor,actionList,callback){
|
||||
//obj形式同callback的obj,为null或undefined时只查询不修改
|
||||
if (!isset(callback)) throw('未设置callback');
|
||||
callback(
|
||||
@ -174,7 +162,7 @@
|
||||
|
||||
|
||||
|
||||
editor_file.editTower = function(editor,obj,callback){
|
||||
editor_file.editTower = function(editor,actionList,callback){
|
||||
//obj形式同callback的obj,为null或undefined时只查询不修改
|
||||
if (!isset(callback)) throw('未设置callback');
|
||||
callback(
|
||||
@ -210,4 +198,30 @@
|
||||
}
|
||||
return formatArrStr;
|
||||
}
|
||||
|
||||
var saveSetting = function(file,actionList,callback) {
|
||||
if (file=='icons') {}
|
||||
if (file=='maps') {}
|
||||
if (file=='items') {}
|
||||
if (file=='enemys') {}
|
||||
if (file=='data') {}
|
||||
callback('出错了,要设置的文件名不识别');
|
||||
}
|
||||
/*
|
||||
[
|
||||
["change","['items']['redJewel']['name']","红宝石的新名字"],
|
||||
["add","['items']['redJewel']['新的和name同级的属性']",123],
|
||||
["change","['itemEffectTip']['redJewel']","',攻击力+'+core.values.redJewel"],
|
||||
]
|
||||
>>
|
||||
'yellowKey': {'cls': 'keys' \*只能取keys items constants tools\n$range(thiseval in ['keys','items','constants','tools'])\n*\ , 'name': '黄钥匙'}
|
||||
|
||||
$range((function(){typeof(thiseval)==typeof(0)||})())
|
||||
if( 注释.indexof('$range(')!= -1){
|
||||
thiseval = 新值;
|
||||
evalstr = 注释.split('$range')[1].split('$end')[0];
|
||||
if(eval(evalstr) !== true)alert('不在取值范围内')
|
||||
}
|
||||
*/
|
||||
|
||||
})();
|
||||
27
libs/project/comment.js
Normal file
27
libs/project/comment.js
Normal file
@ -0,0 +1,27 @@
|
||||
comment =
|
||||
{
|
||||
"items" : {
|
||||
'items':{
|
||||
'cls': "只能取keys items constants tools\n$range(thiseval in ['keys','items','constants','tools'])$end",
|
||||
'name': '名称',
|
||||
'text': '道具在道具栏中显示的描述'
|
||||
},
|
||||
'itemEffect':'cls为items的即捡即用类物品的效果,执行时会对这里的字符串执行eval()',
|
||||
'itemEffectTip':'cls为items的即捡即用类物品,在获得时左上角额外显示的文字,执行时会对这里的字符串执行eval()得到字符串'
|
||||
},
|
||||
"enemys" : {
|
||||
'name': '名称',
|
||||
'hp': '生命值',
|
||||
'atk': '攻击力',
|
||||
'def': '防御力',
|
||||
'money': '金币',
|
||||
'experience': '经验',
|
||||
'special': '特殊属性\n1:先攻,2:魔攻,3:坚固,4:2连击,5:3连击,6:n连击,7:破甲,8:反击,9:净化,10:模仿,11:吸血,12:中毒,13:衰弱,14:诅咒,15:领域,16:夹击,17:仇恨,18:阻击,19:自爆,20:无敌\n多个属性例如用[1,4,11]表示先攻2连击吸血\n模仿怪的攻防设为0就好\n',
|
||||
'value': '特殊属性的数值\n领域怪需要加value表示领域伤害的数值\n吸血怪需要在后面添加value代表吸血比例',
|
||||
'zoneSquare': '领域怪zoneSquare代表是否九宫格伤害',
|
||||
'range': 'range可选,代表领域伤害的范围;不加默认为1\n$range(thiseval==~~thiseval &&thiseval>0)$end',
|
||||
'bomb':' 加入 "bomb": false 代表该怪物不可被炸弹或圣锤炸掉$range(thiseval in [true,false])$end',
|
||||
'point': 'point可以在打败怪物后进行加点,详见文档说明\n$range(thiseval==~~thiseval && thiseval>0)$end',
|
||||
'n': '多连击需要在后面指定n代表是几连击\n$range(thiseval==~~thiseval &&thiseval>0)$end',
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user