GetSuitItemController.cs 1.5 KB

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