修改文字的渲染逻辑
This commit is contained in:
parent
8812074f05
commit
5c84877220
|
|
@ -9,41 +9,6 @@ class TextActor extends CL_BaseObject {
|
||||||
//不需要Update函数
|
//不需要Update函数
|
||||||
NoUpdate = true;
|
NoUpdate = true;
|
||||||
|
|
||||||
OutlineChild = null;
|
|
||||||
Strokeoffsets = [{
|
|
||||||
x = 1,
|
|
||||||
y = 0
|
|
||||||
}, // 右
|
|
||||||
{
|
|
||||||
x = 1,
|
|
||||||
y = 1
|
|
||||||
}, // 右上
|
|
||||||
{
|
|
||||||
x = 0,
|
|
||||||
y = 1
|
|
||||||
}, // 上
|
|
||||||
{
|
|
||||||
x = -1,
|
|
||||||
y = 1
|
|
||||||
}, // 左上
|
|
||||||
{
|
|
||||||
x = -1,
|
|
||||||
y = 0
|
|
||||||
}, // 左
|
|
||||||
{
|
|
||||||
x = -1,
|
|
||||||
y = -1
|
|
||||||
}, // 左下
|
|
||||||
{
|
|
||||||
x = 0,
|
|
||||||
y = -1
|
|
||||||
}, // 下
|
|
||||||
{
|
|
||||||
x = 1,
|
|
||||||
y = -1
|
|
||||||
} // 右下
|
|
||||||
];
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @函数作用: 构造文本精灵
|
* @函数作用: 构造文本精灵
|
||||||
* @参数 font 可传入全局font Id 或 传入 font对象
|
* @参数 font 可传入全局font Id 或 传入 font对象
|
||||||
|
|
@ -75,16 +40,11 @@ class TextActor extends CL_BaseObject {
|
||||||
//设置文本内容
|
//设置文本内容
|
||||||
function SetText(str) {
|
function SetText(str) {
|
||||||
TextActor_SetText(this.C_Object, str);
|
TextActor_SetText(this.C_Object, str);
|
||||||
if (OutlineChild) {
|
|
||||||
foreach(obj in OutlineChild) {
|
|
||||||
obj.SetText(str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置描边
|
//设置描边
|
||||||
function SetOutline(width, color = Color.Black, cap = CapStyle.Square, line_join = LineJoinStyle.Round, dash = DashStyle.Solid) {
|
function SetOutline(color = Color.Black, flag = true) {
|
||||||
TextActor_SetOutLine(this.C_Object, width, color, cap, line_join, dash);
|
TextActor_SetOutLine(this.C_Object, color, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
// //设置描边
|
// //设置描边
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ class _FontAssetManager_ {
|
||||||
//初始化字体
|
//初始化字体
|
||||||
function InitFont() {
|
function InitFont() {
|
||||||
//普通宋体小字
|
//普通宋体小字
|
||||||
Font.PreLoad("Fonts/GasinamuNew.ttf");
|
Font.PreLoad("Fonts/Gasinamu.ttf");
|
||||||
Font("gasinamuM", 11.5).Register(0);
|
Font("gasinamu", 11.5).Register(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
@ -28,7 +28,7 @@ class _FontAssetManager_ {
|
||||||
local TextActor = TextActor(0, style);
|
local TextActor = TextActor(0, style);
|
||||||
TextActor.SetText(text);
|
TextActor.SetText(text);
|
||||||
if (stroke)
|
if (stroke)
|
||||||
TextActor.SetOutline(3.0);
|
TextActor.SetOutline();
|
||||||
return TextActor;
|
return TextActor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue