51 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| /*
 | |
| 文件名:TextActor.nut
 | |
| 路径:Core/BaseClass/TextObject/TextActor.nut
 | |
| 创建日期:2024-12-01	19:51
 | |
| 文件用途:文本样式
 | |
| */
 | |
| class TextActor extends CL_BaseObject {
 | |
| 
 | |
|     /*
 | |
|      * @函数作用: 构造文本精灵
 | |
|      * @参数 font 可传入全局font Id 或 传入 font对象
 | |
|      * @参数 textstyle Map 可选对象:
 | |
|         alignment 对其方式
 | |
|         wrap_width 自动换行宽度
 | |
|         line_spacing 行间距
 | |
|         show_underline 显示下划线
 | |
|         show_strikethrough 	显示删除线
 | |
|         color 颜色
 | |
|      * @返回值
 | |
|     */
 | |
|     constructor(font, textstyle = {}) {
 | |
|         switch (typeof font) {
 | |
|             case "integer":
 | |
|                 C_Object = TextActor_Create(__Font__Map__[font].C_Object, textstyle);
 | |
|                 break;
 | |
|             case "font_data":
 | |
|                 C_Object = TextActor_Create(font.C_Object, textstyle);
 | |
|                 break;
 | |
|             default:
 | |
|                 C_Object = TextActor_Create(Font().C_Object, textstyle);
 | |
|                 break;
 | |
|         }
 | |
|         //传递字体类
 | |
|         base.constructor(C_Object);
 | |
|     }
 | |
| 
 | |
|     //设置文本内容
 | |
|     function SetText(str) {
 | |
|         TextActor_SetText(this.C_Object, str);
 | |
|     }
 | |
| 
 | |
|     //设置描边
 | |
|     function SetOutline(width, color = Color.Black, cap = CapStyle.Square, line_join = LineJoinStyle.Round, dash = DashStyle.Solid) {
 | |
|         TextActor_SetOutLine(this.C_Object, width, color, cap, line_join, dash);
 | |
|     }
 | |
| 
 | |
|     //设置填充颜色
 | |
|     function SetFillColor(Color) {
 | |
|         TextActor_SetFillColor(this.C_Object, Color);
 | |
|     }
 | |
| } |