using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public enum PropertyTip { Mount = 0, Pet = 1, } public class TargetPetAttrWin : Window { [Header("当前属性名称")] [SerializeField] Text m_Property_Text;//属性名称 [Header("当前宠物属性弹框")] [SerializeField] GameObject NowAttTipPet;//当前属性列表 [SerializeField] Text m_LVtext;//等级 [SerializeField] Text curPetAttackText;//战斗力 [SerializeField] Text curPetHitText;//攻击力 [SerializeField] Text curPetAttackSpeedText;//攻击速度 [SerializeField] GameObject NowAttTipPet1;//下级属性列表 [SerializeField] Text m_LVtext1;//等级 [SerializeField] Text curPetAttackText1;//战斗力 [SerializeField] Text curPetHitText1;//攻击力 [SerializeField] Text curPetAttackSpeedText1;//攻击速度 [SerializeField] GameObject m_ManJiImageP;//满级 [Header("当前坐骑属性弹框")] [SerializeField] GameObject NowAttTipMount;//当前属性面板 [SerializeField] Text m_LVtextP;//等级 [SerializeField] Text curMountFightingText;//战斗力 [SerializeField] Text curMountAttackText;//攻击 [SerializeField] Text curMountLifeText;//生命 [SerializeField] Text curMountSpeedText;//速度 [SerializeField] GameObject NowAttTipMount1;//下级属性面板 [SerializeField] Text m_LVtextP1;//等级 [SerializeField] Text curMountFightingText1;//战斗力1 [SerializeField] Text curMountAttackText1;//攻击1 [SerializeField] Text curMountLifeText1;//生命1 [SerializeField] Text curMountSpeedText1;//速度1 [SerializeField] GameObject m_ManJiImage;//满级 [Header("关闭按钮")] [SerializeField] Button m_CloseButton;//满级 PetModel petmodel { get { return ModelCenter.Instance.GetModel(); } } MountModel m_MountModel; MountModel mountModel { get { return m_MountModel ?? (m_MountModel = ModelCenter.Instance.GetModel()); } } RidingAndPetActivationModel ridingModel { get { return ModelCenter.Instance.GetModel(); } } protected override void BindController() { } protected override void AddListeners() { m_CloseButton.AddListener(()=> { Close(); }); } protected override void OnPreOpen() { PropertyMountAndPet(ridingModel.property, ridingModel.RidingId); } protected override void OnAfterOpen() { } protected override void OnPreClose() { } protected override void OnAfterClose() { } public void PropertyMountAndPet(PropertyTip propertyTip, int Id) { switch (propertyTip) { case PropertyTip.Mount: CurMountAttrCtrl(Id); break; case PropertyTip.Pet: CurPetAttrCtrl(); break; } } private void CurPetAttrCtrl() { NowAttTipMount.SetActive(false); NowAttTipMount1.SetActive(false); NowAttTipPet.SetActive(true); NowAttTipPet1.SetActive(true); var petInfoConfig = PetInfoConfig.Get(petmodel.curPetId); if (petInfoConfig == null) return; PetBackpack _PetBackpack = petmodel._DicPetBack[petInfoConfig.ID]; PetClassCostConfig _tagPetClass = PetClassCostConfig.GetPetIdAndRank(petInfoConfig.ID, _PetBackpack.PetClass); PetInfoConfig petinfo = PetInfoConfig.Get(petmodel.curPetId); m_Property_Text.text = Language.Get("SpiritPetAttribute_Z"); curPetHitText.text = _tagPetClass.AtkAdd.ToString();//攻击力 m_LVtext.text = _PetBackpack.PetClass + Language.Get("Z1041"); float AtkNum = (float)UIHelper.GetPropertyValue(PropertyType.ATKSPEED) / 100; curPetAttackSpeedText.text = ((float)Math.Round(AtkNum, 1)).ToString(); PetInfoConfig config = PetInfoConfig.Get(petmodel.curPetId); int[] strNumberSkill = config.SkillID; int[] strSkillUnLock = config.SkillUnLock; int _scoreNum = 0; int _scoreNumAll = 0; for (int i = 0; i < strSkillUnLock.Length; i++) { if (_PetBackpack.PetClass >= strSkillUnLock[i]) { SkillConfig skillconfig = SkillConfig.Get(strNumberSkill[i]); if (skillconfig != null) { _scoreNum += skillconfig.FightPower; } } } _scoreNumAll = Mathf.FloorToInt(_tagPetClass.AtkAdd * 2.5f) + _scoreNum; curPetAttackText.text = _scoreNumAll.ToString(); if (_PetBackpack.PetClass >= petinfo.MaxRank) { curPetAttackText1.transform.parent.gameObject.SetActive(false); curPetHitText1.transform.parent.gameObject.SetActive(false); curPetAttackSpeedText1.transform.parent.gameObject.SetActive(false); m_LVtext1.transform.parent.gameObject.SetActive(false); m_ManJiImageP.SetActive(true); } else { curPetAttackText1.transform.parent.gameObject.SetActive(true); curPetHitText1.transform.parent.gameObject.SetActive(true); curPetAttackSpeedText1.transform.parent.gameObject.SetActive(true); m_LVtext1.transform.parent.gameObject.SetActive(true); m_ManJiImageP.SetActive(false); m_LVtext1.text= (_PetBackpack.PetClass+1) + Language.Get("Z1041"); PetClassCostConfig _tagPetClassNext = PetClassCostConfig.GetPetIdAndRank(petInfoConfig.ID, _PetBackpack.PetClass+1); curPetHitText1.text = _tagPetClassNext.AtkAdd.ToString();//攻击力 curPetAttackSpeedText1.text= ((float)Math.Round(AtkNum, 1)).ToString(); int _scoreNum1 = 0; int _scoreNumAll1 = 0; for (int i = 0; i < strSkillUnLock.Length; i++) { if ((_PetBackpack.PetClass+1) >= strSkillUnLock[i]) { SkillConfig skillconfig = SkillConfig.Get(strNumberSkill[i]); if (skillconfig != null) { _scoreNum1 += skillconfig.FightPower; } } } _scoreNumAll1 = Mathf.FloorToInt(_tagPetClassNext.AtkAdd * 2.5f) + _scoreNum1; curPetAttackText1.text = _scoreNumAll1.ToString(); } } List MountSkills = new List(); private void CurMountAttrCtrl(int ID) { MountSkills.Clear(); foreach (var key in mountModel.GetMountSkillAndItem.Keys) { if (mountModel.GetMountSkillAndItem[key].HorseID == ID) { MountSkills.Add(mountModel.GetMountSkillAndItem[key]); } } NowAttTipPet1.SetActive(false); NowAttTipPet.SetActive(false); NowAttTipMount.SetActive(true); NowAttTipMount1.SetActive(true); HorseConfig horseconfig = HorseConfig.Get(ID); HorseUpConfig horseUpconfig = HorseUpConfig.GetHorseIDAndLV(ID, mountModel._DicHorse[ID].Lv); m_Property_Text.text = Language.Get("MountAttributes_Z"); m_LVtextP.text = mountModel._DicHorse[ID].Lv + Language.Get("Z1041"); int[] strAttrValue = horseUpconfig.AttrValue; Dictionary AddPowerDic = new Dictionary(); AddPowerDic.Clear(); if (strAttrValue.Length != 0) { curMountLifeText.text = strAttrValue[0].ToString();//生命 curMountAttackText.text = strAttrValue[1].ToString();//攻击 curMountSpeedText.text = strAttrValue[2].ToString();//速度 AddPowerDic.Add(6, strAttrValue[0]); AddPowerDic.Add(7, strAttrValue[1]); } int _scoreNum = 0; int _scoreNumAll = 0; for (int i = 0; i < MountSkills.Count; i++) { if (mountModel._DicHorse[ID].Lv >= MountSkills[i].HorseLV) { SkillConfig skillconfig = SkillConfig.Get(MountSkills[i].SkillID); if (skillconfig != null) { _scoreNum += skillconfig.FightPower; } } } _scoreNumAll = UIHelper.GetFightPower(AddPowerDic) + _scoreNum; curMountFightingText.text = _scoreNumAll.ToString(); if (mountModel._DicHorse[ID].Lv >= horseconfig.MaxLV) { m_LVtextP1.transform.parent.gameObject.SetActive(false); curMountFightingText1.transform.parent.gameObject.SetActive(false); curMountLifeText1.transform.parent.gameObject.SetActive(false); curMountAttackText1.transform.parent.gameObject.SetActive(false); curMountSpeedText1.transform.parent.gameObject.SetActive(false); m_ManJiImage.SetActive(true); } else { m_ManJiImage.SetActive(false); m_LVtextP1.transform.parent.gameObject.SetActive(true); curMountFightingText1.transform.parent.gameObject.SetActive(true); curMountLifeText1.transform.parent.gameObject.SetActive(true); curMountAttackText1.transform.parent.gameObject.SetActive(true); curMountSpeedText1.transform.parent.gameObject.SetActive(true); m_LVtextP1.text = (mountModel._DicHorse[ID].Lv+1) + Language.Get("Z1041"); HorseUpConfig horseUpconfigNext = HorseUpConfig.GetHorseIDAndLV(ID, mountModel._DicHorse[ID].Lv + 1); int[] strAttrValueNext = horseUpconfigNext.AttrValue; Dictionary AddPowerDic1 = new Dictionary(); AddPowerDic1.Clear(); if (strAttrValueNext.Length != 0) { curMountLifeText1.text = strAttrValueNext[0].ToString();//生命 curMountAttackText1.text = strAttrValueNext[1].ToString();//攻击 curMountSpeedText1.text = strAttrValueNext[2].ToString();//速度 AddPowerDic1.Add(6, strAttrValueNext[0]); AddPowerDic1.Add(7, strAttrValueNext[1]); } int _scoreNum1 = 0; int _scoreNumAll1 = 0; for (int i = 0; i < MountSkills.Count; i++) { if (mountModel._DicHorse[ID].Lv+1 >= MountSkills[i].HorseLV) { SkillConfig skillconfig = SkillConfig.Get(MountSkills[i].SkillID); if (skillconfig != null) { _scoreNum1 += skillconfig.FightPower; } } } _scoreNumAll1 = UIHelper.GetFightPower(AddPowerDic1) + _scoreNum1; curMountFightingText1.text = _scoreNumAll1.ToString();//战斗力 } } } }