GetSuitItemController.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System.Collections.Generic;
  2. namespace GFGGame
  3. {
  4. public class GetSuitItemController
  5. {
  6. public static bool enable = false;
  7. private static List<int> _waitingToShowList = new List<int>();
  8. public static void AddItemId(int itemId)
  9. {
  10. if(!enable)
  11. {
  12. return;
  13. }
  14. _waitingToShowList.Add(itemId);
  15. }
  16. public static int TryShow(int itemId)
  17. {
  18. if(ViewManager.isViewOpen(ViewName.GET_SUIT_ITEM_VIEW))
  19. {
  20. return 0;
  21. }
  22. if(itemId < 0)
  23. {
  24. int index = _waitingToShowList.IndexOf(itemId);
  25. if(index >= 0)
  26. {
  27. _waitingToShowList.RemoveAt(index);
  28. ViewManager.Show(ViewName.GET_SUIT_ITEM_VIEW, itemId);
  29. }
  30. }
  31. else if(_waitingToShowList.Count > 0)
  32. {
  33. itemId = _waitingToShowList[0];
  34. _waitingToShowList.RemoveAt(0);
  35. ViewManager.Show(ViewName.GET_SUIT_ITEM_VIEW, itemId);
  36. }
  37. return itemId;
  38. }
  39. }
  40. }