//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Tuesday, August 21, 2018
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using UnityEngine.UI;
|
using System.Collections.Generic;
|
using System;
|
using TableConfig;
|
//神兽强化(神兽属性展示)
|
namespace Snxxz.UI {
|
|
public class GodBeastAttributes:MonoBehaviour {
|
[SerializeField] ItemCell m_ItemCell;
|
[SerializeField] GameObject m_FrameNull;
|
[SerializeField] GameObject m_FullLevel;
|
[SerializeField] GameObject m_BottomDisplay;
|
[SerializeField] IntensifySmoothSlider m_ExpSlider;
|
[SerializeField] Text m_ExpNum;
|
[SerializeField] Text m_TextAttributes;
|
[SerializeField] Text m_TextAttributesAdd;
|
[SerializeField] GodBeastSlidingList m_GodBeastSlidingList;
|
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>();
|
PlayerPackModel _playerPack;
|
PlayerPackModel playerPack { get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } }
|
private int GodBeastNumber=0;//神兽编号
|
private int GodBeastPart = 0;//神兽装备ID
|
|
private int SingleProficiency = 0;//单倍熟练度
|
private int DoubleProficiency = 0;//双倍熟练度
|
private int NeedFairyJade = 0;//所需仙玉
|
private void Start()
|
{
|
|
}
|
private void OnEnable()
|
{
|
GodBeastReinforcementWin.ChooseToModify += ChooseToModify;
|
GodBeastSlidingList.AbsorbEvent += AbsorbEvent;
|
}
|
private void OnDisable()
|
{
|
GodBeastReinforcementWin.ChooseToModify -= ChooseToModify;
|
GodBeastSlidingList.AbsorbEvent -= AbsorbEvent;
|
}
|
|
public void Init()
|
{
|
if (QualityLimit.Count <= 0)
|
{
|
string DogzAssist = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("DogzAssist").Numerical4;//获取不同品质的神兽强化上限
|
QualityLimit = ConfigParse.GetDic<int, int>(DogzAssist);
|
}
|
}
|
|
public void Unit()
|
{
|
|
}
|
|
private void ChooseToModify(int locationMarker)
|
{
|
GetGodBeastLocationMarker(locationMarker);
|
}
|
private void AbsorbEvent(Dictionary<int, int> absorb)
|
{
|
AttributeAssignment();
|
}
|
public void GetGodBeastLocationMarker(int LocationMarker)//获取神兽装备的标记信息
|
{
|
if (LocationMarker != 0)
|
{
|
m_ItemCell.gameObject.SetActive(true);
|
GodBeastNumber = LocationMarker % 100;//神兽编号
|
GodBeastPart = LocationMarker / 100;//神兽装备位ID
|
List<ItemModel> itemModel = dogz_model.GetDogzEquips(GodBeastNumber);
|
if (itemModel != null)
|
{
|
for (int i = 0; i < itemModel.Count; i++)
|
{
|
if (itemModel[i].EquipPlace == GodBeastPart)
|
{
|
ItemCellModel ItemModel = new ItemCellModel(itemModel[i].itemId, true, 0, 1);
|
m_ItemCell.Init(ItemModel);
|
}
|
}
|
}
|
m_FrameNull.SetActive(true);
|
m_FullLevel.SetActive(false);
|
AttributeAssignment();
|
}
|
else
|
{
|
m_ItemCell.gameObject.SetActive(false);
|
m_ExpSlider.stage = 0;
|
m_ExpSlider.delay = 0f;
|
m_ExpSlider.ResetStage();
|
m_ExpSlider.value = 0;
|
m_ExpNum.text = "0/0";
|
m_FrameNull.SetActive(false);
|
m_FullLevel.SetActive(false);
|
}
|
}
|
|
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)
|
{
|
return;
|
}
|
|
GainProficiency();//获取熟练度
|
var IudetDogzEquipPlus = ItemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus);
|
if (IudetDogzEquipPlus != null)
|
{
|
int lv = QualityLimit[ItemModel.chinItemModel.ItemColor];
|
var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart, lv);
|
if (IudetDogzEquipPlus[0] >= lv)
|
{
|
m_FrameNull.SetActive(false);
|
m_FullLevel.SetActive(true);
|
m_ExpSlider.stage = lv;
|
m_ExpSlider.delay = 0f;
|
m_ExpSlider.ResetStage();
|
m_ExpSlider.value = 1;
|
m_ExpNum.text = DogzEquipConfig.upExpTotal + "/" + DogzEquipConfig.upExpTotal;
|
}
|
else
|
{
|
|
|
}
|
}
|
else
|
{
|
var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(GodBeastPart,0);
|
m_ExpNum.text = "0/" + DogzEquipConfig.upExpTotal;
|
}
|
}
|
private void GainProficiency()//获取熟练度
|
{
|
SingleProficiency = 0;
|
DoubleProficiency = 0;
|
NeedFairyJade = 0;
|
Dictionary<int,int> DicAb=m_GodBeastSlidingList.Absorption_Dic;
|
foreach (var key in DicAb.Keys)
|
{
|
ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.rptDogzItem, key);
|
if (itemModel != null)
|
{
|
if (itemModel.chinItemModel.Effect1 == 235)
|
{
|
var IudetDogzEquipPlus = itemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus);
|
SingleProficiency += itemModel.chinItemModel.EffectValueA1* DicAb[key];
|
if (IudetDogzEquipPlus != null)
|
{
|
SingleProficiency += IudetDogzEquipPlus[1];
|
DoubleProficiency += itemModel.chinItemModel.EffectValueA1;
|
}
|
else
|
{
|
DoubleProficiency += itemModel.chinItemModel.EffectValueA1 * 2* DicAb[key];
|
NeedFairyJade += itemModel.chinItemModel.Effect2* DicAb[key];
|
}
|
}
|
}
|
}
|
|
}
|
|
|
}
|
|
}
|