\t & \b in editor
This commit is contained in:
parent
b63c06d982
commit
98357fd482
@ -2743,12 +2743,19 @@ ActionParser.prototype.parseAction = function() {
|
|||||||
this.next = data.next;
|
this.next = data.next;
|
||||||
return;
|
return;
|
||||||
case "text": // 文字/对话
|
case "text": // 文字/对话
|
||||||
this.next = MotaActionBlocks['text_0_s'].xmlText([
|
var info = this.getTitleAndPosition(data.text);
|
||||||
this.EvalString(data.text),this.next]);
|
if (info[0] || info[1] || info[2]) {
|
||||||
|
this.next = MotaActionBlocks['text_1_s'].xmlText([
|
||||||
|
info[0], info[1], info[2], info[3], this.next]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.next = MotaActionBlocks['text_0_s'].xmlText([info[3],this.next]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "autoText": // 自动剧情文本
|
case "autoText": // 自动剧情文本
|
||||||
|
var info = this.getTitleAndPosition(data.text);
|
||||||
this.next = MotaActionBlocks['autoText_s'].xmlText([
|
this.next = MotaActionBlocks['autoText_s'].xmlText([
|
||||||
'','','',data.time,this.EvalString(data.text),this.next]);
|
info[0],info[1],info[2],data.time,info[3],this.next]);
|
||||||
break;
|
break;
|
||||||
case "scrollText":
|
case "scrollText":
|
||||||
this.next = MotaActionBlocks['scrollText_s'].xmlText([
|
this.next = MotaActionBlocks['scrollText_s'].xmlText([
|
||||||
@ -3123,8 +3130,10 @@ ActionParser.prototype.parseAction = function() {
|
|||||||
text_choices=MotaActionBlocks['choicesContext'].xmlText([
|
text_choices=MotaActionBlocks['choicesContext'].xmlText([
|
||||||
choice.text,choice.icon,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]);
|
||||||
}
|
}
|
||||||
|
if (!this.isset(data.text)) data.text = '';
|
||||||
|
var info = this.getTitleAndPosition(data.text);
|
||||||
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]);
|
info[3],info[0],info[1],text_choices,this.next]);
|
||||||
break;
|
break;
|
||||||
case "while": // 前置条件循环处理
|
case "while": // 前置条件循环处理
|
||||||
this.next = MotaActionBlocks['while_s'].xmlText([
|
this.next = MotaActionBlocks['while_s'].xmlText([
|
||||||
@ -3391,6 +3400,20 @@ ActionParser.prototype.EvalString = function(EvalString) {
|
|||||||
return EvalString.split('\b').join('\\b').split('\t').join('\\t').split('\n').join('\\n');
|
return EvalString.split('\b').join('\\b').split('\t').join('\\t').split('\n').join('\\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ActionParser.prototype.getTitleAndPosition = function (string) {
|
||||||
|
string = this.EvalString(string);
|
||||||
|
var title = '', icon = '', position = '';
|
||||||
|
string = string.replace(/\\t\[(([^\],]+),)?([^\],]+)\]/g, function (s0, s1, s2, s3) {
|
||||||
|
if (s3) title = s3;
|
||||||
|
if (s2) { icon = s3; title = s2; }
|
||||||
|
if (icon.endsWith('.png')) { title += "," + icon; icon = ''; }
|
||||||
|
return "";
|
||||||
|
}).replace(/\\b\[(.*?)\]/g, function (s0, s1) {
|
||||||
|
position = s1; return "";
|
||||||
|
});
|
||||||
|
return [title, icon, position, string];
|
||||||
|
}
|
||||||
|
|
||||||
ActionParser.prototype.Colour = function(color) {
|
ActionParser.prototype.Colour = function(color) {
|
||||||
return color?JSON.stringify(color).slice(1,-1):null;
|
return color?JSON.stringify(color).slice(1,-1):null;
|
||||||
}
|
}
|
||||||
@ -3478,4 +3501,5 @@ MotaActionFunctions.pattern.idWithoutFlag=/^[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/;
|
|||||||
MotaActionFunctions.pattern.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)?$/;
|
MotaActionFunctions.pattern.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)?$/;
|
||||||
MotaActionFunctions.pattern.fontRe=/^(italic )?(bold )?(\d+)px ([a-zA-Z0-9_\u4E00-\u9FCC]+)$/;
|
MotaActionFunctions.pattern.fontRe=/^(italic )?(bold )?(\d+)px ([a-zA-Z0-9_\u4E00-\u9FCC]+)$/;
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@ -923,7 +923,7 @@ control.prototype.checkBlock = function () {
|
|||||||
if (damage) {
|
if (damage) {
|
||||||
core.status.hero.hp -= damage;
|
core.status.hero.hp -= damage;
|
||||||
core.drawTip("受到"+(core.status.checkBlock.type[loc]||"伤害")+damage+"点");
|
core.drawTip("受到"+(core.status.checkBlock.type[loc]||"伤害")+damage+"点");
|
||||||
this._checkBlock_soundAndAnimate(x, y);
|
core.drawAnimate("zone", x, y);
|
||||||
this._checkBlock_disableQuickShop();
|
this._checkBlock_disableQuickShop();
|
||||||
core.status.hero.statistics.extraDamage += damage;
|
core.status.hero.statistics.extraDamage += damage;
|
||||||
if (core.status.hero.hp <= 0) {
|
if (core.status.hero.hp <= 0) {
|
||||||
@ -937,11 +937,6 @@ control.prototype.checkBlock = function () {
|
|||||||
this._checkBlock_ambush(core.status.checkBlock.ambush[loc]);
|
this._checkBlock_ambush(core.status.checkBlock.ambush[loc]);
|
||||||
}
|
}
|
||||||
|
|
||||||
control.prototype._checkBlock_soundAndAnimate = function (x,y) {
|
|
||||||
core.playSound('zone.mp3');
|
|
||||||
core.drawAnimate("zone", x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
control.prototype._checkBlock_disableQuickShop = function () {
|
control.prototype._checkBlock_disableQuickShop = function () {
|
||||||
// 禁用快捷商店
|
// 禁用快捷商店
|
||||||
if (core.flags.disableShopOnDamage) {
|
if (core.flags.disableShopOnDamage) {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user