完善d.ts & kill bug
This commit is contained in:
parent
e5b04eadd5
commit
b031d46048
@ -3388,11 +3388,10 @@ control.prototype._resize_canvas = function (obj) {
|
|||||||
// resize dynamic canvas
|
// resize dynamic canvas
|
||||||
for (var name in core.dymCanvas) {
|
for (var name in core.dymCanvas) {
|
||||||
var ctx = core.dymCanvas[name], canvas = ctx.canvas;
|
var ctx = core.dymCanvas[name], canvas = ctx.canvas;
|
||||||
var ratio = canvas.hasAttribute('isHD') ? core.domStyle.ratio : 1;
|
|
||||||
canvas.style.width = canvas.width / ratio * core.domStyle.scale + "px";
|
|
||||||
canvas.style.height = canvas.height / ratio * core.domStyle.scale + "px";
|
|
||||||
canvas.style.left = parseFloat(canvas.getAttribute("_left")) * core.domStyle.scale + "px";
|
canvas.style.left = parseFloat(canvas.getAttribute("_left")) * core.domStyle.scale + "px";
|
||||||
canvas.style.top = parseFloat(canvas.getAttribute("_top")) * core.domStyle.scale + "px";
|
canvas.style.top = parseFloat(canvas.getAttribute("_top")) * core.domStyle.scale + "px";
|
||||||
|
var scale = canvas.getAttribute('_scale');
|
||||||
|
core.resizeCanvas(canvas, canvas.width * scale * core.domStyle.scale, canvas.height * scale * core.domStyle.scale);
|
||||||
}
|
}
|
||||||
// resize next
|
// resize next
|
||||||
main.dom.next.style.width = main.dom.next.style.height = 5 * core.domStyle.scale + "px";
|
main.dom.next.style.width = main.dom.next.style.height = 5 * core.domStyle.scale + "px";
|
||||||
|
|||||||
@ -1097,7 +1097,7 @@ ui.prototype.drawTextContent = function (ctx, content, config) {
|
|||||||
config.top = config.top || 0;
|
config.top = config.top || 0;
|
||||||
config.color = core.arrayToRGBA(config.color || textAttribute.text);
|
config.color = core.arrayToRGBA(config.color || textAttribute.text);
|
||||||
if (config.bold == null) config.bold = textAttribute.bold;
|
if (config.bold == null) config.bold = textAttribute.bold;
|
||||||
config.italic = false;
|
config.italic = config.italic || false;
|
||||||
config.align = config.align || textAttribute.align || "left";
|
config.align = config.align || textAttribute.align || "left";
|
||||||
config.fontSize = config.fontSize || textAttribute.textfont;
|
config.fontSize = config.fontSize || textAttribute.textfont;
|
||||||
config.lineHeight = config.lineHeight || (config.fontSize * 1.3);
|
config.lineHeight = config.lineHeight || (config.fontSize * 1.3);
|
||||||
@ -1166,6 +1166,7 @@ ui.prototype._drawTextContent_draw = function (ctx, tempCtx, content, config) {
|
|||||||
while (_drawNext());
|
while (_drawNext());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
clearInterval(core.status.event.interval);
|
||||||
core.status.event.interval = setInterval(function () {
|
core.status.event.interval = setInterval(function () {
|
||||||
if (!_drawNext()) {
|
if (!_drawNext()) {
|
||||||
clearInterval(core.status.event.interval);
|
clearInterval(core.status.event.interval);
|
||||||
|
|||||||
4
main.js
4
main.js
@ -2,7 +2,7 @@ function main () {
|
|||||||
|
|
||||||
//------------------------ 用户修改内容 ------------------------//
|
//------------------------ 用户修改内容 ------------------------//
|
||||||
|
|
||||||
this.version = "2.8.2"; // 游戏版本号;如果更改了游戏内容建议修改此version以免造成缓存问题。
|
this.version = "2.9"; // 游戏版本号;如果更改了游戏内容建议修改此version以免造成缓存问题。
|
||||||
|
|
||||||
this.useCompress = false; // 是否使用压缩文件
|
this.useCompress = false; // 是否使用压缩文件
|
||||||
// 当你即将发布你的塔时,请使用“JS代码压缩工具”将所有js代码进行压缩,然后将这里的useCompress改为true。
|
// 当你即将发布你的塔时,请使用“JS代码压缩工具”将所有js代码进行压缩,然后将这里的useCompress改为true。
|
||||||
@ -188,7 +188,7 @@ function main () {
|
|||||||
this.floors = {}
|
this.floors = {}
|
||||||
this.canvas = {};
|
this.canvas = {};
|
||||||
|
|
||||||
this.__VERSION__ = "2.8.2";
|
this.__VERSION__ = "2.9";
|
||||||
this.__VERSION_CODE__ = 507;
|
this.__VERSION_CODE__ = 507;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
31
runtime.d.ts
vendored
31
runtime.d.ts
vendored
@ -2338,13 +2338,26 @@ declare class ui {
|
|||||||
/**
|
/**
|
||||||
* 绘制一段文字到某个画布上面
|
* 绘制一段文字到某个画布上面
|
||||||
* @param ctx 要绘制到的画布
|
* @param ctx 要绘制到的画布
|
||||||
* @param content 要绘制的内容;转义字符不允许保留 \t, \b 和 \f
|
* @param content 要绘制的内容;转义字符只允许保留 \n, \r[...], \i[...], \c[...], \d, \e
|
||||||
* @param config 绘制配置项,目前暂时包含如下内容(均为可选)
|
* @param config 绘制配置项,目前暂时包含如下内容(均为可选)
|
||||||
* left, top:起始点位置;maxWidth:单行最大宽度;color:默认颜色;align:左中右
|
* left, top:起始点位置;maxWidth:单行最大宽度;color:默认颜色;align:左中右
|
||||||
* fontSize:字体大小;lineHeight:行高;time:打字机间隔;font:默认字体名
|
* fontSize:字体大小;lineHeight:行高;time:打字机间隔;font:默认字体名
|
||||||
* @returns 绘制信息
|
* @returns 绘制信息
|
||||||
*/
|
*/
|
||||||
drawTextContent(ctx: string | CanvasRenderingContext2D, content: string, config: any): any
|
drawTextContent(ctx: string | CanvasRenderingContext2D, content: string, config: {
|
||||||
|
left?: number
|
||||||
|
top?: number
|
||||||
|
maxWidth?: number
|
||||||
|
color?: number
|
||||||
|
align?: 'left' | 'center' | 'right'
|
||||||
|
fontSize: number
|
||||||
|
lineHeight?: number
|
||||||
|
time?: number
|
||||||
|
font?: string
|
||||||
|
letterSpacing?: number
|
||||||
|
bold?: boolean
|
||||||
|
italic?: boolean
|
||||||
|
}): any
|
||||||
|
|
||||||
/** 获得某段文字的预计绘制高度;参见 drawTextContent */
|
/** 获得某段文字的预计绘制高度;参见 drawTextContent */
|
||||||
getTextContentHeight(content: string, config?: any): void
|
getTextContentHeight(content: string, config?: any): void
|
||||||
@ -2927,8 +2940,20 @@ type core = {
|
|||||||
declare class main {
|
declare class main {
|
||||||
readonly core: core
|
readonly core: core
|
||||||
readonly dom = core.dom
|
readonly dom = core.dom
|
||||||
|
/** 游戏版本,发布后会被随机,请勿使用该属性 */
|
||||||
|
readonly version: string
|
||||||
|
readonly useCompress: boolean
|
||||||
|
readonly savePages: number
|
||||||
|
readonly mode: 'play' | 'editor'
|
||||||
|
readonly statusBar: {
|
||||||
|
images: { [x: string]: HTMLElement }
|
||||||
|
icons: { [x: string]: number | null | undefined }
|
||||||
|
[x: string]: HTMLElement | object
|
||||||
|
}
|
||||||
|
readonly __VERSION__: string
|
||||||
|
readonly __VERSION_CODE__: number
|
||||||
|
|
||||||
/** 输出内容(极不好用,建议换成console)*/
|
/** 输出内容(极不好用,建议换成console,我甚至不知道样板为什么会有这个东西)*/
|
||||||
log(e: string | Error, error: boolean): void
|
log(e: string | Error, error: boolean): void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user