using System; using System.Collections.Generic; using TableConfig; using UnityEngine; namespace Snxxz.UI { public static class ActivateShow { public static ActivateFunc activateType { get; private set; } public static List propertyCompares = new List(); public static int fightPower { get; private set; } public static string titleIconKey { get; private set; } public static List skills = new List(); public static int currentLv { get; private set; } public static int beforeLv { get; private set; } public static int godWeaponType { get; private set; } private static Dictionary propertyUpDict = new Dictionary(); public static event Action prepareFlySkillEvent; public static event Action complelteFlySkillEvent; public static void RealmActivate(int _lv) { activateType = ActivateFunc.Realm; propertyCompares.Clear(); propertyUpDict.Clear(); beforeLv = _lv - 1; currentLv = _lv; var _beforeConfig = ConfigManager.Instance.GetTemplate(_lv - 1); List _beforeProperties = new List(); if (_beforeConfig != null) { _beforeProperties.AddRange(_beforeConfig.AddAttrType); } var config = ConfigManager.Instance.GetTemplate(_lv); for (int i = 0; i < config.AddAttrType.Length; i++) { var _index = _beforeProperties.IndexOf(config.AddAttrType[i]); if (_index == -1 || config.AddAttrNum[i] > _beforeConfig.AddAttrNum[_index]) { propertyUpDict.Add(config.AddAttrType[i], config.AddAttrNum[i] - (_index == -1 ? 0 : _beforeConfig.AddAttrNum[_index])); propertyCompares.Add(new PropertyCompare() { key = config.AddAttrType[i], beforeValue = _index == -1 ? 0 : _beforeConfig.AddAttrNum[_index], currentValue = config.AddAttrNum[i] }); } } fightPower = UIHelper.GetFightPower(propertyUpDict); titleIconKey = "UI_JH_3"; if (!WindowCenter.Instance.CheckOpen()) { WindowCenter.Instance.Open(); } } public static void GodWeaponActivate(int _type, int _lv, int _beforeLv) { activateType = ActivateFunc.GodWeapon; currentLv = _lv; godWeaponType = _type; beforeLv = _beforeLv; skills.Clear(); propertyCompares.Clear(); propertyUpDict.Clear(); var _model = ModelCenter.Instance.GetModel(); if (_model.godWeaponSkillDict.ContainsKey(_type)) { var _dict = _model.godWeaponSkillDict[_type]; var _skillid = 0; if (_beforeLv == 0) { foreach (var _key in _dict.Keys) { skills.Add(_dict[_key]); } } else if (_model.TryGetUnlockSkill(godWeaponType, _beforeLv, _lv, out _skillid)) { skills.Add(_skillid); } } var _beforeConfig = GodWeaponConfig.GetGodWeaponCfgByTypeLv(_type, _beforeLv); List _beforeProperties = new List(); if (_beforeConfig != null) { _beforeProperties.AddRange(_beforeConfig.AttrType); } var config = GodWeaponConfig.GetGodWeaponCfgByTypeLv(_type, currentLv); for (int i = 0; i < config.AttrType.Length; i++) { var _index = _beforeProperties.IndexOf(config.AttrType[i]); if (_index == -1 || config.AttrNum[i] > _beforeConfig.AttrNum[_index]) { propertyUpDict.Add(config.AttrType[i], config.AttrNum[i] - (_index == -1 ? 0 : _beforeConfig.AttrNum[_index])); propertyCompares.Add(new PropertyCompare() { key = config.AttrType[i], beforeValue = _index == -1 ? 0 : _beforeConfig.AttrNum[_index], currentValue = config.AttrNum[i] }); } } fightPower = UIHelper.GetFightPower(propertyUpDict); if (_beforeLv != 0) { for (int i = 0; i < skills.Count; i++) { var skillConfig = ConfigManager.Instance.GetTemplate(skills[i]); fightPower += skillConfig.FightPower; } } titleIconKey = _beforeLv == 0 ? "UI_JH_12" : "UI_JH_6"; if (!WindowCenter.Instance.CheckOpen()) { WindowCenter.Instance.Open(); } } public static void StoveUpgrade(int stoveLv) { activateType = ActivateFunc.Stove; propertyCompares.Clear(); propertyUpDict.Clear(); skills.Clear(); beforeLv = stoveLv - 1; currentLv = stoveLv; var model = ModelCenter.Instance.GetModel(); for(int i = 0; i < model.alchemyModellist.Count; i++) { if(stoveLv == model.alchemyModellist[i].BlastFurnaceLV) { skills.Add(model.alchemyModellist[i].AlchemyID); } } var _beforeConfig = ConfigManager.Instance.GetTemplate(beforeLv); List _beforeProperties = new List(); if (_beforeConfig != null) { _beforeProperties.AddRange(_beforeConfig.AttrID); } var config = ConfigManager.Instance.GetTemplate(stoveLv); for (int i = 0; i < config.AttrID.Length; i++) { var _index = _beforeProperties.IndexOf(config.AttrID[i]); if (_index == -1 || config.AttrValue[i] > _beforeConfig.AttrValue[_index]) { propertyUpDict.Add(config.AttrID[i], config.AttrValue[i] - (_index == -1 ? 0 : _beforeConfig.AttrValue[_index])); propertyCompares.Add(new PropertyCompare() { key = config.AttrID[i], beforeValue = _index == -1 ? 0 : _beforeConfig.AttrValue[_index], currentValue = config.AttrValue[i] }); } } fightPower = UIHelper.GetFightPower(propertyUpDict); titleIconKey = "XT_LD_01"; if (!WindowCenter.Instance.CheckOpen()) { WindowCenter.Instance.Open(); } } public static void PrepareSkillFly() { if (prepareFlySkillEvent != null) { prepareFlySkillEvent(activateType, skills[0]); } } public static void CompleteSkillFly() { if (complelteFlySkillEvent != null) { complelteFlySkillEvent(activateType); } } public enum ActivateFunc { Realm, GodWeapon, Stove, //炼丹炉升级 } public struct PropertyCompare { public int key; public int beforeValue; public int currentValue; } } }