45 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| /*
 | |
| 文件名:Top_Title.nut
 | |
| 路径:User/UI/Widget/Top_Title.nut
 | |
| 创建日期:2025-01-06	14:00
 | |
| 文件用途: 窗口顶部标题
 | |
| */
 | |
| 
 | |
| // 窗口顶部标题
 | |
| class Yosin_TopTitle extends Yosin_CommonUi {
 | |
| 
 | |
|     constructor(W, H, title, drawBackground = true) {
 | |
|         base.constructor(0, 0, W, H);
 | |
| 
 | |
|         //内容背景
 | |
|         if (drawBackground) {
 | |
|             local background = Yosin_NineBoxStretch(0, 15, W + 4, H - 15, "sprite/interface/lenheartwindowcommon.img", 97);
 | |
|             Addchild(background);
 | |
|         }
 | |
| 
 | |
|         // 标题背景
 | |
|         local Background = Yosin_EmeStretch(0, 0, W + 3, 22, "sprite/interface/lenheartwindowcommon.img", 609);
 | |
|         Addchild(Background);
 | |
| 
 | |
|         // 标题亮色背景
 | |
|         local BackgroundBright = CL_SpriteObject("sprite/interface/lenheartwindowcommon.img", 483);
 | |
|         local scaleW = (Background.GetSize().w / BackgroundBright.GetSize().w).tofloat();
 | |
|         BackgroundBright.SetScale(scaleW, 1);
 | |
|         BackgroundBright.SetPosition(0, 1);
 | |
|         Addchild(BackgroundBright);
 | |
| 
 | |
| 
 | |
|         // 标题
 | |
|         local titleTextActor = FontAssetManager.GenerateNormal(title, true, {
 | |
|             color = sq_RGBA(206, 189, 140, 255)
 | |
|         });
 | |
|         local titleX = W / 2 - titleTextActor.GetSize().w / 2;
 | |
|         // 绘制标题
 | |
|         titleTextActor.SetPosition(titleX, 2);
 | |
|         Addchild(titleTextActor);
 | |
| 
 | |
|     }
 | |
| 
 | |
| 
 | |
| 
 | |
| } |