From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/XProfessionSkillMgr.cs | 465 +++++++++++++++++++++ 1 file changed, 465 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XProfessionSkillMgr.cs (limited to 'Client/Assets/Scripts/XMainClient/XProfessionSkillMgr.cs') diff --git a/Client/Assets/Scripts/XMainClient/XProfessionSkillMgr.cs b/Client/Assets/Scripts/XMainClient/XProfessionSkillMgr.cs new file mode 100644 index 00000000..4b072e87 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XProfessionSkillMgr.cs @@ -0,0 +1,465 @@ +using System; +using System.Collections.Generic; +using XMainClient.UI; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XProfessionSkillMgr : XSingleton + { + private XTableAsyncLoader _async_loader = null; + + private ProfSkillTable _reader = new ProfSkillTable(); + + private static List m_FootFx; + + private static List m_ProfPortrait; + + private static List m_TeamIndicateAvatar; + + private static List m_SuperRiskAvatar; + + private static List m_RoleMat; + + private static List m_VisibleDistance; + + private static List m_SelectCharDummyHeight; + + public override bool Init() + { + bool flag = this._async_loader == null; + if (flag) + { + this._async_loader = new XTableAsyncLoader(); + this._async_loader.AddTask("Table/ProfessionSkill", this._reader, false); + this._async_loader.Execute(null); + } + bool flag2 = !this._async_loader.IsDone; + return !flag2; + } + + public static void InitFromGlobalConfig() + { + XProfessionSkillMgr.m_FootFx = XSingleton.singleton.GetStringList("FootFx"); + XProfessionSkillMgr.m_ProfPortrait = XSingleton.singleton.GetStringList("ProfPortrait"); + XProfessionSkillMgr.m_TeamIndicateAvatar = XSingleton.singleton.GetStringList("TeamIndicateAvatar"); + XProfessionSkillMgr.m_SuperRiskAvatar = XSingleton.singleton.GetStringList("SuperRiskAvatar"); + XProfessionSkillMgr.m_RoleMat = XSingleton.singleton.GetStringList("ProfRoleMat"); + XProfessionSkillMgr.m_VisibleDistance = XSingleton.singleton.GetFloatList("VisibleDistance"); + XProfessionSkillMgr.m_SelectCharDummyHeight = XSingleton.singleton.GetFloatList("SelectCharDummyHeight"); + XProfessionSkillMgr.CheckProfessionCount(XProfessionSkillMgr.m_FootFx, "FootFx"); + XProfessionSkillMgr.CheckProfessionCount(XProfessionSkillMgr.m_ProfPortrait, "m_ProfPortrait"); + XProfessionSkillMgr.CheckProfessionCount(XProfessionSkillMgr.m_TeamIndicateAvatar, "m_TeamIndicateAvatar"); + XProfessionSkillMgr.CheckProfessionCount(XProfessionSkillMgr.m_SuperRiskAvatar, "m_SuperRiskAvatar"); + XProfessionSkillMgr.CheckProfessionCount(XProfessionSkillMgr.m_RoleMat, "m_RoleMat"); + XProfessionSkillMgr.CheckProfessionCount(XProfessionSkillMgr.m_VisibleDistance, "m_VisibleDistance"); + XProfessionSkillMgr.CheckProfessionCount(XProfessionSkillMgr.m_SelectCharDummyHeight, "m_SelectCharDummyHeight"); + } + + public static bool CheckProfessionCount(List list, string name) + { + bool flag = list.Count < XGame.RoleCount; + bool result; + if (flag) + { + XSingleton.singleton.AddErrorLog(name, " length (", list.Count.ToString(), ") < ProfCount ", XGame.RoleCount.ToString(), null); + result = false; + } + else + { + result = true; + } + return result; + } + + public override void Uninit() + { + this._async_loader = null; + } + + public void SetProfSkillIds(List lst) + { + for (int i = 0; i < this._reader.Table.Length; i++) + { + bool flag = this._reader.Table[i] != null; + if (flag) + { + lst.Add(this._reader.Table[i].ProfID); + } + } + } + + public List GetMainProfList() + { + List list = new List(); + for (int i = 1; i < 10; i++) + { + ProfSkillTable.RowData byProfID = this._reader.GetByProfID(i); + bool flag = byProfID != null; + if (flag) + { + list.Add(byProfID); + } + } + return list; + } + + public string GetProfName(int profID) + { + ProfSkillTable.RowData byProfID = this._reader.GetByProfID(profID); + bool flag = byProfID != null; + string result; + if (flag) + { + result = byProfID.ProfName; + } + else + { + result = XStringDefineProxy.GetString("PROFESSION_NONE"); + } + return result; + } + + public string GetProfHeadIcon(int profID) + { + ProfSkillTable.RowData byProfID = this._reader.GetByProfID(profID % 10); + bool flag = byProfID != null; + string result; + if (flag) + { + result = byProfID.ProfHeadIcon; + } + else + { + result = ""; + } + return result; + } + + public string GetProfHeadIcon2(int profID) + { + ProfSkillTable.RowData byProfID = this._reader.GetByProfID(profID % 10); + bool flag = byProfID != null; + string result; + if (flag) + { + result = byProfID.ProfHeadIcon2; + } + else + { + result = ""; + } + return result; + } + + public string GetProfIcon(int profID) + { + ProfSkillTable.RowData byProfID = this._reader.GetByProfID(profID); + bool flag = byProfID != null; + string result; + if (flag) + { + result = byProfID.ProfIcon; + } + else + { + result = ""; + } + return result; + } + + public string GetProfPic(int profID) + { + ProfSkillTable.RowData byProfID = this._reader.GetByProfID(profID); + bool flag = byProfID != null; + string result; + if (flag) + { + result = byProfID.ProfPic; + } + else + { + result = ""; + } + return result; + } + + public List GetProfSkillID(int profID) + { + List list = new List(); + ProfSkillTable.RowData byProfID = this._reader.GetByProfID(profID); + bool flag = byProfID != null; + if (flag) + { + bool flag2 = byProfID.Skill1 != ""; + if (flag2) + { + list.Add(XSingleton.singleton.XHash(byProfID.Skill1)); + } + bool flag3 = byProfID.Skill2 != ""; + if (flag3) + { + list.Add(XSingleton.singleton.XHash(byProfID.Skill2)); + } + bool flag4 = byProfID.Skill3 != ""; + if (flag4) + { + list.Add(XSingleton.singleton.XHash(byProfID.Skill3)); + } + bool flag5 = byProfID.Skill4 != ""; + if (flag5) + { + list.Add(XSingleton.singleton.XHash(byProfID.Skill4)); + } + } + return list; + } + + public float GetProfFixedEnmity(int profID) + { + ProfSkillTable.RowData byProfID = this._reader.GetByProfID(profID); + bool flag = byProfID != null; + float result; + if (flag) + { + result = byProfID.FixedEnmity; + } + else + { + result = 0f; + } + return result; + } + + public string GetProfDesc(int profID) + { + ProfSkillTable.RowData byProfID = this._reader.GetByProfID(profID); + bool flag = byProfID != null; + string result; + if (flag) + { + result = byProfID.Description; + } + else + { + result = XStringDefineProxy.GetString("PROFESSION_NONE"); + } + return result; + } + + public uint GetProfOperateLevel(int profID) + { + ProfSkillTable.RowData byProfID = this._reader.GetByProfID(profID); + bool flag = byProfID != null; + uint result; + if (flag) + { + result = byProfID.OperateLevel; + } + else + { + result = 0u; + } + return result; + } + + public bool GetProfIsInLeft(int profID) + { + ProfSkillTable.RowData byProfID = this._reader.GetByProfID(profID); + bool flag = byProfID != null; + return !flag || byProfID.PromoteLR; + } + + public uint GetPromoteExperienceID(int profID) + { + ProfSkillTable.RowData byProfID = this._reader.GetByProfID(profID); + bool flag = byProfID != null; + uint result; + if (flag) + { + result = byProfID.PromoteExperienceID; + } + else + { + XSingleton.singleton.AddLog("Can't find the PromoteExperienceID by profID, ID = ", profID.ToString(), null, null, null, null, XDebugColor.XDebug_None); + result = 0u; + } + return result; + } + + public float GetEnmityCoefficient(int profID) + { + ProfSkillTable.RowData byProfID = this._reader.GetByProfID(profID); + bool flag = byProfID != null; + float result; + if (flag) + { + result = byProfID.EnmityCoefficient; + } + else + { + result = 1f; + } + return result; + } + + public string GetFootFx(uint profID) + { + return XSingleton.singleton.ChooseProfData(XProfessionSkillMgr.m_FootFx, profID); + } + + public string GetPortait(uint profID = 0u) + { + return XSingleton.singleton.ChooseProfData(XProfessionSkillMgr.m_ProfPortrait, profID); + } + + public string GetSuperRiskAvatar(uint profID = 0u) + { + return XSingleton.singleton.ChooseProfData(XProfessionSkillMgr.m_SuperRiskAvatar, profID); + } + + public string GetTeamIndicateAvatar(uint profID) + { + return XSingleton.singleton.ChooseProfData(XProfessionSkillMgr.m_TeamIndicateAvatar, profID); + } + + public float GetVisibleDistance(uint profID = 0u) + { + return XSingleton.singleton.ChooseProfData(XProfessionSkillMgr.m_VisibleDistance, profID); + } + + public float GetSelectCharDummyHeight(uint profID = 0u) + { + return XSingleton.singleton.ChooseProfData(XProfessionSkillMgr.m_SelectCharDummyHeight, profID); + } + + public string GetRoleMaterial(uint profID = 0u) + { + return XSingleton.singleton.ChooseProfData(XProfessionSkillMgr.m_RoleMat, profID); + } + + public string GetHalfPic(uint profID) + { + return this.GetLowerCaseWord(profID); + } + + public string GetLowerCaseWord(uint profID) + { + ProfSkillTable.RowData byProfID = this._reader.GetByProfID((int)(profID % 10u)); + bool flag = byProfID == null; + string result; + if (flag) + { + result = string.Empty; + } + else + { + result = byProfID.ProfWord2; + } + return result; + } + + public string GetUpperCaseWord(uint profID) + { + ProfSkillTable.RowData byProfID = this._reader.GetByProfID((int)(profID % 10u)); + bool flag = byProfID == null; + string result; + if (flag) + { + result = string.Empty; + } + else + { + result = byProfID.ProfWord1; + } + return result; + } + + public string GetEquipPrefabModel(FashionList.RowData data, uint profID) + { + string result; + switch (profID) + { + case 1u: + result = data.ModelPrefabWarrior; + break; + case 2u: + result = data.ModelPrefabArcher; + break; + case 3u: + result = data.ModelPrefabSorcer; + break; + case 4u: + result = data.ModelPrefabCleric; + break; + case 5u: + result = data.ModelPrefab5; + break; + case 6u: + result = data.ModelPrefab6; + break; + case 7u: + result = data.ModelPrefab7; + break; + default: + result = string.Empty; + break; + } + return result; + } + + public string GetProfNameIcon(int profID) + { + ProfSkillTable.RowData byProfID = this._reader.GetByProfID(profID); + bool flag = byProfID != null; + string result; + if (flag) + { + result = byProfID.ProfNameIcon; + } + else + { + result = ""; + } + return result; + } + + public string GetProfIntro(int profID) + { + ProfSkillTable.RowData byProfID = this._reader.GetByProfID(profID); + bool flag = byProfID != null; + string result; + if (flag) + { + result = XSingleton.singleton.ReplaceReturn(byProfID.ProfIntro); + } + else + { + result = ""; + } + return result; + } + + public string GetProfTypeIntro(int profID) + { + ProfSkillTable.RowData byProfID = this._reader.GetByProfID(profID); + bool flag = byProfID != null; + string result; + if (flag) + { + result = XSingleton.singleton.ReplaceReturn(byProfID.ProfTypeIntro); + } + else + { + result = ""; + } + return result; + } + + public bool IsExistProf(int profID) + { + ProfSkillTable.RowData byProfID = this._reader.GetByProfID(profID); + return byProfID != null; + } + } +} -- cgit v1.1-26-g67d0