|
@@ -1,10 +1,76 @@
|
|
|
-using CommonAI.ZoneClient;
|
|
|
+using CommonAI.Zone;
|
|
|
+using CommonAI.ZoneClient;
|
|
|
+using CommonLang;
|
|
|
using ET;
|
|
|
using ET.Client;
|
|
|
+using ET.EventType;
|
|
|
+using ProtoBuf;
|
|
|
+using System.ComponentModel;
|
|
|
using XmdsCommon.Plugin;
|
|
|
|
|
|
+public partial class SkillKeyStruct : ProtoObject
|
|
|
+{
|
|
|
+ [ProtoMember(1)]
|
|
|
+ public int keyPos { get; set; }
|
|
|
+
|
|
|
+ [ProtoMember(2)]
|
|
|
+ public int baseSkillId { get; set; }
|
|
|
+
|
|
|
+ [ProtoMember(3)]
|
|
|
+ public int advancedSkillId { get; set; }
|
|
|
+
|
|
|
+ [ProtoMember(4)]
|
|
|
+ public string icon { get; set; }
|
|
|
+
|
|
|
+ [ProtoMember(5)]
|
|
|
+ public int flag { get; set; }
|
|
|
+
|
|
|
+ [ProtoMember(6)]
|
|
|
+ public int unlockLevel { get; set; }
|
|
|
+
|
|
|
+ [ProtoMember(7)]
|
|
|
+ public string name { get; set; }
|
|
|
+
|
|
|
+ [ProtoMember(8)]
|
|
|
+ public string baseSkillIcon { get; set; }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+[Event(SceneType.None)]
|
|
|
+public class LaunchSkillEventHandler : BEvent<LaunchSkillEvent>
|
|
|
+{
|
|
|
+ public override void OnEvent(LaunchSkillEvent a)
|
|
|
+ {
|
|
|
+ var actor = UnitMgr.Instance.Actor;
|
|
|
+ if(actor != null )
|
|
|
+ {
|
|
|
+ var skillinfo = actor.GetSkill(a.index);
|
|
|
+ if (skillinfo != null)
|
|
|
+ {
|
|
|
+ SkillMgr.Instance.LanchSkill(skillinfo.baseSkillId);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Log.Error($"skill info not exist @index: {a.index}");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Log.Warning("actor not exist");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
public class BattleActor : BattlePlayer
|
|
|
{
|
|
|
+ private bool isSkillInited = false;
|
|
|
+ public bool IsSkillOk { get { return isSkillInited; } }
|
|
|
+ private HashMap<int, SkillKeyStruct> SkillLisst = new();
|
|
|
+ public SkillKeyStruct GetSkill(int index)
|
|
|
+ {
|
|
|
+ return SkillLisst[index];
|
|
|
+ }
|
|
|
+
|
|
|
public override void OnAwake(ZoneObject zo)
|
|
|
{
|
|
|
base.OnAwake(zo);
|
|
@@ -37,7 +103,7 @@ public class BattleActor : BattlePlayer
|
|
|
skills = new int[] { baseSkillID };
|
|
|
}
|
|
|
}
|
|
|
- SkillMgr.Instance.Init(skills);
|
|
|
+ InitSkill(skills);
|
|
|
}
|
|
|
else if (op == ZoneUnit.SkillOption.Add || op == ZoneUnit.SkillOption.Remove)
|
|
|
{
|
|
@@ -45,6 +111,30 @@ public class BattleActor : BattlePlayer
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public void InitSkill(params int[] skills)
|
|
|
+ {
|
|
|
+ isSkillInited = true;
|
|
|
+ SkillLisst.Clear();
|
|
|
+
|
|
|
+ var CFG = UnitMgr.Instance.Actor.ZUnit.Templates;
|
|
|
+ for (int i = 0; i < skills.Length; i++)
|
|
|
+ {
|
|
|
+ int skid = skills[i];
|
|
|
+ if (skid != 0)
|
|
|
+ {
|
|
|
+ SkillTemplate skt = CFG.getSkill(skid);
|
|
|
+ SkillLisst[i] = new SkillKeyStruct()
|
|
|
+ {
|
|
|
+ keyPos = i,
|
|
|
+ baseSkillId = skid,
|
|
|
+ icon = skt.IconName
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ EventSystem.Instance.Publish<SkillChangeEvent>();
|
|
|
+ }
|
|
|
+
|
|
|
private void OnStopPickObject(ZoneUnit unit, CommonAI.Zone.UnitStopPickObjectEvent stop)
|
|
|
{
|
|
|
Log.Error("unhande event: OnStopPickObject");
|