浏览代码

增加F1~F9模拟送礼功能

大爷 1 年之前
父节点
当前提交
d400ae30f2

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

@@ -44,9 +44,11 @@ namespace ET
                 }*/
                 eventHandler.Notify(msg as CommonAI.Zone.Event);
             };
-            Layer.DecorationChanged += (ZoneLayer _, ZoneEditorDecoration ed) => {
+
+            //TODO:不支持空气墙、传送阵等的动态显示
+            /*Layer.DecorationChanged += (ZoneLayer _, ZoneEditorDecoration ed) => {
                 Log.Error("not implements: DecorationChanged");
-            };
+            };*/
         }
 
         public void Update(int timeMS)

+ 37 - 47
Unity/Assets/Scripts/Codes/Hotfix/Client/battle/BattleMgr_Cmd.cs

@@ -13,16 +13,6 @@ namespace ET
     [Event]
     public class BattleFuncHandler : BEvent<BattleFunc>
     {
-        private CommonLang.Geometry.Vector3 vecTmp = new CommonLang.Geometry.Vector3();
-        private LaunchEffect effectTmp = new()
-        {
-            Name = "Icon_tiantianquan",
-            BindBody = false,
-            ScaleToBodySize = 8,
-            EarthQuakeMS = 0,
-            EffectTimeMS = 9999999
-        };
-
         protected override async ETTask OnEvent(BattleFunc a)
         {
             Log.Debug($"Battle Func:{a.FuncIndex}");
@@ -42,12 +32,12 @@ namespace ET
                     var rand = new Random();
                     foreach (var id in units)
                     {
-                        float r = (rand.Next(1000)) / 30.0f + 8;
+                        float r = rand.Next(1000) / 30.0f + 8;
                         double ang = rand.Next(120) / 180.0f * Math.PI + Math.PI;
-                        Log.Debug($"rand unit r({r}), ang({ang})");
+                        //Log.Debug($"rand unit r({r}), ang({ang})");
                         float x = centerpos.X + (float)(r * Math.Cos(ang));
                         float y = centerpos.Y - (float)(r * Math.Sin(ang));
-                        Log.Debug($"born unit: r:{r}, ang:{ang}---({x},{y})");
+                        //Log.Debug($"born unit: r:{r}, ang:{ang}---({x},{y})");
 
                         session.Call(new C2G_AddUnitsToMap()
                         {
@@ -57,21 +47,17 @@ namespace ET
                             Y = (int)y
                         }).Coroutine();
                     }
-                    EventSystem.Instance.Publish(BattleMsgEvent.Static.Clone("'<font color=#fe3824>宝宝x</font>'进入了游戏,和大家一起守护家园!"));
+                    //EventSystem.Instance.Publish(BattleMsgEvent.Static.Clone("'<font color=#fe3824>宝宝x</font>'进入了游戏,和大家一起守护家园!"));
                     break;
                 case (int)KeyCode.F2:
                     centerpos = GetCurBattleCenter();
-
-                    vecTmp.Set(centerpos.X, centerpos.Y, 18);
-                    EventSystem.Instance.Publish(PlayEffectEvent.Static.Clone(effectTmp, 0, vecTmp, 1.57f));
-
                     var units2 = new int[] { 102, 112, 122, 132 };
                     rand = new Random();
-                    foreach (var id in units2)
+                    for (int i = 0; i < 2; i++)
                     {
-                        float r = (rand.Next(1000)) / 30.0f + 8;
+                        var id = units2[rand.Next(units2.Length)];
+                        float r = rand.Next(1000) / 30.0f + 8;
                         double ang = rand.Next(120) / 180.0f * Math.PI + Math.PI;
-                        Log.Debug($"rand unit r({r}), ang({ang})");
                         float x = centerpos.X + (float)(r * Math.Cos(ang));
                         float y = centerpos.Y - (float)(r * Math.Sin(ang));
 
@@ -83,20 +69,17 @@ namespace ET
                             Y = (int)y
                         }).Coroutine();
                     }
-                    EventSystem.Instance.Publish(BattleMsgEvent.Static.Clone("'<font color=#fe2c55>宝宝x</font>'使用了'<font color=#fe3824>甜甜圈</font>',成功变形为'二级宝宝'"));
+                    //EventSystem.Instance.Publish(BattleMsgEvent.Static.Clone("'<font color=#fe2c55>宝宝x</font>'使用了'<font color=#fe3824>甜甜圈</font>',成功变形为'二级宝宝'"));
                     break;
                 case (int)KeyCode.F3:
                     centerpos = GetCurBattleCenter();
-                    vecTmp.Set(centerpos.X, centerpos.Y, 18);
-                    EventSystem.Instance.Publish(PlayEffectEvent.Static.Clone(effectTmp, 0, vecTmp, 1.57f));
-
                     var units3 = new int[] { 103, 113, 123, 133 };
                     rand = new Random();
-                    foreach (var id in units3)
+                    for (int i = 0; i < 1; i++)
                     {
-                        float r = (rand.Next(1000)) / 30.0f + 8;
+                        var id = units3[rand.Next(units3.Length)];
+                        float r = rand.Next(1000) / 30.0f + 8;
                         double ang = rand.Next(120) / 180.0f * Math.PI + Math.PI;
-                        Log.Debug($"rand unit r({r}), ang({ang})");
                         float x = centerpos.X + (float)(r * Math.Cos(ang));
                         float y = centerpos.Y - (float)(r * Math.Sin(ang));
 
@@ -108,38 +91,45 @@ namespace ET
                             Y = (int)y
                         }).Coroutine();
                     }
-                    EventSystem.Instance.Publish(BattleMsgEvent.Static.Clone("'<font color=#fe2c55>宝宝x</font>'使用了'<font color=#fe3824>甜甜圈</font>',成功变形为'三级宝宝'"));
+                    //EventSystem.Instance.Publish(BattleMsgEvent.Static.Clone("'<font color=#fe2c55>宝宝x</font>'使用了'<font color=#fe3824>甜甜圈</font>',成功变形为'三级宝宝'"));
                     break;
+
                 case (int)KeyCode.F4:
-                    session.Call(new C2G_TriggrBattleFunction()
+                    session.Call(new C2G_BattleNotify()
                     {
-                        TriggerID = 10111,
-                        Value1 = 0,
-                        Value2 = 0,
-                        Value3 = 0,
-                        Value4 = 0,
-                        Value5 = 0,
-                        Value6 = 0,
+                        Message = BattleNotify.TiktokGift_1.ToString()
                     }).Coroutine();
-                    EventSystem.Instance.Publish(BattleMsgEvent.Static.Clone("'<font color=#fe2c55>宝宝x</font>'使用了'<font color=#fe3824>能量电池</font>',全员满血,并增加攻击"));
                     break;
                 case (int)KeyCode.F5:
-                    session.Call(new C2G_TriggrBattleFunction()
+                    session.Call(new C2G_BattleNotify()
                     {
-                        TriggerID = 10111,
-                        Value1 = 0,
-                        Value2 = 0,
-                        Value3 = 0,
-                        Value4 = 0,
-                        Value5 = 0,
-                        Value6 = 0,
+                        Message = BattleNotify.TiktokGift_10.ToString()
                     }).Coroutine();
-                    EventSystem.Instance.Publish(BattleMsgEvent.Static.Clone("'<font color=#fe2c55>宝宝x</font>'使用了'<font color=#fe3824>恶魔炸弹</font>',召唤出地狱火岩"));
                     break;
                 case (int)KeyCode.F6:
+                    session.Call(new C2G_BattleNotify()
+                    {
+                        Message = BattleNotify.TiktokGift_52.ToString()
+                    }).Coroutine();
+                    break;
                 case (int)KeyCode.F7:
+                    session.Call(new C2G_BattleNotify()
+                    {
+                        Message = BattleNotify.TiktokGift_99.ToString()
+                    }).Coroutine();
+                    break;
                 case (int)KeyCode.F8:
+                    session.Call(new C2G_BattleNotify()
+                    {
+                        Message = BattleNotify.TiktokGift_199.ToString()
+                    }).Coroutine();
+                    break;
                 case (int)KeyCode.F9:
+                    session.Call(new C2G_BattleNotify()
+                    {
+                        Message = BattleNotify.TiktokGift_520.ToString()
+                    }).Coroutine();
+                    break;
                 case (int)KeyCode.F10:
                     break;
             }

+ 7 - 3
Unity/Assets/Scripts/Codes/Model/Share/Const/ConstValue.cs

@@ -1,6 +1,4 @@
-using System;
-
-namespace ET
+namespace ET
 {
     /**
      * 静态常量值
@@ -26,6 +24,12 @@ namespace ET
         ClientIsReady,
         StartRefreshMonster,
         CameraOk,
+        TiktokGift_1,
+        TiktokGift_10,
+        TiktokGift_52,
+        TiktokGift_99,
+        TiktokGift_199,
+        TiktokGift_520,
     }
 }