//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Wednesday, October 11, 2017
|
//--------------------------------------------------------
|
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
//任务界面面板控制器
|
namespace Snxxz.UI
|
{
|
|
public class TaskWin : Window, SecondWindowInterface
|
{
|
|
[SerializeField] FunctionButton CoinTaskWin;
|
[SerializeField] FunctionButton StoryTaskWin;
|
[SerializeField] FunctionButton SideMission;
|
[SerializeField] FunctionButtonGroup FuncBtnGroup;
|
//-------------
|
[SerializeField] GameObject _CoinTaskWin;
|
[SerializeField] GameObject _StoryTaskWin;
|
[SerializeField] GameObject _SideMission;
|
#region Built-in
|
TaskModel taskmodel { get { return ModelCenter.Instance.GetModel<TaskModel>(); } }
|
PlayerDeadModel DeadModel { get { return ModelCenter.Instance.GetModel<PlayerDeadModel>(); } }
|
|
public Button close { get; set; }
|
|
protected override void BindController()
|
{
|
if (this is SecondWindowInterface)
|
{
|
var frame = this.GetComponentInChildren<SecondFrameLoader>();
|
frame.Create();
|
close = frame.GetComponentInChildren<Button>();
|
}
|
}
|
|
protected override void AddListeners()
|
{
|
close.onClick.AddListener(CloseButton);
|
CoinTaskWin.AddListener(OnClickCoinTask);
|
StoryTaskWin.AddListener(OnClickStoryTask);
|
SideMission.AddListener(OnClickSideMission);
|
}
|
|
protected override void OnPreOpen()
|
{
|
DeadModel.playerDieEvent += OnPlayerDie;
|
ClosePanel();
|
if (taskmodel.SideQuestsDic.Count != 0)
|
{
|
SideMission.gameObject.SetActive(true);
|
}
|
else
|
{
|
SideMission.gameObject.SetActive(false);
|
}
|
}
|
|
protected override void OnAfterOpen()
|
{
|
if (functionOrder == 0)
|
{
|
if (FuncOpen.Instance.IsFuncOpen(34))
|
{
|
FuncBtnGroup.TriggerByOrder(0);
|
}
|
else
|
{
|
FuncBtnGroup.TriggerByOrder(1);
|
}
|
}
|
else
|
{
|
FuncBtnGroup.TriggerByOrder(functionOrder);
|
}
|
}
|
protected override void OnPreClose()
|
{
|
DeadModel.playerDieEvent -= OnPlayerDie;
|
}
|
|
private void OnPlayerDie()
|
{
|
CloseImmediately();
|
if (!WindowCenter.Instance.IsOpen<MainInterfaceWin>())
|
{
|
WindowCenter.Instance.Open<MainInterfaceWin>();
|
}
|
}
|
|
protected override void OnAfterClose()
|
{
|
}
|
|
void OnClickCoinTask()
|
{
|
functionOrder = 0;
|
ClosePanel();
|
//if (coinTaskTip.IsPopup)
|
//{
|
// coinTaskTip.IsPopup = false;
|
//}
|
_CoinTaskWin.SetActive(true);
|
}
|
|
void OnClickStoryTask()
|
{
|
functionOrder = 1;
|
ClosePanel();
|
_StoryTaskWin.SetActive(true);
|
}
|
|
void OnClickSideMission()
|
{
|
//if (taskmodel.SideQuestsDic.Count <= 0)
|
//{
|
// SysNotifyMgr.Instance.ShowTip("SideQuest_None");//信息提示
|
// return;
|
//}
|
functionOrder = 2;
|
ClosePanel();
|
_SideMission.SetActive(true);
|
}
|
|
private void ClosePanel()
|
{
|
_StoryTaskWin.SetActive(false);
|
_CoinTaskWin.SetActive(false);
|
_SideMission.SetActive(false);
|
}
|
void CloseButton()
|
{
|
_CoinTaskWin.SetActive(false);
|
_StoryTaskWin.SetActive(false);
|
WindowCenter.Instance.Close<TaskWin>();
|
WindowCenter.Instance.Open<MainInterfaceWin>();
|
|
}
|
#endregion
|
|
}
|
|
}
|
|
|
|
|