| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- using UnityEngine;
- using FairyGUI;
- using UI.TurnTable;
- using System.Collections.Generic;
- using System.Linq;
- using cfg;
- using cfg.GfgCfg;
- using ET;
- namespace GFGGame
- {
- public class TurnSpecialTipsView : BaseWindow
- {
- private UI_TurnSpecialTipsUI _ui;
- public List<DropOutCfg> rewardList = new List<DropOutCfg>();
- private EffectUI _effectUI1;
- private EffectUI _effectUI2;
- public override void Dispose()
- {
- EffectUIPool.Recycle(_effectUI1);
- _effectUI1 = null;
- EffectUIPool.Recycle(_effectUI2);
- _effectUI2 = null;
- base.Dispose();
- if (_ui != null)
- {
- _ui.Dispose();
- _ui = null;
- }
- base.Dispose();
- }
- protected override void Init()
- {
- base.Init();
- }
- protected override void OnInit()
- {
- base.OnInit();
- packageName = UI_TurnSpecialTipsUI.PACKAGE_NAME;
- _ui = UI_TurnSpecialTipsUI.Create();
- viewCom = _ui.target;
- modal = true;
- this.viewCom.Center();
- viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
- _ui.m_list.itemRenderer = RenderTaskList;
- }
- protected override void OnShown()
- {
- base.OnShown();
- //这里根据表来,看放哪
- //int activityID = ActivityDataManager.Instance.GetCurOpenActiveByType(ActivityDataManager.Instance.TurnTableActivityType);
- int dropId =
- ActivityDataManager.Instance
- .TipsDropId; //TurntableLuckyBoxCfgArray.Instance.GetCfgByActivityId(activityID).ExtraIdDropId;
- rewardList = CommonDataManager.Tables.TblDropOutCfg.DataList.Where(a => a.Id == dropId).ToList();
- _ui.m_list.numItems = rewardList.Count;
- }
- protected override void OnHide()
- {
- base.OnHide();
- }
- private void RenderTaskList(int index, GObject obj)
- {
- ItemParamProto itemParam = new ItemParamProto()
- { ItemId = rewardList[index].Item, Count = rewardList[index].MaxNum };
- ItemData reward = ItemUtil.createItemData(itemParam);
- if (obj.data == null)
- {
- obj.data = new ItemView(obj as GComponent);
- }
- (obj.data as ItemView).SetData(reward);
- (obj.data as ItemView).ChangeTxtCountStyle();
- if (isGetBag(reward.id))
- {
- (obj.data as ItemView).ImgHasVisible = true;
- }
- else
- {
- (obj.data as ItemView).ImgHasVisible = false;
- }
- }
- private bool isGetGift(int id)
- {
- ItemCfg itemCfg = CommonDataManager.Tables.TblItemCfg.GetOrDefault(id);
- if (itemCfg == null)
- {
- return false;
- }
- //int targetCount = itemCfg.itemsArr.Length;
- int targetCount = itemCfg.Items.Count;
- int count = 0;
- for (int i = 0; i < itemCfg.Items.Count; i++)
- {
- ItemData itemDate;
- if (BagDataManager.Instance.GetBagData().TryGetValue(itemCfg.Items[i].ItemId, out itemDate))
- {
- if (itemDate.num >= itemCfg.Items[i].Count)
- {
- count++;
- }
- }
- else
- {
- ItemCfg itemcfg = CommonDataManager.Tables.TblItemCfg.GetOrDefault(itemCfg.Items[i].ItemId);
- if (itemcfg.ItemType == ConstItemType.CARD)
- {
- CardData data = CardDataManager.GetCardDataById(itemcfg.Id);
- if (data != null)
- {
- count++;
- }
- }
- else if (itemcfg.ItemType == ConstItemType.ITEM && itemcfg.SubType == 1)
- {
- }
- else
- {
- if (ItemDataManager.GetItemNum(itemCfg.Items[i].ItemId) >= itemCfg.Items[i].Count)
- {
- count++;
- }
- }
- }
- }
- if (count >= targetCount)
- {
- return true;
- }
- return false;
- }
- private bool isGetBag(int id)
- {
- foreach (var item in ActivityDataManager.Instance.GiftBagIdList)
- {
- if (item == id)
- {
- return true;
- }
- }
- return false;
- }
- }
- }
|