1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- using System.Collections.Generic;
- namespace GFGGame
- {
- public class GetSuitItemController
- {
- public static bool enable = true;
- private static List<int> _waitingToShowSuit = new List<int>();
- public static void Clear()
- {
- _waitingToShowSuit.Clear();
- }
- public static void AddItemId(int itemId)
- {
- if (!enable || !GameGlobal.PreDataInited)
- {
- return;
- }
- int suitId = SuitCfgArray.Instance.GetSuitIdOfItem(itemId);
- if (_waitingToShowSuit.IndexOf(suitId) < 0)
- {
- _waitingToShowSuit.Add(suitId);
- }
- }
- public static bool GetSuitWaitingToId(int itemId)
- {
- int suitId = SuitCfgArray.Instance.GetSuitIdOfItem(itemId);
- int index = _waitingToShowSuit.IndexOf(suitId);
- return index >= 0;
- }
- public static int TryShow(int itemId)
- {
- int suitId = 0;
- if (itemId > 0)
- {
- // int index = _waitingToShowList.IndexOf(itemId);
- suitId = SuitCfgArray.Instance.GetSuitIdOfItem(itemId);
- int index = _waitingToShowSuit.IndexOf(suitId);
- if (index >= 0)
- {
- _waitingToShowSuit.RemoveAt(index);
- ViewManager.Show<GetSuitItemVIew>(suitId);
- }
- }
- else if (_waitingToShowSuit.Count > 0)
- {
- suitId = _waitingToShowSuit[0];
- _waitingToShowSuit.RemoveAt(0);
- ViewManager.Show<GetSuitItemVIew>(suitId);
- }
- return suitId;
- }
- }
- }
|