@cc-component/cc-ex-component 1.8.9 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/ex/ExCommon.ts +13 -1
- package/package.json +1 -1
package/assets/ex/ExCommon.ts
CHANGED
|
@@ -19,8 +19,12 @@ declare global {
|
|
|
19
19
|
toNumber(): number;
|
|
20
20
|
/**添加颜色-富文本 */
|
|
21
21
|
addColor(colorHex: string): string
|
|
22
|
-
|
|
22
|
+
/**添加大小 -富文本*/
|
|
23
23
|
addSize(font: number): string
|
|
24
|
+
/**添加描边 -富文本*/
|
|
25
|
+
addOutline(colorHex: string, font: number): string
|
|
26
|
+
/**添加粗体 -富文本*/
|
|
27
|
+
addBold(): string
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
interface Any {
|
|
@@ -781,6 +785,14 @@ String.prototype.addColor = function (colorHex: string): string {
|
|
|
781
785
|
String.prototype.addSize = function (font: number): string {
|
|
782
786
|
return `<size=${font}>${this}</size>`
|
|
783
787
|
};
|
|
788
|
+
// 实现字符串扩展方法
|
|
789
|
+
String.prototype.addOutline = function (colorHex: string, font: number): string {
|
|
790
|
+
return `<outline color=${colorHex} width=${font}>${this}</outline>`
|
|
791
|
+
};
|
|
792
|
+
// 实现字符串扩展方法
|
|
793
|
+
String.prototype.addBold = function (): string {
|
|
794
|
+
return `<b>${this}</b>`
|
|
795
|
+
};
|
|
784
796
|
Label.prototype.fromHEX = function (this: Label, hex: string): void {
|
|
785
797
|
const label = this;
|
|
786
798
|
label.color = (new Color()).fromHEX(hex)
|