//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Thursday, June 21, 2018
|
//--------------------------------------------------------
|
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
namespace Snxxz.UI
|
{
|
|
public class FlyShoseConfirmwin : Window
|
{
|
|
public static UseEnvironment useEnvironment = UseEnvironment.Task;
|
public static Action confirmCallBack;
|
|
[SerializeField] Button m_CloseButton;
|
[SerializeField] Button m_OKButton;
|
[SerializeField] Button m_Cancel;
|
[SerializeField] Toggle m_Toggle;
|
[SerializeField] RichText m_ContentText;//内容
|
[SerializeField] Text m_Text;
|
[SerializeField] Button m_button;
|
[SerializeField] Image m_Image;
|
|
private int FlyShoseID = 0;
|
private int NeedMoney = 1;
|
private int progressRef = -1;
|
|
TaskModel taskmodel { get { return ModelCenter.Instance.GetModel<TaskModel>(); } }
|
PlayerMainDate mainModel { get { return ModelCenter.Instance.GetModel<PlayerMainDate>(); } }
|
|
#region Built-in
|
|
protected override void BindController()
|
{
|
var funconfig = FuncConfigConfig.Get("TransportPay");
|
FlyShoseID = int.Parse(funconfig.Numerical1);
|
NeedMoney = int.Parse(funconfig.Numerical2);
|
m_Text.text = string.Format(Language.Get("FlyShoseConfirmwin_Text1"), NeedMoney);
|
var config = ItemConfig.Get(FlyShoseID);
|
m_Image.SetSprite(config.IconKey);
|
}
|
|
protected override void AddListeners()
|
{
|
m_CloseButton.AddListener(CloseClick);
|
m_Cancel.AddListener(CloseClick);
|
m_OKButton.AddListener(OnclickOKButton);
|
m_Toggle.onValueChanged.AddListener(OnClickToggle);
|
m_button.AddListener(() => { ItemTipUtility.Show(FlyShoseID); });
|
}
|
|
protected override void OnPreOpen()
|
{
|
}
|
|
protected override void OnAfterOpen()
|
{
|
if (taskmodel.allMissionDict.ContainsKey(mainModel.FlyShoseTaskID))
|
{
|
string str = taskmodel.allMissionDict[mainModel.FlyShoseTaskID].InforList;
|
var taskinfo = TASKINFOConfig.Get(str);
|
if (taskinfo != null)
|
{
|
m_ContentText.text = taskinfo.show_writing;
|
}
|
if (taskmodel.BountyDic.ContainsKey(mainModel.FlyShoseTaskID) || taskmodel.FairyAuDic.ContainsKey(mainModel.FlyShoseTaskID))
|
{
|
var config = TASKINFOConfig.Get(str);
|
if (config != null)
|
{
|
string strRichA = TaskAllocation.Instance.GetTaskInfo(config.show_writing, mainModel.FlyShoseTaskID);
|
m_ContentText.text = strRichA;
|
}
|
}
|
}
|
}
|
|
protected override void OnPreClose()
|
{
|
}
|
|
protected override void OnAfterClose()
|
{
|
confirmCallBack = null;
|
}
|
|
#endregion
|
private void OnclickOKButton()
|
{
|
int NeedMoney = (int)UIHelper.GetMoneyCnt(1) ;
|
if (NeedMoney >= 1)
|
{
|
switch (useEnvironment)
|
{
|
case UseEnvironment.Task:
|
m_ContentText.ExcuteHref(1);
|
break;
|
case UseEnvironment.LocalMap:
|
if (confirmCallBack != null)
|
{
|
confirmCallBack();
|
confirmCallBack = null;
|
}
|
break;
|
}
|
Close();
|
}
|
else
|
{
|
WindowCenter.Instance.Open<RechargeTipWin>();
|
}
|
}
|
|
private void OnClickToggle(bool _bool)
|
{
|
switch (useEnvironment)
|
{
|
case UseEnvironment.Task:
|
mainModel.IsFlyShoseBool = _bool;
|
break;
|
case UseEnvironment.LocalMap:
|
break;
|
}
|
}
|
|
public enum UseEnvironment
|
{
|
Task,
|
LocalMap,
|
}
|
|
}
|
|
}
|
|
|
|
|