public void DirToReCallDirAndSetAssetBundleName()
    {
        HDfilePassNameList = new List <string> ();

        //OutOfContents=
        OutOfContentsFolderList = new List <string> ();
        OutOfContentsFolderList.Add("temp");
        OutOfContentsExtentionList = new List <string> ();
        OutOfContentsExtentionList.Add("meta");
        OutOfContentsList = new List <string> ();
        OutOfContentsList.Add("temp");

        Debug.Log("DirToReCallDirAndSetAssetBundleName()--------------------------------------再帰start--------------------");
        HDfilePassNameList = Directory_Have_Re_caller.Directory_Have_Re_callStart(HDAssetBundleTopDir, OutOfContentsFolderList, OutOfContentsExtentionList, OutOfContentsList);
        Debug.Log("DirToReCallDirAndSetAssetBundleName()----------------------------------------再帰end------------------");
        Debug.Log("DirToReCallDirAndSetAssetBundleName() .HDfilePassNameList.Count=" + HDfilePassNameList.Count);


        for (int i = 0; i < HDfilePassNameList.Count; i++)
        {
            Debug.Log("HDfilePassNameList[" + i + "]=" + HDfilePassNameList[i]);
            //HDfilePassNameList[0]=Assets/MyServerData/AssetBundles/Folder1st/Folder2nd/Folder3rd/my_12345_prefab.prefab
            //HDfilePassNameList[1]=Assets/MyServerData/AssetBundles/Folder1st/Folder2nd/Folder3rd/my_67890_prefab.prefab
            //HDfilePassNameList[0]=/works/UnityProject/Unity-5.0-AssetBundle-Demo/unity5_assetbundle-demo/Assets/MyServerData/AssetBundles/Folder1st/Folder2nd/Folder3rd/my_12345_prefab.prefab
            //HDfilePassNameList[1]=/works/UnityProject/Unity-5.0-AssetBundle-Demo/unity5_assetbundle-demo/Assets/MyServerData/AssetBundles/Folder1st/Folder2nd/Folder3rd/my_67890_prefab.prefab

            string AssetPath;
            string AssetBundleName;

            AssetPath = "Assets" + HDfilePassNameList[i].Replace(Application.dataPath, "");
            Debug.Log("AssetPath=" + AssetPath);
            AssetBundleName = HDfilePassNameList[i].Replace(HDAssetBundleTopDir, "");
            ///   AssetBundleName=Folder1st/Folder2nd/Folder3rd/my_67890_prefab.prefab
            string[] filepassNameArr = AssetBundleName.Split("/"[0]);

            string tempPass = "";
            for (int d = 0; d < filepassNameArr.Length; d++)
            {
                if (d < filepassNameArr.Length - 1)
                {
                    tempPass = tempPass + filepassNameArr [d];
                }
                if (d < filepassNameArr.Length - 2)
                {
                    tempPass = tempPass + "/";
                }
            }
            AssetBundleName = tempPass;
            AssetBundleName = AssetBundleName + ".unity3d";
            Debug.Log("AssetBundleName=" + AssetBundleName);

            ///////////////////////////////////////
            AssetBundleNameChengeOneFile(AssetPath, AssetBundleName);
            ////////////////////////////////////////
        }
    }
Пример #2
0
        void OnGUI()
        {
            GUIStyle text_style = new GUIStyle();

            text_style.fontSize  = 15;
            text_style.alignment = TextAnchor.MiddleCenter;

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("默认使用源文件名", GUILayout.MinWidth(0));
            IsThisName = EditorGUILayout.Toggle(IsThisName);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("AssetBundleName:", GUILayout.MinWidth(0));
            if (IsThisName)
            {
                GUILayout.Label("文件相对Assets/Export的路径", GUILayout.MinWidth(0));
            }
            else
            {
                AssetBundleName = EditorGUILayout.TextField(AssetBundleName.ToLower());
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("Variant:", GUILayout.MinWidth(0));
            Variant = EditorGUILayout.TextField(Variant.ToLower());
            EditorGUILayout.EndHorizontal();

            GUILayout.Label("\n");

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("文件夹路径", GUILayout.MinWidth(60));
            if (GUILayout.Button("浏览", GUILayout.MinWidth(60)))
            {
                OpenFolder();
            }

            PathRoot = EditorGUILayout.TextField(PathRoot);
            EditorGUILayout.EndHorizontal();
            if (GUILayout.Button("修改该文件夹下的AssetName及Variant"))
            {
                BuildAssetBundleTools.SetSettings();
            }

            if (GUILayout.Button("清除所有未被引用的AssetName及Variant"))
            {
                AssetDatabase.RemoveUnusedAssetBundleNames();
            }

            if (GUILayout.Button("清空所有AssetName及Variant"))
            {
                ClearAssetBundlesName();
            }
        }
Пример #3
0
    /// <summary>
    /// プレハブをロードする
    /// </summary>
    public void LoadPrefab(string path, Action <GameObject> onLoaded)
    {
        DebugUtil.NullAssert(onLoaded);

        string assetBundleName = AssetBundleName.GetAssetBundleNameFromPath(path);
        string assetName       = Path.GetFileName(path);

        AssetBundleLoader.Instance.LoadAsset(assetBundleName, assetName, loadedObj => {
            onLoaded(loadedObj as GameObject);
        });
    }
Пример #4
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);
        }
Пример #5
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);
        }
Пример #6
0
    public static void BuildTestAssetBundles()
    {
        DeleteFolder(Application.dataPath + "/StreamingAssets");
        AssetBundleName.MarkTestAssetBundle();
        BuildScript.BuildAssetBundles();

        string toolPath = Application.dataPath + "/../../../tools/TemporaryTools";
        string srcPath  = Application.dataPath + "/StreamingAssets/AssetBundles/";
        string destPath = Application.dataPath + "/../../../Server/AssetbundleRes/AssetbundleRes/" + AssetBundleTag.Test;

        DeleteFolder(destPath);
        CopyDirectory(srcPath, destPath);
        CopyDirectory(toolPath, destPath);//将MD5工具也一并拷贝到制定目录
        AssetDatabase.Refresh();

        Process ps = new Process {
            StartInfo = { FileName = destPath + "/FileMd5Gen.exe" }
        };

        ps.Start();
    }
Пример #7
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);
        }
Пример #8
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);
        }
Пример #9
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);
        }
Пример #10
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);
        }
Пример #11
0
 public static void SetupAssetBundleName()
 {
     AssetBundleName.SetupAssetBundleName();
 }