Exemplo n.º 1
0
        private void WriteAppFile(string outputFileName, IEnumerable <CustomisationLocalised> localisedData, LanguageDetail language, Dictionary <string, InventoryDescription> itemNames)
        {
            List <AppGameItemLang> appBlock          = new List <AppGameItemLang>();
            List <AppGameItemBase> appBlockBaseItems = new List <AppGameItemBase>();

            foreach (CustomisationLocalised blockLocalised in localisedData)
            {
                foreach (CustomisationItemLocalised blockLoc in blockLocalised.Items)
                {
                    if (GuidExclusion.All.Any(a => a.Equals(blockLoc.ItemId.Replace("_male", string.Empty).Replace("_female", string.Empty))))
                    {
                        continue;
                    }

                    CustomisationItemLocalised relocalised = (language.LanguageType == LanguageType.English)
                        ? blockLoc
                        : blockLoc.ReLocaliseItem(itemNames);

                    AppGameItem full = AppFileBlockMapper.ToAppFile(relocalised, blockLocalised.Category);
                    if (!_appImagesRepo.FileExists("items", full.AppId))
                    {
                        continue;
                    }

                    appBlock.Add(full.ToLang());
                    string image = GetItemImage(full.AppId);
                    appBlockBaseItems.Add(full.ToBase(image));
                }
            }

            _appFileSysRepo.WriteBackToJsonFile(appBlockBaseItems, outputFileName);
            _appFileSysRepo.WriteBackToJsonFile(appBlock, GetJsonLang(language.LanguageAppFolder, outputFileName));
        }
Exemplo n.º 2
0
        private void WriteAppFile(string outputFileName, IEnumerable <GameItemLocalised> localisedData, Dictionary <string, List <ILocalised> > lookup, LanguageDetail language, Dictionary <string, InventoryDescription> itemNames)
        {
            List <AppGameItemLang> appBlock          = new List <AppGameItemLang>();
            List <AppGameItemBase> appBlockBaseItems = new List <AppGameItemBase>();

            foreach (GameItemLocalised blockLocalised in localisedData)
            {
                if (GuidExclusion.All.Any(a => a.Equals(blockLocalised.ItemId)))
                {
                    continue;
                }

                GameItemLocalised relocalised = (language.LanguageType == LanguageType.English)
                    ? blockLocalised
                    : blockLocalised.ReLocalise(itemNames);

                GameItemFeatures defaultFeatures = new GameItemFeatures {
                    Uuid = blockLocalised.ItemId, Features = null
                };
                GameItemFeatures gameItemFeatures = FeaturesList.Features.FirstOrDefault(u => u.Uuid.Equals(blockLocalised.ItemId, StringComparison.InvariantCultureIgnoreCase)) ?? defaultFeatures;
                Upgrade          gameItemUpgrades = UpgradeList.Upgrades.FirstOrDefault(u => u.Uuid.Equals(blockLocalised.ItemId, StringComparison.InvariantCultureIgnoreCase));

                if (gameItemUpgrades != null && lookup.ContainsKey(gameItemUpgrades.TargetUuid))
                {
                    List <ILocalised> list = lookup[gameItemUpgrades.TargetUuid];
                    if (list != null && list.Count > 0)
                    {
                        if (list[0] is GameItemLocalised)
                        {
                            gameItemUpgrades.TargetId = list[0].AppId;
                        }
                        else
                        {
                            gameItemUpgrades = null;
                        }
                    }
                }

                AppGameItem full = AppFileBlockMapper.ToAppFile(relocalised, gameItemFeatures.Features, gameItemUpgrades);
                appBlock.Add(full.ToLang());
                string image = GetItemImage(full.AppId);
                appBlockBaseItems.Add(full.ToBase(image));
            }

            _appFileSysRepo.WriteBackToJsonFile(appBlockBaseItems, outputFileName);
            _appFileSysRepo.WriteBackToJsonFile(appBlock, GetJsonLang(language.LanguageAppFolder, outputFileName));
        }