| | |
| | | using System; |
| | | using TableConfig; |
| | | //神兽强化(神兽属性展示) |
| | | namespace Snxxz.UI { |
| | | namespace Snxxz.UI
|
| | | { |
| | | |
| | | public class GodBeastAttributes:MonoBehaviour { |
| | | public class GodBeastAttributes : MonoBehaviour
|
| | | { |
| | | [SerializeField] ItemCell m_ItemCell; |
| | | [SerializeField] GameObject m_FrameNull; |
| | | [SerializeField] GameObject m_FullLevel; |
| | | [SerializeField] GameObject m_BottomDisplay; |
| | | [SerializeField] Text m_LvNowText;
|
| | | [SerializeField] Text m_LvNextText; |
| | | |
| | | [SerializeField] IntensifySmoothSlider m_ExpSlider; |
| | | [SerializeField] Text m_ExpNum; |
| | | [SerializeField] Text m_TextAttributes; |
| | | [SerializeField] Text m_TextAttributesAdd;
|
| | | |
| | | [SerializeField] Text m_TextAttributes1; |
| | | [SerializeField] Text m_TextAttributesAdd1;
|
| | | [SerializeField] Text m_TextAttributes2; |
| | | [SerializeField] Text m_TextAttributesAdd2;
|
| | | [SerializeField] GodBeastSlidingList m_GodBeastSlidingList;
|
| | |
|
| | | [SerializeField] Toggle m_DoubleToggle;
|
| | | [SerializeField] Button m_StrengthenBtn;
|
| | | DogzModel Dogz_model;
|
| | | DogzModel dogz_model { get { return Dogz_model ?? (Dogz_model = ModelCenter.Instance.GetModel<DogzModel>()); } } |
| | | private Dictionary<int, int> QualityLimit = new Dictionary<int, int>();
|
| | |
| | | private int GodBeastNumber=0;//神兽编号 |
| | | private int GodBeastPart = 0;//神兽装备ID |
| | | |
| | | private int DogZLv = 0;//获取神兽等级 |
| | | private int DogZExp = 0;//熟练度 |
| | | |
| | | private ItemModel m_DogZItemModel = null; |
| | | private int SingleProficiency = 0;//单倍熟练度 |
| | | private int DoubleProficiency = 0;//双倍熟练度 |
| | | private int NeedFairyJade = 0;//所需仙玉 |
| | | private void Start()
|
| | | {
|
| | | |
| | | m_DoubleToggle.onValueChanged.AddListener(OnClickToggle);
|
| | | m_StrengthenBtn.AddListener(OnClickStrengthBtn);
|
| | | } |
| | | private void OnEnable()
|
| | | {
|
| | | if (m_DoubleToggle.isOn)
|
| | | {
|
| | | m_DoubleToggle.isOn = false;
|
| | | }
|
| | | GodBeastReinforcementWin.ChooseToModify += ChooseToModify;
|
| | | GodBeastSlidingList.AbsorbEvent += AbsorbEvent;
|
| | | }
|
| | |
| | |
|
| | | }
|
| | |
|
| | | private void OnClickToggle(bool Isbool)
|
| | | {
|
| | | AttributeAssignment();
|
| | | }
|
| | | private void OnClickStrengthBtn()
|
| | | {
|
| | |
|
| | | }
|
| | | private void ChooseToModify(int locationMarker)
|
| | | {
|
| | | GetGodBeastLocationMarker(locationMarker);
|
| | | }
|
| | | private void AbsorbEvent(Dictionary<int, int> absorb)
|
| | | {
|
| | | GetDogZLevelAndExp();
|
| | | AttributeAssignment();
|
| | | }
|
| | | public void GetGodBeastLocationMarker(int LocationMarker)//获取神兽装备的标记信息
|
| | |
| | | }
|
| | | m_FrameNull.SetActive(true);
|
| | | m_FullLevel.SetActive(false);
|
| | | GetDogZLevelAndExp();
|
| | | AttributeAssignment();
|
| | | }
|
| | | else
|
| | |
| | |
|
| | | public void AttributeAssignment()
|
| | | {
|
| | | List<ItemModel> itemModel = dogz_model.GetDogzEquips(GodBeastNumber);
|
| | | ItemModel ItemModel=null;
|
| | | if (itemModel != null)
|
| | | {
|
| | | for (int i = 0; i < itemModel.Count; i++)
|
| | | {
|
| | | if (itemModel[i].EquipPlace == GodBeastPart)
|
| | | {
|
| | | ItemModel = itemModel[i];
|
| | | }
|
| | | }
|
| | | }
|
| | | if (ItemModel == null)
|
| | | if (m_DogZItemModel == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | GainProficiency();//获取熟练度
|
| | | var IudetDogzEquipPlus = ItemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus);
|
| | | var IudetDogzEquipPlus = m_DogZItemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus);
|
| | | if (IudetDogzEquipPlus != null)
|
| | | {
|
| | | int lv = QualityLimit[ItemModel.chinItemModel.ItemColor];
|
| | | int lv = QualityLimit[m_DogZItemModel.chinItemModel.ItemColor];
|
| | | var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, lv);
|
| | | if (IudetDogzEquipPlus[0] >= lv)
|
| | | if (DogZLv >= lv)
|
| | | {
|
| | | m_FrameNull.SetActive(false);
|
| | | m_FullLevel.SetActive(true);
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | |
|
| | | if (m_DoubleToggle.isOn)
|
| | | {
|
| | | PropertySetting(DogZExp, DoubleProficiency);
|
| | | }
|
| | | else
|
| | | {
|
| | | PropertySetting(DogZExp, SingleProficiency);
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart,0);
|
| | | m_ExpNum.text = "0/" + DogzEquipConfig.upExpTotal;
|
| | | if (m_DoubleToggle.isOn)
|
| | | {
|
| | | PropertySetting(0, DoubleProficiency);
|
| | | }
|
| | | else
|
| | | {
|
| | | PropertySetting(0, SingleProficiency);
|
| | | }
|
| | | }
|
| | | private void GainProficiency()//获取熟练度
|
| | | }
|
| | | private void GainProficiency()//选中装备的获取熟练度
|
| | | {
|
| | | SingleProficiency = 0;
|
| | | DoubleProficiency = 0;
|
| | |
| | | }
|
| | |
|
| | | }
|
| | | private void PropertySetting(int ExpTotalNow, int ToExpTotal)//属性设置
|
| | | {
|
| | | m_FrameNull.gameObject.SetActive(true);
|
| | | m_FullLevel.SetActive(false);
|
| | | int toLv = ToLv(ToExpTotal);
|
| | | m_LvNowText.text = "+"+DogZLv.ToString();
|
| | | if (DogZLv == toLv)
|
| | | {
|
| | | m_LvNextText.text = "+"+(toLv + 1).ToString();
|
| | | }
|
| | | else
|
| | | {
|
| | | m_LvNextText.text = "+"+toLv.ToString();
|
| | | }
|
| | | var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, DogZLv);
|
| | | if (ToExpTotal == 0)
|
| | | {
|
| | | m_ExpNum.text = DogZExp + "/" + DogzEquipConfig.upExpTotal;
|
| | | }
|
| | | else
|
| | | {
|
| | | m_ExpNum.text = DogZExp + "+" + ToExpTotal + "/" + DogzEquipConfig.upExpTotal;
|
| | | }
|
| | | }
|
| | |
|
| | | private int ToLv(int ToExpTotal)//获取等到达的熟练度等级
|
| | | {
|
| | | int DogzLv = 0;
|
| | | if (m_DogZItemModel == null)
|
| | | {
|
| | | return DogzLv;
|
| | | }
|
| | | int lv = QualityLimit[m_DogZItemModel.chinItemModel.ItemColor];
|
| | | for (int i = lv; i >=0; i--)
|
| | | {
|
| | | var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, i);
|
| | | if (ToExpTotal < DogzEquipConfig.upExpTotal)
|
| | | {
|
| | | DogzLv = DogzEquipConfig.level;
|
| | | }
|
| | | }
|
| | | var DogzEquipMaxConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, lv);
|
| | | if (ToExpTotal >= DogzEquipMaxConfig.upExpTotal)
|
| | | {
|
| | | DogzLv = DogzEquipMaxConfig.level;
|
| | | }
|
| | | return DogzLv;
|
| | | }
|
| | |
|
| | | private void GetDogZLevelAndExp()//获取当前所选选择神兽的等级和熟练度
|
| | | {
|
| | | DogZLv = 0;
|
| | | DogZExp = 0;
|
| | | m_DogZItemModel = null;
|
| | | List<ItemModel> itemModel = dogz_model.GetDogzEquips(GodBeastNumber);
|
| | | ItemModel ItemModel = null;
|
| | | if (itemModel != null)
|
| | | {
|
| | | for (int i = 0; i < itemModel.Count; i++)
|
| | | {
|
| | | if (itemModel[i].EquipPlace == GodBeastPart)
|
| | | {
|
| | | ItemModel = itemModel[i];
|
| | | }
|
| | | }
|
| | | }
|
| | | if (ItemModel == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | m_DogZItemModel = ItemModel;
|
| | | var IudetDogzEquipPlus = ItemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus);
|
| | | if (IudetDogzEquipPlus != null)
|
| | | {
|
| | | DogZLv = IudetDogzEquipPlus[0];
|
| | | DogZExp = IudetDogzEquipPlus[1];
|
| | | }
|
| | | }
|
| | | } |
| | | |
| | | } |