From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/Buff/XBuffSkillsReplace.cs | 84 ++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/Buff/XBuffSkillsReplace.cs (limited to 'Client/Assets/Scripts/XMainClient/Buff/XBuffSkillsReplace.cs') diff --git a/Client/Assets/Scripts/XMainClient/Buff/XBuffSkillsReplace.cs b/Client/Assets/Scripts/XMainClient/Buff/XBuffSkillsReplace.cs new file mode 100644 index 00000000..19f7caf9 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Buff/XBuffSkillsReplace.cs @@ -0,0 +1,84 @@ +using System; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XBuffSkillsReplace : BuffEffect + { + private XBuff m_Buff; + + private XEntity m_Entity; + + public static bool TryCreate(BuffTable.RowData rowData, XBuff buff) + { + bool flag = rowData.SkillsReplace.Count == 0; + bool result; + if (flag) + { + result = false; + } + else + { + buff.AddEffect(new XBuffSkillsReplace(buff)); + result = true; + } + return result; + } + + public XBuffSkillsReplace(XBuff _Buff) + { + this.m_Buff = _Buff; + } + + public override void OnAdd(XEntity entity, CombatEffectHelper pEffectHelper) + { + this.m_Entity = entity; + XBuffSkillsReplace.DoAdd(entity, ref this.m_Buff.BuffInfo.SkillsReplace); + } + + public override void OnRemove(XEntity entity, bool IsReplaced) + { + XBuffSkillsReplace.DoRemove(entity, ref this.m_Buff.BuffInfo.SkillsReplace); + } + + public static void TrySkillsReplace(XEntity entity, UIBuffInfo uibuffInfo, bool bOpen) + { + bool flag = uibuffInfo == null || uibuffInfo.buffInfo == null || uibuffInfo.buffInfo.SkillsReplace.Count == 0; + if (!flag) + { + if (bOpen) + { + XBuffSkillsReplace.DoAdd(entity, ref uibuffInfo.buffInfo.SkillsReplace); + } + else + { + XBuffSkillsReplace.DoRemove(entity, ref uibuffInfo.buffInfo.SkillsReplace); + } + } + } + + public static void DoAdd(XEntity entity, ref SeqListRef list) + { + bool flag = entity == null || entity.Skill == null; + if (!flag) + { + for (int i = 0; i < list.Count; i++) + { + entity.Skill.SetSkillReplace(XSingleton.singleton.XHash(list[i, 0]), XSingleton.singleton.XHash(list[i, 1])); + } + } + } + + public static void DoRemove(XEntity entity, ref SeqListRef list) + { + bool flag = entity == null || entity.Skill == null; + if (!flag) + { + for (int i = 0; i < list.Count; i++) + { + entity.Skill.SetSkillReplace(XSingleton.singleton.XHash(list[i, 0]), 0u); + } + } + } + } +} -- cgit v1.1-26-g67d0