Exemplo n.º 1
0
        public void ItemClick()
        {
            if (itemList != null)
            {
                var itemData = itemList.Item as BagItemDataModel;

                if (itemData.ItemId != -1)
                {
                    var tbItem = Table.GetItemBase(itemData.ItemId);
                    ///宝箱类型特殊处理
                    if (tbItem.Type != 23500)
                    {
                        var e = new PackItemClickEvent();
                        e.BagId   = itemData.BagId;
                        e.Index   = itemList.Index;
                        e.TableId = itemData.ItemId;
                        EventDispatcher.Instance.DispatchEvent(e);
                    }
                    else
                    {
                        if (UIManager.GetInstance().GetController(UIConfig.ChestInfoUI).State == FrameState.Open)
                        {
                            var e = new PackItemClickEvent();
                            e.BagId   = itemData.BagId;
                            e.Index   = itemList.Index;
                            e.TableId = itemData.ItemId;
                            EventDispatcher.Instance.DispatchEvent(e);
                        }
                        else
                        {
                            var e = new UIEvent_ClickChest(itemData.ItemId);
                            //e.Args.Tab = itemData.ItemId;
                            e.From         = "Bag";
                            e.BagDataModel = itemData;
                            EventDispatcher.Instance.DispatchEvent(e);
                        }
                    }

                    //var e = new PackItemClickEvent();
                    //e.BagId = itemData.BagId;
                    //e.Index = itemList.Index;
                    //EventDispatcher.Instance.DispatchEvent(e);
                }
                else
                {
                    if (itemData.Status == (int)eBagItemType.Lock || itemData.Status == (int)eBagItemType.FreeLock)
                    {
                        var e = new PackUnlockEvent(itemData);
                        EventDispatcher.Instance.DispatchEvent(e);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void OnRewardClick(IEvent ievent)
        {
            var e      = ievent as UIEvent_PlayFrameRewardClick;
            var reward = DataModel.Rewards[e.Index];

            if (reward.CanGet && !reward.HasGot)
            {
                ActivationReward((int)eActivationRewardType.TableGift, reward.GiftId);
            }
            else
            {
                var e1 = new UIEvent_ClickChest(reward.ItemId);
                EventDispatcher.Instance.DispatchEvent(e1);
            }
        }
Exemplo n.º 3
0
 public void OnClickIcon()
 {
     if (ItemId != -1)
     {
         var tbItem = Table.GetItemBase(itemIdDM.ItemId);
         if (tbItem.Type != 23500)
         {
             GameUtils.ShowItemIdTip(ItemId);
         }
         else
         {
             var e = new UIEvent_ClickChest(itemIdDM.ItemId);
             e.From = "Store";
             EventDispatcher.Instance.DispatchEvent(e);
         }
     }
 }
Exemplo n.º 4
0
        private void SetChestId(IEvent ievent)
        {
            UIEvent_ClickChest e = (ievent as UIEvent_ClickChest);

            if (m_DataModel.TableId != e.TabIdx)
            {
                m_DataModel.TableId = e.TabIdx;
                InitDataModel();
            }
            if (string.IsNullOrEmpty(e.From))
            {
                m_DataModel.ShowGetButton  = false;
                m_DataModel.ShowSellButton = false;
            }
            else if (e.From == "Store")
            {
                m_DataModel.ShowGetButton  = false;
                m_DataModel.ShowSellButton = false;
            }
            else if (e.From == "Bag")
            {
                m_DataModel.ShowGetButton  = false;
                m_DataModel.ShowSellButton = true;
            }
            if (m_ItemInfoDataModel == null)
            {
                m_ItemInfoDataModel = new ItemInfoDataModel();
            }

            m_IIA.DataModel = e.BagDataModel;

            var controller = UIManager.Instance.GetController(UIConfig.ItemInfoUI);

            controller.RefreshData(m_IIA);

            m_ItemInfoDataModel = (controller.GetDataModel("") as ItemInfoDataModel);

            EventDispatcher.Instance.DispatchEvent(new Show_UI_Event(UIConfig.ChestInfoUI, new ChestInfoUIArguments()));
        }
Exemplo n.º 5
0
        public void OnClickIcon()
        {
            if (ItemId != -1)
            {
                var tbItem = Table.GetItemBase(itemIdDM.ItemId);
                if (tbItem.Type != 23500)
                {
                    //var e = new PackItemClickEvent();
                    //e.BagId = itemData.BagId;
                    //e.Index = itemList.Index;
                    //EventDispatcher.Instance.DispatchEvent(e);
                    GameUtils.ShowItemIdTip(ItemId);
                }
                else
                {
                    var e = new UIEvent_ClickChest(itemIdDM.ItemId);
                    //e.Args.Tab = itemData.ItemId;
                    e.From = "Store";
                    EventDispatcher.Instance.DispatchEvent(e);
                }

                // GameUtils.ShowItemIdTip(ItemId);
            }
        }
Exemplo n.º 6
0
        public void ItemClick()
        {
            var conler   = UIManager.Instance.GetController(UIConfig.BackPackUI);
            var packType = "";

            if (conler != null)
            {
                packType = conler.CallFromOtherClass("GetPackType", null).ToString();
            }

            if (itemList != null)
            {
                var itemData = itemList.Item as BagItemDataModel;

                if (itemData.ItemId != -1)
                {
                    var tbItem = Table.GetItemBase(itemData.ItemId);

                    ///时装特殊处理
                    if (tbItem.Type == 10500 || tbItem.Type == 10501 || tbItem.Type == 10502)
                    {
                        var e = new ShiZhuangItemUseEvent();
                        e.ItemData = itemData;
                        EventDispatcher.Instance.DispatchEvent(e);
                        return;
                    }

                    ///宝箱类型特殊处理
                    if (tbItem.Type != 23500)
                    {
                        var e = new PackItemClickEvent();
                        e.BagId   = itemData.BagId;
                        e.Index   = itemList.Index;
                        e.TableId = itemData.ItemId;
                        EventDispatcher.Instance.DispatchEvent(e);
                    }
                    else
                    {
                        if (UIManager.GetInstance().GetController(UIConfig.ChestInfoUI).State == FrameState.Open)
                        {
                            var e = new PackItemClickEvent();
                            e.BagId   = itemData.BagId;
                            e.Index   = itemList.Index;
                            e.TableId = itemData.ItemId;
                            EventDispatcher.Instance.DispatchEvent(e);
                        }
                        else if (packType == "Depot")
                        {
                            var e = new PackItemClickEvent();
                            e.BagId   = itemData.BagId;
                            e.Index   = itemList.Index;
                            e.TableId = itemData.ItemId;
                            EventDispatcher.Instance.DispatchEvent(e);
                        }
                        else
                        {
                            Debug.Log(packType.ToString());
                            var e = new UIEvent_ClickChest(itemData.ItemId);
                            //e.Args.Tab = itemData.ItemId;
                            e.From         = "Bag";
                            e.BagDataModel = itemData;
                            EventDispatcher.Instance.DispatchEvent(e);
                        }
                    }

                    //var e = new PackItemClickEvent();
                    //e.BagId = itemData.BagId;
                    //e.Index = itemList.Index;
                    //EventDispatcher.Instance.DispatchEvent(e);
                }
                else
                {
                    if (itemData.Status == (int)eBagItemType.Lock || itemData.Status == (int)eBagItemType.FreeLock)
                    {
                        var e = new PackUnlockEvent(itemData);
                        EventDispatcher.Instance.DispatchEvent(e);
                    }
                }
            }
        }