using System;
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace vnxbqy.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<PetModel>(); } }
|
MountModel m_MountModel;
|
MountModel mountModel { get { return m_MountModel ?? (m_MountModel = ModelCenter.Instance.GetModel<MountModel>()); } }
|
RidingAndPetActivationModel ridingModel { get { return ModelCenter.Instance.GetModel<RidingAndPetActivationModel>(); } }
|
|
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:
|
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 = Language.Get("LoadIconLV", _PetBackpack.PetClass);
|
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 = UIHelper.ReplaceLargeNum(_scoreNumAll);
|
if (_PetBackpack.PetClass >= petinfo.MaxRank)
|
{
|
curPetAttackText1.transform.parent.SetActive(false);
|
curPetHitText1.transform.parent.SetActive(false);
|
curPetAttackSpeedText1.transform.parent.SetActive(false);
|
m_LVtext1.transform.parent.SetActive(false);
|
m_ManJiImageP.SetActive(true);
|
}
|
else
|
{
|
curPetAttackText1.transform.parent.SetActive(true);
|
curPetHitText1.transform.parent.SetActive(true);
|
curPetAttackSpeedText1.transform.parent.SetActive(true);
|
m_LVtext1.transform.parent.SetActive(true);
|
m_ManJiImageP.SetActive(false);
|
m_LVtext1.text = Language.Get("LoadIconLV", (_PetBackpack.PetClass + 1));
|
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 = UIHelper.ReplaceLargeNum(_scoreNumAll1);
|
}
|
}
|
|
}
|
}
|