|
@@ -11,8 +11,12 @@ namespace GFGGame
|
|
|
public class LuckyBoxCardView : BaseWindow
|
|
|
{
|
|
|
private UI_LuckyBoxCardUI _ui;
|
|
|
- private List<ItemData> _rewardList;
|
|
|
- private int _type = 0;//弹窗类型:0可跳过,1:首次获得物品不可跳过,2首次获得物品不可跳过,不弹获得套装界面
|
|
|
+ private List<ItemData> _rewardList = new List<ItemData>();
|
|
|
+ private List<ItemData> _newRewardList = new List<ItemData>();
|
|
|
+ private List<ItemData> _oldRewardList = new List<ItemData>();
|
|
|
+ private List<ItemData> _showRewardList = new List<ItemData>();
|
|
|
+
|
|
|
+ // private int _type = 0;//弹窗类型:0可跳过,1:首次获得物品不可跳过,2首次获得物品不可跳过,不弹获得套装界面
|
|
|
|
|
|
private GameObject gameObject;
|
|
|
private GoWrapper wrapper;
|
|
@@ -43,28 +47,37 @@ namespace GFGGame
|
|
|
protected override void OnShown()
|
|
|
{
|
|
|
base.OnShown();
|
|
|
- _rewardList = new List<ItemData>();
|
|
|
-
|
|
|
- List<ItemData> rewards = new List<ItemData>(((this.viewData as object[])[0] as List<ItemData>));
|
|
|
- _rewardList.AddRange(rewards);
|
|
|
+ _rewardList = (this.viewData as object[])[0] as List<ItemData>;
|
|
|
|
|
|
- if (LuckyBoxDataManager.Instance.luckyBoxId > 0)
|
|
|
+ _newRewardList.Clear();
|
|
|
+ _oldRewardList.Clear();
|
|
|
+ for (int i = 0; i < _rewardList.Count; i++)
|
|
|
+ {
|
|
|
+ if (GetThisCount(_rewardList[i].id, _rewardList) == ItemDataManager.GetItemNum(_rewardList[i].id) && !IsAddToNewRewardList(_rewardList[i].id))
|
|
|
+ {
|
|
|
+ _newRewardList.Add(_rewardList[i]);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _oldRewardList.Add(_rewardList[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (LuckyBoxDataManager.Instance.luckyBoxId > 0)//必展示必掉奖励
|
|
|
{
|
|
|
int[][] bonus = LuckyBoxCfgArray.Instance.GetCfg(LuckyBoxDataManager.Instance.luckyBoxId).bonusArr;
|
|
|
List<ItemData> itemDatas = ItemUtil.CreateItemDataList(bonus, LuckyBoxDataManager.Instance.times);
|
|
|
- _rewardList.AddRange(itemDatas);
|
|
|
+ _newRewardList.AddRange(itemDatas);
|
|
|
LuckyBoxDataManager.Instance.luckyBoxId = 0;
|
|
|
}
|
|
|
|
|
|
- _type = (int)(this.viewData as object[])[1];
|
|
|
- _ui.m_btnPass.visible = _type == (int)FirstGetCardViewType.JUMP ? true : false;
|
|
|
UpdateView();
|
|
|
}
|
|
|
private void UpdateView()
|
|
|
{
|
|
|
-
|
|
|
- if (_rewardList.Count - 1 < 0) return;
|
|
|
- ItemData itemdata = _rewardList[_rewardList.Count - 1];
|
|
|
+ _ui.m_btnPass.visible = _newRewardList.Count <= 1;
|
|
|
+ _showRewardList = _newRewardList.Count > 0 ? _newRewardList : _oldRewardList;
|
|
|
+ if (_showRewardList.Count - 1 < 0) return;
|
|
|
+ ItemData itemdata = _showRewardList[_showRewardList.Count - 1];
|
|
|
ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemdata.id);
|
|
|
_ui.m_comCard.m_loaType.url = ResPathUtil.GetCommonGameResPath("hd_sxicon_" + itemCfg.rarity);
|
|
|
_ui.m_comCard.m_loaIcon.url = ResPathUtil.GetIconPath(itemCfg);
|
|
@@ -77,27 +90,27 @@ namespace GFGGame
|
|
|
_ui.m_comCard.m_txtDiscribe.text = itemCfg.desc;
|
|
|
_ui.m_comCard.m_holder.visible = true;
|
|
|
|
|
|
- if (LuckyBoxDataManager.Instance.FirstRewardList.ContainsKey(_rewardList.Count - 1) == true)
|
|
|
+ if (LuckyBoxDataManager.Instance.FirstRewardList.ContainsKey(_showRewardList.Count - 1) == true)
|
|
|
{
|
|
|
- LuckyBoxDataManager.Instance.FirstRewardList.Remove(_rewardList.Count - 1);
|
|
|
+ LuckyBoxDataManager.Instance.FirstRewardList.Remove(_showRewardList.Count - 1);
|
|
|
}
|
|
|
- _rewardList.RemoveAt(_rewardList.Count - 1);
|
|
|
+ _showRewardList.RemoveAt(_showRewardList.Count - 1);
|
|
|
|
|
|
}
|
|
|
|
|
|
private void OnClickBg()
|
|
|
{
|
|
|
- if (_rewardList.Count == 0)
|
|
|
+ if (_newRewardList.Count == 0 && _oldRewardList.Count == 0)
|
|
|
{
|
|
|
- if (_type == (int)FirstGetCardViewType.JUMP)
|
|
|
- {
|
|
|
- ViewManager.Show(ViewName.LUCKY_BOX_BONUS_VIEW, new object[] { (this.viewData as object[])[0] as List<ItemData>, _rewardList });
|
|
|
- }
|
|
|
- else if (_type == (int)FirstGetCardViewType.CANNOT_JUMP)
|
|
|
- {
|
|
|
- GetSuitItemController.TryShow(0);
|
|
|
-
|
|
|
- }
|
|
|
+ // if (_type == (int)FirstGetCardViewType.JUMP)
|
|
|
+ // {
|
|
|
+ ViewManager.Show(ViewName.LUCKY_BOX_BONUS_VIEW, new object[] { (this.viewData as object[])[0] as List<ItemData>, _rewardList });
|
|
|
+ // }
|
|
|
+ // else if (_type == (int)FirstGetCardViewType.CANNOT_JUMP)
|
|
|
+ // {
|
|
|
+ // GetSuitItemController.TryShow(0);
|
|
|
+
|
|
|
+ // }
|
|
|
this.Hide();
|
|
|
return;
|
|
|
}
|
|
@@ -110,6 +123,29 @@ namespace GFGGame
|
|
|
UpdateView();
|
|
|
});
|
|
|
}
|
|
|
+ private int GetThisCount(int itemId, List<ItemData> rewards)
|
|
|
+ {
|
|
|
+ int count = 0;
|
|
|
+ for (int i = 0; i < rewards.Count; i++)
|
|
|
+ {
|
|
|
+ if (rewards[i].id == itemId)
|
|
|
+ {
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return count;
|
|
|
+ }
|
|
|
+ private bool IsAddToNewRewardList(int itemId)
|
|
|
+ {
|
|
|
+ for (int i = 0; i < _newRewardList.Count; i++)
|
|
|
+ {
|
|
|
+ if (itemId == _newRewardList[i].id)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
private void OnClickBtnPass()
|
|
|
{
|
|
|
|