| | |
| | |
|
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | |
| | | protected override void OnPreOpen()
|
| | | {
|
| | | scroller.OnRefreshCell += OnRefreshCell;
|
| | | FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent;
|
| | | itemID = functionOrder;
|
| | |
|
| | | itemCell.Init(new ItemCellModel(itemID, false, 0));
|
| | |
| | | protected override void OnPreClose()
|
| | | {
|
| | | scroller.OnRefreshCell -= OnRefreshCell;
|
| | | FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent;
|
| | | }
|
| | |
|
| | | private void OnFuncStateChangeEvent(int obj)
|
| | | {
|
| | | CreateScroller();
|
| | | }
|
| | |
|
| | | List<int> GetWayList()
|
| | | {
|
| | | var itemConfig = ItemConfig.Get(itemID);
|
| | | if (itemConfig.GetWay.IsNullOrEmpty())
|
| | | return new List<int>();
|
| | | List<int> resList = new List<int>();
|
| | | for (int i = 0; i < itemConfig.GetWay.Length; i++)
|
| | | {
|
| | | int way = itemConfig.GetWay[i];
|
| | | if (!GetItemWaysConfig.HasKey(way))
|
| | | continue;
|
| | | GetItemWaysConfig config = GetItemWaysConfig.Get(way);
|
| | | int funcID = config.FuncID;
|
| | | if (FuncOpenLVConfig.HasKey(funcID) && !FuncOpen.Instance.IsFuncOpen(funcID))
|
| | | continue;
|
| | | resList.Add(way);
|
| | | }
|
| | | return resList;
|
| | | }
|
| | |
|
| | | void CreateScroller()
|
| | | {
|
| | | var itemConfig = ItemConfig.Get(itemID);
|
| | | scroller.Refresh();
|
| | | for (int i = 0; i < itemConfig.GetWay.Length; i++)
|
| | | List<int> wayList = GetWayList();
|
| | | for (int i = 0; i < wayList.Count; i++)
|
| | | {
|
| | | scroller.AddCell(ScrollerDataType.Header, itemConfig.GetWay[i]);
|
| | | }
|