소스 검색

增加登录功能

大爷 2 년 전
부모
커밋
8f4a79be61

+ 0 - 14
Unity/Assets/Scripts/Codes/HotfixView/Client/FGUI/FUIManager.cs

@@ -1,14 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-namespace ET
-{
-    public class FUIManager
-    {
-        public static void Init()
-        {
-
-        }
-    }
-}

+ 18 - 4
Unity/Assets/Scripts/Codes/HotfixView/Client/UI/UILogin/AppStartInitFinish_CreateLoginUI.cs

@@ -1,7 +1,6 @@
 using UnityEngine;
 using FairyGUI;
 using Cysharp.Threading.Tasks;
-
 namespace ET.Client
 {
 	[Event(SceneType.Client)]
@@ -9,14 +8,15 @@ namespace ET.Client
 	{
 		protected override async ETTask Run(Scene scene, EventType.AppStartInitFinish args)
 		{
+            Log.Debug("to load login ui.");
             var ass = await YooAssetProxy.LoadAssetAsync<TextAsset>("FGUI_Login_fui");
             UIPackage.AddPackage(ass.GetAssetObject<TextAsset>().bytes, "Login", LoadPackageInternalAsync);
             var view = UIPackage.CreateObject("Login", "Login").asCom;
-            var preView = GRoot.inst.GetChildAt(0);
-            GRoot.inst.RemoveChildren();
             GRoot.inst.AddChild(view);
+            InitLogin(scene, view);
 
-            preView.Dispose();
+            var preView = GRoot.inst.GetChildAt(0);
+            GRoot.inst.RemoveChild(preView, true);
             UIPackage.RemovePackage("CheckForResUpdate");
         }
 
@@ -33,5 +33,19 @@ namespace ET.Client
             var tex = await YooAssetProxy.LoadAssetAsync<Texture>($"FGUI_{name}");
             item.owner.SetItemAsset(item, tex.GetAsset<Texture>(), DestroyMethod.Unload);
         }
+
+
+        private void InitLogin(Scene scene, GComponent view)
+        {
+            var account = view.GetChild("input_name");
+            var password = view.GetChild("input_password");
+            var btn = view.GetChild("Btn_Login");
+            btn.onClick.Add(()=> 
+            {
+                Log.Debug("to login");
+                btn.enabled = false;
+                LoginHelper.Login(scene, account.text, password.text).Coroutine();
+            });
+        }
     }
 }