| New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Monday, November 12, 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 IceCrystalVeinWin : Window |
| | | { |
| | | [SerializeField] ScrollerController m_ScrollerController; |
| | | [SerializeField] Button m_CloseButton; |
| | | [SerializeField] Button m_SweepingButton;//扫荡 |
| | | [SerializeField] Button m_ChallengeButton;//挑战 |
| | | private int IndexSelect = 1; |
| | | #region Built-in |
| | | protected override void BindController() |
| | | {
|
| | | m_ScrollerController.OnRefreshCell += OnRefreshGridCell; |
| | | } |
| | | |
| | | protected override void AddListeners() |
| | | { |
| | | m_CloseButton.AddListener(OnClickClose); |
| | | m_SweepingButton.AddListener(OnClickSweeping); |
| | | m_ChallengeButton.AddListener(OnClickChallenge); |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | {
|
| | | OnCreateGridLineCell(m_ScrollerController); |
| | | } |
| | | |
| | | protected override void OnAfterOpen() |
| | | { |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | } |
| | | |
| | | protected override void OnAfterClose() |
| | | { |
| | | }
|
| | | #endregion |
| | | private void OnClickClose()
|
| | | {
|
| | | Close();
|
| | | } |
| | | private void OnClickSweeping()
|
| | | {
|
| | |
|
| | | } |
| | | private void OnClickChallenge()
|
| | | {
|
| | |
|
| | | } |
| | | void OnCreateGridLineCell(ScrollerController gridCtrl)
|
| | | {
|
| | | gridCtrl.Refresh();
|
| | | for (int i = 0; i < 5; i++)
|
| | | {
|
| | | gridCtrl.AddCell(ScrollerDataType.Header, i);
|
| | | }
|
| | | gridCtrl.Restart();
|
| | | } |
| | | private void OnRefreshGridCell(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | GameObject Obj1 = cell.transform.Find("TargetBox_1").gameObject;
|
| | | GameObject Obj2 = cell.transform.Find("TargetBox_2").gameObject;
|
| | | int Index = cell.index;
|
| | | if (Index == IndexSelect)
|
| | | {
|
| | | Obj1.SetActive(true);
|
| | | Obj2.SetActive(false);
|
| | | IceCrystalVeinCell iceCrystal = Obj1.GetComponent<IceCrystalVeinCell>();
|
| | | iceCrystal.SetIceCrystalVeinCell(Index);
|
| | | iceCrystal._Button.SetListener(()=> |
| | | {
|
| | | IndexSelect = Index;
|
| | | m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | | Obj1.SetActive(false);
|
| | | Obj2.SetActive(true);
|
| | | IceCrystalVeinCell iceCrystal = Obj2.GetComponent<IceCrystalVeinCell>();
|
| | | iceCrystal.SetIceCrystalVeinCell(Index);
|
| | | iceCrystal._Button.SetListener(() =>
|
| | | {
|
| | | IndexSelect = Index;
|
| | | m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见
|
| | | });
|
| | | }
|
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |