12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- 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.DataInited)
- {
- return;
- }
- int suitId = SuitCfgArray.Instance.GetSuitIdOfItem(itemId);
- if (_waitingToShowSuit.IndexOf(suitId) < 0)
- {
- _waitingToShowSuit.Add(suitId);
- }
- }
- 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(ViewName.GET_SUIT_ITEM_VIEW, suitId);
- }
- }
- else if (_waitingToShowSuit.Count > 0)
- {
- suitId = _waitingToShowSuit[0];
- _waitingToShowSuit.RemoveAt(0);
- ViewManager.Show(ViewName.GET_SUIT_ITEM_VIEW, suitId);
- }
- return suitId;
- }
- }
- }
|