12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using System.Collections.Generic;
- namespace GFGGame
- {
- public class GetSuitItemController
- {
- public static bool enable = false;
- private static List<int> _waitingToShowList = new List<int>();
- public static void AddItemId(int itemId)
- {
- if(!enable)
- {
- return;
- }
- _waitingToShowList.Add(itemId);
- }
- public static int TryShow(int itemId)
- {
- if(ViewManager.isViewOpen(ViewName.GET_SUIT_ITEM_VIEW))
- {
- return 0;
- }
- 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;
- }
- }
- }
|