/*
         * V2の読み込み処理
         */
        void TryLoadV2(string basePath, OptionPath optionPath)
        {
            if (optionPath != null)
            {
                if (optionPath.diff_tex_json_path != null && optionPath.diff_tex_json_path != "")
                {
                    string diffTexJsonPath = diffTexJsonPath = FileUtil.GetPathFromRelative(basePath, optionPath.diff_tex_json_path);

                    V2.DifferenceTextureGenerator diffTex = FileUtil.LoadJsonFile <V2.DifferenceTextureGenerator>(diffTexJsonPath);
                    if (diffTex != null)
                    {
                        V2DiffTextGen = new V2.DiffTexGeneratorProcess(diffTex, Path.GetDirectoryName(diffTexJsonPath));
                    }
                }
                else if (optionPath.base_path != null && optionPath.base_path != "")
                {
                    string diffTexBasePath = diffTexBasePath = FileUtil.GetPathFromRelative(basePath, optionPath.base_path);

                    V2DiffTextGen = V2.DifferenceTextureGenerator.LoadDiffTexGenFromBaseDir(diffTexBasePath);
                }
            }

            if (V2DiffTextGen != null)
            {
                return;
            }

            if (clothPrefabParentPath != "")
            {
                V2DiffTextGen = V2.DifferenceTextureGenerator.LoadDiffTexGenFromBaseDir(basePath);
            }
        }
        //ExpandOptionのバージョンをロードする
        private void LoadExpandFileVersion()
        {
            expandOptionVersion = null;
            if (PrefabData.GetCloth() == null)
            {
                return;
            }

            isLoadExpandGUI = true;

            if (clothPrefabParentPath != "")
            {
                //プレハブ直下もしくは"RiClothesSetuper/" にOptionPathのjsonファイルを置くパターン
                string     basePath   = Path.GetDirectoryName(clothPrefabParentPath) + "/";
                OptionPath optionPath = OptionPath.LoadOptionPathFromBaseDir(basePath);

                if (optionPath != null)
                {
                    if (optionPath.option_json_path != null && optionPath.option_json_path != "")
                    {
                        //プレハブからの相対パス
                        expandJsonPath      = FileUtil.GetPathFromRelative(basePath, optionPath.option_json_path);
                        expandOptionVersion = FileUtil.LoadJsonFile <ExpandOptionVersion>(expandJsonPath);
                    }
                    else if (optionPath.base_path != null && optionPath.base_path != "")
                    {
                        string optionBasePath = FileUtil.GetPathFromRelative(basePath, optionPath.base_path);

                        LoadOptionVersionJsonOnBasePath(optionBasePath);
                    }
                }

                //この時点でexpandOptionに中身が入っていたら終了する
                if (expandOptionVersion != null)
                {
                    return;
                }

                //プレハブ直下もしくは"RiClothesSetuper/"にOption.jsonを置くパターン
                if (clothPrefabParentPath != "")
                {
                    LoadOptionVersionJsonOnBasePath(basePath);
                }
            }
        }
示例#3
0
        public void LoadLanguage(string clothPrefabParentPath)
        {
            I18N.Instance().ResetText();

            if (PrefabData.GetCloth() == null)
            {
                return;
            }

            bool isLoadLanguage = false;

            if (clothPrefabParentPath != "")
            {
                //プレハブ直下もしくは"RiClothesSetuper/" にOptionPathのjsonファイルを置くパターン
                string basePath = Path.GetDirectoryName(clothPrefabParentPath) + "/";

                OptionPath optionPath = OptionPath.LoadOptionPathFromBaseDir(basePath);

                if (optionPath != null)
                {
                    if (optionPath.language_dir_path != null && optionPath.language_dir_path != "")
                    {
                        string languageDirPath = FileUtil.GetPathFromRelative(basePath, optionPath.language_dir_path);
                        I18N.Instance().LoadTextFile(languageDirPath, true);
                        isLoadLanguage = true;
                    }
                    else if (optionPath.base_path != null && optionPath.base_path != "")
                    {
                        string languageBasePath = FileUtil.GetPathFromRelative(basePath, optionPath.base_path);
                        I18N.Instance().LoadTextFile(languageBasePath, false);
                        isLoadLanguage = true;
                    }
                }

                //この時点でロードできていたら終了
                if (isLoadLanguage)
                {
                    return;
                }

                I18N.Instance().LoadTextFile(basePath, false);
                return;
            }
        }
        void LoadDiffTexture()
        {
            ClearDiffTexture();
            if (PrefabData.GetCloth() == null)
            {
                return;
            }

            clothPrefabParentPath = PrefabUtility.GetPrefabAssetPathOfNearestInstanceRoot(PrefabData.GetCloth());
            if (clothPrefabParentPath == "")
            {
                return;
            }

            string     basePath   = FileUtil.GetBasePath().Replace("Assets/", "") + Path.GetDirectoryName(clothPrefabParentPath) + "/";
            OptionPath optionPath = OptionPath.LoadOptionPathFromBaseDir(basePath);

            TryLoadV2(basePath, optionPath);
            //V2の読み込みができていたら終了
            if (V2DiffTextGen != null)
            {
                return;
            }

            //プレハブ直下もしくは"RiClothesSetuper/" にOptionPathのjsonファイルを置くパターン
            if (optionPath != null)
            {
                //DiffText V1の読み込み
                if (optionPath.option_json_path != null && optionPath.option_json_path != "")
                {
                    string optionJsonPath = "";
                    optionJsonPath = FileUtil.GetPathFromRelative(basePath, optionPath.option_json_path);
                    V1.ExpandOption expandOption = FileUtil.LoadJsonFile <V1.ExpandOption>(optionJsonPath);
                    string          outputPath   = basePath;
                    if (optionPath.base_path != null && optionPath.base_path != "")
                    {
                        outputPath = FileUtil.GetPathFromRelative(basePath, optionPath.base_path);
                    }
                    if (expandOption != null)
                    {
                        V1DiffTextGen = new V1.DiffTexGeneratorProcess(expandOption.difference_textures, outputPath);
                    }
                }
                else if (optionPath.base_path != null && optionPath.base_path != "")
                {
                    string optionBasePath = FileUtil.GetPathFromRelative(basePath, optionPath.base_path);

                    LoadDiffTexOnBasePath(optionBasePath);
                }
            }

            //この時点でロードできていたら終了
            if (V1DiffTextGen != null)
            {
                return;
            }

            //プレハブ直下もしくは"RiClothesSetuper/"にOption.jsonを置くパターン
            if (clothPrefabParentPath != "")
            {
                LoadDiffTexOnBasePath(basePath);
            }
        }