using vnxbqy.UI;
|
using System;
|
using System.Collections.Generic;
|
using UnityEngine.UI;
|
using System.Collections;
|
|
public class investCell : ILBehaviour
|
{
|
Image Img_Got;
|
Image Img_UnReach;
|
Button Btn_Goto;
|
Button Btn_Get;
|
List<ItemCell> items = new List<ItemCell>();
|
Text info;
|
|
protected override void Awake()
|
{
|
Img_Got = proxy.GetWidgtEx<Image>("Img_Got");
|
Img_UnReach = proxy.GetWidgtEx<Image>("Img_UnReach");
|
Btn_Goto = proxy.GetWidgtEx<Button>("Btn_Goto");
|
Btn_Get = proxy.GetWidgtEx<Button>("Btn_Get");
|
items.Clear();
|
items.Add(proxy.GetWidgtEx<ItemCell>("itemcell0"));
|
items.Add(proxy.GetWidgtEx<ItemCell>("itemcell1"));
|
info = proxy.GetWidgtEx<Text>("Text_Amount");
|
|
}
|
|
public void Display(int index)
|
{
|
var result = InvestModel.Instance.GetSingleInvestState(InvestModel.Instance.selectType, index);
|
Img_Got.SetActiveIL(false);
|
Img_UnReach.SetActiveIL(false);
|
Btn_Goto.SetActiveIL(false);
|
Btn_Get.SetActiveIL(false);
|
|
var config = InvestConfig.Get(index);
|
info.text = config.info;
|
|
if (result == 1)
|
{
|
if (InvestModel.Instance.selectType == InvestModel.InvestType_Boss)
|
{
|
Btn_Goto.SetActiveIL(true);
|
Btn_Goto.SetListener(()=> {
|
|
BossModel.Instance.GotoKillBoss(config.needNPCID, ()=> {
|
WindowCenter.Instance.CloseEx<OpenServerActivityWin>();
|
});
|
});
|
}
|
else
|
Img_UnReach.SetActiveIL(true);
|
}
|
else if (result == 2)
|
{
|
Btn_Get.SetActiveIL(true);
|
Btn_Get.SetListener(()=> {
|
InvestModel.Instance.SendGetReward(InvestModel.Instance.selectType, index);
|
});
|
}
|
else if (result == 3)
|
{
|
Img_Got.SetActiveIL(true);
|
}
|
|
for (int i = 0; i < items.Count; i++)
|
{
|
List<ItemEx> awards = new List<ItemEx>();
|
InvestModel.Instance.TryGetItems(InvestModel.Instance.selectType, index, out awards);
|
if (i < awards.Count)
|
{
|
items[i].SetActiveIL(true);
|
var itemId = awards[i].id;
|
var model = new ItemCellModel(itemId, false, (ulong)awards[i].count);
|
items[i].Init(model);
|
items[i].auctionIcon.SetActiveIL(awards[i].bind != 0);
|
items[i].button.SetListener(() =>
|
{
|
ItemTipUtility.Show(itemId);
|
});
|
}
|
else
|
{
|
items[i].SetActiveIL(false);
|
}
|
}
|
}
|
|
|
}
|