//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Thursday, April 26, 2018
|
//--------------------------------------------------------
|
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace Snxxz.UI {
|
|
public class FairyJadeInvestmentTipWin : Window
|
{
|
public static Action SelectNumberRefresh;
|
FairyJadeInvestmentModel m_FairyJadeInvestmentModel;
|
FairyJadeInvestmentModel fairyJadeInvestmentModel { get { return m_FairyJadeInvestmentModel ?? (m_FairyJadeInvestmentModel = ModelCenter.Instance.GetModel<FairyJadeInvestmentModel>()); } }
|
VipInvestModel m_VipInvestModel;
|
VipInvestModel VipInvestModel { get { return m_VipInvestModel ?? (m_VipInvestModel = ModelCenter.Instance.GetModel<VipInvestModel>()); } }
|
[SerializeField] Button[] m_AmountOfChoices;
|
[SerializeField] Text[] m_Labels;
|
#region Built-in
|
protected override void BindController()
|
{
|
}
|
|
protected override void AddListeners()
|
{
|
for (int i = 0; i < m_AmountOfChoices.Length; i++)
|
{
|
var index = i;
|
m_AmountOfChoices[i].SetListener(() =>
|
{
|
OnAmount(index);
|
});
|
}
|
}
|
|
protected override void OnPreOpen()
|
{
|
var maxGear = VipInvestModel.GetInvestMaxGear(3);
|
int InvestGold = fairyJadeInvestmentModel.GetInvestGold();
|
for (int i = 0; i < m_AmountOfChoices.Length; i++)
|
{
|
m_AmountOfChoices[i].SetActive(i < maxGear);
|
if (i < maxGear)
|
{
|
var gold = VipInvestModel.GetInvestAmount(3, i);
|
m_Labels[i].text = gold.ToString();
|
m_AmountOfChoices[i].SetActive(InvestGold < gold);
|
}
|
}
|
}
|
|
protected override void OnAfterOpen()
|
{
|
}
|
|
protected override void OnPreClose()
|
{
|
}
|
|
protected override void OnAfterClose()
|
{
|
}
|
#endregion
|
|
private void OnAmount(int index)
|
{
|
fairyJadeInvestmentModel.selectInvestMoney = VipInvestModel.GetInvestAmount(3, index);
|
if (SelectNumberRefresh != null)
|
{
|
SelectNumberRefresh();
|
}
|
Close();
|
}
|
}
|
|
}
|