GetSuitItemController.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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(itemId < 0)
  19. {
  20. int index = _waitingToShowList.IndexOf(itemId);
  21. if(index >= 0)
  22. {
  23. _waitingToShowList.RemoveAt(index);
  24. ViewManager.Show(ViewName.GET_SUIT_ITEM_VIEW, itemId);
  25. }
  26. }
  27. else if(_waitingToShowList.Count > 0)
  28. {
  29. itemId = _waitingToShowList[0];
  30. _waitingToShowList.RemoveAt(0);
  31. ViewManager.Show(ViewName.GET_SUIT_ITEM_VIEW, itemId);
  32. }
  33. return itemId;
  34. }
  35. }
  36. }