Exemplo n.º 1
0
 public WeaponBagItemInfo(PlayerWeaponData playerWeaponData, WeaponResConfigItem newWeaponConfig, WeaponAvatarConfigItem weaponAvatarConfigItem)
 {
     _playerWeaponData   = playerWeaponData;
     _weaponConfig       = newWeaponConfig;
     _weaponAvatarConfig = weaponAvatarConfigItem;
     if (_playerWeaponData.Muzzle > 0)
     {
         _muzzleAsset = SingletonManager.Get <WeaponPartsConfigManager>().GetAsset(_playerWeaponData.Muzzle);
     }
     if (_playerWeaponData.Magazine > 0)
     {
         _magazineAsset = SingletonManager.Get <WeaponPartsConfigManager>().GetAsset(_playerWeaponData.Magazine);
     }
     if (_playerWeaponData.Stock > 0)
     {
         _magazineAsset = SingletonManager.Get <WeaponPartsConfigManager>().GetAsset(_playerWeaponData.Stock);
     }
     if (_playerWeaponData.UpperRail > 0)
     {
         _magazineAsset = SingletonManager.Get <WeaponPartsConfigManager>().GetAsset(_playerWeaponData.UpperRail);
     }
     if (_playerWeaponData.LowerRail > 0)
     {
         _magazineAsset = SingletonManager.Get <WeaponPartsConfigManager>().GetAsset(_playerWeaponData.LowerRail);
     }
 }
Exemplo n.º 2
0
 public WeaponBagItemInfo(PlayerWeaponData playerWeaponData, WeaponResConfigItem newWeaponConfig, WeaponAvatarConfigItem weaponAvatarConfigItem)
 {
     _playerWeaponData   = playerWeaponData;
     _weaponConfig       = newWeaponConfig;
     _weaponAvatarConfig = weaponAvatarConfigItem;
     if (_playerWeaponData.Muzzle > 0)
     {
         _muzzleAsset = GetWeaponPartIcon(_playerWeaponData.Muzzle);
     }
     if (_playerWeaponData.Magazine > 0)
     {
         _magazineAsset = GetWeaponPartIcon(_playerWeaponData.Magazine);
     }
     if (_playerWeaponData.Stock > 0)
     {
         _stockAsset = GetWeaponPartIcon(_playerWeaponData.Stock);
     }
     if (_playerWeaponData.UpperRail > 0)
     {
         _upperAsset = GetWeaponPartIcon(_playerWeaponData.UpperRail);
     }
     if (_playerWeaponData.LowerRail > 0)
     {
         _lowerAsset = GetWeaponPartIcon(_playerWeaponData.LowerRail);
     }
 }
Exemplo n.º 3
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();
            }
        }