GetSuitItemController.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System.Collections.Generic;
  2. namespace GFGGame
  3. {
  4. public class GetSuitItemController
  5. {
  6. public static bool enable = true;
  7. public static bool showSingle = false; //是否是每次获得套装就需要显示一次
  8. private static List<int> _waitingToShowSuit = new List<int>();
  9. //这个变量主要用于抽奖自动打开
  10. public static bool isAuto = false;
  11. public static void Clear()
  12. {
  13. _waitingToShowSuit.Clear();
  14. }
  15. public static void AddItemId(int itemId)
  16. {
  17. if (!enable || !GameGlobal.PreDataInited)
  18. {
  19. return;
  20. }
  21. int suitId = SuitCfgArray.Instance.GetSuitIdOfItem(itemId);
  22. //引导是合成套装不弹窗
  23. if (GuideDataManager.currentGuideId != 13 && _waitingToShowSuit.IndexOf(suitId) < 0 && !showSingle)
  24. {
  25. _waitingToShowSuit.Add(suitId);
  26. }
  27. }
  28. public static int TryShow(int itemId)
  29. {
  30. int suitId = 0;
  31. if (itemId > 0)
  32. {
  33. // int index = _waitingToShowList.IndexOf(itemId);
  34. suitId = SuitCfgArray.Instance.GetSuitIdOfItem(itemId);
  35. int index = _waitingToShowSuit.IndexOf(suitId);
  36. if (index >= 0)
  37. {
  38. _waitingToShowSuit.RemoveAt(index);
  39. ViewManager.Show<SuitItemView>(new object[] { suitId, 0 });
  40. }
  41. }
  42. else if (_waitingToShowSuit.Count > 0)
  43. {
  44. suitId = _waitingToShowSuit[0];
  45. _waitingToShowSuit.RemoveAt(0);
  46. ViewManager.Show<SuitItemView>(new object[] { suitId ,0});
  47. }
  48. return suitId;
  49. }
  50. }
  51. }