| 
									
										
										
										
											2024-12-11 15:08:57 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 文件名:0_Login.nut | 
					
						
							|  |  |  | 路径:User/UI/0_Login.nut | 
					
						
							|  |  |  | 创建日期:2024-12-01	15:13 | 
					
						
							|  |  |  | 文件用途:登录界面窗口 | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | class _Login_Window extends Yosin_Window { | 
					
						
							|  |  |  |     //调试模式 | 
					
						
							|  |  |  |     // DeBugMode = true; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //不是窗口 | 
					
						
							|  |  |  |     // NoWindow = true; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     //是否可见 | 
					
						
							|  |  |  |     // Visible = false; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     AccountInputBox = null; | 
					
						
							|  |  |  |     PasswordInputBox = null; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     BackGroundMusic = null; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { | 
					
						
							|  |  |  |         base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //注册绘制 | 
					
						
							|  |  |  |         RegisterDraw(); | 
					
						
							|  |  |  |         //注册控件 | 
					
						
							|  |  |  |         RegisterWidget(); | 
					
						
							|  |  |  |         // OpenDeBug(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //播放音乐 | 
					
						
							|  |  |  |         PlayBackgroundMusic(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function PlayBackgroundMusic() { | 
					
						
							|  |  |  |         // BackGroundMusic = Sound("SoundPacks/Loop.ogg"); | 
					
						
							|  |  |  |         // BackGroundMusic.Play(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function MusicLogic() { | 
					
						
							|  |  |  |         if (BackGroundMusic == null) return; | 
					
						
							|  |  |  |         if (!BackGroundMusic.IsPlaying()) BackGroundMusic.Play(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function RegisterWidget() { | 
					
						
							|  |  |  |         //账号输入框 | 
					
						
							|  |  |  |         local AccountInputBox = Yosin_InputBox(752, 240, 200); | 
					
						
							|  |  |  |         AddUIChild(AccountInputBox); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //密码输入框 | 
					
						
							|  |  |  |         local PasswordInputBox = Yosin_InputBox(752, 280, 200); | 
					
						
							|  |  |  |         AddUIChild(PasswordInputBox); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //登录按钮 | 
					
						
							|  |  |  |         local LoginButton = Yosin_BaseButton(770, 410, 77, 24 "sprite/interface/lenheartwindowcommon.img", 90); | 
					
						
							|  |  |  |         //点击事件回调 | 
					
						
							|  |  |  |         LoginButton.OnClick = function(Button) { | 
					
						
							|  |  |  |             MySocket.Send(1, { | 
					
						
							|  |  |  |                 account = AccountInputBox.str, | 
					
						
							|  |  |  |                 password = PasswordInputBox.str | 
					
						
							|  |  |  |             }) | 
					
						
							|  |  |  |         }.bindenv(this); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //登录按钮文本 | 
					
						
							| 
									
										
										
										
											2024-12-14 23:15:53 +08:00
										 |  |  |         local LoginTextActor = FontAssetManager.GenerateNormal("登录", true, { | 
					
						
							|  |  |  |             color = sq_RGBA(200, 195, 169, 255) | 
					
						
							|  |  |  |         }); | 
					
						
							| 
									
										
										
										
											2024-12-11 15:08:57 +08:00
										 |  |  |         LoginTextActor.SetPosition(26, 4); | 
					
						
							|  |  |  |         LoginButton.Addchild(LoginTextActor); | 
					
						
							|  |  |  |         AddUIChild(LoginButton); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //注册按钮 | 
					
						
							|  |  |  |         local RegisterButton = Yosin_BaseButton(865, 410, 77, 24 "sprite/interface/lenheartwindowcommon.img", 90); | 
					
						
							|  |  |  |         //点击事件回调 | 
					
						
							|  |  |  |         RegisterButton.OnClick = function(Button) { | 
					
						
							|  |  |  |             MySocket.Send(3, { | 
					
						
							|  |  |  |                 account = AccountInputBox.str, | 
					
						
							|  |  |  |                 password = PasswordInputBox.str | 
					
						
							|  |  |  |             }) | 
					
						
							|  |  |  |         }.bindenv(this); | 
					
						
							|  |  |  |         //注册按钮文本 | 
					
						
							| 
									
										
										
										
											2024-12-14 23:15:53 +08:00
										 |  |  |         local RegisterTextActor = FontAssetManager.GenerateNormal("注册", true, { | 
					
						
							|  |  |  |             color = sq_RGBA(200, 195, 169, 255) | 
					
						
							|  |  |  |         }); | 
					
						
							| 
									
										
										
										
											2024-12-11 15:08:57 +08:00
										 |  |  |         RegisterTextActor.SetPosition(26, 4); | 
					
						
							|  |  |  |         RegisterButton.Addchild(RegisterTextActor); | 
					
						
							|  |  |  |         AddUIChild(RegisterButton); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function RegisterDraw() { | 
					
						
							|  |  |  |         //大背景 | 
					
						
							|  |  |  |         local BackGround = CL_SpriteObject("sprite/interface2/charactercreatever2/characterbackground.img", 14); | 
					
						
							|  |  |  |         Addchild(BackGround); | 
					
						
							|  |  |  |         //左上角的背景 | 
					
						
							|  |  |  |         local Cover = CL_SpriteObject("sprite/interface2/channel/channelselect/channelbackground/channelbackground.img", 20); | 
					
						
							|  |  |  |         Addchild(Cover); | 
					
						
							|  |  |  |         //登录框的背景 | 
					
						
							|  |  |  |         local LoginBoxBg = CL_SpriteObject("sprite/login_ui.img", 3); | 
					
						
							|  |  |  |         LoginBoxBg.SetPosition(634, 0); | 
					
						
							|  |  |  |         Addchild(LoginBoxBg); | 
					
						
							|  |  |  |         local AniObj = Animation("ui/selectcharacter/animation/selectcharactereffect.ani"); | 
					
						
							|  |  |  |         AniObj.SetPosition(770, 0); | 
					
						
							|  |  |  |         Addchild(AniObj); | 
					
						
							|  |  |  |         //登录游戏字体 | 
					
						
							|  |  |  |         local LoginText = CL_SpriteObject("sprite/login_ui.img", 0); | 
					
						
							|  |  |  |         LoginText.SetPosition(796, 65); | 
					
						
							|  |  |  |         Addchild(LoginText); | 
					
						
							|  |  |  |         //登录游戏说明 | 
					
						
							|  |  |  |         local LoginTexttip = CL_SpriteObject("sprite/login_ui.img", 1); | 
					
						
							|  |  |  |         LoginTexttip.SetPosition(-33, 40); | 
					
						
							|  |  |  |         LoginText.Addchild(LoginTexttip); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //账号 | 
					
						
							| 
									
										
										
										
											2024-12-14 23:15:53 +08:00
										 |  |  |         local AccountTextActor = FontAssetManager.GenerateNormal("账号:", false, { | 
					
						
							|  |  |  |             color = sq_RGBA(200, 195, 169, 255) | 
					
						
							|  |  |  |         }); | 
					
						
							| 
									
										
										
										
											2024-12-11 15:08:57 +08:00
										 |  |  |         AccountTextActor.SetPosition(720, 241); | 
					
						
							|  |  |  |         Addchild(AccountTextActor); | 
					
						
							|  |  |  |         //密码 | 
					
						
							| 
									
										
										
										
											2024-12-14 23:15:53 +08:00
										 |  |  |         local PasswordTextActor = FontAssetManager.GenerateNormal("密码:", false, { | 
					
						
							|  |  |  |             color = sq_RGBA(200, 195, 169, 255) | 
					
						
							|  |  |  |         }); | 
					
						
							| 
									
										
										
										
											2024-12-11 15:08:57 +08:00
										 |  |  |         PasswordTextActor.SetPosition(720, 281); | 
					
						
							|  |  |  |         Addchild(PasswordTextActor); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-13 20:51:26 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-11 15:08:57 +08:00
										 |  |  |     //逻辑入口 | 
					
						
							|  |  |  |     function Proc(Dt) { | 
					
						
							|  |  |  |         MusicLogic(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         SyncPos(X, Y); | 
					
						
							|  |  |  |         base.Proc(Dt); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |