Пример #1
0
        public static int GetSound(string key)
        {
            FreeItemInfo info = GetItemInfo(key);

            if (info.cat == (int)ECategory.GameItem)
            {
                switch (info.id)
                {
                case 100:
                    return(221);

                case 101:
                    return(222);

                case 102:
                    return(223);

                case 103:
                    return(219);

                case 104:
                    return(223);

                case 105:
                    return(220);

                case 106:
                    return(224);

                default:
                    break;
                }
            }

            return(-1);
        }
Пример #2
0
        private static void IniItems()
        {
            if (_itemInfos == null)
            {
                infoDic = new Dictionary <int, Dictionary <int, FreeItemInfo> >();

                List <FreeItemInfo> list = new List <FreeItemInfo>();
                foreach (var item in SingletonManager.Get <RoleAvatarConfigManager>().GetConfig().Items)
                {
                    if (item != null)
                    {
                        FreeItemInfo itemInfo = new FreeItemInfo((int)ECategory.Avatar, item.Id, ((int)ECategory.Avatar * 10000 + item.Id).ToString(),
                                                                 item.Name, "avatar", (avatarMap.ContainsKey(item.Type) ? avatarMap[item.Type] : item.Type.ToString()), "", "icon/roleavatar/RA_4_12_Icon", "icon/roleavatar/RA_4_12_Icon", 0);

                        if (!string.IsNullOrEmpty(item.Icon))
                        {
                            itemInfo.fIcon    = item.IconBundle + "/" + item.Icon;
                            itemInfo.mIcon    = item.IconBundle + "/" + item.Icon;
                            itemInfo.capacity = (int)item.Capacity;

                            list.Add(itemInfo);
                            AddToInfoDic(itemInfo);
                        }
                    }
                    else
                    {
                        Debug.LogWarningFormat("item res {0} is not defined.", item.Id);
                    }
                }

                foreach (WeaponResConfigItem item in SingletonManager.Get <WeaponResourceConfigManager>().GetConfigs().Values)
                {
                    Utils.AssetManager.AssetInfo asset = SingletonManager.Get <WeaponAvatarConfigManager>().GetIcon(item.AvatorId);
                    FreeItemInfo itemInfo = new FreeItemInfo((int)ECategory.Weapon, item.Id, ((int)ECategory.Weapon * 10000 + item.Id).ToString(),
                                                             item.Name, "weapon", "w" + item.Type.ToString(), "", asset.BundleName + "/" + asset.AssetName, asset.BundleName + "/" + asset.AssetName, 0);
                    itemInfo.weight = item.Weight;
                    list.Add(itemInfo);
                    AddToInfoDic(itemInfo);
                }

                foreach (WeaponPartSurvivalConfigItem part in SingletonManager.Get <WeaponPartSurvivalConfigManager>().GetConfigs().Values)
                {
                    if (part.PartsList != null)
                    {
                        WeaponPartsConfigItem item     = SingletonManager.Get <WeaponPartsConfigManager>().GetConfigById(part.PartsList[0]);
                        FreeItemInfo          itemInfo = new FreeItemInfo((int)ECategory.WeaponPart, part.Id, ((int)ECategory.WeaponPart * 10000 + part.Id).ToString(),
                                                                          part.Name, "part", "p" + partMap[item.Type].ToString(), "", "icon/weaponpart/" + item.Icon, "icon/weaponpart/" + item.Icon, 0);
                        itemInfo.weight = item.Weight;
                        list.Add(itemInfo);
                        AddToInfoDic(itemInfo);
                    }
                    else
                    {
                        Debug.LogWarningFormat("weapon part {0},{1},{2} is not valid.", part.Id, part.Name, part.PartsList);
                    }
                }

                foreach (GameItemConfigItem item in SingletonManager.Get <GameItemConfigManager>().GetConfig().Items)
                {
                    FreeItemInfo itemInfo = new FreeItemInfo((int)ECategory.GameItem, item.Id, ((int)ECategory.GameItem * 10000 + item.Id).ToString(),
                                                             item.Name, "use", "use", "", item.IconBundle + "/" + item.Icon, item.IconBundle + "/" + item.Icon, item.Sing);
                    itemInfo.weight = item.Weight;
                    itemInfo.stack  = item.Stack;
                    list.Add(itemInfo);
                    AddToInfoDic(itemInfo);
                }

                _itemInfos = list.ToArray();
            }
        }
Пример #3
0
        public static int GetSing(FreeItem item)
        {
            FreeItemInfo info = GetItemInfo(item.GetKey());

            return(info.sing);
        }