\z[n]暂停打字效果
This commit is contained in:
parent
1072a134da
commit
8caf1f9b35
@ -282,13 +282,14 @@ floorId指定的是目标楼层的唯一标识符(ID)。
|
||||
- 使用`${}`来计算一个表达式的值,如`${status:atk+status:def}`。
|
||||
- 使用`\f[...]`来同时插入一张立绘图,如`\f[1.png,100,200]`。
|
||||
- 使用`\\i[...]`来在对话框中绘制一个图标,如`\\i[fly]`。
|
||||
- 使用`\\c[...]`来修改字体大小,如`\\b[16]`。
|
||||
- 使用`\\c[...]`来修改字体大小,如`\\c[16]`。
|
||||
- 使用`\\d`来加粗或者取消粗体。
|
||||
- 使用`\\e`来加斜体或取消斜体。
|
||||
- 使用`\\z[...]`来添加打字中的暂停效果。
|
||||
|
||||
从V2.5.2开始,也允许绘制一张头像图在对话框中,只要通过`\t[1.png]`或`\t[标题,1.png]`的写法。
|
||||
|
||||
**使用`\\i,\\c,\\d,\\e`时请注意:在事件块中,允许只写一个反斜杠`\`,系统会自动转义成`\\`;但是在脚本中必须两个反斜杠都写上!**
|
||||
**使用`\\i,\\c,\\d,\\e,\\z`时请注意:在事件块中,允许只写一个反斜杠`\`,系统会自动转义成`\\`;但是在脚本中必须两个反斜杠都写上!**
|
||||
|
||||
详细信息请参见[剧情文本控制](event#text:显示一段文字(剧情))中的说明。
|
||||
|
||||
|
||||
@ -410,7 +410,7 @@ function omitedcheckUpdateFunction(event) {
|
||||
}
|
||||
}
|
||||
try {
|
||||
var code = Blockly.JavaScript.workspaceToCode(workspace).replace(/\\\\(i|c|d|e)/g, '\\\\\\\\$1');
|
||||
var code = Blockly.JavaScript.workspaceToCode(workspace).replace(/\\\\(i|c|d|e|z)/g, '\\\\\\\\$1');
|
||||
codeAreaHL.setValue(code);
|
||||
} catch (error) {
|
||||
codeAreaHL.setValue(String(error));
|
||||
@ -565,7 +565,7 @@ function omitedcheckUpdateFunction(event) {
|
||||
MotaActionFunctions.parse(
|
||||
eval('obj=' + codeAreaHL.getValue().replace(/[<>&]/g, function (c) {
|
||||
return {'<': '<', '>': '>', '&': '&'}[c];
|
||||
}).replace(/\\(r|f|i|c|d|e)/g,'\\\\$1')),
|
||||
}).replace(/\\(r|f|i|c|d|e|z)/g,'\\\\$1')),
|
||||
document.getElementById('entryType').value
|
||||
);
|
||||
}
|
||||
@ -639,7 +639,7 @@ function omitedcheckUpdateFunction(event) {
|
||||
return;
|
||||
}
|
||||
var code = Blockly.JavaScript.workspaceToCode(editor_blockly.workspace);
|
||||
code = code.replace(/\\(i|c|d|e)/g, '\\\\$1');
|
||||
code = code.replace(/\\(i|c|d|e|z)/g, '\\\\$1');
|
||||
eval('var obj=' + code);
|
||||
if (this.checkAsync(obj) && confirm("警告!存在不等待执行完毕的事件但却没有用【等待所有异步事件处理完毕】来等待" +
|
||||
"它们执行完毕,这样可能会导致录像检测系统出问题。\n你要返回修改么?")) return;
|
||||
@ -690,7 +690,7 @@ function omitedcheckUpdateFunction(event) {
|
||||
];
|
||||
if (b && types.indexOf(b.type)>=0) {
|
||||
try {
|
||||
var code = "[" + Blockly.JavaScript.blockToCode(b).replace(/\\(i|c|d|e)/g, '\\\\$1') + "]";
|
||||
var code = "[" + Blockly.JavaScript.blockToCode(b).replace(/\\(i|c|d|e|z)/g, '\\\\$1') + "]";
|
||||
eval("var obj="+code);
|
||||
if (obj.length > 0 && b.type == 'waitContext_2') {
|
||||
var dt = obj[0];
|
||||
|
||||
29
libs/ui.js
29
libs/ui.js
@ -907,9 +907,11 @@ ui.prototype._drawTextContent_draw = function (ctx, tempCtx, content, config) {
|
||||
var _drawNext = function () {
|
||||
if (config.index >= config.blocks.length) return false;
|
||||
var block = config.blocks[config.index++];
|
||||
ctx.drawImage(tempCtx.canvas, block.left, block.top, block.width, block.height,
|
||||
config.left + block.left + block.marginLeft, config.top + block.top + block.marginTop,
|
||||
block.width, block.height);
|
||||
if (block != null) {
|
||||
ctx.drawImage(tempCtx.canvas, block.left, block.top, block.width, block.height,
|
||||
config.left + block.left + block.marginLeft, config.top + block.top + block.marginTop,
|
||||
block.width, block.height);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (config.time == 0) {
|
||||
@ -961,6 +963,7 @@ ui.prototype._drawTextContent_drawChar = function (tempCtx, content, config, ch)
|
||||
tempCtx.font = this._buildFont(config.currfont, config.bold, config.italic);
|
||||
return true;
|
||||
}
|
||||
if (c == 'z') return this._drawTextContent_emptyChar(tempCtx, content, config);
|
||||
}
|
||||
// \\e 斜体切换
|
||||
if (ch == '\\' && content.charAt(config.index)=='e') {
|
||||
@ -994,6 +997,7 @@ ui.prototype._drawTextContent_newLine = function (tempCtx, config) {
|
||||
marginLeft = totalWidth - width;
|
||||
|
||||
config.blocks.forEach(function (b) {
|
||||
if (b == null) return;
|
||||
if (b.line == config.line) {
|
||||
b.marginLeft = marginLeft;
|
||||
// b.marginTop = 0; // 上对齐
|
||||
@ -1038,6 +1042,23 @@ ui.prototype._drawTextContent_changeFont = function (tempCtx, content, config) {
|
||||
return this._drawTextContent_next(tempCtx, content, config);
|
||||
}
|
||||
|
||||
ui.prototype._drawTextContent_emptyChar = function (tempCtx, content, config) {
|
||||
config.index++;
|
||||
var index = config.index, index2;
|
||||
if (content.charAt(index) == '[' && ((index2=content.indexOf(']', index))>=0)) {
|
||||
var str = content.substring(index+1, index2);
|
||||
if (/^\d+$/.test(str)) {
|
||||
var value = parseInt(str);
|
||||
for (var i = 0; i < value; ++i) {
|
||||
config.blocks.push(null); // Empty char
|
||||
}
|
||||
} else config.blocks.push(null);
|
||||
config.index = index2 + 1;
|
||||
}
|
||||
else config.blocks.push(null);
|
||||
return this._drawTextContent_next(tempCtx, content, config);
|
||||
}
|
||||
|
||||
ui.prototype._drawTextContent_drawIcon = function (tempCtx, content, config) {
|
||||
// 绘制一个 \i 效果
|
||||
var index = config.index, index2;
|
||||
@ -1072,7 +1093,7 @@ ui.prototype.getTextContentHeight = function (content, config) {
|
||||
}
|
||||
|
||||
ui.prototype._getRealContent = function (content) {
|
||||
return content.replace(/(\r|\\(r|c|d|e))(\[.*?])?/g, "").replace(/(\\i)(\[.*?])?/g, "占1");
|
||||
return content.replace(/(\r|\\(r|c|d|e|z))(\[.*?])?/g, "").replace(/(\\i)(\[.*?])?/g, "占1");
|
||||
}
|
||||
|
||||
////// 绘制一个对话框 //////
|
||||
|
||||
Loading…
Reference in New Issue
Block a user