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); } } }
public void OnClickFightPrepareHandle() { DungeonInfo dungeonInfo = DungeonDetailProxy.instance.DungeonInfo; if (dungeonInfo.dungeonData.dayChallengeTimes > 0 && dungeonInfo.todayChallengedTimes >= dungeonInfo.dungeonData.dayChallengeTimes) { string tipsTitle = Localization.Get("ui.dungeon_detail_view.reset_dungeon_challenge_times_tips_title"); string tipsContent = string.Format(Localization.Get("ui.dungeon_detail_view.reset_dungeon_challenge_times_tips_content"), VIPProxy.instance.VIPData.dayRefreshTimes - dungeonInfo.dayRefreshTimes, VIPProxy.instance.VIPData.dayRefreshTimes); int cost = TimesCostData.GetTimesCostData(2, dungeonInfo.dayRefreshTimes + 1).cost; ConfirmBuyShopItemTipsView.Open(tipsTitle, tipsContent, new GameResData(BaseResType.Diamond, 0, cost, 0), OnClickBuyChallengeTimesHandler, ConsumeTipType.None); return; } if (isClickStartFight) { return; } StartCoroutine(EnableClickFightCoroutine()); DungeonDetailProxy.instance.StartFight(); }
public void OnClickExchangeBtnHandler() { BlackMarketInfo info = BlackMarketProxy.instance.selectBlackMarketInfo; if (info == null) { CommonErrorTipsView.Open(Localization.Get("ui.black_market_view.choiceGoods")); return; } if (info.limitLv > GameProxy.instance.AccountLevel) { CommonErrorTipsView.Open(Localization.Get("ui.black_market_view.levelNotEnough")); return; } if (info.remaindCount == 0) { CommonErrorTipsView.Open(Localization.Get("ui.black_market_view.exchangeEmpty")); return; } List <GameResData> materials = info.materials; GameResData resData; bool hasDiamond = false; GameResData diamondResData = null; for (int i = 0, count = materials.Count; i < count; i++) { resData = materials[i]; int ownCount = 0; if (resData.type == BaseResType.Item) { ownCount = ItemProxy.instance.GetItemCountByItemID(resData.id); } else { ownCount = GameProxy.instance.BaseResourceDictionary.GetValue(resData.type); if (resData.type == BaseResType.Diamond) { hasDiamond = true; diamondResData = resData; } } if (ownCount < resData.count) { CommonErrorTipsView.Open(Localization.Get("ui.black_market_view.notEnoughMaterial")); return; } } if (hasDiamond) { if (ConsumeTipProxy.instance.GetConsumeTipEnable(ConsumeTipType.DiamondBuyBlackmarket)) { ConfirmBuyShopItemTipsView.Open("", diamondResData, ExchangeSureHandler, ConsumeTipType.DiamondBuyBlackmarket); } else { ExchangeSureHandler(); } } else { ExchangeSureHandler(); } }
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)); } }