public bool GetConsumeTipEnable(ConsumeTipType type)
 {
     if (ConsumeTipDictionary.ContainsKey(type))
     {
         return(ConsumeTipDictionary[type]);
     }
     return(true);
 }
 public static ConsumeTipData GetConsumeTipDataByType(ConsumeTipType type)
 {
     if (ConsumeTipDataDictionary.ContainsKey((int)type))
     {
         return(ConsumeTipDataDictionary[(int)type]);
     }
     return(null);
 }
        public static GameObject OpenConfirmBuyShopItemTipsView(string itemName, int costResTypeValue, int costResID, int costResCount, System.Action onClickBuyButtonHandler, int consumeTipTypeValue)
        {
            GameResData costGameResData = new GameResData();

            costGameResData.type  = (BaseResType)costResTypeValue;
            costGameResData.id    = costResID;
            costGameResData.count = costResCount;
            ConsumeTipType consumeTipType = (ConsumeTipType)consumeTipTypeValue;

            return(Logic.UI.Tips.View.ConfirmBuyShopItemTipsView.Open(itemName, costGameResData, onClickBuyButtonHandler, consumeTipType).gameObject);
        }
Exemple #4
0
 public void SetTip(int costDiamond, int buyCount, int remaindCount, System.Action sureCallback, ConsumeTipType type)
 {
     _sureCallback        = sureCallback;
     costDiamondText.text = string.Format(Localization.Get("ui.train_buy_point_view.diamondCost"), costDiamond);
     buyCountText.text    = string.Format(Localization.Get("ui.train_buy_point_view.buyNum"), buyCount);
     remaindText.text     = string.Format(Localization.Get("ui.train_buy_point_view.remaindTime"), remaindCount);
     _consumeTipType      = type;
     if (!ConsumeTipProxy.instance.HasConsumeTipKey(type))
     {
         toggleTip.gameObject.SetActive(false);
     }
 }
 public void SetTypeAndCost(BagType bagType, int cost, System.Action confirmAction, ConsumeTipType type = ConsumeTipType.None)
 {
     _bagType        = bagType;
     _cost           = cost;
     costText.text   = cost.ToString();
     action          = confirmAction;
     _consumeTipType = type;
     if (!ConsumeTipProxy.instance.HasConsumeTipKey(type))
     {
         toggleTip.gameObject.SetActive(false);
     }
 }
 public void SetInfo(string tipsDescription, System.Action onClickOKButtonHandler, ConsumeTipType type = ConsumeTipType.None)
 {
     tipsTitleText.text          = Localization.Get("confirm_tips_view.tips_title");
     cancelText.text             = Localization.Get("confirm_tips_view.cancel");
     okText.text                 = Localization.Get("confirm_tips_view.ok");
     tipsDescriptionText.text    = tipsDescription;
     this.onClickOKButtonHandler = onClickOKButtonHandler;
     _consumeTipType             = type;
     if (!ConsumeTipProxy.instance.HasConsumeTipKey(type))
     {
         toggleTip.gameObject.SetActive(false);
     }
 }
        public void SetConsumeTipEnable(ConsumeTipType type, bool value)
        {
            if (type == ConsumeTipType.None)
            {
                return;
            }
            LuaTable table = (LuaTable)LuaScriptMgr.Instance.CallLuaFunction("gamemanager.GetModel", "consume_tip_model")[0];

            table.GetLuaFunction("SetConsumeTipEnable").Call((int)type, value);

            if (ConsumeTipDictionary.ContainsKey(type))
            {
                ConsumeTipDictionary[type] = value;
                //Save();
            }
        }
Exemple #8
0
 private void SetInfo(GameResData costGameResData, string content, System.Action clickCancelButtonDelegate, System.Action clickOKButtonDelegate, ConsumeTipType type = ConsumeTipType.None)
 {
     titleText.text     = Localization.Get("ui.confirm_cost_tip_view.title");
     costTitleText.text = Localization.Get("ui.confirm_cost_tip_view.cost_title");
     contentText.text   = content;
     costResourceIconImage.SetSprite(ResMgr.instance.Load <Sprite>(UIUtil.GetBaseResIconPath(costGameResData.type)));
     costResourceAmountText.text = costGameResData.count.ToString();
     cancelText.text             = Localization.Get("ui.confirm_cost_tip_view.cancel");
     okText.text = Localization.Get("ui.confirm_cost_tip_view.ok");
     _clickCancelButtonDelegate = clickCancelButtonDelegate;
     _clickOKButtonDelegate     = clickOKButtonDelegate;
     _consumeTipType            = type;
     if (!ConsumeTipProxy.instance.HasConsumeTipKey(type))
     {
         toggleTip.gameObject.SetActive(false);
     }
 }
 public void SetInfo(string itemName, GameResData costGameResData, System.Action onClickBuyButtonHandler, ConsumeTipType type)
 {
     titleText.text     = Localization.Get("ui.confirm_buy_shop_item_tips_view.title");
     tipsText.text      = string.Format(Localization.Get("ui.confirm_buy_shop_item_tips_view.tips"), itemName);
     costTitleText.text = Localization.Get("ui.confirm_buy_shop_item_tips_view.tip.cost_title");
     costResourceIconImage.SetSprite(ResMgr.instance.Load <Sprite>(UIUtil.GetBaseResIconPath(costGameResData.type)));
     costResourceIconImage.SetNativeSize();
     costResourceCountText.text = costGameResData.count.ToString();
     cancelText.text            = Localization.Get("ui.confirm_buy_shop_item_tips_view.tip.cancel");
     buyText.text = Localization.Get("ui.confirm_buy_shop_item_tips_view.tip.buy");
     this.onClickBuyButtonHandler = onClickBuyButtonHandler;
     _consumeTipType = type;
     if (!ConsumeTipProxy.instance.HasConsumeTipKey(type))
     {
         toggleTip.gameObject.SetActive(false);
     }
 }
        public static void Open(string tipsDescription, System.Action onClickOKButtonHandler, System.Action onClickCancelButtonHandler, ConsumeTipType type = ConsumeTipType.None)
        {
            ConfirmTipsView confirmTipsView = UIMgr.instance.Open <ConfirmTipsView>(PREFAB_PATH, EUISortingLayer.Tips);

            confirmTipsView.SetInfo(tipsDescription, onClickOKButtonHandler, type);
            confirmTipsView.onClickCancelButtonHandler = onClickCancelButtonHandler;
        }
        public static CommonExpandBagTipsView Open(BagType bagType, int cost, System.Action confirmAction, ConsumeTipType type)
        {
            CommonExpandBagTipsView view = UIMgr.instance.Open <CommonExpandBagTipsView>(PREFAB_PATH, EUISortingLayer.Tips);

            view.SetTypeAndCost(bagType, cost, confirmAction, type);
            return(view);
        }
Exemple #12
0
        public static ConfirmCostTipsView Open(GameResData costGameResData, string title, string content, System.Action clickCancelButtonDelegate, System.Action clickOKButtonDelegate, ConsumeTipType type = ConsumeTipType.None)
        {
            ConfirmCostTipsView view = Open(costGameResData, content, clickCancelButtonDelegate, clickOKButtonDelegate, type);

            view.titleText.text = title;
            return(view);
        }
Exemple #13
0
        public static ConfirmCostTipsView Open(GameResData costGameResData, string content, System.Action clickCancelButtonDelegate, System.Action clickOKButtonDelegate, ConsumeTipType type = ConsumeTipType.None)
        {
            ConfirmCostTipsView confirmCostTipsView = UIMgr.instance.Open <ConfirmCostTipsView>(PREFAB_PATH, EUISortingLayer.Tips);

            confirmCostTipsView.SetInfo(costGameResData, content, clickCancelButtonDelegate, clickOKButtonDelegate, type);
            return(confirmCostTipsView);
        }
Exemple #14
0
 public void SetType(ConsumeTipType type)
 {
     _consumeTipData = ConsumeTipData.GetConsumeTipDataByType(type);
     Refresh();
 }
 public bool HasConsumeTipKey(ConsumeTipType type)
 {
     return(ConsumeTipDictionary.ContainsKey(type));
 }
Exemple #16
0
        public static ComfirmBuyTrainPointView Open(int costDiamond, int buyCount, int remaindCount, System.Action sureCallback, ConsumeTipType type)
        {
            ComfirmBuyTrainPointView view = UIMgr.instance.Open <ComfirmBuyTrainPointView>(PREFAB_PATH, EUISortingLayer.Tips);

            view.SetTip(costDiamond, buyCount, remaindCount, sureCallback, type);
            return(view);
        }
Exemple #17
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));
            }
        }
        public static ConfirmBuyShopItemTipsView Open(string title, string tips, GameResData costGameResData, System.Action onClickBuyButtonHandler, ConsumeTipType consumeTipType = ConsumeTipType.None)
        {
            ConfirmBuyShopItemTipsView confirmBuyShopItemTipsView = UIMgr.instance.Open <ConfirmBuyShopItemTipsView>(PREFAB_PATH, EUISortingLayer.Tips);

            confirmBuyShopItemTipsView.SetInfo("", costGameResData, onClickBuyButtonHandler, consumeTipType);
            confirmBuyShopItemTipsView.titleText.text = title;
            confirmBuyShopItemTipsView.tipsText.text  = tips;
            return(confirmBuyShopItemTipsView);
        }
        public static ConfirmBuyShopItemTipsView Open(string itemName, GameResData costGameResData, System.Action onClickBuyButtonHandler, ConsumeTipType type = ConsumeTipType.None)
        {
            ConfirmBuyShopItemTipsView confirmBuyShopItemTipsView = UIMgr.instance.Open <ConfirmBuyShopItemTipsView>(PREFAB_PATH, EUISortingLayer.Tips);

            confirmBuyShopItemTipsView.SetInfo(itemName, costGameResData, onClickBuyButtonHandler, type);
            return(confirmBuyShopItemTipsView);
        }