|
@@ -5,6 +5,7 @@ using CommonLang;
|
|
|
using Sirenix.Utilities;
|
|
|
using ET.EventType;
|
|
|
using System.Collections.Generic;
|
|
|
+using System;
|
|
|
|
|
|
namespace ET.Client
|
|
|
{
|
|
@@ -17,6 +18,70 @@ namespace ET.Client
|
|
|
{
|
|
|
vecTemp.Set(args.Pos.X, args.Pos.Y, args.Pos.Z);
|
|
|
EffectMgr.Instance.PlayEffect(args.Effect, args.HostId, vecTemp, args.Rotation).Coroutine();
|
|
|
+
|
|
|
+ var tag = args.Effect.Tag;
|
|
|
+ if (!tag.IsNullOrWhitespace())
|
|
|
+ {
|
|
|
+ ProcessLauncheffectTag(args.HostId, args.Effect.Tag).Coroutine();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public async ETTask ProcessLauncheffectTag(uint objectid, string tag)
|
|
|
+ {
|
|
|
+ //Effect支持Tag设置Event,格式:Event:事件名(事件参数)
|
|
|
+ Match m = Regex.Match(tag, @"^@(\w+)\(([\w\d\s_,]+)\)");
|
|
|
+ if (m.Groups.Count >= 3)
|
|
|
+ {
|
|
|
+ string name = m.Groups[1].Value;
|
|
|
+ string param = m.Groups[2].Value;
|
|
|
+ switch (name)
|
|
|
+ {
|
|
|
+ case "ChangeMode":
|
|
|
+ var ps = param.Split(',');
|
|
|
+ if (ps.Length > 1)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var delay = Convert.ToInt32(ps[1]);
|
|
|
+ await TimerComponent.Instance.WaitAsync(delay);
|
|
|
+ EventSystem.Instance.Publish(ChangeModeEvent.Static.Clone(objectid, ps[0]));
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ Log.Error($"effect tag param error: {tag}");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ EventSystem.Instance.Publish(ChangeModeEvent.Static.Clone(objectid, param));
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ default:
|
|
|
+ Log.Error($"effect unknow tag: {tag}");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Log.Error($"effect illegal tag: {tag}");
|
|
|
+
|
|
|
+ /*if (!string.IsNullOrEmpty(effectData.Tag))
|
|
|
+ {
|
|
|
+ //Effect支持Tag设置Event,格式:Event:事件名(事件参数)
|
|
|
+ Match m = Regex.Match(effectData.Tag, @"^Event:(\w+)\((.*)\)");
|
|
|
+ if (m.Groups.Count >= 3)
|
|
|
+ {
|
|
|
+ string eventName = m.Groups[1].Value;
|
|
|
+ string eventParam = m.Groups[2].Value;
|
|
|
+ if (!string.IsNullOrEmpty(eventName))
|
|
|
+ {
|
|
|
+ Log.Error("Not support: Effect({0}) Triggle event:{1}", effectData.Name, effectData.Tag);
|
|
|
+ EventManager.Fire("Event." + eventName, new Dictionary<string, object>()
|
|
|
+ {
|
|
|
+ {"param", eventParam},
|
|
|
+ {"position", gt.position}
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }*/
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -158,26 +223,6 @@ namespace ET.Client
|
|
|
var scale = effectData.ScaleToBodySize != 0 ? effectData.ScaleToBodySize : 1f;
|
|
|
vecTemp.Set(scale, scale, scale);
|
|
|
gt.localScale = vecTemp;
|
|
|
-
|
|
|
- if (!string.IsNullOrEmpty(effectData.Tag))
|
|
|
- {
|
|
|
- //Effect支持Tag设置Event,格式:Event:事件名(事件参数)
|
|
|
- Match m = Regex.Match(effectData.Tag, @"^Event:(\w+)\((.*)\)");
|
|
|
- if (m.Groups.Count >= 3)
|
|
|
- {
|
|
|
- string eventName = m.Groups[1].Value;
|
|
|
- string eventParam = m.Groups[2].Value;
|
|
|
- if (!string.IsNullOrEmpty(eventName))
|
|
|
- {
|
|
|
- Log.Error("Not support: Effect({0}) Triggle event:{1}", effectData.Name, effectData.Tag);
|
|
|
- /*EventManager.Fire("Event." + eventName, new Dictionary<string, object>()
|
|
|
- {
|
|
|
- {"param", eventParam},
|
|
|
- {"position", gt.position}
|
|
|
- });*/
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
go.SetActive(true);
|
|
|
|
|
|
if (!effectData.SoundName.IsNullOrWhitespace())
|