//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Saturday, December 23, 2017
|
//--------------------------------------------------------
|
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace vnxbqy.UI
|
{
|
|
public class BattleGroundGuideWin : Window
|
{
|
[SerializeField] FlipScroll flipScroll;
|
[SerializeField] Button m_LeftBtn;
|
[SerializeField] Button m_RightBtn;
|
[SerializeField] Button m_CloseBtn;
|
[SerializeField] Image m_NowImg;
|
[SerializeField] Image m_LastImg;
|
[SerializeField] Text m_NowTipTxt;
|
[SerializeField] Text m_LastTipTxt;
|
[SerializeField] UIAlphaTween m_NowAlphaTween;
|
[SerializeField] UIAlphaTween m_LastAlphaTween;
|
|
private bool isOnSingle = false;
|
|
FairyLeagueModel m_Model;
|
FairyLeagueModel model {
|
get {
|
return m_Model ?? (m_Model = ModelCenter.Instance.GetModel<FairyLeagueModel>());
|
}
|
}
|
#region Built-in
|
protected override void BindController()
|
{
|
}
|
|
protected override void AddListeners()
|
{
|
m_LeftBtn.onClick.AddListener(flipScroll.FlipLeft);
|
m_RightBtn.onClick.AddListener(flipScroll.FlipRight);
|
m_CloseBtn.onClick.AddListener(CloseClick);
|
flipScroll.OnRefreshData += OnRefreshData;
|
}
|
|
protected override void OnPreOpen()
|
{
|
m_NowAlphaTween.SetStartState();
|
m_LastAlphaTween.SetStartState();
|
m_NowTipTxt.text = string.Empty;
|
m_LastTipTxt.text = string.Empty;
|
isOnSingle = false;
|
flipScroll.pageCnt = model.GuideImgKeys == null ? 0 : model.GuideImgKeys.Length;
|
}
|
|
protected override void OnAfterOpen()
|
{
|
}
|
|
protected override void OnPreClose()
|
{
|
}
|
|
protected override void OnAfterClose()
|
{
|
}
|
#endregion
|
private void OnRefreshData(int page, RectTransform rect)
|
{
|
m_NowAlphaTween.Play(!isOnSingle);
|
m_LastAlphaTween.Play(!isOnSingle);
|
|
if (!isOnSingle) {
|
m_NowImg.SetSprite(model.GuideImgKeys[page]);
|
m_NowTipTxt.text = page.ToString();
|
}
|
else {
|
m_LastImg.SetSprite(model.GuideImgKeys[page]);
|
m_LastTipTxt.text = page.ToString();
|
}
|
|
isOnSingle = !isOnSingle;
|
}
|
|
}
|
|
}
|