Bläddra i källkod

Merge remote-tracking branch 'origin/master'

johnclot69 1 år sedan
förälder
incheckning
0ea92185f6

+ 41 - 0
Unity/Assets/Scenes/Init.unity

@@ -650,6 +650,8 @@ GameObject:
   - component: {fileID: 1042023526}
   - component: {fileID: 1042023525}
   - component: {fileID: 1042023524}
+  - component: {fileID: 1042023528}
+  - component: {fileID: 1042023527}
   m_Layer: 0
   m_Name: BattleCamera
   m_TagString: MainCamera
@@ -756,6 +758,45 @@ Camera:
   m_OcclusionCulling: 1
   m_StereoConvergence: 10
   m_StereoSeparation: 0.022
+--- !u!95 &1042023527
+Animator:
+  serializedVersion: 4
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1042023522}
+  m_Enabled: 1
+  m_Avatar: {fileID: 0}
+  m_Controller: {fileID: 0}
+  m_CullingMode: 0
+  m_UpdateMode: 0
+  m_ApplyRootMotion: 0
+  m_LinearVelocityBlending: 0
+  m_StabilizeFeet: 0
+  m_WarningMessage: 
+  m_HasTransformHierarchy: 1
+  m_AllowConstantClipSamplingOptimization: 1
+  m_KeepAnimatorControllerStateOnDisable: 0
+--- !u!320 &1042023528
+PlayableDirector:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1042023522}
+  m_Enabled: 1
+  serializedVersion: 3
+  m_PlayableAsset: {fileID: 11400000, guid: 8babbb9fb1776784e8937421f28fab88, type: 2}
+  m_InitialState: 0
+  m_WrapMode: 2
+  m_DirectorUpdateMode: 1
+  m_InitialTime: 0
+  m_SceneBindings:
+  - key: {fileID: -5287455096285614599, guid: 8babbb9fb1776784e8937421f28fab88, type: 2}
+    value: {fileID: 1042023527}
+  m_ExposedReferences:
+    m_References: []
 --- !u!1 &1072855710
 GameObject:
   m_ObjectHideFlags: 0

+ 0 - 2
Unity/Assets/Scripts/Codes/Hotfix/Client/Login/EnterMapHelper.cs

@@ -31,8 +31,6 @@ namespace ET.Client
 
                 //告诉战斗服 i am ready
                 session.Send(new BattleClientReady());
-
-                session.Call(new C2G_BattleNotify() { Message = BattleNotify.ClientIsReady.ToString() }).Coroutine();
             }
             catch (Exception e)
             {

+ 2 - 3
Unity/Assets/Scripts/Codes/Hotfix/Client/battle/BattleMgr.cs

@@ -369,10 +369,9 @@ namespace ET
             {
                 var e = ev as ClientMsgEvent;
                 Log.Debug($">>>Battle client event: {e.Message}");
-                if(e.Message == BattleNotify.CameraOk.ToString() )
+                /*if(e.Message == BattleNotify.CameraOk.ToString() )
                 {
-                    EventSystem.Instance.Publish<CameraOkEvent>();
-                }
+                }*/
             });
             /*BubbleTalkEvent
             AddEffectEvent

+ 1 - 0
Unity/Assets/Scripts/Codes/Hotfix/Client/battle/BattleMgr_Cmd.cs

@@ -21,6 +21,7 @@ namespace ET
             switch (a.FuncIndex)
             {
                 case (int)BattleFunc.FUNC.Start:
+                    session.Call(new C2G_BattleNotify() { Message = BattleNotify.ClientIsReady.ToString() }).Coroutine();
                     session.Call(new C2G_BattleNotify()
                     {
                         Message = BattleNotify.StartRefreshMonster.ToString()

+ 37 - 6
Unity/Assets/Scripts/Codes/HotfixView/Client/Camera/CameraMgr.cs

@@ -1,16 +1,47 @@
 using DG.Tweening;
 using ET.EventType;
+using FairyGUI;
 using UnityEngine;
+using UnityEngine.Playables;
 
 namespace ET.Client
 {
     public static class CameraMgr
     {
+        public static Camera MainCamera { get; private set; }
         public static void Init()
         {
-            var camera = GlobalViewMgr.Instance.BattleCamera;
-            camera.transform.SetPositionAndRotation(new Vector3(70, 50, 0), Quaternion.Euler(35, 0, 0));
-            camera.fieldOfView = 60;
+            MainCamera = Camera.main;
+            MainCamera.transform.SetPositionAndRotation(new Vector3(230, 35, -5), Quaternion.Euler(20, 0, 0));
+            MainCamera.fieldOfView = 60;
+        }
+
+        [Event]
+        public class SceneChangeFinishEvent : BEvent<SceneLoadFinish>
+        {
+            protected override async ETTask OnEvent(SceneLoadFinish a)
+            {
+                GRoot.inst.RemoveChildren();
+                var playable = MainCamera.GetComponent<PlayableDirector>();
+                if (playable != null)
+                {
+                    playable.Play();
+                    playable.stopped += (pd) =>
+                    {
+                        EventSystem.Instance.Publish<ShowHUDEvent>();
+
+                        GameObject.Destroy(playable);
+                        var ani = MainCamera.GetComponent<Animator>();
+                        if(ani != null) GameObject.Destroy(ani);
+                    };
+                }
+                else
+                {
+                    Log.Error("Not Found Camera PlayableDirector");
+                    EventSystem.Instance.Publish<ShowHUDEvent>();
+                }
+                await ETTask.CompletedTask;
+            }
         }
 
         //相机跟随主角
@@ -29,7 +60,7 @@ namespace ET.Client
             if (bShaking) return;
             bShaking = true;
 
-            Transform trans = GlobalViewMgr.Instance.BattleCamera.transform;
+            Transform trans = MainCamera.transform;
             var savePos = trans.localPosition;
             Tweener tweener = trans.DOShakePosition(shakeTime, shakeStength);
             tweener.OnComplete<Tweener>(() =>
@@ -46,7 +77,7 @@ namespace ET.Client
 
         public static void DragMe(Vector3 start, Vector3 end, float duration, System.Action endcb)
         {
-            Transform trans = GlobalViewMgr.Instance.BattleCamera.transform;
+            Transform trans = MainCamera.transform;
             trans.position = start;
             var tweener = trans.DOMove(end, duration);
             tweener.OnComplete<Tweener>(() =>
@@ -63,7 +94,7 @@ namespace ET.Client
         {
             var endpos = new Vector3(args.X, args.Y, args.Z);
             float time = (float)args.TimeMS / 1000;
-            Transform trans = GlobalViewMgr.Instance.BattleCamera.transform;
+            Transform trans = CameraMgr.MainCamera.transform;
 
             if (args.MoveSpeedSec > 0.0001 && time < 0.01)
             {

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

@@ -9,7 +9,7 @@ namespace ET.Client
     {
         protected override async ETTask OnEvent(EventType.SceneChangeStart args)
         {
-            UIHelper.Create( "Loading" ).Coroutine();
+            UIHelper.ShowLoadingUI();
 
             var mapInfo = MapConfigCategory.Instance.Get( args.mapId );
             var scnName = mapInfo.MapName;
@@ -27,7 +27,7 @@ namespace ET.Client
             EventSystem.Instance.Publish<EventType.SceneLoadFinish>();
             PlayerComponent.Instance.ClientScene().GetComponent<ObjectWait>().Notify( new Wait_SceneChangeFinish() );
 
-            UIHelper.SetVisible("Loading", false);
+            UIHelper.HideLoadingUI();
         }
     }
 }

+ 40 - 37
Unity/Assets/Scripts/Codes/HotfixView/Client/UI/HUD/SceneChangeFinishEvent_CreateHUD.cs → Unity/Assets/Scripts/Codes/HotfixView/Client/UI/HUD/CreateHUD.cs

@@ -4,9 +4,9 @@ using FairyGUI;
 namespace ET.Client
 {
     [Event]
-    public class SceneChangeFinishEvent_CreateUIHelp : BEvent<SceneLoadFinish>
+    public class SceneChangeFinishEvent_CreateUIHelp : BEvent<ShowHUDEvent>
     {
-        protected override async ETTask OnEvent(SceneLoadFinish a)
+        protected override async ETTask OnEvent(ShowHUDEvent _)
         {
             var view = await UIHelper.Create( "HUD" );
             HUDMgr.InitView( view );
@@ -38,35 +38,36 @@ namespace ET.Client
 
         protected override async ETTask OnEvent(HPRefresh a)
         {
-            GProgressBar progress = null;
-            GTextField txt = null;
-            if(a.HPIndex == HPRefresh.Index.Tower)
+            var view = UIHelper.GetUI("HUD") as GComponent;
+            if (view != null)
             {
-                if(progressBar1 == null)
+                GProgressBar progress = null;
+                GTextField txt = null;
+                if (a.HPIndex == HPRefresh.Index.Tower)
                 {
-                    var view = UIHelper.GetUI("HUD") as GComponent;
-                    progressBar1 = view.GetChild("HPBar1").asProgress;
-                    txt1 = progressBar1.GetChild("title").asTextField;
+                    if (progressBar1 == null)
+                    {
+                        progressBar1 = view.GetChild("HPBar1").asProgress;
+                        txt1 = progressBar1.GetChild("title").asTextField;
+                    }
+                    progress = progressBar1;
+                    txt = txt1;
                 }
-                progress = progressBar1;
-                txt = txt1;
-            }
-            else
-            {
-                if (progressBar2 == null)
+                else
                 {
-                    var view = UIHelper.GetUI("HUD") as GComponent;
-                    progressBar2 = view.GetChild("HPBar2").asProgress;
-                    txt2 = progressBar2.GetChild("title").asTextField;
+                    if (progressBar2 == null)
+                    {
+                        progressBar2 = view.GetChild("HPBar2").asProgress;
+                        txt2 = progressBar2.GetChild("title").asTextField;
+                    }
+                    progress = progressBar2;
+                    txt = txt2;
                 }
-                progress = progressBar2;
-                txt = txt2;
-            }
-
-            progress.visible = true;
-            progress.value = a.Progress;
-            txt.text = a.Progress.ToString("F2") + "%";
 
+                progress.visible = true;
+                progress.value = a.Progress;
+                txt.text = a.Progress.ToString("F2") + "%";
+            }
             await ETTask.CompletedTask;
         }
     }
@@ -119,23 +120,26 @@ namespace ET.Client
         protected override async ETTask OnEvent(BattleMsgEvent a)
         {
             var view = UIHelper.GetUI("HUD") as GComponent;
-            var list = view.GetChild("InfoList").asList;
-
-            if(CurIndex >= list.numChildren)
+            if (view != null)
             {
-                CurIndex = 0;
-            }
+                var list = view.GetChild("InfoList").asList;
 
-            var comp = list.GetChildAt(CurIndex).asCom;
-            var txt = comp.GetChild("text");
-            txt.text = a.msg;
+                if (CurIndex >= list.numChildren)
+                {
+                    CurIndex = 0;
+                }
 
-            ++CurIndex;
+                var comp = list.GetChildAt(CurIndex).asCom;
+                var txt = comp.GetChild("text");
+                txt.text = a.msg;
+
+                ++CurIndex;
+            }
             await ETTask.CompletedTask;
         }
     }
 
-    [Event]
+    /*[Event]
     public class CameraOkHandler : BEvent<CameraOkEvent>
     {
         protected override async ETTask OnEvent(CameraOkEvent a)
@@ -145,7 +149,7 @@ namespace ET.Client
 
             await ETTask.CompletedTask;
         }
-    }
+    }*/
     
 
     public static class HUDMgr
@@ -214,7 +218,6 @@ namespace ET.Client
             txthp2.text = "";
 
             var btn = view.GetChild("btn_start");
-            btn.visible = false;
             btn.onClick.Set( () => {
                 btn.visible = false;
                 EventSystem.Instance.Publish(BattleFunc.Static.Clone((int)BattleFunc.FUNC.Start));

+ 1 - 1
Unity/Assets/Scripts/Codes/HotfixView/Client/UI/HUD/SceneChangeFinishEvent_CreateHUD.cs.meta → Unity/Assets/Scripts/Codes/HotfixView/Client/UI/HUD/CreateHUD.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: b3aaceb25d10c4b46b21314e5df94413
+guid: 7e303de5bfd75784ab240c86d5abae1b
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

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

@@ -59,5 +59,22 @@ namespace ET.Client
         {
             return GRoot.inst.GetChild(uiName);
         }
+
+        public static async void ShowLoadingUI()
+        {
+            var loading = UIHelper.GetUI("Loading");
+            if (loading == null)
+            {
+                await UIHelper.Create("Loading");
+            }
+            else
+            {
+                loading.visible = true;
+            }
+        }
+        public static void HideLoadingUI()
+        {
+            SetVisible("Loading", false);
+        }
     }
 }

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

@@ -259,7 +259,7 @@ namespace ET
                 return this;
             }
         }
-        public class CameraOkEvent { }
+        public class ShowHUDEvent { }
     }
 
     //状态指令

+ 0 - 1
Unity/Assets/Scripts/Codes/Model/Share/Const/ConstValue.cs

@@ -23,7 +23,6 @@
     {
         ClientIsReady,
         StartRefreshMonster,
-        CameraOk,
         TiktokGift_1,
         TiktokGift_10,
         TiktokGift_52,