瀏覽代碼

增加主播功能按钮:增加单位

大爷 1 年之前
父節點
當前提交
91ccdd5a9f

+ 36 - 2
Unity/Assets/Scripts/Codes/Hotfix/Client/battle/BattleMgr_Cmd.cs

@@ -1,9 +1,42 @@
-
-using CommonAI.Zone;
+using CommonAI.Zone;
 using ET.Client;
+using ET.EventType;
 
 namespace ET
 {
+    [Event(SceneType.None)]
+    public class BattleFuncHandler : BEvent<BattleFunc>
+    {
+        public override void OnEvent(BattleFunc a)
+        {
+            Log.Debug($"Battle Func:{a.FuncIndex}");
+            asyncHandler(a.FuncIndex).Coroutine();
+        }
+        private async ETTask asyncHandler(BattleFunc.Index index)
+        {
+            var session = PlayerComponent.Instance.ClientScene().GetComponent<SessionComponent>().Session;
+            switch (index)
+            {
+                case BattleFunc.Index.Func1:
+                    var ret = await session.Call(new C2G_AddUnitsToMap()
+                    {
+                        UnitId = 102,
+                        Force = 1,
+                        X = 2,
+                        Y = 30
+                    });
+
+                    if(ret.Error != 0)
+                    {
+                        Log.Error(ret.Message);
+                    }
+                    break;
+                default:
+                    break;
+            }
+        }
+    }
+
     //发送战斗服指令相关
     public partial class BattleMgr
     {
@@ -29,4 +62,5 @@ namespace ET
             return new UnitGuardAction(UnitMgr.Instance.ActorId, flag, CommonAI.XmdsConstConfig.AUTO_GUARD_MODE_POINT);
         }
     }
+
 }

+ 2 - 0
Unity/Assets/Scripts/Codes/HotfixView/Client/Camera/CameraMgr.cs

@@ -1,4 +1,5 @@
 using DG.Tweening;
+using FairyGUI;
 using UnityEngine;
 
 namespace ET.Client
@@ -10,6 +11,7 @@ namespace ET.Client
         public static void FollowMe(Vector3 pos)
         {
             var camera = Camera.main;
+            pos.x += 7;
             pos.y = 15;
             pos.z -= 25;
             camera.transform.position = pos;

+ 8 - 1
Unity/Assets/Scripts/Codes/HotfixView/Client/Global/GlobalViewMgr.cs

@@ -1,4 +1,5 @@
-using UnityEngine;
+using FairyGUI;
+using UnityEngine;
 
 namespace ET.Client
 {
@@ -15,6 +16,12 @@ namespace ET.Client
 
             self.BattleCamera = GameObject.Find("/Global/BattleCamera").GetComponent<Camera>();
             //self.UICamera = GameObject.Find("/Global/UICamera").GetComponent<Camera>();
+
+            /*var uiContentScale = self.Global.GetComponent<UIContentScaler>();
+            uiContentScale.scaleMode = UIContentScaler.ScaleMode.ScaleWithScreenSize;
+            uiContentScale.designResolutionX = 1600;
+            uiContentScale.designResolutionY = 2500;
+            uiContentScale.screenMatchMode = UIContentScaler.ScreenMatchMode.MatchWidthOrHeight;*/
         }
     }
 }

+ 14 - 4
Unity/Assets/Scripts/Codes/HotfixView/Client/UI/HUD/SceneChangeFinishEvent_CreateHUD.cs

@@ -1,5 +1,4 @@
-using CommonAI.Zone;
-using ET.EventType;
+using ET.EventType;
 using FairyGUI;
 
 namespace ET.Client
@@ -39,7 +38,7 @@ namespace ET.Client
             var btn1 = view.GetChild("btn_skill1");
             var btn2 = view.GetChild("btn_skill2");
 
-            var actor = UnitMgr.Instance.Actor;
+            /*var actor = UnitMgr.Instance.Actor;
             if (actor == null || !actor.IsSkillOk)
             {
                 btn1.visible = false;
@@ -56,7 +55,18 @@ namespace ET.Client
 
             btn2.onClick.Set(() => {
                 EventSystem.Instance.Publish<LaunchSkillEvent>(LaunchSkillEvent.Static.Clone(1));
-            });
+            });*/
+
+            btn1.visible = false;
+            btn2.visible = false;
+            for (int i=1; i<=4; i++)
+            {
+                var btn = view.GetChild($"btn_func{i}");
+                var index = i;
+                btn.onClick.Set(() => {
+                    EventSystem.Instance.Publish<BattleFunc>(BattleFunc.Static.Clone(index));
+                });
+            }
         }
     }
 }

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

@@ -96,6 +96,20 @@ namespace ET
                 return this;
             }
         }
+        public class BattleFunc
+        {
+            public enum Index
+            {
+                Func1 = 1, Func2, Func3, Func4
+            }
+            public Index FuncIndex;
+            public static BattleFunc Static = new();
+            public BattleFunc Clone(int index)
+            {
+                FuncIndex = (Index)index;
+                return this;
+            }
+        }
     }
 
     //状态指令