Compare commits
	
		
			No commits in common. "89dc150b09f6876609ad8786d38247ac42873cc8" and "1ecde645ce0aa3bfcc63640bb0ae625228b0de80" have entirely different histories.
		
	
	
		
			89dc150b09
			...
			1ecde645ce
		
	
		
							
								
								
									
										
											BIN
										
									
								
								Yosin_Engine.exe
								
								
								
								
							
							
						
						
									
										
											BIN
										
									
								
								Yosin_Engine.exe
								
								
								
								
							
										
											Binary file not shown.
										
									
								
							|  | @ -103,12 +103,12 @@ class Yosin_BaseWindow extends Layer { | |||
|     } | ||||
|     //设置回调事件 | ||||
|     function SetUpdateFunc(Func) { | ||||
|         CallBackFunc = Func; | ||||
|         UpdateFunc = Func; | ||||
|     } | ||||
|     //逻辑 | ||||
|     function Proc(Dt) { | ||||
|         foreach(Window in UI_Childrens) { | ||||
|             // if (Window.CallBackFunc) Window.CallBackFunc(Window); | ||||
|             if (Window.UpdateFunc) Window.UpdateFunc(Window, Dt); | ||||
|             Window.Proc(Dt); | ||||
|         } | ||||
|         //显示才调用Update | ||||
|  | @ -125,6 +125,16 @@ class Yosin_BaseWindow extends Layer { | |||
|         Visible = Flag; | ||||
|         base.SetVisible(Flag); | ||||
|     } | ||||
| 
 | ||||
|     /* | ||||
|      * @函数作用: 添加子对象 | ||||
|      * @参数 name | ||||
|      */ | ||||
|     function AddUIChild(gChild) { | ||||
|         this.UI_Childrens.append(gChild); | ||||
|         Addchild(gChild); | ||||
|         // gChild.Parent = this; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | @ -224,16 +234,6 @@ class Yosin_Window extends Yosin_BaseWindow { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /* | ||||
|      * @函数作用: 添加子对象 | ||||
|      * @参数 name | ||||
|      */ | ||||
|     function AddUIChild(gChild) { | ||||
|         this.UI_Childrens.append(gChild); | ||||
|         Addchild(gChild); | ||||
|         // gChild.Parent = this; | ||||
|     } | ||||
| 
 | ||||
|     //关闭窗口 -并没有销毁只是隐藏 | ||||
|     function CloseWindow() { | ||||
|         this.Visible = false; | ||||
|  |  | |||
|  | @ -41,6 +41,7 @@ class Yosin_CommonUi extends Yosin_BaseWindow { | |||
|         local Pos = GetWorldPosition(); | ||||
|         if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Pos.x, Pos.y, Width, Height)) isInRect = true; | ||||
|         else isInRect = false; | ||||
|         base.OnMouseProc(MousePos_X, MousePos_Y); | ||||
|     } | ||||
|     //鼠标左键按下回调 | ||||
|     function OnMouseLbDown(MousePos_X, MousePos_Y) { | ||||
|  | @ -52,10 +53,12 @@ class Yosin_CommonUi extends Yosin_BaseWindow { | |||
|                 Sq_PlaySoundEffect(OnClickSound); | ||||
|             } | ||||
|         } | ||||
|         base.OnMouseLbDown(MousePos_X, MousePos_Y); | ||||
|     } | ||||
|     //鼠标左键弹起回调 | ||||
|     function OnMouseLbUp(MousePos_X, MousePos_Y) { | ||||
|         isLBDown = false; | ||||
|         base.OnMouseLbUp(MousePos_X, MousePos_Y); | ||||
|     } | ||||
| 
 | ||||
|     //鼠标左键单击回调 | ||||
|  | @ -64,6 +67,7 @@ class Yosin_CommonUi extends Yosin_BaseWindow { | |||
|         if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Pos.x, Pos.y, Width, Height)) { | ||||
|             if (OnClick) OnClick(this); | ||||
|         } | ||||
|         base.OnMouseLbClick(MousePos_X, MousePos_Y); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | @ -72,7 +76,6 @@ class Yosin_CommonUi extends Yosin_BaseWindow { | |||
| class Yosin_BaseButton extends Yosin_CommonUi { | ||||
|     //按钮状态 | ||||
|     State = 0; | ||||
|     DWidth = null; | ||||
|     Path = null; | ||||
|     Idx = null; | ||||
| 
 | ||||
|  | @ -82,7 +85,6 @@ class Yosin_BaseButton extends Yosin_CommonUi { | |||
| 
 | ||||
| 
 | ||||
|     constructor(X, Y, W, H, Path, Idx) { | ||||
|         this.DWidth = W; | ||||
|         this.Path = Path; | ||||
|         this.Idx = Idx; | ||||
|         base.constructor(X, Y, W, H); | ||||
|  | @ -136,3 +138,45 @@ class Yosin_BaseButton extends Yosin_CommonUi { | |||
|         ChangeFrame(); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| //三分法拉伸 | ||||
| class Yosin_EmeStretch extends Yosin_CommonUi { | ||||
| 
 | ||||
|     Path = null; | ||||
|     Idx = null; | ||||
|     //按钮状态 | ||||
|     SpriteList = null; | ||||
| 
 | ||||
|     constructor(X, Y, W, H, Path, Idx, Direction = true) { | ||||
|         this.Path = Path; | ||||
|         this.Idx = Idx; | ||||
|         base.constructor(X, Y, W, H); | ||||
| 
 | ||||
|         SpriteList = []; | ||||
|         SpriteList.push(CL_SpriteObject(Path, Idx)); | ||||
|         SpriteList.push(CL_SpriteObject(Path, Idx + 1)); | ||||
|         SpriteList.push(CL_SpriteObject(Path, Idx + 2)); | ||||
| 
 | ||||
|         //横向 | ||||
|         if (Direction) { | ||||
|             local ScaleW = (W - SpriteList[0].GetSize().w - SpriteList[2].GetSize().w); | ||||
|             local ScaleRate = ScaleW / SpriteList[1].GetSize().w; | ||||
|             SpriteList[1].SetPosition(SpriteList[0].GetSize().w, 0); | ||||
|             SpriteList[1].SetScale(ScaleRate, 1.0); | ||||
|             SpriteList[2].SetPosition(SpriteList[0].GetSize().w + ScaleW, 0); | ||||
|         } | ||||
|         //纵向 | ||||
|         else { | ||||
|             local ScaleH = (H - SpriteList[0].GetSize().h - SpriteList[2].GetSize().h); | ||||
|             local ScaleRate = ScaleH / SpriteList[1].GetSize().h; | ||||
|             SpriteList[1].SetPosition(0, SpriteList[0].GetSize().h); | ||||
|             SpriteList[1].SetScale(1.0, ScaleRate); | ||||
|             SpriteList[2].SetPosition(0, SpriteList[0].GetSize().h + ScaleH); | ||||
|         } | ||||
| 
 | ||||
|         foreach(Child in SpriteList) { | ||||
|             Addchild(Child); | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| } | ||||
|  | @ -61,6 +61,8 @@ sqr/User/Stage/LodingStage.nut | |||
| sqr/User/Stage/TestStage.nut | ||||
| 
 | ||||
| sqr/User/UI/Widget/InputBox.nut | ||||
| sqr/User/UI/Widget/Drag_Button.nut | ||||
| sqr/User/UI/Widget/Scroll_Bar.nut | ||||
| 
 | ||||
| sqr/User/UI/Window/0_Login.nut | ||||
| sqr/User/UI/Window/1_Select_Character.nut | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ function TestStage() { | |||
| 
 | ||||
|     local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1066, 600, 0); | ||||
|     local T = { | ||||
|         Background = 1 | ||||
|         Background = 0 | ||||
|     } | ||||
|     Window.Init(T); | ||||
| 
 | ||||
|  |  | |||
|  | @ -0,0 +1,33 @@ | |||
| /* | ||||
| 文件名:Drag_Button.nut | ||||
| 路径:User/UI/Widget/Drag_Button.nut | ||||
| 创建日期:2024-12-14	09:40 | ||||
| 文件用途:拖动按钮 | ||||
| */ | ||||
| class Yosin_DragButton extends Yosin_CommonUi { | ||||
| 
 | ||||
|     //按钮状态 | ||||
|     State = 0; | ||||
|     Path = null; | ||||
|     Idx = null; | ||||
| 
 | ||||
|     Sprite = null; | ||||
|     SpriteState = -1; | ||||
|     FrameList = null; | ||||
| 
 | ||||
|     constructor(X, Y, W, H, Path, Idx) { | ||||
|         this.Path = Path; | ||||
|         this.Idx = Idx; | ||||
|         base.constructor(X, Y, W, H); | ||||
| 
 | ||||
|         FrameList = []; | ||||
|         Sprite = CL_SpriteObject(); | ||||
|         // Sprite.ShowBorder(true); | ||||
|         Addchild(Sprite); | ||||
| 
 | ||||
|         for (local i = 0; i< 4; i++) { | ||||
|             local Sf = CL_SpriteFrameObject(this.Path, this.Idx + i); | ||||
|             FrameList.push(Sf); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,55 @@ | |||
| /* | ||||
| 文件名:Scroll_Bar.nut | ||||
| 路径:User/UI/Widget/Scroll_Bar.nut | ||||
| 创建日期:2024-12-13	23:17 | ||||
| 文件用途: | ||||
| */ | ||||
| //基础按钮 | ||||
| class Yosin_ScrollBar extends Yosin_CommonUi { | ||||
|     //控制器 | ||||
|     Controller = null; | ||||
| 
 | ||||
|     //是否焦点 | ||||
|     IsFocus = false; | ||||
| 
 | ||||
|     //上按钮 | ||||
|     UpButton = null; | ||||
|     //下按钮 | ||||
|     DownButton = null; | ||||
| 
 | ||||
|     //Path | ||||
|     Path = "sprite/interface/lenheartwindowcommon.img"; | ||||
| 
 | ||||
|     constructor(X, Y, H, gSize) { | ||||
|         base.constructor(X, Y, 9, H > 26 ? H : 26); | ||||
| 
 | ||||
|         Controller = { | ||||
|             CurPos = 0, | ||||
|             Size = gSize | ||||
|         } | ||||
| 
 | ||||
|         //上按钮 | ||||
|         UpButton = Yosin_BaseButton(0, 0, 9, 13, Path, 16); | ||||
|         //点击事件回调 | ||||
|         UpButton.OnClick = function(Button) { | ||||
| 
 | ||||
|         }.bindenv(this); | ||||
|         AddUIChild(UpButton); | ||||
| 
 | ||||
|         //滚动条 | ||||
| 
 | ||||
|         //下按钮 | ||||
|         DownButton = Yosin_BaseButton(0, Height - 13, 9, 13, Path, 22); | ||||
|         //点击事件回调 | ||||
|         DownButton.OnClick = function(Button) { | ||||
| 
 | ||||
|         }.bindenv(this); | ||||
|         AddUIChild(DownButton); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     function Proc(Dt) { | ||||
|         base.Proc(Dt); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | @ -82,11 +82,14 @@ class _Select_Character_SettingBackground_Window extends Yosin_Window { | |||
|     //选择背景按钮集合 | ||||
|     SettingBackgroundButtonList = null; | ||||
| 
 | ||||
|     Background = null; | ||||
| 
 | ||||
|     constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { | ||||
|         base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); | ||||
|         SettingBackgroundButtonList = []; | ||||
| 
 | ||||
|         SetClipRect(-gWidth, 0, gWidth, gHeight + 20); | ||||
|         // SetClipRect(-gWidth, 0, gWidth, gHeight + 20); | ||||
|         // SetClipRect(0, 0, 1066, 600); | ||||
|         // ShowBorder(true); | ||||
|         // SetLayerOpacity(1); | ||||
|     } | ||||
|  | @ -98,7 +101,7 @@ class _Select_Character_SettingBackground_Window extends Yosin_Window { | |||
| 
 | ||||
|     function RegisterDraw() { | ||||
|         //背景 | ||||
|         local Background = CL_SpriteObject("sprite/interface2/selectcharacter_ver2/setup/setup.img", 17); | ||||
|         Background = CL_SpriteObject("sprite/interface2/selectcharacter_ver2/setup/setup.img", 17); | ||||
|         Addchild(Background); | ||||
| 
 | ||||
|         for (local i = 0; i< 24; i++) { | ||||
|  | @ -199,6 +202,14 @@ class _Select_Character_Window extends Yosin_Window { | |||
|             } | ||||
|         }) | ||||
|         SettingButton.Addchild(LoginTextActor); | ||||
| 
 | ||||
| 
 | ||||
|         // local TestButton = Yosin_ScrollBar(300, 200, 50, 100); | ||||
|         // AddUIChild(TestButton); | ||||
|         local TestButton = Yosin_SplicingButton(200, 200, 77, 68 "sprite/interface/lenheartwindowcommon.img", 184, false); | ||||
|         // local TestButton = Yosin_EmeStretch(200, 200, 77, 68 "sprite/interface/lenheartwindowcommon.img", 184, false); | ||||
|         TestButton.SetScale(5.0, 5.0); | ||||
|         AddUIChild(TestButton); | ||||
|     } | ||||
| 
 | ||||
|     //切换背景 | ||||
|  | @ -209,6 +220,16 @@ class _Select_Character_Window extends Yosin_Window { | |||
|         } | ||||
|         BackGround = CL_SpriteObject("sprite/interface2/selectcharacter_ver2/background/large/background_large_event.img", Idx); | ||||
|         BackGround.SetZOrder(-10); | ||||
| 
 | ||||
|         /* | ||||
| 
 | ||||
|                 BackGround = Layer(); | ||||
|         BackGround.Addchild(CL_SpriteObject("sprite/interface2/selectcharacter_ver2/background/large/background_large_event.img", Idx)); | ||||
|         BackGround.SetZOrder(-10); | ||||
|         BackGround.SetPosition(100, 100); | ||||
|         BackGround.SetClipRect(0, 0, 200, 200); | ||||
| 
 | ||||
|         */ | ||||
|         Addchild(BackGround); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -160,5 +160,14 @@ | |||
|     }, | ||||
|     "Core/BaseClass/LayerObject.nut": { | ||||
|         "description": "图层类" | ||||
|     }, | ||||
|     "User/UI/Widget/Scroll_Bar.nut": { | ||||
|         "description": "滚动条" | ||||
|     }, | ||||
|     "User/UI/Widget/InputBox.nut": { | ||||
|         "description": "输入框" | ||||
|     }, | ||||
|     "User/UI/Widget/Drag_Button.nut": { | ||||
|         "description": "拖动按钮" | ||||
|     } | ||||
| } | ||||
		Loading…
	
		Reference in New Issue