|
@@ -10,9 +10,17 @@ namespace GFGGame
|
|
|
{
|
|
|
private UI_LuckBoxBonusShowUI _ui;
|
|
|
private List<ItemData> _rewardList = new List<ItemData>();
|
|
|
+ private List<ItemData> _rewardItemList = new List<ItemData>();
|
|
|
private Dictionary<int , Dictionary<int, EffectUI>> _effListTen = new Dictionary<int, Dictionary<int, EffectUI>>();
|
|
|
private Dictionary<int, EffectUI> _effList = new Dictionary<int, EffectUI>();
|
|
|
|
|
|
+ Dictionary<int, int> _itemIdList = new Dictionary<int, int>();
|
|
|
+ Dictionary<int, GComponent> _itemObjList = new Dictionary<int, GComponent>();
|
|
|
+ List<int> _recordOpenIndex = new List<int>(); //记录打开过得item位置
|
|
|
+ private int _countShow = 0; //第几次展示
|
|
|
+ private int _countNewRecord = 0; //展示步骤
|
|
|
+ private bool touchFlipOpen = true; //禁用点击
|
|
|
+
|
|
|
private EffectUI _effectUI1;
|
|
|
private EffectUI _effectUI2;
|
|
|
private EffectUI _effectUI3;
|
|
@@ -67,9 +75,11 @@ namespace GFGGame
|
|
|
this.viewCom = _ui.target;
|
|
|
isfullScreen = true;
|
|
|
|
|
|
- _ui.m_loaBg.onClick.Add(this.Hide);
|
|
|
+ _ui.m_loaBg.onClick.Add(OnClickLoaBg);
|
|
|
_ui.m_loaBg.url = ResPathUtil.GetBgImgPath("zx_bg");
|
|
|
|
|
|
+ _ui.m_BtnPass.onClick.Add(OnClickBtnPass);
|
|
|
+
|
|
|
UpdateEffect();
|
|
|
}
|
|
|
private void UpdateEffect()
|
|
@@ -82,6 +92,11 @@ namespace GFGGame
|
|
|
{
|
|
|
base.OnShown();
|
|
|
_rewardList.AddRange(this.viewData as List<ItemData>);
|
|
|
+ _itemIdList.Clear();
|
|
|
+ _itemObjList.Clear();
|
|
|
+ _recordOpenIndex.Clear();
|
|
|
+ _ui.m_BtnPass.visible = true;
|
|
|
+
|
|
|
if (_rewardList.Count == 1)
|
|
|
{
|
|
|
_ui.m_c1.selectedIndex = 0;
|
|
@@ -102,59 +117,59 @@ namespace GFGGame
|
|
|
_rewardList.Clear();
|
|
|
|
|
|
base.OnHide();
|
|
|
- GetSuitItemController.TryShow(0);
|
|
|
+ Timers.inst.Remove(UpDataTime);
|
|
|
+ Timers.inst.Remove(UpClickDataTime);
|
|
|
}
|
|
|
|
|
|
private void UpdateItem(GComponent com, int index, int countType)
|
|
|
{
|
|
|
UI_LuckyBoxBonusShowItem item = UI_LuckyBoxBonusShowItem.Proxy(com);
|
|
|
-
|
|
|
ItemData itemData = _rewardList[index];
|
|
|
ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemData.id);
|
|
|
item.m_comIcon.m_c1.selectedIndex = itemCfg.rarity;
|
|
|
item.m_comIcon.m_txtName.text = itemCfg.name;
|
|
|
item.m_comIcon.m_icon.url = ResPathUtil.GetIconPath(itemCfg);
|
|
|
- RarityIconController.UpdateRarityIcon(item.m_comIcon.m_rarity, itemData.id, false);
|
|
|
+ item.m_comIcon.m_FlipOpenType.selectedIndex = 1;
|
|
|
|
|
|
- item.m_comIcon.m_holder.visible = false;
|
|
|
- item.m_comIcon.m_holder1.visible = false;
|
|
|
+ //带特效的处理先注释
|
|
|
+ //item.m_comIcon.m_holder.visible = false;
|
|
|
+ //item.m_comIcon.m_holder1.visible = false;
|
|
|
+ //if (itemCfg.rarity > 2) {
|
|
|
+ // string resPath = itemCfg.rarity == ConstDressRarity.Rarity_TIANYI ? "CK_all_01" : "CK_all_02";
|
|
|
+ // GGraph holder = itemCfg.rarity == 3 ? item.m_comIcon.m_holder : item.m_comIcon.m_holder1;
|
|
|
+ // holder.visible = true;
|
|
|
+ // if (countType == 10 && (!_effListTen.ContainsKey(index) ||
|
|
|
+ // ((itemCfg.rarity == 3 && !_effListTen[index].ContainsKey(0)) || (itemCfg.rarity == 4 && !_effListTen[index].ContainsKey(1)))))
|
|
|
+ // {
|
|
|
+ // EffectUI _effectUI = EffectUIPool.CreateEffectUI(holder, "ui_LuckyBox", resPath);
|
|
|
|
|
|
- if (itemCfg.rarity > 2) {
|
|
|
- string resPath = itemCfg.rarity == ConstDressRarity.Rarity_TIANYI ? "CK_all_01" : "CK_all_02";
|
|
|
- GGraph holder = itemCfg.rarity == 3 ? item.m_comIcon.m_holder : item.m_comIcon.m_holder1;
|
|
|
- holder.visible = true;
|
|
|
- if (countType == 10 && (!_effListTen.ContainsKey(index) ||
|
|
|
- ((itemCfg.rarity == 3 && !_effListTen[index].ContainsKey(0)) || (itemCfg.rarity == 4 && !_effListTen[index].ContainsKey(1)))))
|
|
|
- {
|
|
|
- EffectUI _effectUI = EffectUIPool.CreateEffectUI(holder, "ui_LuckyBox", resPath);
|
|
|
+ // if (!_effListTen.ContainsKey(index))
|
|
|
+ // {
|
|
|
+ // Dictionary<int, EffectUI> effectList = new Dictionary<int, EffectUI>();
|
|
|
+ // if (itemCfg.rarity == 3)
|
|
|
+ // effectList.Add(0, _effectUI);
|
|
|
+ // else if (itemCfg.rarity == 4)
|
|
|
+ // effectList.Add(1, _effectUI);
|
|
|
+ // _effListTen.Add(index, effectList);
|
|
|
+ // }
|
|
|
+ // else {
|
|
|
+ // if (itemCfg.rarity == 3)
|
|
|
+ // _effListTen[index].Add(0, _effectUI);
|
|
|
+ // else if (itemCfg.rarity == 4)
|
|
|
+ // _effListTen[index].Add(1, _effectUI);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
- if (!_effListTen.ContainsKey(index))
|
|
|
- {
|
|
|
- Dictionary<int, EffectUI> effectList = new Dictionary<int, EffectUI>();
|
|
|
- if (itemCfg.rarity == 3)
|
|
|
- effectList.Add(0, _effectUI);
|
|
|
- else if (itemCfg.rarity == 4)
|
|
|
- effectList.Add(1, _effectUI);
|
|
|
- _effListTen.Add(index, effectList);
|
|
|
- }
|
|
|
- else {
|
|
|
- if (itemCfg.rarity == 3)
|
|
|
- _effListTen[index].Add(0, _effectUI);
|
|
|
- else if (itemCfg.rarity == 4)
|
|
|
- _effListTen[index].Add(1, _effectUI);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (countType == 1 &&
|
|
|
- ((itemCfg.rarity == 3 && !_effList.ContainsKey(0)) || (itemCfg.rarity == 4 && !_effList.ContainsKey(1))))
|
|
|
- {
|
|
|
- EffectUI _effectUI = EffectUIPool.CreateEffectUI(holder, "ui_LuckyBox", resPath);
|
|
|
- if (itemCfg.rarity == 3)
|
|
|
- _effList.Add(0, _effectUI);
|
|
|
- else if (itemCfg.rarity == 4)
|
|
|
- _effList.Add(1, _effectUI);
|
|
|
- }
|
|
|
- }
|
|
|
+ // if (countType == 1 &&
|
|
|
+ // ((itemCfg.rarity == 3 && !_effList.ContainsKey(0)) || (itemCfg.rarity == 4 && !_effList.ContainsKey(1))))
|
|
|
+ // {
|
|
|
+ // EffectUI _effectUI = EffectUIPool.CreateEffectUI(holder, "ui_LuckyBox", resPath);
|
|
|
+ // if (itemCfg.rarity == 3)
|
|
|
+ // _effList.Add(0, _effectUI);
|
|
|
+ // else if (itemCfg.rarity == 4)
|
|
|
+ // _effList.Add(1, _effectUI);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
|
|
|
int count = 0;
|
|
|
bool isFirst = false;
|
|
@@ -169,7 +184,10 @@ namespace GFGGame
|
|
|
{
|
|
|
item.target.onClick.Add(ShowItemTips);
|
|
|
}
|
|
|
- item.target.data = itemCfg.id;
|
|
|
+ item.target.data = index;
|
|
|
+
|
|
|
+ _itemIdList.Add(index,itemCfg.id);
|
|
|
+ _itemObjList.Add(index, com);
|
|
|
|
|
|
UI_LuckyBoxBonusShowItem.ProxyEnd();
|
|
|
}
|
|
@@ -177,9 +195,132 @@ namespace GFGGame
|
|
|
private void ShowItemTips(EventContext context)
|
|
|
{
|
|
|
GObject obj = context.sender as GObject;
|
|
|
- int itemID = (int)obj.data;
|
|
|
+ int index = (int)obj.data;
|
|
|
+ TouchClickItem(index);
|
|
|
+ Timers.inst.Add(1f, 0, UpClickDataTime,index);
|
|
|
+ }
|
|
|
+
|
|
|
+ void TouchClickItem(int index)
|
|
|
+ {
|
|
|
+ if (!touchFlipOpen)
|
|
|
+ return;
|
|
|
+
|
|
|
+ ClickItem(index);
|
|
|
+ }
|
|
|
+
|
|
|
+ void ClickItem(int index)
|
|
|
+ {
|
|
|
+ if (!_recordOpenIndex.Contains(index)) {
|
|
|
+
|
|
|
+ //touchFlipOpen = false;
|
|
|
+
|
|
|
+ UI_LuckyBoxBonusShowItem item = UI_LuckyBoxBonusShowItem.Proxy(_itemObjList[index]);
|
|
|
+ item.m_comIcon.m_FlipOpenType.selectedIndex = 0;
|
|
|
+
|
|
|
+ if (_recordOpenIndex.Count >= _rewardList.Count)
|
|
|
+ _ui.m_BtnPass.visible = false;
|
|
|
+
|
|
|
+ //先翻开牌面
|
|
|
+ if (!item.m_comIcon.m_imgNew.visible)
|
|
|
+ {
|
|
|
+ HideOtherShowWindow();
|
|
|
+ _recordOpenIndex.Add(index);
|
|
|
+ touchFlipOpen = true;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (_countNewRecord <= 1) {
|
|
|
+ HideOtherShowWindow();
|
|
|
+ _countNewRecord += 1;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- GoodsItemTipsController.ShowItemTips(itemID);
|
|
|
+ if (item.m_comIcon.m_imgNew.visible && _countNewRecord >= 1)
|
|
|
+ {
|
|
|
+ //判断是否有套装需要展示
|
|
|
+ if (GetSuitItemController.GetSuitWaitingToId(_itemIdList[index]))
|
|
|
+ {
|
|
|
+ if (_countShow < 1)
|
|
|
+ {
|
|
|
+ ViewManager.Hide<GetSuitItemVIew>();
|
|
|
+ _rewardItemList.Clear();
|
|
|
+ _rewardItemList.Add(_rewardList[index]);
|
|
|
+ ViewManager.Show<LuckyBoxNewDressView>(_rewardItemList);
|
|
|
+ _countShow += 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ViewManager.Hide<LuckyBoxNewDressView>();
|
|
|
+ ViewManager.Hide<LuckyBoxNewCardView>();
|
|
|
+ GetSuitItemController.TryShow(_itemIdList[index]);
|
|
|
+ _recordOpenIndex.Add(index);
|
|
|
+ touchFlipOpen = true;
|
|
|
+ _countShow = 0;
|
|
|
+ _countNewRecord = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ViewManager.Hide<GetSuitItemVIew>();
|
|
|
+ _rewardItemList.Clear();
|
|
|
+ _rewardItemList.Add(_rewardList[index]);
|
|
|
+ ViewManager.Show<LuckyBoxNewDressView>(_rewardItemList);
|
|
|
+ _recordOpenIndex.Add(index);
|
|
|
+ touchFlipOpen = true;
|
|
|
+ _countNewRecord = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ UI_LuckyBoxBonusShowItem.ProxyEnd();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ GoodsItemTipsController.ShowItemTips(_itemIdList[index]);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnClickLoaBg()
|
|
|
+ {
|
|
|
+ if (_recordOpenIndex.Count >= _rewardList.Count)
|
|
|
+ this.Hide();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnClickBtnPass()
|
|
|
+ {
|
|
|
+ Timers.inst.Add(1f, 0, UpDataTime);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void UpDataTime(object param = null)
|
|
|
+ {
|
|
|
+ if (_recordOpenIndex.Count >= _rewardList.Count) {
|
|
|
+ Timers.inst.Remove(UpDataTime);
|
|
|
+ HideOtherShowWindow();
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < _rewardList.Count; i++)
|
|
|
+ {
|
|
|
+ if (!_recordOpenIndex.Contains(i)) {
|
|
|
+ ClickItem(i);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void UpClickDataTime(object param = null)
|
|
|
+ {
|
|
|
+ int index = (int)param;
|
|
|
+ if (_recordOpenIndex.Contains(index))
|
|
|
+ {
|
|
|
+ Timers.inst.Remove(UpClickDataTime);
|
|
|
+ HideOtherShowWindow();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ ClickItem(index);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void HideOtherShowWindow()
|
|
|
+ {
|
|
|
+ ViewManager.Hide<GetSuitItemVIew>();
|
|
|
+ ViewManager.Hide<LuckyBoxNewDressView>();
|
|
|
+ ViewManager.Hide<LuckyBoxNewCardView>();
|
|
|
}
|
|
|
}
|
|
|
}
|