Fix bug & clearTextBox multi
This commit is contained in:
parent
9dec925995
commit
8b667ba852
@ -1078,13 +1078,15 @@ return code;
|
|||||||
*/;
|
*/;
|
||||||
|
|
||||||
clearTextBox_s
|
clearTextBox_s
|
||||||
: '清除对话框' ':' Int Newline
|
: '清除对话框' ':' EvalString? Newline
|
||||||
|
|
||||||
/* clearTextBox_s
|
/* clearTextBox_s
|
||||||
tooltip : 清除对话框
|
tooltip : 清除对话框
|
||||||
helpUrl : /_docs/#/instruction
|
helpUrl : /_docs/#/instruction
|
||||||
default : [1]
|
default : ["1"]
|
||||||
var code = '{"type": "clearTextBox", "code": '+Int_0+'},\n';
|
if (EvalString_0 && !/^\d+(,\d+)*$/.test(EvalString_0)) throw new Error('对话框编号需要以逗号分隔');
|
||||||
|
EvalString_0 = EvalString_0 ? (', "code": ['+EvalString_0+']') : '';
|
||||||
|
var code = '{"type": "clearTextBox"'+EvalString_0+'},\n';
|
||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
|
|||||||
@ -301,7 +301,7 @@ ActionParser.prototype.parseAction = function() {
|
|||||||
data.code, data.loc[0], data.loc[1], data.relative||false, data.moveMode, data.time, data.async, this.next]);
|
data.code, data.loc[0], data.loc[1], data.relative||false, data.moveMode, data.time, data.async, this.next]);
|
||||||
break;
|
break;
|
||||||
case "clearTextBox": // 清除对话框
|
case "clearTextBox": // 清除对话框
|
||||||
this.next = MotaActionBlocks['clearTextBox_s'].xmlText([data.code,this.next]);
|
this.next = MotaActionBlocks['clearTextBox_s'].xmlText([(data.code||"").toString(),this.next]);
|
||||||
break;
|
break;
|
||||||
case "autoText": // 自动剧情文本
|
case "autoText": // 自动剧情文本
|
||||||
var info = this.getTitleAndPosition(data.text);
|
var info = this.getTitleAndPosition(data.text);
|
||||||
@ -321,7 +321,7 @@ ActionParser.prototype.parseAction = function() {
|
|||||||
if (!/^\w+\.png$/.test(data.background))
|
if (!/^\w+\.png$/.test(data.background))
|
||||||
data.background=this.Colour(data.background);
|
data.background=this.Colour(data.background);
|
||||||
this.next = MotaActionBlocks['setText_s'].xmlText([
|
this.next = MotaActionBlocks['setText_s'].xmlText([
|
||||||
data.position,data.offset,data.align,data.title,data.bold,'rgba('+data.title+')',
|
data.position,data.offset,data.align,data.bold,data.title,'rgba('+data.title+')',
|
||||||
data.text,'rgba('+data.text+')',data.background,'rgba('+data.background+')',
|
data.text,'rgba('+data.text+')',data.background,'rgba('+data.background+')',
|
||||||
data.titlefont,data.textfont,data.lineHeight,data.time,data.letterSpacing,data.animateTime,this.next]);
|
data.titlefont,data.textfont,data.lineHeight,data.time,data.letterSpacing,data.animateTime,this.next]);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -1354,7 +1354,7 @@ events.prototype.__action_doAsyncFunc = function (isAsync, func) {
|
|||||||
events.prototype._action_text = function (data, x, y, prefix) {
|
events.prototype._action_text = function (data, x, y, prefix) {
|
||||||
if (this.__action_checkReplaying()) return;
|
if (this.__action_checkReplaying()) return;
|
||||||
data.text = core.replaceText(data.text, prefix);
|
data.text = core.replaceText(data.text, prefix);
|
||||||
var ctx = data.code ? '__text__' + data.code : null;;
|
var ctx = data.code ? ('__text__' + data.code) : null;;
|
||||||
data.ctx = ctx;
|
data.ctx = ctx;
|
||||||
if (core.getContextByName(ctx) && !data.showAll) {
|
if (core.getContextByName(ctx) && !data.showAll) {
|
||||||
core.ui._animateUI('hide', ctx, function () {
|
core.ui._animateUI('hide', ctx, function () {
|
||||||
@ -3127,14 +3127,26 @@ events.prototype._moveTextBox_moving = function (ctx, moveInfo, callback) {
|
|||||||
|
|
||||||
////// 清除对话框 //////
|
////// 清除对话框 //////
|
||||||
events.prototype.clearTextBox = function (code, callback) {
|
events.prototype.clearTextBox = function (code, callback) {
|
||||||
var ctx = '__text__' + code;
|
if (code == null) {
|
||||||
if (!core.getContextByName(ctx)) {
|
code = Object.keys(core.dymCanvas).filter(function (one) { return one.startsWith('__text__') })
|
||||||
if (callback) callback();
|
.map(function (one) { return one.substring('__text__'.length); })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(code instanceof Array)) code = [code];
|
||||||
|
var index = 0;
|
||||||
|
var _work = function () {
|
||||||
|
if (index == code.length) {
|
||||||
|
if (callback) callback();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var ctx = '__text__' + code[index++];
|
||||||
|
if (!core.getContextByName(ctx)) return _work();
|
||||||
core.ui._animateUI('hide', ctx, function () {
|
core.ui._animateUI('hide', ctx, function () {
|
||||||
core.deleteCanvas(ctx);
|
core.deleteCanvas(ctx);
|
||||||
if (callback) callback();
|
_work();
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
_work();
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 关门 //////
|
////// 关门 //////
|
||||||
|
|||||||
@ -1416,6 +1416,7 @@ ui.prototype.drawTextBox = function(content, config) {
|
|||||||
config = config || {};
|
config = config || {};
|
||||||
|
|
||||||
this.clearUI();
|
this.clearUI();
|
||||||
|
content = core.replaceText(content);
|
||||||
|
|
||||||
var ctx = config.ctx || null;
|
var ctx = config.ctx || null;
|
||||||
if (ctx && main.mode == 'play') {
|
if (ctx && main.mode == 'play') {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user