123456789101112131415161718192021222324252627282930313233343536373839 |
- using System.Collections.Generic;
- namespace GFGGame
- {
- public class GetSuitItemController
- {
- public static bool enable = true;
- private static List<int> _waitingToShowList = new List<int>();
- public static void AddItemId(int itemId)
- {
- if(!enable || GameGlobal.myUnit == null)
- {
- return;
- }
- _waitingToShowList.Add(itemId);
- }
- public static int TryShow(int itemId)
- {
- if(itemId < 0)
- {
- int index = _waitingToShowList.IndexOf(itemId);
- if(index >= 0)
- {
- _waitingToShowList.RemoveAt(index);
- ViewManager.Show(ViewName.GET_SUIT_ITEM_VIEW, itemId);
- }
- }
- else if(_waitingToShowList.Count > 0)
- {
- itemId = _waitingToShowList[0];
- _waitingToShowList.RemoveAt(0);
- ViewManager.Show(ViewName.GET_SUIT_ITEM_VIEW, itemId);
- }
- return itemId;
- }
- }
- }
|