//-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Tuesday, July 16, 2019 //-------------------------------------------------------- using UnityEngine; using System.Collections; using UnityEngine.UI; using System.Collections.Generic; namespace vnxbqy.UI { public class EquipStarEffectTipModel : Model { EquipModel equipModel { get { return ModelCenter.Instance.GetModel(); } } EquipStarModel starModel { get { return ModelCenter.Instance.GetModel(); } } EquipStrengthModel strengthModel { get { return ModelCenter.Instance.GetModel(); } } EquipTrainModel trainModel { get { return ModelCenter.Instance.GetModel(); } } public Int2 equipPosition { get; private set; } public override void Init() { } public override void UnInit() { } public void Preview(Int2 equipPosition) { this.equipPosition = equipPosition; WindowCenter.Instance.Open(); } public Dictionary> GetSuitEffectInfos(Int2 equipPosition) { var maxStarLevel = EquipStarModel.GetMaxStarLevel(equipPosition.x); if (equipPosition.y >= 1 && equipPosition.y <= 8) { var effectInfos = new Dictionary>(); var configs = EquipSuitConfig.GetConfigs(PlayerDatas.Instance.baseData.Job, equipPosition.x, EquipSuitType.EightSuit); for (int i = 0; i < 19; i += 3) { if (maxStarLevel >= i) { effectInfos[i] = new List(); var twoSuit = equipModel.GetEquipSuitEntry(equipPosition.x, i, EquipSuitType.TwoSuit); var fiveSuit = equipModel.GetEquipSuitEntry(equipPosition.x, i, EquipSuitType.FiveSuit); var eightSuit = equipModel.GetEquipSuitEntry(equipPosition.x, i, EquipSuitType.EightSuit); effectInfos[i].Add(new SuitEffectInfo() { suitType = EquipSuitType.TwoSuit, star = i, actived = twoSuit.actived, properties = twoSuit.properties }); effectInfos[i].Add(new SuitEffectInfo() { suitType = EquipSuitType.FiveSuit, star = i, actived = fiveSuit.actived, properties = fiveSuit.properties }); var skillId = 0; var skillDescription = string.Empty; foreach (var config in configs) { if (config.star == i) { skillId = config.skillID; skillDescription = config.description; break; } } effectInfos[i].Add(new SuitEffectInfo() { suitType = EquipSuitType.EightSuit, star = i, actived = eightSuit.actived, properties = eightSuit.properties, skillId = skillId, skillDescription = skillDescription, }); } } return effectInfos; } else { return null; } } public List GetStarProperties(Int2 equipPosition) { var effectInfos = new List(); var maxStarLevel = EquipStarModel.GetMaxStarLevel(equipPosition.x); var starLevel = starModel.GetEquipStarLevel(equipPosition); var configs = EquipStarConfig.GetConfigs(equipPosition.x, equipPosition.y); var lastStarAttrCount = 0; if (configs == null) return effectInfos; for (var i = 0; i < configs.Count; i++) { var config = configs[i]; if (config.Star <= maxStarLevel && (lastStarAttrCount != config.StarAttrInfo.Length)) { effectInfos.Add(new StarProperty() { star = config.Star, actived = starLevel >= config.Star, property = config.StarAttrInfo[config.StarAttrInfo.Length - 1] }); } lastStarAttrCount = config.StarAttrInfo.Length; } return effectInfos; } public List GetGemHoleInfos(Int2 equipPosition) { var effectInfos = new List(); var maxStarLevel = EquipStarModel.GetMaxStarLevel(equipPosition.x); var starLevel = starModel.GetEquipStarLevel(equipPosition); if (maxStarLevel >= 0) { effectInfos.Add(new GemHoleInfo() { star = 0, actived = starLevel >= 0, index = 1 }); } if (maxStarLevel >= 2) { effectInfos.Add(new GemHoleInfo() { star = 2, actived = starLevel >= 2, index = 2 }); } if (maxStarLevel >= 5) { effectInfos.Add(new GemHoleInfo() { star = 5, actived = starLevel >= 5, index = 3 }); } return effectInfos; } public List GetStrengthLevelInfos(Int2 equipPosition) { var effectInfos = new List(); var maxStarLevel = EquipStarModel.GetMaxStarLevel(equipPosition.x); var starLevel = starModel.GetEquipStarLevel(equipPosition); var strengthType = EquipStrengthModel.GetEquipStrengthType(equipPosition.y); var lastStarStrengthLevel = 0; for (int i = 0; i <= maxStarLevel; i++) { var levelLimit = strengthModel.GetEquipLevelMax(strengthType, i); if (levelLimit != 0 && lastStarStrengthLevel != levelLimit) { effectInfos.Add(new StrengthLevelInfo() { star = i, actived = starLevel >= i, level = levelLimit }); } lastStarStrengthLevel = levelLimit; } return effectInfos; } public List GetTrainLevelInfos(Int2 equipPosition) { var effectInfos = new List(); var maxStarLevel = EquipStarModel.GetMaxStarLevel(equipPosition.x); var starLevel = starModel.GetEquipStarLevel(equipPosition); var type = EquipTrainModel.GetTrainType(equipPosition.y); var lastStarTrainLevel = 0; for (int i = 0; i <= maxStarLevel; i++) { var config = WashLevelMaxConfig.Get(type, i); var levelLimit = config.levelMax; if (levelLimit != lastStarTrainLevel) { effectInfos.Add(new TrainLevelInfo() { star = i, actived = starLevel >= i, level = levelLimit }); } lastStarTrainLevel = levelLimit; } return effectInfos; } public List DisplayStarProperty(Int2 equipPosition) { var effectInfos = GetStarProperties(equipPosition); var descriptions = new List(); for (var i = 0; i < effectInfos.Count; i++) { var info = effectInfos[i]; var property = PlayerPropertyConfig.GetFullDescription(info.property.x, info.property.y); var tmpString = Language.Get("EquipStar1", EquipStarEffectTipModel.GetStarNumberCHS(info.star), property); descriptions.Add(info.actived ? UIHelper.AppendColor(TextColType.Green, tmpString, true) : UIHelper.AppendColor(TextColType.White, tmpString, true)); } return descriptions; } public List GetNextTwoSpecialEffect(Int2 equipPosition) { var specialEffects = new List(); var maxStarLevel = EquipStarModel.GetMaxStarLevel(equipPosition.x); var starLevel = starModel.GetStarLevel(equipPosition); if (starLevel == maxStarLevel) { var suitLevel = starLevel - starLevel % 3; specialEffects.Add(Language.Get("EquipStar2", GetStarNumberCHS(starLevel), GetStarNumberCHS(suitLevel))); var equipStarConfig = EquipStarConfig.Get(equipPosition.x, equipPosition.y, starLevel); var property = equipStarConfig.StarAttrInfo[equipStarConfig.StarAttrInfo.Length - 1]; specialEffects.Add(Language.Get("EquipStar3", GetStarNumberCHS(starLevel), PlayerPropertyConfig.GetFullDescription(property.x, property.y) )); return specialEffects; } if (equipPosition.y >= 1 && equipPosition.y <= 8) { if (starLevel % 3 == 2) { var suitLevel = starLevel - starLevel % 3; specialEffects.Add(Language.Get("EquipStar2", GetStarNumberCHS(starLevel + 1), GetStarNumberCHS(suitLevel))); } } var nowStarConfig = EquipStarConfig.Get(equipPosition.x, equipPosition.y, starLevel); var nextStarConfig = EquipStarConfig.Get(equipPosition.x, equipPosition.y, starLevel + 1); if (nowStarConfig == null || nowStarConfig.StarAttrInfo.Length != nextStarConfig.StarAttrInfo.Length) { var property = nextStarConfig.StarAttrInfo[nextStarConfig.StarAttrInfo.Length - 1]; specialEffects.Add(Language.Get("EquipStar3", GetStarNumberCHS(starLevel + 1), PlayerPropertyConfig.GetFullDescription(property.x, property.y) )); } if (specialEffects.Count >= 2) { return specialEffects; } //var strengthType = EquipStrengthModel.GetEquipStrengthType(equipPosition.y); //var nowStrengthLevel = strengthModel.GetEquipLevelMax(strengthType, starLevel); //var nextStrengthLevel = strengthModel.GetEquipLevelMax(strengthType, starLevel + 1); //if (nowStrengthLevel != nextStrengthLevel) //{ // specialEffects.Add(string.Format("【{0}星】{1}", // GetStarNumberCHS(starLevel + 1), // string.Format("强化等级提升至{0}", nextStrengthLevel) // )); //} //if (specialEffects.Count >= 2) //{ // return specialEffects; //} if (starLevel == 1 || starLevel == 4) { specialEffects.Add(Language.Get("EquipStar3", GetStarNumberCHS(starLevel + 1), Language.Get("StarUpgradeSuccessTip3", GetStarNumberCHS(starLevel == 1 ? 1 : 2)) )); } if (specialEffects.Count >= 2) { return specialEffects; } var type = EquipTrainModel.GetTrainType(equipPosition.y); var nowConfig = WashLevelMaxConfig.Get(type, starLevel); var nowTrainLevel = nowConfig.levelMax; var nextConfig = WashLevelMaxConfig.Get(type, starLevel + 1); var nextTrainLevel = nextConfig.levelMax; if (nowTrainLevel != nextTrainLevel) { specialEffects.Add(Language.Get("EquipStar3", GetStarNumberCHS(starLevel + 1), Language.Get("EquipStar4", nextTrainLevel) )); } return specialEffects; } public static string GetStarNumberCHS(int star) { return Language.Get("Num_CHS_" + star); } public struct SuitEffectInfo { public int star; public bool actived; public EquipSuitType suitType; public List properties; public int skillId; public string skillDescription; } public struct StarProperty { public int star; public bool actived; public Int2 property; } public struct GemHoleInfo { public int star; public bool actived; public int index; } public struct StrengthLevelInfo { public int star; public bool actived; public int level; } public struct TrainLevelInfo { public int star; public bool actived; public int level; } } }