Browse Source

修改登录流程:加载战斗场景时仍显示登录ui;开始游戏时才会展现镜头动画

大爷 1 year ago
parent
commit
4b07c32b42

+ 1 - 1
Unity/Assets/Scripts/Codes/Hotfix/Client/Login/LoginHelper.cs

@@ -69,7 +69,7 @@ namespace ET.Client
                 //使用简化流程直接进入游戏
                 var ret = (G2C_BindPlayer)await gateSession.Call(new C2G_BindPlayer() { PlayerId = g2CLoginGate.Player.id });
 
-                await EventSystem.Instance.PublishWait(EventType.LoginFinish.Clone(ret.Player));
+                //await EventSystem.Instance.PublishWait(EventType.LoginFinish.Clone(ret.Player));
 
                 EnterMapHelper.EnterMapAsync(clientScene, ret.Player, ret.Player.instanceId).Coroutine();
             }

+ 6 - 2
Unity/Assets/Scripts/Codes/HotfixView/Client/Scene/LoadSceneEventHandle.cs

@@ -1,5 +1,6 @@
 using Cysharp.Threading.Tasks;
 using ET;
+using ET.EventType;
 using UnityEngine;
 
 namespace ET.Client
@@ -23,10 +24,13 @@ namespace ET.Client
             await GameObjectPool.Instance.CacheSceneObject( mapInfo.Id );
             Log.Debug( $"cache scene object end." );
 
+            UIHelper.HideLoadingUI();
+
             // 通知等待场景切换的协程
-            EventSystem.Instance.Publish<EventType.SceneLoadFinish>();
+            //EventSystem.Instance.Publish<EventType.SceneLoadFinish>()
 
-            UIHelper.HideLoadingUI();
+            UIHelper.RemoveAllUiExceptSth();
+            EventSystem.Instance.Publish<ShowHUDEvent>();
         }
     }
 }

+ 8 - 2
Unity/Assets/Scripts/Codes/HotfixView/Client/UI/HUD/CreateHUD.cs

@@ -19,9 +19,15 @@ namespace ET.Client
             txthp2.text = "";
 
             var btn = view.GetChild("btn_start");
-            btn.onClick.Set(() => {
+            btn.onClick.Set(() =>
+            {
                 btn.visible = false;
-                EventSystem.Instance.Publish(BattleFunc.Static.Clone((int)BattleFunc.FUNC.Start));
+
+                CameraMgr.PlayStartAnimation(() =>
+                {
+                    EventSystem.Instance.Publish(BattleFunc.Clone((int)BattleFunc.FUNC.Start));
+                }).Coroutine();
+                
             });
         }
     }

+ 14 - 0
Unity/Assets/Scripts/Codes/HotfixView/Client/UI/UIHelper.cs

@@ -1,4 +1,5 @@
 using FairyGUI;
+using System.Linq;
 using UnityEngine;
 
 namespace ET.Client
@@ -60,6 +61,19 @@ namespace ET.Client
             return GRoot.inst.GetChild(uiName);
         }
 
+        public static void RemoveAllUiExceptSth()
+        {
+            string[] excepts = { "HeadBarRoot" };
+            var chds = GRoot.inst.GetChildren();
+            foreach(var ch in chds)
+            {
+                if(!excepts.Contains<string>(ch.name))
+                {
+                    GRoot.inst.RemoveChild(ch, false);
+                }
+            }
+        }
+
         public static async void ShowLoadingUI()
         {
             var loading = UIHelper.GetUI("Loading");

+ 6 - 8
Unity/Assets/Scripts/Codes/HotfixView/Client/UI/UILogin/ShowLoginUIEventHandle.cs

@@ -29,7 +29,7 @@ namespace ET.Client
                 }
             }
 
-            GRoot.inst.RemoveChildren();
+            UIHelper.RemoveAllUiExceptSth();
 
             var view = await UIHelper.Create( "Login" );
             InitLogin( view ).Coroutine();
@@ -179,10 +179,10 @@ namespace ET.Client
                                     "\n微信:[color=#FF0000]omm_wh[/color]";
                     }
                 }
-                /*else
+                else
                 {
-                    GameSetting.Instance.SetInt(GameSetting.Sets.TiktokRoomId_int, roomid);
-                }*/
+                    imgtips.visible = false;
+                }
             });
 
             if (strRoomToken.IsNullOrWhitespace())
@@ -192,13 +192,11 @@ namespace ET.Client
                             "如重试后还是不行,请与客服联系" +
                             "\n抖音:[color=#FF0000]奥陌陌网络科技[/color]" +
                             "\n微信:[color=#FF0000]omm_wh[/color]";
-                strRoomToken = "NoToken";
-                Log.Info("start without token");
             }
             else
             {
-                //await TimerComponent.Instance.WaitAsync(300);
-                //btn.FireClick(false, true);
+                await TimerComponent.Instance.WaitAsync(500);
+                btn.FireClick(false, true);
             }
         }
     }

+ 16 - 4
Unity/Assets/Scripts/Codes/Model/Client/EventTypeClient.cs

@@ -104,7 +104,7 @@ namespace ET
             }
         }
         public class SkillChangeEvent { }
-        public class SceneLoadFinish { }
+        //public class SceneLoadFinish { }
         public class LaunchSkillEvent
         {
             public int index;
@@ -177,13 +177,15 @@ namespace ET
             public enum FUNC
             {
                 Start = 1001,
+                Start2,
+                Start3,
             }
             public int FuncIndex;
             public static BattleFunc Static = new();
-            public BattleFunc Clone(int index)
+            public static BattleFunc Clone(int index)
             {
-                FuncIndex = index;
-                return this;
+                Static.FuncIndex = index;
+                return Static;
             }
         }
         public class HPRefresh
@@ -220,6 +222,16 @@ namespace ET
                 return this;
             }
         }
+        public class CameraPlaybleEvent
+        {
+            public string Playable;
+            public static CameraPlaybleEvent Static = new();
+            public static CameraPlaybleEvent Clone(string name)
+            {
+                Static.Playable = name;
+                return Static;
+            }
+        }
         public class GameoverEvent
         {
             public int winForce;