diff --git a/_docs/api.md b/_docs/api.md index e68ab4a3..38916a10 100644 --- a/_docs/api.md +++ b/_docs/api.md @@ -1770,6 +1770,7 @@ config为绘制的配置项,目前可以包括如下几项: - fontSize:字体大小,如果不设置则使用剧情文本设置中的正文字体大小。 - lineHeight:绘制的行距值,如果不设置则使用fontSize*1.3(即1.3倍行距)。 - time:打字机效果。若不为0,则会逐个字进行绘制,并设置core.status.event.interval定时器。 + - interval:字符间的间距。值表示绘制每个字符之间间隔的距离,默认为0。 core.drawTextBox(content, showAll) diff --git a/_docs/event.md b/_docs/event.md index 1ec838be..cdef9c0a 100644 --- a/_docs/event.md +++ b/_docs/event.md @@ -413,6 +413,8 @@ textfont为可选项,表示正文字体大小(px为单位)。默认值:` time为可选项,表示文字添加的速度。若此项设置为0将直接全部显示,若大于0则会设置为相邻字符依次显示的时间间隔。 默认值:`0` +interval为可选项,表示文字之间的间距。单位为像素值。默认值:`0` + ### tip:显示一段提示文字 `{"type": "tip"}`可以在左上角显示一段提示文字。 diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index 5c851d22..49220756 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -523,7 +523,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+'"'; diff --git a/libs/ui.js b/libs/ui.js index 8cef6e47..a8275aa6 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -857,7 +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.interval = config.interval == null ? (textAttribute.interval || 0) : config.interval; config.index = 0; config.currcolor = config.color;