Beispiel #1
0
        public static TranslationGenerator WrapTranslationCollector(string path,
                                                                    TranslationDumper <IDictionary <string, string> > .TranslationCollector translationCollector)
        {
            IEnumerable <ITranslationDumper> Generator()
            {
                yield return(new StringTranslationDumper(path, translationCollector));
            }

            return(Generator);
        }
Beispiel #2
0
        protected virtual IEnumerable <ITranslationDumper> GetScenarioTextDumpers()
        {
            var allJpText = new HashSet <string>();

            foreach (var scenarioRoot in ResourceHelper.GetScenarioDirs())
            {
                var baseChoiceDictionary = BuildReplacementDictionary(scenarioRoot);
                foreach (var assetBundleName in GetAssetBundleNameListFromPath(scenarioRoot, true))
                {
                    foreach (var assetName in GetAssetNamesFromBundle(assetBundleName))
                    {
                        var asset = ManualLoadAsset <ScenarioData>(assetBundleName, assetName, "abdata");
                        if (asset is null || asset.list is null)
                        {
                            continue;
                        }

                        var filePath         = BuildAssetFilePath(assetBundleName, assetName);
                        var choiceDictionary =
                            new Dictionary <string, KeyValuePair <string, string> >(baseChoiceDictionary);


                        IDictionary <string, string> AssetDumper()
                        {
                            var translations = new OrderedDictionary <string, string>();

                            foreach (var param in asset.list)
                            {
                                /*
                                 * Logger.LogFatal(
                                 *  $"{nameof(GetScenarioTextDumpers)}.{nameof(AssetDumper)}: {assetBundleName} {assetName} {param.Command} {param}");
                                 */
                                // update as we go so most recent entries are in place
                                UpdatedReplacementDictionary(assetBundleName, ref choiceDictionary, param);
                                HandleAdvCommandDump(assetBundleName, assetName, param, translations, ref choiceDictionary, allJpText);
                            }

                            return(translations);
                        }

                        TranslationDumper <IDictionary <string, string> > .TranslationCollector assetDumper = AssetDumper;
                        yield return(new StringTranslationDumper(filePath, assetDumper));
                    }
                }
            }
        }