using vnxbqy.UI;
|
using System;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
using LitJson;
|
|
class TreasurePavilionUpgradeLVCell : ILBehaviour
|
{
|
List<Text> baseAttrList = new List<Text>();
|
List<ItemCell> items = new List<ItemCell>();
|
Button lvBtn;
|
Text maxText;
|
|
PackModel packModel { get { return ModelCenter.Instance.GetModelEx<PackModel>(); } }
|
|
protected override void Awake()
|
{
|
for (int i = 0; i < 3; i++)
|
{
|
baseAttrList.Add(proxy.GetWidgtEx<Text>("attr" + i));
|
}
|
|
for (int i = 0; i < 3; i++)
|
{
|
items.Add(proxy.GetWidgtEx<ItemCell>("itemCell" + i));
|
}
|
lvBtn = proxy.GetWidgtEx<Button>("lvBtn");
|
maxText = proxy.GetWidgtEx<Text>("Text");
|
}
|
|
|
|
public void Display(int gubaoID)
|
{
|
var gubaoInfo = TreasurePavilionModel.Instance.TryGetGubaoInfo(gubaoID);
|
var config = ILGubaoConfig.Get(gubaoID);
|
var lvConfig = ILGubaoLVConfig.Get(ILGubaoLVConfig.GetGubaoQualityLVIndex(config.GubaoType, config.GubaoQuality, gubaoInfo[1]));
|
int nextindex = ILGubaoLVConfig.GetGubaoQualityLVIndex(config.GubaoType, config.GubaoQuality, gubaoInfo[1] + 1);
|
for (int i = 0; i < baseAttrList.Count; i++)
|
{
|
if (i < lvConfig.LVAttrTypeList.Length)
|
{
|
baseAttrList[i].SetActiveIL(true);
|
if (nextindex == -1)
|
{
|
baseAttrList[i].text = PlayerPropertyConfig.GetFullDescription(lvConfig.LVAttrTypeList[i], lvConfig.LVAttrValueList[i]);
|
}
|
else
|
{
|
var nextLVConfig = ILGubaoLVConfig.Get(nextindex);
|
var nextStr = UIHelper.AppendColor(TextColType.Green, " +" + (nextLVConfig.LVAttrValueList[i] - lvConfig.LVAttrValueList[i]));
|
baseAttrList[i].text = PlayerPropertyConfig.GetFullDescription(lvConfig.LVAttrTypeList[i], lvConfig.LVAttrValueList[i]) + nextStr;
|
}
|
}
|
else
|
{
|
baseAttrList[i].SetActiveIL(false);
|
}
|
}
|
if (nextindex == -1)
|
{
|
for (int i = 0; i < items.Count; i++)
|
{
|
items[i].SetActiveIL(false);
|
}
|
lvBtn.SetActiveIL(false);
|
maxText.SetActiveIL(true);
|
}
|
else
|
{
|
var nextLVConfig = ILGubaoLVConfig.Get(nextindex);
|
var needItems = ILGubaoLVConfig.GetGubaoQualityLVItems(config.GubaoType, config.GubaoQuality, gubaoInfo[1]);
|
for (int i = 0; i < items.Count; i++)
|
{
|
if (i < needItems.Count)
|
{
|
int itemID = needItems[i].x;
|
int cnt = needItems[i].y;
|
int hasCnt = packModel.GetItemCountByID(PackType.Item, itemID);
|
items[i].SetActiveIL(true);
|
items[i].Init(new ItemCellModel(itemID, false, 0));
|
items[i].button.SetListener(()=> {
|
ItemTipUtility.Show(itemID);
|
});
|
var cntTxt = items[i].transform.Find("Text").GetComponent<Text>();
|
cntTxt.text = hasCnt + "/" + cnt;
|
cntTxt.color = UIHelper.GetUIColor(hasCnt >= cnt ? TextColType.Green : TextColType.Red);
|
}
|
else
|
{
|
items[i].SetActiveIL(false);
|
}
|
}
|
maxText.SetActiveIL(false);
|
lvBtn.SetActiveIL(true);
|
lvBtn.SetListener(()=> {
|
for (int i = 0; i < needItems.Count; i++)
|
{
|
int itemID = needItems[i].x;
|
int cnt = needItems[i].y;
|
int hasCnt = packModel.GetItemCountByID(PackType.Item, itemID);
|
if (hasCnt < cnt)
|
{
|
SysNotifyMgr.Instance.ShowTip("NotEnoughMaterial");
|
return;
|
}
|
LimitedTimeLuxuryGiftModel.Instance.IsItemIdShow(5, itemID, cnt, 1,0);
|
}
|
|
TreasurePavilionModel.Instance.UpgradeGubaoLV(gubaoID);
|
});
|
}
|
|
}
|
}
|