commit
180816c100
@ -326,9 +326,12 @@ floorId指定的是目标楼层的唯一标识符(ID)。
|
|||||||
- 使用`\r[...]`来动态修改局部文本的颜色,如`\r[red]`。
|
- 使用`\r[...]`来动态修改局部文本的颜色,如`\r[red]`。
|
||||||
- 使用`${}`来计算一个表达式的值,如`${status:atk+status:def}`。
|
- 使用`${}`来计算一个表达式的值,如`${status:atk+status:def}`。
|
||||||
- 使用`\f[...]`来同时插入一张立绘图,如`\f[1.png,100,200]`。
|
- 使用`\f[...]`来同时插入一张立绘图,如`\f[1.png,100,200]`。
|
||||||
|
- 使用`\\i[...]`来在对话框中绘制一个图标,如`\\i[fly]`。
|
||||||
|
|
||||||
从V2.5.2开始,也允许绘制一张头像图在对话框中,只要通过`\t[1.png]`或`\t[标题,1.png]`的写法。
|
从V2.5.2开始,也允许绘制一张头像图在对话框中,只要通过`\t[1.png]`或`\t[标题,1.png]`的写法。
|
||||||
|
|
||||||
|
**使用`\\i[...]`绘制图标请注意:在事件块中,允许只写一个反斜杠`\i`,系统会自动转义成`\\i`;但是在脚本中必须两个反斜杠都写上!**
|
||||||
|
|
||||||
详细信息请参见[剧情文本控制](event#text:显示一段文字(剧情))中的说明。
|
详细信息请参见[剧情文本控制](event#text:显示一段文字(剧情))中的说明。
|
||||||
|
|
||||||
从V2.5.2开始,可以用一张WindowSkin图片作为对话框的背景皮肤。
|
从V2.5.2开始,可以用一张WindowSkin图片作为对话框的背景皮肤。
|
||||||
|
|||||||
@ -267,6 +267,21 @@
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
从V2.5.5以后,也可以使用`\\i[...]`来在对话框中绘制一个图标。
|
||||||
|
|
||||||
|
这里可以使用一个合法ID(32x48图块除外),或使用一个系统图标(`core.statusBar.icons`中的内容)。
|
||||||
|
|
||||||
|
``` js
|
||||||
|
"x,y": [ // 实际执行的事件列表
|
||||||
|
"\t[勇士]\b[up,hero]这是一个飞行器\\i[fly],这是一个破墙镐\\i[pickaxe]",
|
||||||
|
"\t[hero]也可以使用系统图标,比如这是存档\\i[save],这是工具栏\\i[toolbox]",
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
**可以在控制台中输入`core.statusBar.icons`以查看所有的系统图标定义。**
|
||||||
|
|
||||||
|
!> 注意,在事件块中,允许只写一个反斜杠`\i`,系统会自动转义成`\\i`;但是在脚本中必须两个反斜杠都写上!
|
||||||
|
|
||||||
另外值得一提的是,我们是可以在文字中计算一个表达式的值的。只需要将表达式用 `${ }`整个括起来就可以。
|
另外值得一提的是,我们是可以在文字中计算一个表达式的值的。只需要将表达式用 `${ }`整个括起来就可以。
|
||||||
|
|
||||||
``` js
|
``` js
|
||||||
@ -425,6 +440,23 @@ value是一个表达式,将通过这个表达式计算出的结果赋值给nam
|
|||||||
|
|
||||||
另外注意一点的是,如果hp被设置成了0或以下,将触发lose事件,直接死亡。
|
另外注意一点的是,如果hp被设置成了0或以下,将触发lose事件,直接死亡。
|
||||||
|
|
||||||
|
### setValue2:增减勇士的某个属性、道具个数,或某个变量/Flag的值
|
||||||
|
|
||||||
|
和`{"type": "setValue"}`的写法完全相同,不过此项是可以直接将值加减到原始数值上。
|
||||||
|
|
||||||
|
即下面的写法是等价的:
|
||||||
|
|
||||||
|
``` js
|
||||||
|
"x,y": [ // 实际执行的事件列表
|
||||||
|
{"type": "setValue", "name": "status:atk", "value": "status:atk+10" } // 攻击提高10点
|
||||||
|
{"type": "setValue2", "name": "status:atk", "value": "10" } // 和上面写法等价
|
||||||
|
{"type": "setValue", "name": "item:yellowKey", "value": "item:yellowKey-3" } // 黄钥匙个数-3
|
||||||
|
{"type": "setValue2", "name": "item:yellowKey", "value": "-3" } // 和上面写法等价
|
||||||
|
{"type": "setValue", "name": "flag:door2", "value": "flag:door2+1" } // 将变量door值+1
|
||||||
|
{"type": "setValue2", "name": "flag:door2", "value": "01" } // 和上面写法等价
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
### setFloor:设置楼层属性
|
### setFloor:设置楼层属性
|
||||||
|
|
||||||
使用`{"type":"setFloor"}`可以设置某层楼的楼层属性。
|
使用`{"type":"setFloor"}`可以设置某层楼的楼层属性。
|
||||||
|
|||||||
@ -229,6 +229,7 @@ action
|
|||||||
| setText_s
|
| setText_s
|
||||||
| tip_s
|
| tip_s
|
||||||
| setValue_s
|
| setValue_s
|
||||||
|
| setValue2_s
|
||||||
| setFloor_s
|
| setFloor_s
|
||||||
| setGlobalAttribute_s
|
| setGlobalAttribute_s
|
||||||
| setGlobalValue_s
|
| setGlobalValue_s
|
||||||
@ -465,6 +466,18 @@ var code = '{"type": "setValue", "name": "'+idString_e_0+'", "value": "'+express
|
|||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
|
setValue2_s
|
||||||
|
: '数值增减' ':' '名称' idString_e '+=' expression Newline
|
||||||
|
|
||||||
|
|
||||||
|
/* setValue2_s
|
||||||
|
tooltip : setValue2:增减勇士的某个属性、道具个数, 或某个变量/Flag的值
|
||||||
|
helpUrl : https://h5mota.com/games/template/docs/#/event?id=setValue2%ef%bc%9a%e5%a2%9e%e5%87%8f%e5%8b%87%e5%a3%ab%e7%9a%84%e6%9f%90%e4%b8%aa%e5%b1%9e%e6%80%a7%e3%80%81%e9%81%93%e5%85%b7%e4%b8%aa%e6%95%b0%ef%bc%8c%e6%88%96%e6%9f%90%e4%b8%aa%e5%8f%98%e9%87%8f%2fFlag%e7%9a%84%e5%80%bc
|
||||||
|
colour : this.dataColor
|
||||||
|
var code = '{"type": "setValue2", "name": "'+idString_e_0+'", "value": "'+expression_0+'"},\n';
|
||||||
|
return code;
|
||||||
|
*/;
|
||||||
|
|
||||||
setFloor_s
|
setFloor_s
|
||||||
: '设置楼层属性' ':' Floor_Meta_List '楼层名' IdString? '值' EvalString Newline
|
: '设置楼层属性' ':' Floor_Meta_List '楼层名' IdString? '值' EvalString Newline
|
||||||
|
|
||||||
@ -1528,13 +1541,13 @@ return code;
|
|||||||
*/;
|
*/;
|
||||||
|
|
||||||
choicesContext
|
choicesContext
|
||||||
: '子选项' EvalString '颜色' EvalString? Colour BGNL? Newline action+
|
: '子选项' EvalString '图标' IdString? '颜色' EvalString? Colour BGNL? Newline action+
|
||||||
|
|
||||||
|
|
||||||
/* choicesContext
|
/* choicesContext
|
||||||
tooltip : 选项的选择
|
tooltip : 选项的选择
|
||||||
helpUrl : https://h5mota.com/games/template/docs/#/event?id=choices%EF%BC%9A%E7%BB%99%E7%94%A8%E6%88%B7%E6%8F%90%E4%BE%9B%E9%80%89%E9%A1%B9
|
helpUrl : https://h5mota.com/games/template/docs/#/event?id=choices%EF%BC%9A%E7%BB%99%E7%94%A8%E6%88%B7%E6%8F%90%E4%BE%9B%E9%80%89%E9%A1%B9
|
||||||
default : ["提示文字:红钥匙",""]
|
default : ["提示文字:红钥匙","",""]
|
||||||
colour : this.subColor
|
colour : this.subColor
|
||||||
if (EvalString_1) {
|
if (EvalString_1) {
|
||||||
var colorRe = /^(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(,0(\.\d+)?|,1)?$/;
|
var colorRe = /^(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(,0(\.\d+)?|,1)?$/;
|
||||||
@ -1543,7 +1556,8 @@ if (EvalString_1) {
|
|||||||
else
|
else
|
||||||
EvalString_1 = ', "color": "'+EvalString_1+'"';
|
EvalString_1 = ', "color": "'+EvalString_1+'"';
|
||||||
}
|
}
|
||||||
var code = '{"text": "'+EvalString_0+'"'+EvalString_1+', "action": [\n'+action_0+']},\n';
|
IdString_0 = IdString_0?(', "icon": "'+IdString_0+'"'):'';
|
||||||
|
var code = '{"text": "'+EvalString_0+'"'+IdString_0+EvalString_1+', "action": [\n'+action_0+']},\n';
|
||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
@ -2364,6 +2378,13 @@ ActionParser.prototype.parseAction = function() {
|
|||||||
MotaActionBlocks['evalString_e'].xmlText([data.value]),
|
MotaActionBlocks['evalString_e'].xmlText([data.value]),
|
||||||
this.next]);
|
this.next]);
|
||||||
break;
|
break;
|
||||||
|
case "setValue2":
|
||||||
|
this.next = MotaActionBlocks['setValue2_s'].xmlText([
|
||||||
|
// MotaActionBlocks['idString_e'].xmlText([data.name]),
|
||||||
|
this.tryToUseEvFlag_e('idString_e', [data.name]),
|
||||||
|
MotaActionBlocks['evalString_e'].xmlText([data.value]),
|
||||||
|
this.next]);
|
||||||
|
break;
|
||||||
case "setFloor":
|
case "setFloor":
|
||||||
this.next = MotaActionBlocks['setFloor_s'].xmlText([
|
this.next = MotaActionBlocks['setFloor_s'].xmlText([
|
||||||
data.name, data.floorId||null, data.value, this.next]);
|
data.name, data.floorId||null, data.value, this.next]);
|
||||||
@ -2411,7 +2432,7 @@ ActionParser.prototype.parseAction = function() {
|
|||||||
var text_choices = null;
|
var text_choices = null;
|
||||||
for(var ii=data.choices.length-1,choice;choice=data.choices[ii];ii--) {
|
for(var ii=data.choices.length-1,choice;choice=data.choices[ii];ii--) {
|
||||||
text_choices=MotaActionBlocks['choicesContext'].xmlText([
|
text_choices=MotaActionBlocks['choicesContext'].xmlText([
|
||||||
choice.text,choice.color,'rgba('+choice.color+')',this.insertActionList(choice.action),text_choices]);
|
choice.text,choice.icon,choice.color,'rgba('+choice.color+')',this.insertActionList(choice.action),text_choices]);
|
||||||
}
|
}
|
||||||
this.next = MotaActionBlocks['choices_s'].xmlText([
|
this.next = MotaActionBlocks['choices_s'].xmlText([
|
||||||
this.isset(data.text)?this.EvalString(data.text):null,'','',text_choices,this.next]);
|
this.isset(data.text)?this.EvalString(data.text):null,'','',text_choices,this.next]);
|
||||||
|
|||||||
@ -16,26 +16,31 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
|||||||
"images": {
|
"images": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
|
"_range": "editor.mode.checkUnique(thiseval)",
|
||||||
"_data": "在此存放所有可能使用的图片(tilesets除外) \n图片可以被作为背景图(的一部分),也可以直接用自定义事件进行显示。 \n 图片名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好 \n 建议对于较大的图片,在网上使用在线的“图片压缩工具(http://compresspng.com/zh/)”来进行压缩,以节省流量 \n 依次向后添加"
|
"_data": "在此存放所有可能使用的图片(tilesets除外) \n图片可以被作为背景图(的一部分),也可以直接用自定义事件进行显示。 \n 图片名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好 \n 建议对于较大的图片,在网上使用在线的“图片压缩工具(http://compresspng.com/zh/)”来进行压缩,以节省流量 \n 依次向后添加"
|
||||||
},
|
},
|
||||||
"tilesets": {
|
"tilesets": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
|
"_range": "editor.mode.checkUnique(thiseval)",
|
||||||
"_data": "在此存放额外素材的图片名, \n可以自定导入任意张素材图片,无需PS,无需注册,即可直接在游戏中使用 \n 形式如[\"1.png\", \"2.png\"] ,将需要的素材图片放在images目录下 \n 素材的宽高必须都是32的倍数,且图片上的总图块数不超过1000(即最多有1000个32*32的图块在该图片上)"
|
"_data": "在此存放额外素材的图片名, \n可以自定导入任意张素材图片,无需PS,无需注册,即可直接在游戏中使用 \n 形式如[\"1.png\", \"2.png\"] ,将需要的素材图片放在images目录下 \n 素材的宽高必须都是32的倍数,且图片上的总图块数不超过1000(即最多有1000个32*32的图块在该图片上)"
|
||||||
},
|
},
|
||||||
"animates": {
|
"animates": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
|
"_range": "editor.mode.checkUnique(thiseval)",
|
||||||
"_data": "在此存放所有可能使用的动画,必须是animate格式,在这里不写后缀名 \n动画必须放在animates目录下;文件名不能使用中文,不能带空格或特殊字符 \n \"jianji\", \"thunder\" \n 根据需求自行添加"
|
"_data": "在此存放所有可能使用的动画,必须是animate格式,在这里不写后缀名 \n动画必须放在animates目录下;文件名不能使用中文,不能带空格或特殊字符 \n \"jianji\", \"thunder\" \n 根据需求自行添加"
|
||||||
},
|
},
|
||||||
"bgms": {
|
"bgms": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
|
"_range": "editor.mode.checkUnique(thiseval)",
|
||||||
"_data": "在此存放所有的bgm,和文件名一致。 \n音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好"
|
"_data": "在此存放所有的bgm,和文件名一致。 \n音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好"
|
||||||
},
|
},
|
||||||
"sounds": {
|
"sounds": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
|
"_range": "editor.mode.checkUnique(thiseval)",
|
||||||
"_data": "在此存放所有的SE,和文件名一致 \n音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好"
|
"_data": "在此存放所有的SE,和文件名一致 \n音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好"
|
||||||
},
|
},
|
||||||
"startBackground": {
|
"startBackground": {
|
||||||
@ -131,17 +136,20 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
|||||||
"title": {
|
"title": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
|
"_string": true,
|
||||||
"_data": "游戏名,将显示在标题页面以及切换楼层的界面中"
|
"_data": "游戏名,将显示在标题页面以及切换楼层的界面中"
|
||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
|
"_string": true,
|
||||||
"_range": "/^[a-zA-Z0-9_]{1,30}$/.test(thiseval)",
|
"_range": "/^[a-zA-Z0-9_]{1,30}$/.test(thiseval)",
|
||||||
"_data": "游戏的唯一英文标识符。由英文、数字、下划线组成,不能超过30个字符。\n此项必须修改,其将直接影响到存档的定位!"
|
"_data": "游戏的唯一英文标识符。由英文、数字、下划线组成,不能超过30个字符。\n此项必须修改,其将直接影响到存档的定位!"
|
||||||
},
|
},
|
||||||
"version": {
|
"version": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
|
"_string": true,
|
||||||
"_data": "当前游戏版本;版本不一致的存档不能通用。"
|
"_data": "当前游戏版本;版本不一致的存档不能通用。"
|
||||||
},
|
},
|
||||||
"floorId": {
|
"floorId": {
|
||||||
@ -160,6 +168,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
|||||||
"name": {
|
"name": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
|
"_string": true,
|
||||||
"_data": "勇士名;可以改成喜欢的"
|
"_data": "勇士名;可以改成喜欢的"
|
||||||
},
|
},
|
||||||
"lv": {
|
"lv": {
|
||||||
@ -211,6 +220,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
|||||||
"equipment": {
|
"equipment": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
|
"_range": "thiseval instanceof Array",
|
||||||
"_data": "初始装上的装备,此处建议请直接留空数组"
|
"_data": "初始装上的装备,此处建议请直接留空数组"
|
||||||
},
|
},
|
||||||
"items": {
|
"items": {
|
||||||
@ -220,21 +230,25 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
|||||||
"keys": {
|
"keys": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
|
"_range": "thiseval instanceof Object && !(thiseval instanceof Array)",
|
||||||
"_data": "初始三种钥匙个数"
|
"_data": "初始三种钥匙个数"
|
||||||
},
|
},
|
||||||
"constants": {
|
"constants": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
|
"_range": "thiseval instanceof Object && !(thiseval instanceof Array)",
|
||||||
"_data": "初始永久道具个数,例如初始送手册可以写 {\"book\": 1}"
|
"_data": "初始永久道具个数,例如初始送手册可以写 {\"book\": 1}"
|
||||||
},
|
},
|
||||||
"tools": {
|
"tools": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
|
"_range": "thiseval instanceof Object && !(thiseval instanceof Array)",
|
||||||
"_data": "初始消耗道具个数,例如初始有两破可以写 {\"pickaxe\": 2}"
|
"_data": "初始消耗道具个数,例如初始有两破可以写 {\"pickaxe\": 2}"
|
||||||
},
|
},
|
||||||
"equips": {
|
"equips": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
|
"_range": "thiseval instanceof Object && !(thiseval instanceof Array)",
|
||||||
"_data": "初始装备个数,例如初始送铁剑可以写 {\"sword1\": 1}"
|
"_data": "初始装备个数,例如初始送铁剑可以写 {\"sword1\": 1}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -242,6 +256,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
|||||||
"flyRange": {
|
"flyRange": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
|
"_range": "thiseval instanceof Array",
|
||||||
"_data": "初始可飞的楼层;一般留空数组即可"
|
"_data": "初始可飞的楼层;一般留空数组即可"
|
||||||
},
|
},
|
||||||
"loc": {
|
"loc": {
|
||||||
@ -276,6 +291,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
|||||||
"flags": {
|
"flags": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
|
"_range": "thiseval instanceof Object && !(thiseval instanceof Array)",
|
||||||
"_data": "游戏过程中的变量或flags"
|
"_data": "游戏过程中的变量或flags"
|
||||||
},
|
},
|
||||||
"steps": {
|
"steps": {
|
||||||
|
|||||||
@ -1230,15 +1230,14 @@ editor.prototype.listen = function () {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var clearLoc = document.getElementById('clearLoc');
|
var _clearPoint = function (clearPoint) {
|
||||||
clearLoc.onmousedown = function(e){
|
|
||||||
editor.hideMidMenu();
|
editor.hideMidMenu();
|
||||||
e.stopPropagation();
|
|
||||||
editor.preMapData = null;
|
editor.preMapData = null;
|
||||||
reDo = null;
|
reDo = null;
|
||||||
editor.info = 0;
|
editor.info = 0;
|
||||||
editor_mode.onmode('');
|
editor_mode.onmode('');
|
||||||
var now = editor.pos;
|
var now = editor.pos;
|
||||||
|
if (clearPoint)
|
||||||
editor.map[now.y][now.x]=editor.info;
|
editor.map[now.y][now.x]=editor.info;
|
||||||
editor.updateMap();
|
editor.updateMap();
|
||||||
fields.forEach(function(v){
|
fields.forEach(function(v){
|
||||||
@ -1249,11 +1248,23 @@ editor.prototype.listen = function () {
|
|||||||
printe(err);
|
printe(err);
|
||||||
throw(err)
|
throw(err)
|
||||||
}
|
}
|
||||||
;printf('清空此点及事件成功');
|
;printf(clearPoint?'清空该点和事件成功':'只清空该点事件成功');
|
||||||
editor.drawPosSelection();
|
editor.drawPosSelection();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var clearEvent = document.getElementById('clearEvent');
|
||||||
|
clearEvent.onmousedown = function (e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
_clearPoint(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
var clearLoc = document.getElementById('clearLoc');
|
||||||
|
clearLoc.onmousedown = function(e){
|
||||||
|
e.stopPropagation();
|
||||||
|
_clearPoint(true);
|
||||||
|
}
|
||||||
|
|
||||||
var brushMod=document.getElementById('brushMod');
|
var brushMod=document.getElementById('brushMod');
|
||||||
brushMod.onchange=function(){
|
brushMod.onchange=function(){
|
||||||
editor.brushMod=brushMod.value;
|
editor.brushMod=brushMod.value;
|
||||||
|
|||||||
@ -64,9 +64,9 @@ editor_blockly = function () {
|
|||||||
MotaActionBlocks['lose_s'].xmlText(),
|
MotaActionBlocks['lose_s'].xmlText(),
|
||||||
MotaActionBlocks['choices_s'].xmlText([
|
MotaActionBlocks['choices_s'].xmlText([
|
||||||
'选择剑或者盾','流浪者','man',MotaActionBlocks['choicesContext'].xmlText([
|
'选择剑或者盾','流浪者','man',MotaActionBlocks['choicesContext'].xmlText([
|
||||||
'剑','',null,MotaActionFunctions.actionParser.parseList([{"type": "openDoor", "loc": [3,3]}]),
|
'剑','','',null,MotaActionFunctions.actionParser.parseList([{"type": "openDoor", "loc": [3,3]}]),
|
||||||
MotaActionBlocks['choicesContext'].xmlText([
|
MotaActionBlocks['choicesContext'].xmlText([
|
||||||
'盾','',null,MotaActionFunctions.actionParser.parseList([{"type": "openDoor", "loc": [9,3]}]),
|
'盾','','',null,MotaActionFunctions.actionParser.parseList([{"type": "openDoor", "loc": [9,3]}]),
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
@ -75,6 +75,9 @@ editor_blockly = function () {
|
|||||||
MotaActionBlocks['setValue_s'].xmlText([
|
MotaActionBlocks['setValue_s'].xmlText([
|
||||||
MotaActionBlocks['idString_1_e'].xmlText(['status','hp'])
|
MotaActionBlocks['idString_1_e'].xmlText(['status','hp'])
|
||||||
]),
|
]),
|
||||||
|
MotaActionBlocks['setValue2_s'].xmlText([
|
||||||
|
MotaActionBlocks['idString_1_e'].xmlText(['status','hp'])
|
||||||
|
]),
|
||||||
MotaActionBlocks['setFloor_s'].xmlText(),
|
MotaActionBlocks['setFloor_s'].xmlText(),
|
||||||
MotaActionBlocks['setGlobalAttribute_s'].xmlText(),
|
MotaActionBlocks['setGlobalAttribute_s'].xmlText(),
|
||||||
MotaActionBlocks['setGlobalValue_s'].xmlText(),
|
MotaActionBlocks['setGlobalValue_s'].xmlText(),
|
||||||
@ -154,6 +157,9 @@ editor_blockly = function () {
|
|||||||
MotaActionBlocks['setValue_s'].xmlText([
|
MotaActionBlocks['setValue_s'].xmlText([
|
||||||
MotaActionBlocks['idString_1_e'].xmlText(['status','hp'])
|
MotaActionBlocks['idString_1_e'].xmlText(['status','hp'])
|
||||||
]),
|
]),
|
||||||
|
MotaActionBlocks['setValue2_s'].xmlText([
|
||||||
|
MotaActionBlocks['idString_1_e'].xmlText(['status','hp'])
|
||||||
|
]),
|
||||||
MotaActionBlocks['expression_arithmetic_0'].xmlText(),
|
MotaActionBlocks['expression_arithmetic_0'].xmlText(),
|
||||||
MotaActionBlocks['evFlag_e'].xmlText(),
|
MotaActionBlocks['evFlag_e'].xmlText(),
|
||||||
MotaActionBlocks['negate_e'].xmlText(),
|
MotaActionBlocks['negate_e'].xmlText(),
|
||||||
@ -178,8 +184,8 @@ editor_blockly = function () {
|
|||||||
{"text": "黄钥匙(\${9+flag:shop_times}金币)", "color": [255,255,0,1], "action": [
|
{"text": "黄钥匙(\${9+flag:shop_times}金币)", "color": [255,255,0,1], "action": [
|
||||||
{"type": "if", "condition": "status:money>=9+flag:shop_times",
|
{"type": "if", "condition": "status:money>=9+flag:shop_times",
|
||||||
"true": [
|
"true": [
|
||||||
{"type": "setValue", "name": "status:money", "value": "status:money-(9+flag:shop_times)"},
|
{"type": "setValue2", "name": "status:money", "value": "-(9+flag:shop_times)"},
|
||||||
{"type": "setValue", "name": "item:yellowKey", "value": "item:yellowKey+1"},
|
{"type": "setValue2", "name": "item:yellowKey", "value": "1"},
|
||||||
],
|
],
|
||||||
"false": [
|
"false": [
|
||||||
"\t[老人,man]你的金钱不足!",
|
"\t[老人,man]你的金钱不足!",
|
||||||
@ -194,7 +200,7 @@ editor_blockly = function () {
|
|||||||
]}
|
]}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{"type": "setValue", "name": "flag:shop_times", "value": "flag:shop_times+1"},
|
{"type": "setValue2", "name": "flag:shop_times", "value": "1"},
|
||||||
{"type": "revisit"}
|
{"type": "revisit"}
|
||||||
], 'event'),
|
], 'event'),
|
||||||
'<label text="战前剧情"></label>',
|
'<label text="战前剧情"></label>',
|
||||||
@ -217,7 +223,7 @@ editor_blockly = function () {
|
|||||||
],'afterBattle'),
|
],'afterBattle'),
|
||||||
'<label text="打怪开门"></label>',
|
'<label text="打怪开门"></label>',
|
||||||
MotaActionFunctions.actionParser.parse([
|
MotaActionFunctions.actionParser.parse([
|
||||||
{"type": "setValue", "name": "flag:__door__", "value": "flag:__door__+1"},
|
{"type": "setValue2", "name": "flag:__door__", "value": "1"},
|
||||||
{"type": "if", "condition": "flag:__door__==2",
|
{"type": "if", "condition": "flag:__door__==2",
|
||||||
"true": [
|
"true": [
|
||||||
{"type": "openDoor", "loc": [10,5]}
|
{"type": "openDoor", "loc": [10,5]}
|
||||||
@ -339,7 +345,7 @@ function omitedcheckUpdateFunction(event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
var code = Blockly.JavaScript.workspaceToCode(workspace);
|
var code = Blockly.JavaScript.workspaceToCode(workspace).replace(/\\i/g, '\\\\i');
|
||||||
codeAreaHL.setValue(code);
|
codeAreaHL.setValue(code);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
codeAreaHL.setValue(String(error));
|
codeAreaHL.setValue(String(error));
|
||||||
@ -481,7 +487,8 @@ function omitedcheckUpdateFunction(event) {
|
|||||||
MotaActionFunctions.parse(
|
MotaActionFunctions.parse(
|
||||||
eval('obj=' + codeAreaHL.getValue().replace(/[<>&]/g, function (c) {
|
eval('obj=' + codeAreaHL.getValue().replace(/[<>&]/g, function (c) {
|
||||||
return {'<': '<', '>': '>', '&': '&'}[c];
|
return {'<': '<', '>': '>', '&': '&'}[c];
|
||||||
}).replace(/\\r/g, '\\\\r').replace(/\\f/g, '\\\\f')),
|
}).replace(/\\r/g, '\\\\r').replace(/\\f/g, '\\\\f')
|
||||||
|
.replace(/\\i/,'\\\\i')),
|
||||||
document.getElementById('entryType').value
|
document.getElementById('entryType').value
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -555,6 +562,7 @@ function omitedcheckUpdateFunction(event) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var code = Blockly.JavaScript.workspaceToCode(editor_blockly.workspace);
|
var code = Blockly.JavaScript.workspaceToCode(editor_blockly.workspace);
|
||||||
|
code = code.replace(/\\i/g, '\\\\i');
|
||||||
eval('var obj=' + code);
|
eval('var obj=' + code);
|
||||||
setvalue(JSON.stringify(obj));
|
setvalue(JSON.stringify(obj));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1166,7 +1166,21 @@ editor_mode = function (editor) {
|
|||||||
if(editor.isMobile)editor.showdataarea(false);
|
if(editor.isMobile)editor.showdataarea(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
editor_mode.checkUnique = function (thiseval) {
|
||||||
|
if (!(thiseval instanceof Array)) return false;
|
||||||
|
var map = {};
|
||||||
|
for (var i = 0; i<thiseval.length; ++i) {
|
||||||
|
if (map[thiseval[i]]) {
|
||||||
|
alert("警告:存在重复定义!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
map[thiseval[i]] = true;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
editor_mode.checkFloorIds = function(thiseval){
|
editor_mode.checkFloorIds = function(thiseval){
|
||||||
|
if (!editor_mode.checkUnique(thiseval)) return false;
|
||||||
var oldvalue = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main.floorIds;
|
var oldvalue = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main.floorIds;
|
||||||
fs.readdir('project/floors',function(err, data){
|
fs.readdir('project/floors',function(err, data){
|
||||||
if(err){
|
if(err){
|
||||||
@ -1186,7 +1200,7 @@ editor_mode = function (editor) {
|
|||||||
printe(objs_.slice(-1)[0]);
|
printe(objs_.slice(-1)[0]);
|
||||||
throw(objs_.slice(-1)[0])
|
throw(objs_.slice(-1)[0])
|
||||||
}
|
}
|
||||||
;printe('已放弃floorIds的修改');
|
;printe('已放弃floorIds的修改,请F5进行刷新');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -64,11 +64,8 @@ editor_multi = function () {
|
|||||||
return '\t';
|
return '\t';
|
||||||
}
|
}
|
||||||
|
|
||||||
editor_multi.format = function () {
|
var _format = function () {
|
||||||
if (!editor_multi.lintAutocomplete) {
|
if (!editor_multi.lintAutocomplete) return;
|
||||||
alert("只有代码才能进行格式化操作!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
codeEditor.setValue(js_beautify(codeEditor.getValue(), {
|
codeEditor.setValue(js_beautify(codeEditor.getValue(), {
|
||||||
brace_style: "collapse-preserve-inline",
|
brace_style: "collapse-preserve-inline",
|
||||||
indent_with_tabs: true,
|
indent_with_tabs: true,
|
||||||
@ -76,6 +73,15 @@ editor_multi = function () {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
editor_multi.format = function () {
|
||||||
|
if (!editor_multi.lintAutocomplete) {
|
||||||
|
alert("只有代码才能进行格式化操作!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_format();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
editor_multi.import = function (id_, args) {
|
editor_multi.import = function (id_, args) {
|
||||||
var thisTr = document.getElementById(id_);
|
var thisTr = document.getElementById(id_);
|
||||||
if (!thisTr) return false;
|
if (!thisTr) return false;
|
||||||
@ -122,6 +128,8 @@ editor_multi = function () {
|
|||||||
editor_multi.id = '';
|
editor_multi.id = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// ----- 自动格式化
|
||||||
|
_format();
|
||||||
if (editor_multi.id === 'callFromBlockly') {
|
if (editor_multi.id === 'callFromBlockly') {
|
||||||
editor_multi.id = '';
|
editor_multi.id = '';
|
||||||
editor_multi.multiLineDone();
|
editor_multi.multiLineDone();
|
||||||
|
|||||||
@ -316,6 +316,7 @@
|
|||||||
<div id='chooseInRight' class="menuitem"><div class="menuitem-content">在素材区选中此图块</div></div>
|
<div id='chooseInRight' class="menuitem"><div class="menuitem-content">在素材区选中此图块</div></div>
|
||||||
<div id='copyLoc' class="menuitem"><div class="menuitem-content">复制此事件</div></div>
|
<div id='copyLoc' class="menuitem"><div class="menuitem-content">复制此事件</div></div>
|
||||||
<div id='moveLoc' class="menuitem"><div class="menuitem-content">移动此事件</div></div>
|
<div id='moveLoc' class="menuitem"><div class="menuitem-content">移动此事件</div></div>
|
||||||
|
<div id='clearEvent' class="menuitem"><div class="menuitem-content">仅清空此点事件</div></div>
|
||||||
<div id='clearLoc' class="menuitem"><div class="menuitem-content">清空此点及事件</div></div>
|
<div id='clearLoc' class="menuitem"><div class="menuitem-content">清空此点及事件</div></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -336,6 +336,7 @@
|
|||||||
<div id='chooseInRight' class="menuitem"><div class="menuitem-content">在素材区选中此图块</div></div>
|
<div id='chooseInRight' class="menuitem"><div class="menuitem-content">在素材区选中此图块</div></div>
|
||||||
<div id='copyLoc' class="menuitem"><div class="menuitem-content">复制此事件</div></div>
|
<div id='copyLoc' class="menuitem"><div class="menuitem-content">复制此事件</div></div>
|
||||||
<div id='moveLoc' class="menuitem"><div class="menuitem-content">移动此事件</div></div>
|
<div id='moveLoc' class="menuitem"><div class="menuitem-content">移动此事件</div></div>
|
||||||
|
<div id='clearEvent' class="menuitem"><div class="menuitem-content">仅清空此点事件</div></div>
|
||||||
<div id='clearLoc' class="menuitem"><div class="menuitem-content">清空此点及事件</div></div>
|
<div id='clearLoc' class="menuitem"><div class="menuitem-content">清空此点及事件</div></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1001,8 +1001,11 @@ events.prototype.doAction = function() {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "setValue":
|
case "setValue":
|
||||||
|
case "setValue2":
|
||||||
try {
|
try {
|
||||||
var value=core.calValue(data.value, prefix);
|
var value=core.calValue(data.value, prefix);
|
||||||
|
if (data.type == 'setValue2')
|
||||||
|
value += core.calValue(data.name, prefix);
|
||||||
// 属性
|
// 属性
|
||||||
if (data.name.indexOf("status:")==0) {
|
if (data.name.indexOf("status:")==0) {
|
||||||
core.setStatus(data.name.substring(7), value);
|
core.setStatus(data.name.substring(7), value);
|
||||||
|
|||||||
77
libs/ui.js
77
libs/ui.js
@ -503,8 +503,25 @@ ui.prototype.calTextBoxWidth = function (canvas, content, min_width, max_width)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui.prototype.__getIconInfo = function (id) {
|
||||||
|
var image = null, icon = null;
|
||||||
|
["terrains","animates","items","npcs","enemys"].forEach(function (v) {
|
||||||
|
if (core.isset(core.material.icons[v][id])) {
|
||||||
|
image = core.material.images[v];
|
||||||
|
icon = core.material.icons[v][id];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (image == null) {
|
||||||
|
if (id in core.statusBar.icons) {
|
||||||
|
image = core.statusBar.icons[id];
|
||||||
|
icon = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return [image,icon];
|
||||||
|
}
|
||||||
|
|
||||||
ui.prototype.__drawText = function (canvas, content, content_left, content_top, valid_width,
|
ui.prototype.__drawText = function (canvas, content, content_left, content_top, valid_width,
|
||||||
color, per_height, time) {
|
color, per_height, text_font, time) {
|
||||||
core.setTextAlign(canvas, 'left');
|
core.setTextAlign(canvas, 'left');
|
||||||
|
|
||||||
var offsetx = content_left, offsety = content_top;
|
var offsetx = content_left, offsety = content_top;
|
||||||
@ -543,6 +560,29 @@ ui.prototype.__drawText = function (canvas, content, content_left, content_top,
|
|||||||
else currcolor = color;
|
else currcolor = color;
|
||||||
return drawNext();
|
return drawNext();
|
||||||
}
|
}
|
||||||
|
// \\i 绘制图标
|
||||||
|
if (ch == '\\' && content.charAt(index)=='i') {
|
||||||
|
// 绘制图标
|
||||||
|
var index2;
|
||||||
|
if (content.charAt(index+1) == '[' && ((index2=content.indexOf(']', index+1))>=0)) {
|
||||||
|
var str = content.substring(index+2, index2);
|
||||||
|
// --- 获得图标
|
||||||
|
var iconInfo = core.ui.__getIconInfo(str), image = iconInfo[0], icon = iconInfo[1];
|
||||||
|
if (image != null) {
|
||||||
|
if (core.isset(valid_width) && offsetx + text_font + 6 > content_left + valid_width) {
|
||||||
|
index --;
|
||||||
|
offsetx = content_left;
|
||||||
|
offsety += per_height;
|
||||||
|
return drawNext();
|
||||||
|
}
|
||||||
|
// --- 绘制
|
||||||
|
core.drawImage(canvas, image, 0, 32*icon, 32, 32, offsetx + 2, offsety - text_font + 1, text_font+2, text_font+2);
|
||||||
|
offsetx += text_font + 6;
|
||||||
|
index = index2+1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// 检查是不是自动换行
|
// 检查是不是自动换行
|
||||||
var charwidth = core.calWidth(canvas, ch);
|
var charwidth = core.calWidth(canvas, ch);
|
||||||
if (core.isset(valid_width) && offsetx + charwidth > content_left + valid_width) {
|
if (core.isset(valid_width) && offsetx + charwidth > content_left + valid_width) {
|
||||||
@ -663,7 +703,7 @@ ui.prototype.drawTextBox = function(content, showAll) {
|
|||||||
var globalFont = core.status.globalAttribute.font;
|
var globalFont = core.status.globalAttribute.font;
|
||||||
var font = textfont + 'px '+globalFont;
|
var font = textfont + 'px '+globalFont;
|
||||||
if (textAttribute.bold) font = "bold "+font;
|
if (textAttribute.bold) font = "bold "+font;
|
||||||
var realContent = content.replace(/(\r|\\r)(\[.*?])?/g, "");
|
var realContent = content.replace(/(\r|\\r)(\[.*?])?/g, "").replace(/(\\i)(\[.*?])?/g, "啊1");
|
||||||
|
|
||||||
var leftSpace = 25, rightSpace = 12;
|
var leftSpace = 25, rightSpace = 12;
|
||||||
if (core.isset(px) && core.isset(py)) leftSpace = 20;
|
if (core.isset(px) && core.isset(py)) leftSpace = 20;
|
||||||
@ -797,7 +837,7 @@ ui.prototype.drawTextBox = function(content, showAll) {
|
|||||||
|
|
||||||
core.setFont('ui', font);
|
core.setFont('ui', font);
|
||||||
|
|
||||||
this.__drawText('ui', content, content_left, content_top, validWidth, textColor, textfont + 5,
|
this.__drawText('ui', content, content_left, content_top, validWidth, textColor, textfont + 5, textfont,
|
||||||
(showAll || textAttribute.time<=0 || core.status.event.id!='action')?0:textAttribute.time);
|
(showAll || textAttribute.time<=0 || core.status.event.id!='action')?0:textAttribute.time);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -819,7 +859,7 @@ ui.prototype.drawScrollText = function (content, time, callback) {
|
|||||||
|
|
||||||
var font = textfont+"px "+core.status.globalAttribute.font;
|
var font = textfont+"px "+core.status.globalAttribute.font;
|
||||||
if (textAttribute.bold) font = "bold "+font;
|
if (textAttribute.bold) font = "bold "+font;
|
||||||
var realContent = content.replace(/(\r|\\r)(\[.*?])?/g, "");
|
var realContent = content.replace(/(\r|\\r)(\[.*?])?/g, "").replace(/(\\i)(\[.*?])?/g, "啊1");
|
||||||
var contents = core.splitLines('ui', realContent), lines = contents.length;
|
var contents = core.splitLines('ui', realContent), lines = contents.length;
|
||||||
|
|
||||||
// 计算总高度,按1.4倍行距计算
|
// 计算总高度,按1.4倍行距计算
|
||||||
@ -830,7 +870,7 @@ ui.prototype.drawScrollText = function (content, time, callback) {
|
|||||||
tempCanvas.clearRect(0, 0, width, height);
|
tempCanvas.clearRect(0, 0, width, height);
|
||||||
tempCanvas.font = font;
|
tempCanvas.font = font;
|
||||||
|
|
||||||
this.__drawText(tempCanvas, content, offset, textfont, null, textColor, 1.4*textfont, 0);
|
this.__drawText(tempCanvas, content, offset, textfont, null, textColor, 1.4*textfont, textfont, 0);
|
||||||
|
|
||||||
// 开始绘制到UI上
|
// 开始绘制到UI上
|
||||||
core.clearMap('ui');
|
core.clearMap('ui');
|
||||||
@ -854,8 +894,7 @@ ui.prototype.drawScrollText = function (content, time, callback) {
|
|||||||
|
|
||||||
////// 绘制一个选项界面 //////
|
////// 绘制一个选项界面 //////
|
||||||
ui.prototype.drawChoices = function(content, choices) {
|
ui.prototype.drawChoices = function(content, choices) {
|
||||||
|
choices = core.clone(choices || []);
|
||||||
choices = choices || [];
|
|
||||||
|
|
||||||
var background = core.status.textAttribute.background;
|
var background = core.status.textAttribute.background;
|
||||||
var isWindowSkin = false;
|
var isWindowSkin = false;
|
||||||
@ -879,7 +918,12 @@ ui.prototype.drawChoices = function(content, choices) {
|
|||||||
var globalFont = core.status.globalAttribute.font;
|
var globalFont = core.status.globalAttribute.font;
|
||||||
core.setFont('ui', "bold 17px "+globalFont);
|
core.setFont('ui', "bold 17px "+globalFont);
|
||||||
for (var i = 0; i < choices.length; i++) {
|
for (var i = 0; i < choices.length; i++) {
|
||||||
width = Math.max(width, core.calWidth('ui', core.replaceText(choices[i].text || choices[i]))+30);
|
if (typeof choices[i] === 'string')
|
||||||
|
choices[i] = {"text": choices[i]};
|
||||||
|
choices[i].text = core.replaceText(choices[i].text);
|
||||||
|
choices[i].width = core.calWidth('ui', core.replaceText(choices[i].text));
|
||||||
|
if (core.isset(choices[i].icon)) choices[i].width += 28;
|
||||||
|
width = Math.max(width, choices[i].width+30);
|
||||||
}
|
}
|
||||||
|
|
||||||
var left=parseInt((416 - width) / 2); // 左边界
|
var left=parseInt((416 - width) / 2); // 左边界
|
||||||
@ -898,7 +942,7 @@ ui.prototype.drawChoices = function(content, choices) {
|
|||||||
// 获得name, image, icon
|
// 获得name, image, icon
|
||||||
var info = this.getTitleAndIcon(content);
|
var info = this.getTitleAndIcon(content);
|
||||||
content = core.replaceText(info.content);
|
content = core.replaceText(info.content);
|
||||||
var realContent = content.replace(/(\r|\\r)(\[.*?])?/g, "");
|
var realContent = content.replace(/(\r|\\r)(\[.*?])?/g, "").replace(/(\\i)(\[.*?])?/g, "啊1");
|
||||||
id=info.id; name=info.name; image=info.image;
|
id=info.id; name=info.name; image=info.image;
|
||||||
icon=info.icon; iconHeight=info.iconHeight; animate=info.animate;
|
icon=info.icon; iconHeight=info.iconHeight; animate=info.animate;
|
||||||
if (id=='hero' || core.isset(icon))
|
if (id=='hero' || core.isset(icon))
|
||||||
@ -967,7 +1011,7 @@ ui.prototype.drawChoices = function(content, choices) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
core.setFont('ui', 'bold 15px '+globalFont);
|
core.setFont('ui', 'bold 15px '+globalFont);
|
||||||
this.__drawText('ui', content, content_left, content_top, validWidth, textColor, 20, 0);
|
this.__drawText('ui', content, content_left, content_top, validWidth, textColor, 20, 15, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 选项
|
// 选项
|
||||||
@ -976,14 +1020,23 @@ ui.prototype.drawChoices = function(content, choices) {
|
|||||||
var color = choices[i].color || textColor;
|
var color = choices[i].color || textColor;
|
||||||
if (color instanceof Array) color = core.arrayToRGBA(color);
|
if (color instanceof Array) color = core.arrayToRGBA(color);
|
||||||
core.setFillStyle('ui', color);
|
core.setFillStyle('ui', color);
|
||||||
core.fillText('ui', core.replaceText(choices[i].text || choices[i]), 208, choice_top + 32 * i, null, "bold 17px "+globalFont);
|
var offset = 208;
|
||||||
|
if (core.isset(choices[i].icon)) {
|
||||||
|
var iconInfo = this.__getIconInfo(choices[i].icon), image = iconInfo[0], icon = iconInfo[1];
|
||||||
|
if (image != null) {
|
||||||
|
core.drawImage('ui', image, 0, 32*icon, 32, 32,
|
||||||
|
208 - choices[i].width/2, choice_top + 32*i - 17, 22, 22);
|
||||||
|
offset += 14;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
core.fillText('ui', choices[i].text, offset, choice_top + 32 * i, null, "bold 17px "+globalFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (choices.length>0) {
|
if (choices.length>0) {
|
||||||
if (!core.isset(core.status.event.selection)) core.status.event.selection=0;
|
if (!core.isset(core.status.event.selection)) core.status.event.selection=0;
|
||||||
while (core.status.event.selection<0) core.status.event.selection+=choices.length;
|
while (core.status.event.selection<0) core.status.event.selection+=choices.length;
|
||||||
while (core.status.event.selection>=choices.length) core.status.event.selection-=choices.length;
|
while (core.status.event.selection>=choices.length) core.status.event.selection-=choices.length;
|
||||||
var len = core.calWidth('ui', core.replaceText(choices[core.status.event.selection].text || choices[core.status.event.selection]));
|
var len = choices[core.status.event.selection].width;
|
||||||
if (isWindowSkin)
|
if (isWindowSkin)
|
||||||
this.drawWindowSelector(background, 208-len/2-5, choice_top + 32 * core.status.event.selection - 20, len+10, 28);
|
this.drawWindowSelector(background, 208-len/2-5, choice_top + 32 * core.status.event.selection - 20, len+10, 28);
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user