using vnxbqy.UI;
|
using UnityEngine;
|
using System.Collections.Generic;
|
|
public class CelestialPalaceTreeGain : MonoBehaviour
|
{
|
[SerializeField] TextEx txtAwardCount;
|
[SerializeField] TextEx txtFortuneCount;
|
[SerializeField] ButtonEx btnGain;
|
[SerializeField] UIEffect uiEffect;
|
|
TiandaoTreeConfig config;
|
int awardIndex;
|
int state;
|
CelestialPalaceModel model { get { return ModelCenter.Instance.GetModel<CelestialPalaceModel>(); } }
|
public void Display(int awardIndex)
|
{
|
this.awardIndex = awardIndex;
|
if (!TiandaoTreeConfig.Has(awardIndex))
|
return;
|
uiEffect.Stop();
|
// 获取当前这档天道果的显示状态 0 不可领取(未达成) 1 可领取 2 已领取
|
state = model.GetGainState(awardIndex);
|
btnGain.SetColorful(null, state != 2); // 领取后置灰
|
if (state == 1)
|
uiEffect.Play();
|
config = TiandaoTreeConfig.Get(awardIndex);
|
txtAwardCount.text = Language.Get("CelestialPalace13", model.GetAwardCount(awardIndex));
|
txtFortuneCount.text = Language.Get("CelestialPalace12", model.nowQiYun, config.NeedQiyun);
|
btnGain.SetListener(OnClickGain);
|
}
|
|
void OnClickGain()
|
{
|
if (state == 1)
|
{
|
if (model.TryAutoHaveAward(out List<Item> awardList) && !awardList.IsNullOrEmpty())
|
{
|
//ItemLogicUtility.Instance.ShowGetItem(awardList, "", 5);
|
}
|
}
|
else
|
{
|
ItemTipUtility.Show(model.moneyItemId);
|
}
|
}
|
}
|