public void ClickTransferHandler()
        {
            int transferTaskConditioCount = _playerData.transferTaskConditionIDList.Count;

            for (int i = 0; i < transferTaskConditioCount; i++)
            {
                TaskConditionData taskConditionData = TaskConditionData.GetTaskConditionData(_playerData.transferTaskConditionIDList[i]);
                if (!TaskUtil.IsTaskConditionFinished(taskConditionData))
                {
                    CommonErrorTipsView.Open(Localization.Get("ui.common_tips.activate_profession_task_unfinished"));
                    return;
                }
            }
            //通用材料检测
            Dictionary <uint, List <Toggle> > groupDic = generalMeterialGroup.toggleGroup;
            List <int> generalMList = new List <int>();

            foreach (var value in groupDic)
            {
                if (!value.Value[0].isOn)
                {
                    generalMList.Add((int)value.Key);
                }
            }
            //资源是否够
            List <GameResData> transferCostResourcesList = _playerData.transferCostList;
            int transferCostResourceCount = transferCostResourcesList.Count;

            for (int i = 0; i < transferCostResourceCount; i++)
            {
                GameResData gameResData = transferCostResourcesList[i];
                if (GameResUtil.IsBaseRes(gameResData.type))
                {
                    if (GameProxy.instance.BaseResourceDictionary[gameResData.type] < gameResData.count)
                    {
                        CommonErrorTipsView.Open(string.Format(Localization.Get("ui.common_tips.not_enough_resource"), GameResUtil.GetBaseResName(gameResData.type)));
                        return;
                    }
                }
                else if (gameResData.type == BaseResType.Item)
                {
                    ItemData itemData = ItemData.GetItemDataByID(gameResData.id);
                    if (generalMList.Contains(gameResData.id))                   //选择了通用材料
                    {
                        itemData = ItemData.GetItemDataByID(itemData.universal_id);
                    }

                    ItemInfo itemInfo = ItemProxy.instance.GetItemInfoByItemID(itemData.id);
                    if (itemInfo == null || itemInfo.count < gameResData.count)
                    {
//						CommonErrorTipsView.Open(string.Format(Localization.Get("ui.common_tips.not_enough_resource"), Localization.Get(itemData.name)));
                        CommonAutoDestroyTipsView.Open(Localization.Get("ui.activate_profession_view.item_not_enough"));
                        return;
                    }
                }
            }

            PlayerController.instance.CLIENT2LOBBY_PLAYER_TRANSFER_REQ((int)_playerData.Id, generalMList);
            UIMgr.instance.Close(PREFAB_PATH);
        }
Пример #2
0
        public void ClickAgainHandler()
        {
            int         shopID          = 0;
            int         shopItemID      = 0;
            string      shopItemName    = string.Empty;
            GameResData costGameResData = null;
            int         costType        = 1;

            if (_shopHeroRandomCardInfo != null)
            {
                shopID          = _shopHeroRandomCardInfo.ShopCardRandomData.shopID;
                shopItemID      = _shopHeroRandomCardInfo.ShopCardRandomData.id;
                shopItemName    = Localization.Get(_shopHeroRandomCardInfo.ShopCardRandomData.name);
                costGameResData = _shopHeroRandomCardInfo.ShopCardRandomData.costGameResData;
                if (_shopHeroRandomCardInfo.RemainFreeTimes > 0 && _shopHeroRandomCardInfo.NextFreeBuyCountDownTime <= 0)
                {
                    costType = 0;
                }
            }

            if (costType == 0)   //免费
            {
                ShopController.instance.CLIENT2LOBBY_PURCHASE_GOODS_REQ(shopID, shopItemID, costType);
            }
            else if (costType == 1)   //非免费
            {
                if (GameResUtil.IsBaseRes(costGameResData.type))
                {
                    if (GameProxy.instance.BaseResourceDictionary[costGameResData.type] < costGameResData.count)
                    {
                        CommonErrorTipsView.Open(string.Format(Localization.Get("ui.common_tips.not_enough_resource"), GameResUtil.GetBaseResName(costGameResData.type)));
                        return;
                    }

                    if (costGameResData.type == Logic.Enums.BaseResType.Diamond)
                    {
                        if (ConsumeTipProxy.instance.GetConsumeTipEnable(ConsumeTipType.DiamondDrawSingleHero))
                        {
                            ConfirmBuyShopItemTipsView.Open(shopItemName, costGameResData, ClickConfirmBuyHandler, ConsumeTipType.DiamondDrawSingleHero);
                        }
                        else
                        {
                            ClickConfirmBuyHandler();
                        }
                    }
                    else
                    {
                        ShopController.instance.CLIENT2LOBBY_PURCHASE_GOODS_REQ(shopID, shopItemID, costType);
                    }
                }
                else
                {
                    ShopController.instance.CLIENT2LOBBY_PURCHASE_GOODS_REQ(shopID, shopItemID, costType);
                }
            }
        }
Пример #3
0
        public void ClickBuyHandler()
        {
            int            shopID          = 0;
            int            shopItemID      = 0;
            string         shopItemName    = string.Empty;
            GameResData    costGameResData = null;
            int            costType        = 1;
            ConsumeTipType consumTipType   = ConsumeTipType.None;          //提示

            if (_shopHeroRandomCardInfo != null)
            {
                shopID          = _shopHeroRandomCardInfo.ShopCardRandomData.shopID;
                shopItemID      = _shopHeroRandomCardInfo.ShopCardRandomData.id;
                shopItemName    = Localization.Get(_shopHeroRandomCardInfo.ShopCardRandomData.name);
                costGameResData = _shopHeroRandomCardInfo.ShopCardRandomData.costGameResData;
                if (_shopHeroRandomCardInfo.RemainFreeTimes > 0 && _shopHeroRandomCardInfo.NextFreeBuyCountDownTime <= 0)
                {
                    costType = 0;
                }
                consumTipType = _shopHeroRandomCardInfo.ShopCardRandomData.buyType == 1 ? ConsumeTipType.DiamondDrawSingleHero : ConsumeTipType.DiamondDrawTenHeroes;
            }
            else if (_shopEquipmentRandomCardInfo != null)
            {
                shopID          = _shopEquipmentRandomCardInfo.ShopCardRandomData.shopID;
                shopItemID      = _shopEquipmentRandomCardInfo.ShopCardRandomData.id;
                shopItemName    = Localization.Get(_shopEquipmentRandomCardInfo.ShopCardRandomData.name);
                costGameResData = _shopEquipmentRandomCardInfo.ShopCardRandomData.costGameResData;
                if (_shopEquipmentRandomCardInfo.RemainFreeTimes > 0 && _shopEquipmentRandomCardInfo.NextFreeBuyCountDownTime <= 0)
                {
                    costType = 0;
                }
//				consumTipType = _shopEquipmentRandomCardInfo.ShopCardRandomData.buyType == 1 ? ConsumeTipType.DiamondSingleLotteryEquip : ConsumeTipType.None;
            }
            else if (_shopDiamondItemInfo != null)
            {
                shopID          = _shopDiamondItemInfo.ShopDiamondData.shopID;
                shopItemID      = _shopDiamondItemInfo.ShopDiamondData.id;
                shopItemName    = Localization.Get(_shopDiamondItemInfo.ShopDiamondData.name);
                costGameResData = _shopDiamondItemInfo.ShopDiamondData.costGameResData;
            }
            else if (_shopActionItemInfo != null)
            {
                shopID          = _shopActionItemInfo.ShopLimitItemData.shopID;
                shopItemID      = _shopActionItemInfo.ShopLimitItemData.id;
                shopItemName    = Localization.Get(_shopActionItemInfo.ShopLimitItemData.name);
                costGameResData = _shopActionItemInfo.ShopLimitItemData.costGameResData;
                BaseResType resourseResType = _shopActionItemInfo.ShopLimitItemData.resourseGameResData.type;
                if (resourseResType == BaseResType.TowerAction)
                {
                    consumTipType = ConsumeTipType.DiamondBuyWorldTreeCount;
                }
                else if (resourseResType == BaseResType.PvpAction)
                {
                    consumTipType = ConsumeTipType.DiamondBuyPvpCount;
                }
                else if (resourseResType == BaseResType.PveAction)
                {
                    consumTipType = ConsumeTipType.DiamondBuyPveAction;
                }
            }
            else if (_shopGoldItemInfo != null)
            {
                shopID          = _shopGoldItemInfo.ShopLimitItemData.shopID;
                shopItemID      = _shopGoldItemInfo.ShopLimitItemData.id;
                shopItemName    = Localization.Get(_shopGoldItemInfo.ShopLimitItemData.name);
                costGameResData = _shopGoldItemInfo.ShopLimitItemData.costGameResData;
                consumTipType   = ConsumeTipType.DiamondBuyCoin;
            }
            else if (_shopGoodsItemInfo != null)
            {
                shopID          = _shopGoodsItemInfo.ShopGoodsData.shopID;
                shopItemID      = _shopGoodsItemInfo.ShopGoodsData.id;
                shopItemName    = Localization.Get(_shopGoodsItemInfo.ShopGoodsData.name);
                costGameResData = _shopGoodsItemInfo.ShopGoodsData.costGameResData;
            }

            // 对于限制购买次数的物品,先判断是否还有购买次数
            if (_shopActionItemInfo != null || _shopGoldItemInfo != null)
            {
                ShopLimitItemData shopLimitItemData = null;
                if (_shopActionItemInfo != null)
                {
                    shopLimitItemData = _shopActionItemInfo.ShopLimitItemData;
                    if (shopLimitItemData.baseResType == BaseResType.PveAction)
                    {
                        if (shopLimitItemData.id > VIPProxy.instance.VIPData.pveActionBuyTimes)
                        {
                            ConfirmTipsView.Open(Localization.Get("ui.shop_view.not_enough_remain_times_tips"), ClickGoToBuyDiamond);
                            return;
                        }
                    }
                    else if (shopLimitItemData.baseResType == BaseResType.TowerAction)
                    {
                        if (shopLimitItemData.id > VIPProxy.instance.VIPData.worldTreeActionBuyTimes)
                        {
                            ConfirmTipsView.Open(Localization.Get("ui.shop_view.not_enough_remain_times_tips"), ClickGoToBuyDiamond);
                            return;
                        }
                    }
                }
                else if (_shopGoldItemInfo != null)
                {
                    shopLimitItemData = _shopGoldItemInfo.ShopLimitItemData;
                    if (shopLimitItemData.id > VIPProxy.instance.VIPData.goldBuyTimes)
                    {
                        ConfirmTipsView.Open(Localization.Get("ui.shop_view.not_enough_remain_times_tips"), ClickGoToBuyDiamond);
                        return;
                    }
                }
            }
            // 对于限制购买次数的物品,先判断是否还有购买次数

            if (costType == 0)               //免费
            {
                ShopController.instance.CLIENT2LOBBY_PURCHASE_GOODS_REQ(shopID, shopItemID, costType);
            }
            else if (costType == 1)               //非免费
            {
                if (GameResUtil.IsBaseRes(costGameResData.type))
                {
                    if (GameProxy.instance.BaseResourceDictionary[costGameResData.type] < costGameResData.count)
                    {
                        if (costGameResData.type == BaseResType.Diamond)
                        {
                            string diamondNotEnoughTipsString = Localization.Get("ui.common_tips.not_enough_diamond_and_go_to_buy");
                            ConfirmTipsView.Open(diamondNotEnoughTipsString, ClickGoToBuyDiamond, ConsumeTipType.None);
                        }
                        else
                        {
                            CommonErrorTipsView.Open(string.Format(Localization.Get("ui.common_tips.not_enough_resource"), GameResUtil.GetBaseResName(costGameResData.type)));
                        }
                        return;
                    }

                    if (costGameResData.type == Logic.Enums.BaseResType.Diamond)
                    {
                        if (ConsumeTipProxy.instance.GetConsumeTipEnable(consumTipType))
                        {
                            ConfirmBuyShopItemTipsView.Open(shopItemName, costGameResData, ClickConfirmBuyHandler, consumTipType);
                        }
                        else
                        {
                            ClickConfirmBuyHandler();
                        }
                    }
                    else
                    {
                        ShopController.instance.CLIENT2LOBBY_PURCHASE_GOODS_REQ(shopID, shopItemID, costType);
                    }
                }
                else
                {
                    ShopController.instance.CLIENT2LOBBY_PURCHASE_GOODS_REQ(shopID, shopItemID, costType);
                }
                Debugger.Log(string.Format("[ShopItemView]shopid:{0},shopitemid:{1},costtype:{2}", shopID, shopItemID, costType));
            }
        }