GetSuitItemController.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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> _waitingToShowList = new List<int>();
  8. private static List<int> _waitingToShowSuit = new List<int>();
  9. public static void AddItemId(int itemId)
  10. {
  11. if (!enable || GameGlobal.myUnit == null)
  12. {
  13. return;
  14. }
  15. _waitingToShowList.Add(itemId);
  16. int suitId = SuitCfgManager.Instance.GetItemSuitId(itemId);
  17. if (_waitingToShowSuit.IndexOf(suitId) < 0)
  18. {
  19. _waitingToShowSuit.Add(suitId);
  20. }
  21. }
  22. public static int TryShow(int itemId)
  23. {
  24. int suitId = 0;
  25. if (itemId > 0)
  26. {
  27. // int index = _waitingToShowList.IndexOf(itemId);
  28. suitId = SuitCfgManager.Instance.GetItemSuitId(itemId);
  29. int index = _waitingToShowSuit.IndexOf(suitId);
  30. if (index >= 0)
  31. {
  32. _waitingToShowSuit.RemoveAt(index);
  33. ViewManager.Show(ViewName.GET_SUIT_ITEM_VIEW, suitId);
  34. }
  35. }
  36. else if (_waitingToShowSuit.Count > 0)
  37. {
  38. suitId = _waitingToShowSuit[0];
  39. _waitingToShowSuit.RemoveAt(0);
  40. ViewManager.Show(ViewName.GET_SUIT_ITEM_VIEW, suitId);
  41. }
  42. return suitId;
  43. }
  44. }
  45. }