This commit is contained in:
voderl 2019-10-28 21:08:01 +08:00
parent 5acd702ccc
commit ba297813c3
4 changed files with 7 additions and 4 deletions

View File

@ -1757,6 +1757,7 @@ config为绘制的配置项目前可以包括如下几项
- fontSize字体大小如果不设置则使用剧情文本设置中的正文字体大小。
- lineHeight绘制的行距值如果不设置则使用fontSize*1.3即1.3倍行距)。
- time打字机效果。若不为0则会逐个字进行绘制并设置core.status.event.interval定时器。
- interval字符间的间距。值表示绘制每个字符之间间隔的距离默认为0。
core.drawTextBox(content, showAll)

View File

@ -413,6 +413,8 @@ textfont为可选项表示正文字体大小px为单位。默认值`
time为可选项表示文字添加的速度。若此项设置为0将直接全部显示若大于0则会设置为相邻字符依次显示的时间间隔。 默认值:`0`
interval为可选项表示文字之间的间距。单位为像素值。默认值`0`
### tip显示一段提示文字
`{"type": "tip"}`可以在左上角显示一段提示文字。

View File

@ -462,7 +462,7 @@ setText_s
/* setText_s
tooltip : setText设置剧情文本的属性,颜色为RGB三元组或RGBA四元组,打字间隔为剧情文字添加的时间间隔,为整数或不填
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,"","","",""]
SetTextPosition_List_0 =SetTextPosition_List_0==='null'?'': ', "position": "'+SetTextPosition_List_0+'"';

View File

@ -875,7 +875,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.interval = config.interval == null ? (textAttribute.interval || 0) : config.interval;
config.index = 0;
config.currcolor = config.color;
@ -1263,7 +1263,7 @@ ui.prototype._drawTextBox_drawTitleAndIcon = function (titleInfo, hPos, vPos, al
}
ui.prototype._createTextCanvas = function (content, lineHeight) {
var width = this.PIXEL, height = 30 + this.getTextContentHeight(content, {lineHeight: lineHeight});
var width = this.PIXEL, height = 30 + this.getTextContentHeight(content, {lineHeight: lineHeight,maxWidth:core.__PIXELS__});
var ctx = document.createElement('canvas').getContext('2d');
ctx.canvas.width = width;
ctx.canvas.height = height;
@ -1280,7 +1280,7 @@ ui.prototype.drawScrollText = function (content, time, lineHeight, callback) {
var offset = core.status.textAttribute.offset || 15;
lineHeight *= core.status.textAttribute.textfont;
var ctx = this._createTextCanvas(content, lineHeight);
var obj = { align: core.status.textAttribute.align, lineHeight: lineHeight };
var obj = { align: core.status.textAttribute.align, lineHeight: lineHeight ,maxWidth: core.__PIXELS__};
if (obj.align == 'right') obj.left = this.PIXEL - offset;
else if (obj.align != 'center') obj.left = offset;
this.drawTextContent(ctx, content, obj);