public static string LoadAllListText(List <string> _lstAssetBundleNames, string _strLoadFile)
    {
        StringBuilder stringBuilder = new StringBuilder();

        for (int index1 = 0; index1 < _lstAssetBundleNames.Count; ++index1)
        {
            string[] allAssetName = AssetBundleCheck.GetAllAssetName(_lstAssetBundleNames[index1], false, (string)null, false);
            bool     flag         = false;
            for (int index2 = 0; index2 < allAssetName.Length; ++index2)
            {
                if (allAssetName[index2].Compare(_strLoadFile, true))
                {
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                GlobalMethod.DebugLog("[" + _lstAssetBundleNames[index1] + "][" + _strLoadFile + "]は見つかりません", 1);
            }
            else
            {
                TextAsset textAsset = CommonLib.LoadAsset <TextAsset>(_lstAssetBundleNames[index1], _strLoadFile, false, string.Empty);
                AssetBundleManager.UnloadAssetBundle(_lstAssetBundleNames[index1], true, (string)null, false);
                if (!Object.op_Equality((Object)textAsset, (Object)null))
                {
                    stringBuilder.Append(textAsset.get_text());
                }
            }
        }
        return(stringBuilder.ToString());
    }
Beispiel #2
0
        int DumpCommunicationText()
        {
            HashSet <string> AllJPText = new HashSet <string>();

            foreach (var AssetBundleName in CommonLib.GetAssetBundleNameListFromPath("communication"))
            {
                if (AssetBundleName.Contains("hit_"))
                {
                    continue;
                }

                foreach (var AssetName in AssetBundleCheck.GetAllAssetName(AssetBundleName))
                {
                    var Asset = ManualLoadAsset <ExcelData>(AssetBundleName, AssetName, "abdata");

                    HashSet <string> JPText = new HashSet <string>();

                    foreach (var param in Asset.list)
                    {
                        if (15 <= param.list.Count && !param.list[15].IsNullOrEmpty() && param.list[15] != "テキスト")
                        {
                            AllJPText.Add($"//{param.list[15]}=");
                            JPText.Add($"//{param.list[15]}=");
                        }
                    }

                    if (JPText.Count > 0)
                    {
                        string FolderPath = Path.Combine(Paths.GameRootPath, "TextDump");
                        FolderPath = Path.Combine(FolderPath, AssetBundleName.Replace(".unity3d", ""));
                        FolderPath = Path.Combine(FolderPath, AssetName.Replace(".asset", ""));
                        FolderPath = FolderPath.Replace('/', '\\');
                        if (!Directory.Exists(FolderPath))
                        {
                            Directory.CreateDirectory(FolderPath);
                        }

                        string FilePath = Path.Combine(FolderPath, "translation.txt");
                        if (File.Exists(FilePath))
                        {
                            File.Delete(FilePath);
                        }

                        File.WriteAllLines(FilePath, JPText.ToArray());
                    }
                }
            }
            Logger.Log(LogLevel.Info, $"Total Communication unique lines:{AllJPText.Count}");
            return(AllJPText.Count);
        }
Beispiel #3
0
        int DumpScenarioText()
        {
            HashSet <string> AllJPText = new HashSet <string>();

            foreach (var AssetBundleName in CommonLib.GetAssetBundleNameListFromPath("adv/scenario", true))
            {
                foreach (var AssetName in AssetBundleCheck.GetAllAssetName(AssetBundleName)) //.Where(x => x.StartsWith("personality_voice_"))
                {
                    var Asset = ManualLoadAsset <ADV.ScenarioData>(AssetBundleName, AssetName, "abdata");

                    HashSet <string> JPText = new HashSet <string>();
                    foreach (var param in Asset.list)
                    {
                        if (param.Command == ADV.Command.Text)
                        {
                            if (1 <= param.Args.Length && !param.Args[1].IsNullOrEmpty())
                            {
                                AllJPText.Add($"//{param.Args[1]}=");
                                JPText.Add($"//{param.Args[1]}=");
                            }
                        }
                    }

                    if (JPText.Count > 0)
                    {
                        string FolderPath = Path.Combine(Paths.GameRootPath, "TextDump");
                        FolderPath = Path.Combine(FolderPath, AssetBundleName.Replace(".unity3d", ""));
                        FolderPath = Path.Combine(FolderPath, AssetName.Replace(".asset", ""));
                        FolderPath = FolderPath.Replace('/', '\\');
                        if (!Directory.Exists(FolderPath))
                        {
                            Directory.CreateDirectory(FolderPath);
                        }

                        string FilePath = Path.Combine(FolderPath, "translation.txt");
                        if (File.Exists(FilePath))
                        {
                            File.Delete(FilePath);
                        }

                        File.WriteAllLines(FilePath, JPText.ToArray());
                    }
                }
            }
            Logger.Log(LogLevel.Info, $"Total Scenario unique lines:{AllJPText.Count}");
            return(AllJPText.Count);
        }
 public static List <ExcelData.Param> LoadExcelDataAlFindlFile(
     string _strAssetPath,
     string _strFileName,
     int sCell,
     int sRow,
     int eCell,
     int eRow,
     List <string> _OmitFolderName = null,
     bool _isWarning = true)
 {
     GlobalMethod.lstABName.Clear();
     GlobalMethod.lstABName = GlobalMethod.GetAssetBundleNameListFromPath(_strAssetPath, false);
     GlobalMethod.lstABName.Sort();
     for (int index1 = 0; index1 < GlobalMethod.lstABName.Count; ++index1)
     {
         GlobalMethod.strNo.Clear();
         GlobalMethod.strNo.Append(Path.GetFileNameWithoutExtension(GlobalMethod.lstABName[index1]));
         GlobalMethod.strNo.Replace(GlobalMethod.strNo.ToString(), YS_Assist.GetStringRight(GlobalMethod.strNo.ToString(), 2));
         if (_OmitFolderName == null || !_OmitFolderName.Contains(GlobalMethod.strNo.ToString()))
         {
             string[] allAssetName = AssetBundleCheck.GetAllAssetName(GlobalMethod.lstABName[index1], false, (string)null, false);
             bool     flag         = false;
             for (int index2 = 0; index2 < allAssetName.Length; ++index2)
             {
                 if (allAssetName[index2].Compare(_strFileName, true))
                 {
                     flag = true;
                     break;
                 }
             }
             if (!flag)
             {
                 GlobalMethod.DebugLog("[" + GlobalMethod.lstABName[index1] + "][" + _strFileName + "]は見つかりません", 1);
             }
             else
             {
                 List <ExcelData.Param> objList = GlobalMethod.LoadExcelData(GlobalMethod.lstABName[index1], _strFileName, sCell, sRow, eCell, eRow, _isWarning);
                 if (objList != null)
                 {
                     return(objList);
                 }
             }
         }
     }
     return((List <ExcelData.Param>)null);
 }
    public static bool AssetFileExist(string path, string targetName, string manifest = "")
    {
        bool flag = false;

        if (path.IsNullOrEmpty() || !AssetBundleCheck.IsFile(path, targetName))
        {
            return(flag);
        }
        foreach (string self in AssetBundleCheck.GetAllAssetName(path, false, manifest, false))
        {
            if (self.Compare(targetName, true))
            {
                flag = true;
                break;
            }
        }
        return(flag);
    }
Beispiel #6
0
        private Dictionary <string, string> BuildReplacementDictionary()
        {
            Dictionary <string, string> result = new Dictionary <string, string>();
            List <string> assetBundleNames     = CommonLib.GetAssetBundleNameListFromPath("adv/scenario", true);

            assetBundleNames.Sort();

            foreach (var AssetBundleName in assetBundleNames)
            {
                List <string> AssetNameList = new List <string>(AssetBundleCheck.GetAllAssetName(AssetBundleName));
                AssetNameList.Sort();
                foreach (var AssetName in AssetNameList)
                {
                    var Asset = ManualLoadAsset <ADV.ScenarioData>(AssetBundleName, AssetName, "abdata");
                    textResourceHelper.BuildReplacements(Asset.list).ToList().ForEach(x => result[BuildReplacementKey(AssetBundleName, x.Key)] = x.Value);
                }
            }
            return(result);
        }
    public static List <T> LoadAllFolder <T>(
        string _findFolder,
        string _strLoadFile,
        List <string> _OmitFolderName = null)
        where T : Object
    {
        List <T> objList = new List <T>();

        GlobalMethod.lstABName.Clear();
        GlobalMethod.lstABName = GlobalMethod.GetAssetBundleNameListFromPath(_findFolder, false);
        GlobalMethod.lstABName.Sort();
        for (int index1 = 0; index1 < GlobalMethod.lstABName.Count; ++index1)
        {
            string stringRight = YS_Assist.GetStringRight(Path.GetFileNameWithoutExtension(GlobalMethod.lstABName[index1]), 2);
            if (_OmitFolderName == null || !_OmitFolderName.Contains(stringRight))
            {
                string[] allAssetName = AssetBundleCheck.GetAllAssetName(GlobalMethod.lstABName[index1], false, (string)null, false);
                bool     flag         = false;
                for (int index2 = 0; index2 < allAssetName.Length; ++index2)
                {
                    if (allAssetName[index2].Compare(_strLoadFile, true))
                    {
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    GlobalMethod.DebugLog("[" + GlobalMethod.lstABName[index1] + "][" + _strLoadFile + "]は見つかりません", 1);
                }
                else
                {
                    T obj = CommonLib.LoadAsset <T>(GlobalMethod.lstABName[index1], _strLoadFile, false, string.Empty);
                    AssetBundleManager.UnloadAssetBundle(GlobalMethod.lstABName[index1], true, (string)null, false);
                    if (Object.op_Implicit((Object)(object)obj))
                    {
                        objList.Add(obj);
                    }
                }
            }
        }
        return(objList);
    }
    public static string LoadAllListText(
        string _assetbundleFolder,
        string _strLoadFile,
        List <string> _OmitFolderName = null)
    {
        StringBuilder stringBuilder = new StringBuilder();

        GlobalMethod.lstABName.Clear();
        GlobalMethod.lstABName = GlobalMethod.GetAssetBundleNameListFromPath(_assetbundleFolder, false);
        GlobalMethod.lstABName.Sort();
        for (int index1 = 0; index1 < GlobalMethod.lstABName.Count; ++index1)
        {
            string stringRight = YS_Assist.GetStringRight(Path.GetFileNameWithoutExtension(GlobalMethod.lstABName[index1]), 2);
            if (_OmitFolderName == null || !_OmitFolderName.Contains(stringRight))
            {
                string[] allAssetName = AssetBundleCheck.GetAllAssetName(GlobalMethod.lstABName[index1], false, (string)null, false);
                bool     flag         = false;
                for (int index2 = 0; index2 < allAssetName.Length; ++index2)
                {
                    if (allAssetName[index2].Compare(_strLoadFile, true))
                    {
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    GlobalMethod.DebugLog("[" + GlobalMethod.lstABName[index1] + "][" + _strLoadFile + "]は見つかりません", 1);
                }
                else
                {
                    TextAsset textAsset = CommonLib.LoadAsset <TextAsset>(GlobalMethod.lstABName[index1], _strLoadFile, false, string.Empty);
                    AssetBundleManager.UnloadAssetBundle(GlobalMethod.lstABName[index1], true, (string)null, false);
                    if (!Object.op_Equality((Object)textAsset, (Object)null))
                    {
                        stringBuilder.Append(textAsset.get_text());
                    }
                }
            }
        }
        return(stringBuilder.ToString());
    }
Beispiel #9
0
        int DumpHText()
        {
            HashSet <string> AllJPText = new HashSet <string>();

            foreach (var AssetBundleName in CommonLib.GetAssetBundleNameListFromPath("h/list/"))
            {
                foreach (var AssetName in AssetBundleCheck.GetAllAssetName(AssetBundleName).Where(x => x.StartsWith("personality_voice_")))
                {
                    if (AssetName.EndsWith(".txt"))
                    {
                        var Asset = ManualLoadAsset <TextAsset>(AssetBundleName, AssetName, "abdata");

                        HashSet <string> JPText = new HashSet <string>();
                        string[]         Rows   = Asset.text.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
                        for (int i = 0; i < Rows.Count(); i++)
                        {
                            string[] Cells = Rows[i].Split('\t');
                            if (4 < Cells.Length && !Cells[4].IsNullOrEmpty())
                            {
                                AllJPText.Add($"//{Cells[4]}=");
                                JPText.Add($"//{Cells[4]}=");
                            }
                            if (27 < Cells.Length && !Cells[27].IsNullOrEmpty())
                            {
                                AllJPText.Add($"//{Cells[27]}=");
                                JPText.Add($"//{Cells[27]}=");
                            }
                            if (50 < Cells.Length && !Cells[50].IsNullOrEmpty())
                            {
                                AllJPText.Add($"//{Cells[50]}=");
                                JPText.Add($"//{Cells[50]}=");
                            }
                            if (73 < Cells.Length && !Cells[73].IsNullOrEmpty())
                            {
                                AllJPText.Add($"//{Cells[73]}=");
                                JPText.Add($"//{Cells[73]}=");
                            }
                        }

                        if (JPText.Count > 0)
                        {
                            string FolderPath = Path.Combine(Paths.GameRootPath, "TextDump");
                            FolderPath = Path.Combine(FolderPath, AssetBundleName.Replace(".unity3d", ""));
                            FolderPath = Path.Combine(FolderPath, AssetName.Replace(".txt", ""));
                            FolderPath = FolderPath.Replace('/', '\\');
                            if (!Directory.Exists(FolderPath))
                            {
                                Directory.CreateDirectory(FolderPath);
                            }

                            string FilePath = Path.Combine(FolderPath, "translation.txt");
                            if (File.Exists(FilePath))
                            {
                                File.Delete(FilePath);
                            }

                            File.WriteAllLines(FilePath, JPText.ToArray());
                        }
                    }
                }
            }
            Logger.Log(LogLevel.Info, $"Total H-Scene unique lines:{AllJPText.Count}");
            return(AllJPText.Count);
        }
Beispiel #10
0
        private int DumpCommunicationText()
        {
            HashSet <string> AllJPText = new HashSet <string>();

            foreach (var AssetBundleName in CommonLib.GetAssetBundleNameListFromPath("communication"))
            {
                if (AssetBundleName.Contains("hit_"))
                {
                    continue;
                }

                foreach (var AssetName in AssetBundleCheck.GetAllAssetName(AssetBundleName))
                {
                    if (AssetName.Contains("speed_"))
                    {
                        continue;
                    }

                    var Asset = ManualLoadAsset <ExcelData>(AssetBundleName, AssetName, "abdata");

                    Dictionary <string, string> Translations = new Dictionary <string, string>();

                    foreach (var param in Asset.list)
                    {
                        if (15 <= param.list.Count && !param.list[15].IsNullOrEmpty() && param.list[15] != "テキスト")
                        {
                            AllJPText.Add(param.list[15]);
                            Translations[param.list[15]] = "";
                            try
                            {
                                Translations[param.list[15]] = param.list[20];
                            }
                            catch { }
                        }
                    }

                    if (Translations.Count > 0)
                    {
                        string FolderPath = Path.Combine(Paths.GameRootPath, "TextDump");
                        FolderPath = Path.Combine(FolderPath, AssetBundleName.Replace(".unity3d", ""));
                        FolderPath = Path.Combine(FolderPath, AssetName.Replace(".asset", ""));
                        FolderPath = FolderPath.Replace('/', '\\');
                        if (!Directory.Exists(FolderPath))
                        {
                            Directory.CreateDirectory(FolderPath);
                        }

                        string FilePath = Path.Combine(FolderPath, "translation.txt");
                        if (File.Exists(FilePath))
                        {
                            File.Delete(FilePath);
                        }

                        List <string> Lines = new List <string>();
                        foreach (var tl in Translations)
                        {
                            string JP  = tl.Key.Trim();
                            string ENG = tl.Value.Trim();
                            if (JP.Contains("\n"))
                            {
                                JP = $"\"{JP.Replace("\n", @"\n").Trim()}\"";
                            }
                            if (ENG.Contains("\n"))
                            {
                                ENG = $"\"{ENG.Replace("\n", @"\n").Trim()}\"";
                            }
                            ENG = ENG.Replace(";", ",");

                            if (ENG.IsNullOrEmpty())
                            {
                                Lines.Add($"//{JP}=");
                            }
                            else
                            {
                                Lines.Add($"{JP}={ENG}");
                            }
                        }

                        File.WriteAllLines(FilePath, Lines.ToArray());
                    }
                }
            }
            Logger.Log(LogLevel.Info, $"[TextDump] Total Communication unique lines:{AllJPText.Count}");
            return(AllJPText.Count);
        }
Beispiel #11
0
        private int DumpScenarioText()
        {
            HashSet <string> AllJPText = new HashSet <string>();

            foreach (var AssetBundleName in CommonLib.GetAssetBundleNameListFromPath("adv/scenario", true))
            {
                foreach (var AssetName in AssetBundleCheck.GetAllAssetName(AssetBundleName)) //.Where(x => x.StartsWith("personality_voice_"))
                {
                    var Asset = ManualLoadAsset <ADV.ScenarioData>(AssetBundleName, AssetName, "abdata");

                    Dictionary <string, string> Translations = new Dictionary <string, string>();

                    foreach (var param in Asset.list)
                    {
                        if (param.Command == ADV.Command.Text)
                        {
                            if (param.Args.Length >= 2 && !param.Args[1].IsNullOrEmpty())
                            {
                                AllJPText.Add(param.Args[1]);
                                Translations[param.Args[1]] = "";
                                if (param.Args.Length >= 3 && !param.Args[2].IsNullOrEmpty())
                                {
                                    Translations[param.Args[1]] = param.Args[2];
                                }
                            }
                        }
                    }

                    if (Translations.Count > 0)
                    {
                        string FolderPath = Path.Combine(Paths.GameRootPath, "TextDump");
                        FolderPath = Path.Combine(FolderPath, AssetBundleName.Replace(".unity3d", ""));
                        FolderPath = Path.Combine(FolderPath, AssetName.Replace(".asset", ""));
                        FolderPath = FolderPath.Replace('/', '\\');
                        if (!Directory.Exists(FolderPath))
                        {
                            Directory.CreateDirectory(FolderPath);
                        }

                        string FilePath = Path.Combine(FolderPath, "translation.txt");
                        if (File.Exists(FilePath))
                        {
                            File.Delete(FilePath);
                        }

                        List <string> Lines = new List <string>();
                        foreach (var tl in Translations)
                        {
                            string JP  = tl.Key.Trim();
                            string ENG = tl.Value.Trim();
                            if (JP.Contains("\n"))
                            {
                                JP = $"\"{JP.Replace("\n", @"\n").Trim()}\"";
                            }
                            if (ENG.Contains("\n"))
                            {
                                ENG = $"\"{ENG.Replace("\n", @"\n").Trim()}\"";
                            }

                            if (ENG.IsNullOrEmpty())
                            {
                                Lines.Add($"//{JP}=");
                            }
                            else
                            {
                                Lines.Add($"{JP}={ENG}");
                            }
                        }

                        File.WriteAllLines(FilePath, Lines.ToArray());
                    }
                }
            }
            Logger.Log(LogLevel.Info, $"[TextDump] Total Scenario unique lines:{AllJPText.Count}");
            return(AllJPText.Count);
        }
Beispiel #12
0
        private int DumpScenarioText()
        {
            HashSet <string> AllJPText = new HashSet <string>();

            foreach (var AssetBundleName in CommonLib.GetAssetBundleNameListFromPath("adv/scenario", true))
            {
                foreach (var AssetName in AssetBundleCheck.GetAllAssetName(AssetBundleName)) //.Where(x => x.StartsWith("personality_voice_"))
                {
                    var Asset = ManualLoadAsset <ADV.ScenarioData>(AssetBundleName, AssetName, "abdata");

                    Dictionary <string, string> Translations = new Dictionary <string, string>();

                    foreach (var param in Asset.list)
                    {
                        if (!textResourceHelper.IsSupportedCommand(param.Command))
                        {
                            continue;
                        }

                        if (param.Command == ADV.Command.Text)
                        {
                            if (param.Args.Length >= 2 && !param.Args[1].IsNullOrEmpty())
                            {
                                AllJPText.Add(param.Args[1]);
                                Translations[param.Args[1]] = "";
                                if (param.Args.Length >= 3 && !param.Args[2].IsNullOrEmpty())
                                {
                                    Translations[param.Args[1]] = param.Args[2];
                                }
                            }
                        }
                        else if (param.Command == ADV.Command.Calc)
                        {
                            if (param.Args.Length >= 3 && textResourceHelper.CalcKeys.Contains(param.Args[0]))
                            {
                                var key = textResourceHelper.GetSpecializedKey(param, 2, out string value);
                                AllJPText.Add(key);
                                Translations[key] = value;
                            }
                        }
                        else if (param.Command == ADV.Command.Format)
                        {
                            if (param.Args.Length >= 2 && textResourceHelper.FormatKeys.Contains(param.Args[0]))
                            {
                                AllJPText.Add(param.Args[1]);
                                Translations[param.Args[1]] = "";
                            }
                        }
                        else if (param.Command == ADV.Command.Choice)
                        {
                            for (int i = 0; i < param.Args.Length; i++)
                            {
                                var key = textResourceHelper.GetSpecializedKey(param, i, out string value);
                                if (!key.IsNullOrEmpty())
                                {
                                    AllJPText.Add(key);
                                    Translations[key] = value;
                                }
                            }
                        }
#if false
                        else if (param.Command == ADV.Command.Switch)
                        {
                            for (int i = 0; i < param.Args.Length; i++)
                            {
                                var key = textResourceHelper.GetSpecializedKey(param, i, out string value);
                                AllJPText.Add(key);
                                Translations[key] = value;
                            }
                        }
#endif
#if false
                        else if (param.Command == ADV.Command.InfoText)
                        {
                            for (int i = 2; i < param.Args.Length; i += 2)
                            {
                                AllJPText.Add(param.Args[i]);
                                Translations[param.Args[i]] = "";
                            }
                        }
#endif
#if false
                        else if (param.Command == ADV.Command.Jump)
                        {
                            if (param.Args.Length >= 1 && !AllAscii.IsMatch(param.Args[0]))
                            {
                                AllJPText.Add(param.Args[0]);
                                Translations[param.Args[0]] = "Jump";
                            }
                        }
#endif
                        else
                        {
                            Logger.LogDebug($"[TextDump] Unsupported command: {param.Command}: {string.Join(",", param.Args.Select((a) => a?.ToString() ?? string.Empty).ToArray())}");
                        }
                    }

                    if (Translations.Count > 0)
                    {
                        string FolderPath = Path.Combine(Paths.GameRootPath, "TextDump");
                        FolderPath = Path.Combine(FolderPath, AssetBundleName.Replace(".unity3d", ""));
                        FolderPath = Path.Combine(FolderPath, AssetName.Replace(".asset", ""));
                        FolderPath = FolderPath.Replace('/', '\\');
                        if (!Directory.Exists(FolderPath))
                        {
                            Directory.CreateDirectory(FolderPath);
                        }

                        string FilePath = Path.Combine(FolderPath, "translation.txt");
                        if (File.Exists(FilePath))
                        {
                            File.Delete(FilePath);
                        }

                        List <string> Lines = new List <string>();
                        foreach (var tl in Translations)
                        {
                            string JP  = tl.Key.Trim();
                            string ENG = tl.Value.Trim();
                            if (JP.Contains("\n"))
                            {
                                JP = $"\"{JP.Replace("\n", @"\n").Trim()}\"";
                            }
                            if (ENG.Contains("\n"))
                            {
                                ENG = $"\"{ENG.Replace("\n", @"\n").Trim()}\"";
                            }
                            ENG = ENG.Replace(";", ",");

                            if (ENG.IsNullOrEmpty())
                            {
                                Lines.Add($"{JP}=");
                            }
                            else
                            {
                                Lines.Add($"{JP}={ENG}");
                            }
                        }

                        File.WriteAllLines(FilePath, Lines.ToArray());
                    }
                }
            }
            Logger.LogInfo($"[TextDump] Total Scenario unique lines:{AllJPText.Count}");
            return(AllJPText.Count);
        }
Beispiel #13
0
        private int DumpSubtitleText()
        {
            HashSet <string> AllJPText = new HashSet <string>();
            Dictionary <string, Dictionary <string, string> > AllText = new Dictionary <string, Dictionary <string, string> >();

            foreach (var AssetBundleName in CommonLib.GetAssetBundleNameListFromPath("studioneo/info/"))
            {
                foreach (var AssetName in AssetBundleCheck.GetAllAssetName(AssetBundleName).Where(x => x.StartsWith("voice_")))
                {
                    var AssetSplit = AssetName.Replace(".asset", "").Split('_');
                    var Asset      = CommonLib.LoadAsset <ExcelData>(AssetBundleName, AssetName);

                    string prefix = AssetSplit[3] == "00" ? "c" + AssetSplit[1] : "BattleArena";

                    if (!AllText.TryGetValue(prefix, out var _))
                    {
                        AllText[prefix] = new Dictionary <string, string>();
                    }

                    foreach (var param in Asset.list)
                    {
                        if (5 <= param.list.Count && !param.list[5].IsNullOrEmpty() && param.list[5] != "ファイル名")
                        {
                            AllJPText.Add(param.list[3]);
                            AllText[prefix][param.list[5]] = param.list[3];
                        }
                    }
                }
            }

            foreach (var TranslationsKVP in AllText)
            {
                var Translations = TranslationsKVP.Value;
                if (Translations.Count > 0)
                {
                    string FolderPath = Path.Combine(Paths.GameRootPath, "TextDump");
                    string FilePath   = Path.Combine(FolderPath, $"{TranslationsKVP.Key}.xml");

                    Directory.CreateDirectory(FolderPath);
                    if (File.Exists(FilePath))
                    {
                        File.Delete(FilePath);
                    }

                    XmlWriterSettings settings = new XmlWriterSettings();
                    settings.Indent = true;

                    using (XmlWriter writer = XmlWriter.Create(FilePath, settings))
                    {
                        writer.WriteStartElement("HS_Subtitles");

                        foreach (var tl in Translations)
                        {
                            writer.WriteStartElement("Sub");
                            writer.WriteAttributeString("Asset", tl.Key.Trim());
                            writer.WriteAttributeString("Text", tl.Value.Trim());
                            writer.WriteEndElement();
                        }
                        writer.WriteEndElement();
                        writer.Flush();
                    }
                }
            }

            Logger.Log(LogLevel.Info, $"[TextDump] Total Subtitle unique lines:{AllJPText.Count}");
            return(AllJPText.Count);
        }
Beispiel #14
0
        public override void Do()
        {
            base.Do();
            Common.Release(this.scenario);
            int num1 = 0;

            string[] args1  = this.args;
            int      index1 = num1;
            int      num2   = index1 + 1;
            string   bundle = args1[index1];

            string[] args2  = this.args;
            int      index2 = num2;
            int      num3   = index2 + 1;
            string   asset  = args2[index2];
            int?     no     = new int?();

            string[]        args3  = this.args;
            int             index3 = num3;
            int             num4   = index3 + 1;
            Action <string> act    = (Action <string>)(s => no = new int?(int.Parse(s)));

            args3.SafeProc(index3, act);
            Action action = (Action)(() =>
            {
                GameObject asset1 = AssetBundleManager.LoadAsset(bundle, asset, typeof(GameObject), (string)null).GetAsset <GameObject>();
                this.data = (Data)((GameObject)Object.Instantiate <GameObject>((M0)asset1, this.scenario.commandController.EventCGRoot, false)).GetComponent <Data>();
                if (no.HasValue)
                {
                    Transform transform1 = ((Component)this.data).get_transform();
                    Transform transform2 = this.scenario.commandController.GetChara(no.Value).backup.transform;
                    Transform transform3 = transform1;
                    transform3.set_position(Vector3.op_Addition(transform3.get_position(), transform2.get_position()));
                    Transform transform4 = transform1;
                    transform4.set_rotation(Quaternion.op_Multiply(transform4.get_rotation(), transform2.get_rotation()));
                }
                ((Object)this.data).set_name(((Object)asset1).get_name());
                AssetBundleManager.UnloadAssetBundle(bundle, false, (string)null, false);
            });

            if (!bundle.IsNullOrEmpty())
            {
                action();
            }
            else
            {
                foreach (string assetBundleName in CommonLib.GetAssetBundleNameListFromPath("adv/scenario/eventcg/", true))
                {
                    if (asset.Check(true, AssetBundleCheck.GetAllAssetName(assetBundleName, false, (string)null, false)) != -1)
                    {
                        bundle = assetBundleName;
                        action();
                        break;
                    }
                }
            }
            this.scenario.commandController.useCorrectCamera = false;
            if (Object.op_Inequality((Object)this.scenario.virtualCamera, (Object)null))
            {
                this.data.camRoot = ((Component)this.scenario.virtualCamera).get_transform();
                if (Object.op_Inequality((Object)this.data.cameraData, (Object)null))
                {
                    CharaData charaData = this.scenario.commandController.Characters.Values.FirstOrDefault <CharaData>((Func <CharaData, bool>)(p => p.data.isHeroine));
                    if (charaData != null)
                    {
                        ChaControl chaCtrl = charaData.chaCtrl;
                        if (!((Collection <ChaControl>) this.data.cameraData.chaCtrlList).Contains(chaCtrl))
                        {
                            ((Collection <ChaControl>) this.data.cameraData.chaCtrlList).Add(chaCtrl);
                        }
                    }
                }
            }
            else
            {
                this.data.camRoot = ((Component)this.scenario.AdvCamera).get_transform();
            }
            CommandController commandController = this.scenario.commandController;

            this.data.SetChaRoot(commandController.CharaRoot, commandController.Characters);
            this.data.Next(0, commandController.Characters);
        }
Beispiel #15
0
            public static string[] GetAssetNamesFromBundle(string assetBundleName)
            {
                string[] ret;

                try
                {
                    ret = AssetBundleCheck.GetAllAssetName(assetBundleName);
                    if (ret?.Length > 0)
                    {
                        return(ret);
                    }
                }
                catch { }


                try
                {
                    ret = AssetBundleCheck.GetAllAssetName(assetBundleName, isAllCheck: true);
                    if (ret?.Length > 0)
                    {
                        return(ret);
                    }
                }
                catch { }



#if !HS2
                AssetBundle assetBundle = null;
                try
                {
                    if (AssetBundleManager.AllLoadedAssetBundleNames.Contains(assetBundleName))
                    {
                        using (var enumerator = AssetBundleManager.ManifestBundlePack.GetEnumerator())
                        {
                            while (enumerator.MoveNext())
                            {
                                var current = enumerator.Current;
                                if (current.Value.LoadedAssetBundles.TryGetValue(assetBundleName,
                                                                                 out var loadedAssetBundle)
                                    )
                                {
                                    ret = loadedAssetBundle.m_AssetBundle.GetAllAssetNames().Select(Path.GetFileName)
                                          .ToArray();
                                    if (ret?.Length > 0)
                                    {
                                        return(ret);
                                    }
                                }
                            }
                        }
                    }
                }
                catch { }

                AssetBundleManager.LoadAssetBundleInternal(assetBundleName, false);
                var loadedAssetBundle1 = AssetBundleManager.GetLoadedAssetBundle(assetBundleName, out var err);

                if (loadedAssetBundle1 is null)
                {
                    Logger.LogError(err);
                    assetBundle =
                        AssetBundle.LoadFromFile(string.Concat(AssetBundleManager.BaseDownloadingURL, assetBundleName));
                }
                else
                {
                    assetBundle = loadedAssetBundle1.m_AssetBundle;
                }


                try
                {
                    if (assetBundle != null)
                    {
                        ret = assetBundle.GetAllAssetNames().Select(Path.GetFileName).ToArray();
                        if (ret?.Length > 0)
                        {
                            return(ret);
                        }
                    }
                }
                finally
                {
                    if (loadedAssetBundle1 == null && assetBundle != null)
                    {
                        AssetBundleManager.UnloadAssetBundle(assetBundle.name, false);
                    }
                }
#endif


                return(new string[0]);
            }
Beispiel #16
0
 public static string[] GetAssetNamesFromBundle(string assetBundleName) => AssetBundleCheck.GetAllAssetName(assetBundleName);