commit
0bab4e508c
@ -519,13 +519,13 @@ return code;
|
||||
*/;
|
||||
|
||||
setText_s
|
||||
: '设置剧情文本的属性' '位置' SetTextPosition_List '偏移像素' EvalString? '对齐' TextAlign_List? BGNL? '标题颜色' EvalString? Colour '正文颜色' EvalString? Colour '背景色' EvalString? Colour BGNL? '粗体' B_1_List '标题字体大小' EvalString? '正文字体大小' EvalString? '打字间隔' EvalString? Newline
|
||||
: '设置剧情文本的属性' '位置' SetTextPosition_List '偏移像素' EvalString? '对齐' TextAlign_List? BGNL? '标题颜色' EvalString? Colour '正文颜色' EvalString? Colour '背景色' EvalString? Colour BGNL? '粗体' B_1_List '标题字体大小' EvalString? '正文字体大小' EvalString? '打字间隔' EvalString? '字符间距' EvalString? Newline
|
||||
|
||||
|
||||
/* setText_s
|
||||
tooltip : setText:设置剧情文本的属性,颜色为RGB三元组或RGBA四元组,打字间隔为剧情文字添加的时间间隔,为整数或不填
|
||||
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=settext%EF%BC%9A%E8%AE%BE%E7%BD%AE%E5%89%A7%E6%83%85%E6%96%87%E6%9C%AC%E7%9A%84%E5%B1%9E%E6%80%A7
|
||||
default : [null,"",null,"",'rgba(255,255,255,1)',"",'rgba(255,255,255,1)',"",'rgba(255,255,255,1)',null,"","",""]
|
||||
default : [null,"",null,"",'rgba(255,255,255,1)',"",'rgba(255,255,255,1)',"",'rgba(255,255,255,1)',null,"","","",""]
|
||||
SetTextPosition_List_0 =SetTextPosition_List_0==='null'?'': ', "position": "'+SetTextPosition_List_0+'"';
|
||||
TextAlign_List_0 = TextAlign_List_0==='null'?'': ', "align": "'+TextAlign_List_0+'"';
|
||||
var colorRe = MotaActionFunctions.pattern.colorRe;
|
||||
@ -564,8 +564,12 @@ if (EvalString_6) {
|
||||
if (!/^\d+$/.test(EvalString_6))throw new Error('打字时间间隔必须是整数或不填');
|
||||
EvalString_6 = ', "time": '+EvalString_6;
|
||||
}
|
||||
if (EvalString_7) {
|
||||
if (!/^\d+$/.test(EvalString_7))throw new Error('字符间距必须是整数或不填');
|
||||
EvalString_7 = ', "interval": '+EvalString_7;
|
||||
}
|
||||
B_1_List_0 = B_1_List_0==='null'?'':', "bold": '+B_1_List_0;
|
||||
var code = '{"type": "setText"'+SetTextPosition_List_0+EvalString_0+TextAlign_List_0+EvalString_1+EvalString_2+B_1_List_0+EvalString_3+EvalString_4+EvalString_5+EvalString_6+'},\n';
|
||||
var code = '{"type": "setText"'+SetTextPosition_List_0+EvalString_0+TextAlign_List_0+EvalString_1+EvalString_2+B_1_List_0+EvalString_3+EvalString_4+EvalString_5+EvalString_6+EvalString_7+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
@ -2983,7 +2987,7 @@ ActionParser.prototype.parseAction = function() {
|
||||
this.next = MotaActionBlocks['setText_s'].xmlText([
|
||||
data.position,data.offset,data.align,data.title,'rgba('+data.title+')',
|
||||
data.text,'rgba('+data.text+')',data.background,'rgba('+data.background+')',
|
||||
data.bold,data.titlefont,data.textfont,data.time,this.next]);
|
||||
data.bold,data.titlefont,data.textfont,data.time,data.interval,this.next]);
|
||||
break;
|
||||
case "tip":
|
||||
this.next = MotaActionBlocks['tip_s'].xmlText([
|
||||
|
||||
@ -1087,7 +1087,7 @@ events.prototype._action_comment = function (data, x, y, prefix) {
|
||||
}
|
||||
|
||||
events.prototype._action_setText = function (data, x, y, prefix) {
|
||||
["position", "offset", "align", "bold", "titlefont", "textfont", "time"].forEach(function (t) {
|
||||
["position", "offset", "align", "bold", "titlefont", "textfont", "time", "interval"].forEach(function (t) {
|
||||
if (data[t] != null) core.status.textAttribute[t] = data[t];
|
||||
});
|
||||
["background", "title", "text"].forEach(function (t) {
|
||||
|
||||
@ -857,6 +857,7 @@ ui.prototype.drawTextContent = function (ctx, content, config) {
|
||||
config.fontSize = config.fontSize || textAttribute.textfont;
|
||||
config.lineHeight = config.lineHeight || (config.fontSize * 1.3);
|
||||
config.time = config.time || 0;
|
||||
config.interval = textAttribute.interval || 0;
|
||||
|
||||
config.index = 0;
|
||||
config.currcolor = config.color;
|
||||
@ -962,7 +963,7 @@ ui.prototype._drawTextContent_drawChar = function (tempCtx, content, config, ch)
|
||||
tempCtx.font = this._buildFont(config.fontSize, config.bold, config.italic);
|
||||
}
|
||||
// 检查是不是自动换行
|
||||
var charwidth = core.calWidth(tempCtx, ch);
|
||||
var charwidth = core.calWidth(tempCtx, ch) + config.interval;
|
||||
if (config.maxWidth != null && config.offsetX + charwidth > config.maxWidth) {
|
||||
this._drawTextContent_newLine(tempCtx, config);
|
||||
config.index--;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user