Browse Source

增加编辑器事件“发送消息到游戏服”预埋参数:{objid},填充为触发单位object id

大爷 1 year ago
parent
commit
cbdf050fd3
1 changed files with 10 additions and 1 deletions
  1. 10 1
      Common/CommonAI/Zone/ZoneEditor/EventTrigger/Actions.Zone.cs

+ 10 - 1
Common/CommonAI/Zone/ZoneEditor/EventTrigger/Actions.Zone.cs

@@ -254,8 +254,17 @@ namespace CommonAI.Zone.ZoneEditor.EventTrigger
         override public void DoAction(EventTriggerAdapter api, EventArguments args)
         {
             string msg = Message.GetValue(api, args);
-            if (msg != null)
+            if (!string.IsNullOrEmpty(msg))
             {
+                if(msg.Contains("{objid}"))
+                {
+                    var unit = args.TriggingUnit;
+                    if(unit == null)
+                    {
+                        return;
+                    }
+                    msg = msg.Replace("objid", $"{unit.get_id()}");
+                }
                 api.ZoneAPI.SendMessageToGameServer(msg);
             }
         }