对话框不等待操作

This commit is contained in:
ckcz123 2021-08-31 20:14:25 +08:00
parent c3e1d2f7b4
commit bf4c63a514
5 changed files with 19 additions and 11 deletions

View File

@ -968,7 +968,7 @@ return code+',\n';
*/;
text_1_s
: '标题' EvalString? '图像' EvalString? '对话框效果' EvalString? '起点像素 px' PosString? 'py' PosString? '宽' PosString? '对话框编号' Int BGNL? Newline EvalString_Multi Newline
: '标题' EvalString? '图像' EvalString? '对话框效果' EvalString? '起点 px' PosString? 'py' PosString? '宽' PosString? '编号' Int '不等待操作' Bool BGNL? Newline EvalString_Multi Newline
/* text_1_s
@ -976,7 +976,7 @@ tooltip : text显示一段文字剧情,选项较多请右键点击帮
helpUrl : /_docs/#/instruction
previewBlock : true
allIds : ['EvalString_1']
default : ["小妖精","fairy","","","","",0,"欢迎使用事件编辑器(双击方块可直接预览)"]
default : ["小妖精","fairy","","","","",0,false,"欢迎使用事件编辑器(双击方块可直接预览)"]
var title='';
if (EvalString_0==''){
if (EvalString_1=='' )title='';
@ -997,10 +997,11 @@ if(EvalString_2 && !(/^(up|center|down|hero|this)(,(hero|null|\d+,\d+|\d+))?$/.t
}
EvalString_2 = EvalString_2 && ('\\b['+EvalString_2+']');
var code = '"'+title+EvalString_2+EvalString_Multi_0+'"';
if (block.isCollapsed() || !block.isEnabled() || pos || Int_0) {
if (block.isCollapsed() || !block.isEnabled() || pos || Int_0 || Bool_0) {
code = '{"type": "text", "text": '+code;
if (pos) code += ', "pos": ' + pos;
if (Int_0) code += ', "code": ' + Int_0;
if (Bool_0) code += ', "async": true';
if (block.isCollapsed()) code += ', "_collapsed": true';
if (!block.isEnabled()) code += ', "_disabled": true';
code += '}';
@ -1009,7 +1010,7 @@ return code+',\n';
*/;
text_2_s
: '标题' EvalString? '图像' EvalString? '对话框效果' EvalString? '起点像素 px' PosString? 'py' PosString? '宽' PosString? '对话框编号' Int BGNL? Newline EvalString_Multi BGNL? Newline textDrawingList* Newline
: '标题' EvalString? '图像' EvalString? '对话框效果' EvalString? '起点 px' PosString? 'py' PosString? '宽' PosString? '编号' Int '不等待操作' Bool BGNL? Newline EvalString_Multi BGNL? Newline textDrawingList* Newline
/* text_2_s
@ -1038,10 +1039,11 @@ if(EvalString_2 && !(/^(up|center|down|hero|this)(,(hero|null|\d+,\d+|\d+))?$/.t
}
EvalString_2 = EvalString_2 && ('\\b['+EvalString_2+']');
var code = '"'+title+EvalString_2+textDrawingList_0.replace(/\s/g, '')+EvalString_Multi_0+'"';
if (block.isCollapsed() || !block.isEnabled() || pos || Int_0) {
if (block.isCollapsed() || !block.isEnabled() || pos || Int_0 || Bool_0) {
code = '{"type": "text", "text": '+code;
if (pos) code += ', "pos": ' + pos;
if (Int_0) code += ', "code": ' + Int_0;
if (Bool_0) code += ', "async": true';
if (block.isCollapsed()) code += ', "_collapsed": true';
if (!block.isEnabled()) code += ', "_disabled": true';
code += '}';

View File

@ -292,12 +292,12 @@ ActionParser.prototype.parseAction = function() {
}
data.pos = data.pos || [];
this.next = MotaActionFunctions.xmlText('text_2_s', [
info[0], info[1], info[2], data.pos[0], data.pos[1], data.pos[2], data.code||0, info[3], buildTextDrawing(textDrawing), this.next
info[0], info[1], info[2], data.pos[0], data.pos[1], data.pos[2], data.code||0, data.async||false, info[3], buildTextDrawing(textDrawing), this.next
], /* isShadow */false, /*comment*/ null, /*collapsed*/ data._collapsed, /*disabled*/ data._disabled);
} else if (info[0] || info[1] || info[2] || data.pos || data.code) {
data.pos = data.pos || [];
this.next = MotaActionFunctions.xmlText('text_1_s',[
info[0], info[1], info[2], data.pos[0], data.pos[1], data.pos[2], data.code||0, info[3], this.next], /* isShadow */false, /*comment*/ null, /*collapsed*/ data._collapsed, /*disabled*/ data._disabled);
info[0], info[1], info[2], data.pos[0], data.pos[1], data.pos[2], data.code||0, data.async||false, info[3], this.next], /* isShadow */false, /*comment*/ null, /*collapsed*/ data._collapsed, /*disabled*/ data._disabled);
}
else {
this.next = MotaActionFunctions.xmlText('text_0_s', [info[3],this.next],

View File

@ -244,7 +244,7 @@ editor_blockly = function () {
}
}
if (one.type == 'previewUI' && this.checkAsync(one.action)) return true;
if (one.async && one.type != 'animate' && one.type != 'function') hasAsync = true;
if (one.async && one.type != 'animate' && one.type != 'function' && one.type != 'text') hasAsync = true;
if (one.type == 'waitAsync') hasAsync = false;
}
return hasAsync;

View File

@ -1359,12 +1359,18 @@ events.prototype._action_text = function (data, x, y, prefix) {
if (core.getContextByName(ctx) && !data.showAll) {
core.ui._animateUI('hide', ctx, function () {
core.ui.drawTextBox(data.text, data);
core.ui._animateUI('show', ctx);
core.ui._animateUI('show', ctx, function () {
if (data.async) core.doAction();
});
});
return;
}
core.ui.drawTextBox(data.text, data);
if (!data.showAll) core.ui._animateUI('show', ctx);
if (!data.showAll) {
core.ui._animateUI('show', ctx, function () {
if (data.async) core.doAction();
});
}
}
events.prototype._action_moveTextBox = function (data, x, y, prefix) {

View File

@ -1463,7 +1463,7 @@ ui.prototype.drawTextBox = function(content, config) {
// Step 5: 绘制正文
var config = this.drawTextContent(config.ctx || 'ui', content, {
left: hPos.content_left, top: content_top, maxWidth: hPos.validWidth,
lineHeight: vPos.lineHeight, time: (config.showAll || textAttribute.time<=0 || core.status.event.id!='action')?0:textAttribute.time
lineHeight: vPos.lineHeight, time: (config.showAll || config.async || textAttribute.time<=0 || core.status.event.id!='action')?0:textAttribute.time
});
// Step 6: 绘制光标