//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Tuesday, October 30, 2018
|
//--------------------------------------------------------
|
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
using TableConfig;
|
using EnhancedUI.EnhancedScroller;
|
|
namespace Snxxz.UI
|
{
|
|
public class FeatureNotice2Win : Window
|
{
|
|
[SerializeField] ScrollerController m_ScrollerController;
|
[SerializeField] Button m_CloseButton;
|
[SerializeField] FeatureNoticeTip m_FeatureNoticeTip;
|
[SerializeField] ScaleTween m_ScaleTween;
|
FeatureNoticeModel featureNoticeModel { get { return ModelCenter.Instance.GetModel<FeatureNoticeModel>(); } }
|
private bool IsJump = false;
|
#region Built-in
|
protected override void BindController()
|
{
|
m_ScrollerController.OnRefreshCell += OnRefreshGridCell;
|
}
|
|
protected override void AddListeners()
|
{
|
m_CloseButton.AddListener(OnClickBtn);
|
}
|
|
protected override void OnPreOpen()
|
{
|
UnopenedFirst();
|
m_ScaleTween.SetStartState();
|
IsJump = WindowJumpMgr.Instance.IsJumpState;
|
m_FeatureNoticeTip.Init();
|
OnCreateGridLineCell(m_ScrollerController);
|
}
|
|
protected override void OnAfterOpen()
|
{
|
if (!IsJump)//是否经历跳转打开
|
{
|
m_ScaleTween.Play(false, IsOpen);
|
}
|
else
|
{
|
m_ScaleTween.SetEndState();
|
}
|
}
|
|
protected override void OnPreClose()
|
{
|
}
|
|
protected override void OnAfterClose()
|
{
|
}
|
|
private void OnClickBtn()
|
{
|
if (!WindowJumpMgr.Instance.IsJumpState)//是否经历跳
|
{
|
m_FeatureNoticeTip.FeatureNoticeTipObj.SetActive(true);
|
m_ScaleTween.Play(true, IsClose);
|
}
|
else
|
{
|
Close();
|
WindowCenter.Instance.Open<MainInterfaceWin>();
|
}
|
}
|
void OnCreateGridLineCell(ScrollerController gridCtrl)
|
{
|
gridCtrl.Refresh();
|
for (int i = 0; i < featureNoticeModel.FunctionList.Count; i++)
|
{
|
gridCtrl.AddCell(ScrollerDataType.Header, featureNoticeModel.FunctionList[i].FuncId);
|
}
|
gridCtrl.Restart();
|
}
|
private void OnRefreshGridCell(ScrollerDataType type, CellView cell)
|
{
|
int funcId = cell.index;
|
Transform Tran = cell.transform;
|
GameObject Tran1 = Tran.Find("FeaturesTypeOne").gameObject;
|
GameObject Tran2 = Tran.Find("FeaturesTypeTwo").gameObject;
|
if (funcId == featureNoticeModel.FunctionForecastIndex)
|
{
|
|
Tran1.SetActive(false);
|
Tran2.SetActive(true);
|
FeaturesType3 featuresType3 = Tran2.GetComponent<FeaturesType3>();
|
featuresType3.GetTheFeatureID(funcId);
|
return;
|
}
|
else
|
{
|
Tran1.SetActive(true);
|
Tran2.SetActive(false);
|
FeaturesType3 featuresType3 = Tran1.GetComponent<FeaturesType3>();
|
featuresType3.GetTheFeatureID(funcId);
|
return;
|
}
|
|
}
|
private void IsOpen()
|
{
|
m_FeatureNoticeTip.FeatureNoticeTipObj.SetActive(false);
|
}
|
private void IsClose()
|
{
|
Close();
|
WindowCenter.Instance.Open<MainInterfaceWin>();
|
}
|
|
private void UnopenedFirst()
|
{
|
var configs = Config.Instance.GetAllValues<FunctionForecastConfig>();
|
foreach (var config in configs)
|
{
|
int openTag = config.FuncId;
|
if (!FuncOpen.Instance.IsFuncOpen(openTag))
|
{
|
featureNoticeModel.FunctionForecastIndex = config.OpenNumber;
|
return;
|
}
|
}
|
}
|
|
#endregion
|
|
}
|
|
}
|