//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Thursday, September 21, 2017
|
//--------------------------------------------------------
|
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace Snxxz.UI {
|
|
public class MarketWin : Window
|
{
|
[SerializeField] Button leftBtn;
|
[SerializeField] Button rightBtn;
|
[SerializeField] Button closeBtn;
|
[SerializeField] FunctionButton dealTitleBtn;
|
[SerializeField] FunctionButton putawayTitleBtn;
|
[SerializeField] FunctionButton dealRecordTitleBtn;
|
[SerializeField] FunctionButtonGroup buttonGroup;
|
#region Built-in
|
protected override void BindController()
|
{
|
}
|
|
protected override void AddListeners()
|
{
|
leftBtn.onClick.AddListener(buttonGroup.TriggerLast);
|
rightBtn.onClick.AddListener(buttonGroup.TriggerNext);
|
closeBtn.onClick.AddListener(OnClose);
|
dealTitleBtn.onClick.AddListener(OnDeal);
|
putawayTitleBtn.onClick.AddListener(OnPutaway);
|
dealRecordTitleBtn.onClick.AddListener(OnDealRecord);
|
}
|
|
private void OnDealRecord()
|
{
|
CloseChildWin();
|
if (windowState == WindowState.Opened)
|
{
|
WindowCenter.Instance.OpenWithoutAnimation<MarketDealRecordWin>();
|
}
|
else
|
{
|
WindowCenter.Instance.Open<MarketDealRecordWin>();
|
}
|
functionOrder = 2;
|
}
|
|
private void OnPutaway()
|
{
|
CloseChildWin();
|
if (windowState == WindowState.Opened)
|
{
|
WindowCenter.Instance.OpenWithoutAnimation<MarketPutawayWin>();
|
}
|
else
|
{
|
WindowCenter.Instance.Open<MarketPutawayWin>();
|
}
|
functionOrder = 1;
|
}
|
|
private void OnDeal()
|
{
|
CloseChildWin();
|
if (windowState == WindowState.Opened)
|
{
|
WindowCenter.Instance.OpenWithoutAnimation<MarketDealWin>();
|
}
|
else
|
{
|
WindowCenter.Instance.Open<MarketDealWin>();
|
}
|
functionOrder = 0;
|
}
|
|
protected override void OnPreOpen()
|
{
|
CloseChildWin();
|
}
|
|
protected override void OnActived()
|
{
|
base.OnActived();
|
buttonGroup.TriggerByOrder(functionOrder);
|
}
|
|
protected override void OnAfterOpen()
|
{
|
}
|
|
protected override void OnPreClose()
|
{
|
CloseChildWin();
|
}
|
|
protected override void OnAfterClose()
|
{
|
if (!WindowJumpMgr.Instance.IsJumpState)
|
{
|
WindowCenter.Instance.Open<MainInterfaceWin>();
|
}
|
}
|
#endregion
|
private void OnClose()
|
{
|
CloseChildWin();
|
CloseImmediately();
|
|
}
|
private void CloseChildWin()
|
{
|
if (WindowCenter.Instance.CheckOpen<MarketDealWin>()) {
|
WindowCenter.Instance.CloseImmediately<MarketDealWin>();
|
}
|
if (WindowCenter.Instance.CheckOpen<MarketPutawayWin>()) {
|
WindowCenter.Instance.CloseImmediately<MarketPutawayWin>();
|
}
|
if (WindowCenter.Instance.CheckOpen<MarketDealRecordWin>()) {
|
WindowCenter.Instance.CloseImmediately<MarketDealRecordWin>();
|
}
|
}
|
}
|
|
}
|
|
|
|
|