mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-11-04 23:22:57 +08:00
fix: TextContentParser 特殊情况
This commit is contained in:
parent
ee5c6a687e
commit
1ee3c44d26
@ -817,7 +817,7 @@ export class TextContentParser {
|
|||||||
return pointer;
|
return pointer;
|
||||||
}
|
}
|
||||||
const time = parseInt(param);
|
const time = parseInt(param);
|
||||||
this.addWaitRenderable(end, time);
|
this.addWaitRenderable(end + 1, time);
|
||||||
return end;
|
return end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -830,19 +830,19 @@ export class TextContentParser {
|
|||||||
}
|
}
|
||||||
if (/^\d+$/.test(param)) {
|
if (/^\d+$/.test(param)) {
|
||||||
const num = Number(param);
|
const num = Number(param);
|
||||||
this.addIconRenderable(end, num as AllNumbers);
|
this.addIconRenderable(end + 1, num as AllNumbers);
|
||||||
} else {
|
} else {
|
||||||
if (/^X\d+$/.test(param)) {
|
if (/^X\d+$/.test(param)) {
|
||||||
// 额外素材
|
// 额外素材
|
||||||
const num = Number(param.slice(1));
|
const num = Number(param.slice(1));
|
||||||
this.addIconRenderable(end, num as AllNumbers);
|
this.addIconRenderable(end + 1, num as AllNumbers);
|
||||||
} else {
|
} else {
|
||||||
const num = texture.idNumberMap[param as AllIds];
|
const num = texture.idNumberMap[param as AllIds];
|
||||||
if (num === void 0) {
|
if (num === void 0) {
|
||||||
logger.warn(59, param);
|
logger.warn(59, param);
|
||||||
return end;
|
return end;
|
||||||
}
|
}
|
||||||
this.addIconRenderable(end, num);
|
this.addIconRenderable(end + 1, num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return end;
|
return end;
|
||||||
@ -986,8 +986,10 @@ export class TextContentParser {
|
|||||||
this.resolved += char;
|
this.resolved += char;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.nodePointer < text.length) {
|
||||||
this.addTextNode(text.length, false);
|
this.addTextNode(text.length, false);
|
||||||
return this.splitLines(width);
|
}
|
||||||
|
return this.textNodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1403,28 +1405,3 @@ export function buildFont(
|
|||||||
) {
|
) {
|
||||||
return `${italic ? 'italic ' : ''}${weight} ${size}px "${family}"`;
|
return `${italic ? 'italic ' : ''}${weight} ${size}px "${family}"`;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.parser = new TextContentParser(
|
|
||||||
{
|
|
||||||
fillStyle: '#fff',
|
|
||||||
fontFamily: 'Verdana',
|
|
||||||
fontSize: 16,
|
|
||||||
fontItalic: false,
|
|
||||||
fontWeight: 400
|
|
||||||
},
|
|
||||||
{
|
|
||||||
font: new Font('Verdana', 16),
|
|
||||||
breakChars: new Set(''),
|
|
||||||
keepLast: false,
|
|
||||||
interval: 20,
|
|
||||||
lineHeight: 0,
|
|
||||||
wordBreak: WordBreak.Space,
|
|
||||||
textAlign: TextAlign.Left,
|
|
||||||
ignoreLineStart: new Set(),
|
|
||||||
ignoreLineEnd: new Set(),
|
|
||||||
fillStyle: '#fff',
|
|
||||||
strokeStyle: '#fff',
|
|
||||||
strokeWidth: 2,
|
|
||||||
width: 200
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user