Пример #1
0
        public void SetAsCostResources(GameResData gameResData)
        {
            SetSelect(false);
            textName.gameObject.SetActive(false);
            //Sprite iconSprite = null;
            int requiredCount = 0;
            int ownCount      = 0;

            BaseResType type = gameResData.type;
            int         id   = gameResData.id;

            if (type != BaseResType.Hero && type != BaseResType.Equipment && type != BaseResType.Item)
            {
                ownCount = GameProxy.instance.BaseResourceDictionary[gameResData.type];
                ItemData data = ItemData.GetBasicResItemByType(type);
                if (data != null)
                {
                    id = data.id;
                }
            }
            else
            {
                ItemInfo itemInfo = ItemProxy.instance.GetItemInfoByItemID(gameResData.id);
                if (itemInfo != null)
                {
                    ownCount = itemInfo.count;
                }
            }
            requiredCount = gameResData.count;
            //			if (gameResData.type == BaseResType.Gold
            //			    || gameResData.type == BaseResType.Diamond
            //			    || gameResData.type == BaseResType.Crystal
            //			    || gameResData.type == BaseResType.Honor)
            //			{
            //				iconSprite = ResMgr.instance.Load<Sprite>(ResPath.GetItemIconPath(((int)gameResData.type).ToString()));
            //				requiredCount = gameResData.count;
            //				ownCount = GameProxy.instance.BaseResourceDictionary[gameResData.type];
            //			}
            //			else if (gameResData.type == BaseResType.Item)
            //			{
            //				ItemData itemData = ItemData.GetItemDataByID(gameResData.id);
            //				iconSprite = ResMgr.instance.Load<Sprite>(ResPath.GetItemIconPath(itemData.icon));
            //				requiredCount = gameResData.count;
            //
            //				ItemInfo itemInfo = ItemProxy.instance.GetItemInfoByItemID(gameResData.id);
            //				if (itemInfo != null)
            //				{
            //					ownCount = itemInfo.count;
            //				}
            //			}
            //			itemIconImage.sprite = iconSprite;
            //			itemIconImage.SetNativeSize();
            SetItemInfo(new ItemInfo(0, id, gameResData.count));
            textCount.text = ownCount >= requiredCount?UIUtil.FormatToGreenText(requiredCount.ToString()) : UIUtil.FormatToRedText(requiredCount.ToString());
        }
Пример #2
0
        public static string GetBaseResName(BaseResType baseResType)
        {
            string name = string.Empty;

            switch (baseResType)
            {
            case BaseResType.Account_Exp:
                name = Localization.Get("game.base_resource.account_exp");
                break;

            case BaseResType.ArenaPoint:
                name = Localization.Get("game.base_resource.arena_point");
                break;

            case BaseResType.Crystal:
                name = Localization.Get("game.base_resource.crystal");
                break;

            case BaseResType.Diamond:
                name = Localization.Get("game.base_resource.diamond");
                break;

            case BaseResType.Gold:
                name = Localization.Get("game.base_resource.gold");
                break;

            case BaseResType.Hero_Exp:
                name = Localization.Get("game.base_resource.hero_exp");
                break;

            case BaseResType.Honor:
                name = Localization.Get("game.base_resource.honor");
                break;

            case BaseResType.PveAction:
                name = Localization.Get("game.base_resource.pve_action");
                break;

            case BaseResType.PvpAction:
                name = Localization.Get("game.base_resource.pvp_actio");
                break;

            case BaseResType.TowerAction:
                name = Localization.Get("game.base_resource.tower_action");
                break;

            default:
                name = string.Empty;
                break;
            }
            return(name);
        }
Пример #3
0
        //基础资源类型
        public static ItemData GetBasicResItemByType(BaseResType type)
        {
            ItemData data;

            foreach (var value in ItemDataDictionary)
            {
                data = value.Value;
                if (data.type == (int)type)
                {
                    return(data);
                }
            }
            return(null);
        }
Пример #4
0
        private void RefreshBaseResources()
        {
            Dictionary <BaseResType, int> baseResourceDictionary = GameProxy.instance.BaseResourceDictionary;
            List <BaseResType>            keys = new List <BaseResType>(baseResourceDictionary.Keys);
            int keyCount = keys.Count;

            for (int i = 0; i < keyCount; i++)
            {
                BaseResType baseResType = keys[i];
                if (_baseResourceTextDictionary.ContainsKey(baseResType))
                {
                    _baseResourceTextDictionary[baseResType].text = baseResourceDictionary[baseResType].ToString();
                }
            }
        }
Пример #5
0

        
Пример #6
0
        private int GetBaseResNum(List <GameResData> dataList, BaseResType type)
        {
            int         num = 0;
            GameResData data;

            for (int i = 0, count = dataList.Count; i < count; i++)
            {
                data = dataList[i];
                if (data.type == type)
                {
                    num += data.count;
                }
            }
            return(num);
        }
Пример #7
0
        public void SetGameResData(GameResData gameResData)
        {
            int id = gameResData.id;

            BaseResType type = gameResData.type;

            if (type != BaseResType.Hero && type != BaseResType.Equipment && type != BaseResType.Item)
            {
                ItemData data = ItemData.GetBasicResItemByType(type);
                if (data != null)
                {
                    id = data.id;
                }
            }
            else
            {
            }
            SetItemInfo(new ItemInfo(0, id, gameResData.count));
        }
Пример #8
0
        public static bool IsBaseRes(BaseResType baseResType)
        {
            switch (baseResType)
            {
            case BaseResType.Account_Exp:
            case BaseResType.ArenaPoint:
            case BaseResType.Crystal:
            case BaseResType.Diamond:
            case BaseResType.Gold:
            case BaseResType.Hero_Exp:
            case BaseResType.Honor:
            case BaseResType.PveAction:
            case BaseResType.PvpAction:
            case BaseResType.TowerAction:
                return(true);

            default:
                return(false);
            }
        }
Пример #9
0
        private void RefreshBaseResources()
        {
            Dictionary <BaseResType, int> baseResourceDictionary = GameProxy.instance.BaseResourceDictionary;
            List <BaseResType>            keys = new List <BaseResType>(_baseResourceTextDictionary.Keys);
            int keyCount = keys.Count;

            for (int i = 0; i < keyCount; i++)
            {
                BaseResType baseResType = keys[i];
                if (baseResourceDictionary.ContainsKey(baseResType))
                {
                    int value = baseResourceDictionary[baseResType];


                    _baseResourceTextDictionary[baseResType].text = StringUtil.ConvertBigQuantity(value);
                }
                else
                {
                    _baseResourceTextDictionary[baseResType].text = "0";
                }
            }
        }
Пример #10
0
        public void OnBaseResourcesUpdate(List <BaseResourceInfo> baseResourceInfos)
        {
            int baseResourceInfoCount = baseResourceInfos.Count;

            for (int i = 0; i < baseResourceInfoCount; i++)
            {
                BaseResourceInfo baseResourceInfo = baseResourceInfos[i];
                BaseResType      baseResType      = (BaseResType)baseResourceInfo.type;
                if (!BaseResourceDictionary.ContainsKey(baseResType))
                {
                    BaseResourceDictionary.Add(baseResType, baseResourceInfo.value);
                }
                else
                {
                    BaseResourceDictionary[baseResType] = baseResourceInfo.value;
                }
            }

            if (onBaseResourcesUpdateDelegate != null)
            {
                onBaseResourcesUpdateDelegate();
            }
        }
Пример #11
0

        
Пример #12
0
 public void TDGAItemOnUse(int itemId, int itemNumber, BaseResType baseResType)
 {
     TDGAItem.OnUse(GenerateItemId(itemId, baseResType), itemNumber);
 }
Пример #13
0
 public void TDGAItemOnPurchase(string functionName, BaseResType baseResType, int itemId, int itemNumber, double priceInVirtualCurrency)
 {
     TDGAItem.OnPurchase(functionName + ":" + GenerateItemId(itemId, baseResType), itemNumber, priceInVirtualCurrency);
 }
Пример #14
0
        public static string GenerateItemId(int itemId, BaseResType baseResType)
        {
            string result = "";

            switch (baseResType)
            {
            case BaseResType.Hero:
            {
                HeroData data = HeroData.GetHeroDataByID(itemId);
                if (data == null)
                {
                    Debugger.LogError("[TalkingDataController]GenerateItemId, can not find HeroData,id:" + itemId);
                }
                else
                {
                    result = Localization.Get(data.name);
                }
            }

            break;

            case BaseResType.Equipment:
            {
                EquipmentData data = EquipmentData.GetEquipmentDataByID(itemId);
                if (data == null)
                {
                    Debugger.LogError("[TalkingDataController]GenerateItemId, can not find EquipData,id:" + itemId);
                }
                else
                {
                    result = Localization.Get(data.name);
                }
            }
            break;

            case BaseResType.Item:
            {
                ItemData data = ItemData.GetItemDataByID(itemId);
                if (data == null)
                {
                    Debugger.LogError("[TalkingDataController]GenerateItemId, can not find ItemData,id:" + itemId);
                }
                else
                {
                    result = Localization.Get(data.name);
                }
            }
            break;

            default:
            {
                ItemData data = ItemData.GetBasicResItemByType(baseResType);
                if (data == null)
                {
                    Debugger.LogError("[TalkingDataController]GenerateItemId, can not find ItemData by baseResType:" + baseResType);
                }
                else
                {
                    result = Localization.Get(data.name);
                }
            }
            break;
            }
            return(result);
        }
Пример #15
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));
            }
        }
Пример #16
0
        public static string GetBaseResIconPath(BaseResType baseResType)
        {
            string baseResIconPath = string.Empty;

            switch (baseResType)
            {
            case BaseResType.PveAction:
                baseResIconPath = Path.Combine(BASE_RES_ICON_PATH, "icon_key_small");
                break;

            case BaseResType.TowerAction:
                baseResIconPath = Path.Combine(BASE_RES_ICON_PATH, "world_tree_fruit");
                break;

            case BaseResType.PvpAction:
                baseResIconPath = Path.Combine(BASE_RES_ICON_PATH, "icon_key_pvp_small");
                break;

            case BaseResType.Gold:
                baseResIconPath = Path.Combine(BASE_RES_ICON_PATH, "icon_coin_small");
                break;

            case BaseResType.Crystal:
                baseResIconPath = Path.Combine(BASE_RES_ICON_PATH, "");
                break;

            case BaseResType.Diamond:
                baseResIconPath = Path.Combine(BASE_RES_ICON_PATH, "icon_gem_small");
                break;

            case BaseResType.Honor:
                baseResIconPath = Path.Combine(BASE_RES_ICON_PATH, "icon_honor_small");
                break;

            case BaseResType.RMB:
                baseResIconPath = Path.Combine(BASE_RES_ICON_PATH, "icon_rmb_sml");
                break;

            case BaseResType.Hero_Exp:                            //伙伴经验
                baseResIconPath = Path.Combine(BASE_RES_ICON_PATH, "icon_exp_green_sml");
                break;

            case BaseResType.Account_Exp:                         //账号经验
                baseResIconPath = Path.Combine(BASE_RES_ICON_PATH, "icon_exp_sml");
                break;

            case BaseResType.ExpeditionPoint:                    //远征币(类似荣誉)
                baseResIconPath = Path.Combine(BASE_RES_ICON_PATH, "icon_expedition_small");
                break;

            case BaseResType.WorldBossResource:                    //世界Boss资源
                baseResIconPath = Path.Combine(BASE_RES_ICON_PATH, "icon_type_sml_06");
                break;

            case BaseResType.FromationTrainPoint:                     //阵型培养点
                baseResIconPath = Path.Combine(BASE_RES_ICON_PATH, "ui_team_3");
                break;

            default:
                break;
            }
            return(baseResIconPath);
        }
Пример #17
0
        void OnGUI()
        {
            EditorGUILayout.Space();
            GUILayout.Label("备注:\n" +
                            "1、只针对副本掉落查找\n" +
                            "2、星级为0: 表示忽略星级查找", GUILayout.Width(300), GUILayout.Height(50));

            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal();

            GUILayout.Label("物品类型:", GUILayout.Width(100));
            selectType = (BaseResType)EditorGUILayout.EnumPopup(selectType, GUILayout.Width(200));

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();

            GUILayout.Label("测试技能(heroid,skillid):", GUILayout.Width(100));
            selectId = EditorGUILayout.IntField(selectId, GUILayout.Width(200), GUILayout.Height(20));

            EditorGUILayout.EndHorizontal();


            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal();
            if (selectType == BaseResType.Hero || selectType == BaseResType.Equipment || selectType == BaseResType.Item)
            {
                GUILayout.Label("物品id:", GUILayout.Width(100));
                selectId = EditorGUILayout.IntField(selectId, GUILayout.Width(200), GUILayout.Height(20));
            }
            else
            {
                selectId = 0;
            }

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal();
            if (selectType == BaseResType.Hero)
            {
                GUILayout.Label("物品星级:", GUILayout.Width(100));
                selectStar = EditorGUILayout.IntField(selectStar, GUILayout.Width(200), GUILayout.Height(20));
            }
            else
            {
                selectStar = 0;
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("查找", GUILayout.Width(100), GUILayout.Height(25)))
            {
                Clear();
                if (!Application.isPlaying)
                {
                    resultNameTip  = "运行游戏才能查哟!!!";
                    resultNameTip2 = string.Empty;
                    return;
                }


                Dictionary <int, DungeonData> dungeonDataDic = DungeonData.DungeonDataDictionary;
                DungeonData dungeon;

                foreach (var value in dungeonDataDic)
                {
                    dungeon = value.Value;

                    CheckViewDisplayData(dungeon);
                    CheckLootData(dungeon);
                }
                if (lootDungeonDictionay.Count == 0)
                {
                    resultNameTip = "未找到哟!!!";
                }
                if (lootViewDisplayDungeonDictionay.Count == 0)
                {
                    resultNameTip2 = "未找到哟!!!";
                }
                //----------------------打印技能伤害数据------------------
                TestSkillDescription();

                //---------------------test 屏蔽词--------------------
                //				string[] blockWords = Common.Util.BlackListWordUtil.blockWords;
                //				List<string> blockList = new List<string>();
                //				StringBuilder builder = new StringBuilder();
                //				for(int i = 0,count = blockWords.Length;i<count;i++)
                //				{
                //					if(!blockList.Contains(blockWords[i]))
                //					{
                //						blockList.Add(blockWords[i]);
                //						builder.Append(blockWords[i]).Append("\r\n");
                //					}
                //				}
                //				builder.AppendFormat("屏蔽词个数:{0}",blockList.Count);
                //				resultNameTip = builder.ToString();
                //				return ;
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("副本列表(掉落包中的掉落):", GUILayout.Width(310));
            EditorGUILayout.LabelField("副本列表(界面上显示的掉落):");
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();

            scrollPos = EditorGUILayout.BeginScrollView(scrollPos, false, false, GUILayout.Width(700), GUILayout.Height(500));
            EditorGUILayout.TextArea(resultNameTip);
            EditorGUILayout.EndScrollView();

            EditorGUILayout.LabelField("", GUILayout.Width(10));

            scrollPos2 = EditorGUILayout.BeginScrollView(scrollPos2, false, false, GUILayout.Width(300), GUILayout.Height(500));
            EditorGUILayout.TextArea(resultNameTip2);
            EditorGUILayout.EndScrollView();
            EditorGUILayout.EndHorizontal();
        }
Пример #18
0
 public void SetBaseRes(BaseResType type, float delay)
 {
     this.type  = type;
     _showDelay = delay;
 }