1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using System.Collections.Generic;
- namespace GFGGame
- {
- public class GetSuitItemController
- {
- public static bool enable = true;
- public static bool showSingle = false; //是否是每次获得套装就需要显示一次
- private static List<int> _waitingToShowSuit = new List<int>();
- //这个变量主要用于抽奖自动打开
- public static bool isAuto = false;
- public static void Clear()
- {
- _waitingToShowSuit.Clear();
- }
- public static void AddItemId(int itemId)
- {
- if (!enable || !GameGlobal.PreDataInited)
- {
- return;
- }
- int suitId = SuitCfgArray.Instance.GetSuitIdOfItem(itemId);
- //引导是合成套装不弹窗
- if (GuideDataManager.currentGuideId != 13 && _waitingToShowSuit.IndexOf(suitId) < 0 && !showSingle)
- {
- _waitingToShowSuit.Add(suitId);
- }
- }
- public static int TryShow(int itemId)
- {
- int suitId = 0;
- if (itemId > 0)
- {
- // int index = _waitingToShowList.IndexOf(itemId);
- suitId = SuitCfgArray.Instance.GetSuitIdOfItem(itemId);
- int index = _waitingToShowSuit.IndexOf(suitId);
- if (index >= 0)
- {
- _waitingToShowSuit.RemoveAt(index);
- ViewManager.Show<SuitItemView>(new object[] { suitId, 0 });
- }
- }
- else if (_waitingToShowSuit.Count > 0)
- {
- suitId = _waitingToShowSuit[0];
- _waitingToShowSuit.RemoveAt(0);
- ViewManager.Show<SuitItemView>(new object[] { suitId ,0});
- }
- return suitId;
- }
- }
- }
|