Example #1
0
 /// <summary>
 /// キャシュ書き込みの準備
 /// </summary>
 /// <param name="id">キャッシュ番号</param>
 /// <param name="cacheRootDir">キャッシュのディレクトリ</param>
 /// <param name="isDebugFileName">デバッグ用のファイル名か?(ファイル名を隠蔽しないか)</param>
 /// <returns>キャッシュファイルパス</returns>
 public string ReadyToWriteCache(int id, string cacheRootDir, bool isDebugFileName)
 {
     oldCachePath = cachePath;
     //キャッシュ書き込みするものはパスを作る
     if (StrageType == AssetFileStrageType.Web)
     {
         if (isDebugFileName)
         {
             //デバッグ用に、DL元と同じファイル構成を再現
             cachePath = FilePathUtil.Combine(cacheRootDir, new Uri(FilePath).Host + new Uri(FilePath).AbsolutePath);
         }
         else
         {
             //キャッシュファイルIDで管理
             cachePath = FilePathUtil.Combine(cacheRootDir, id.ToString());
         }
         cacheVersion = Mathf.Max(0, Version);
     }
     else
     {
         Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.NoChacheTypeFile));
         cachePath = "";
     }
     return(cachePath);
 }
Example #2
0
        public override void DoCommand(AdvEngine engine)
        {
            string root = FilePathUtil.Combine(engine.DataManager.SettingDataManager.BootSetting.ResourceDir, "Movie");

            WrapperMoviePlayer.Play(FilePathUtil.Combine(root, label), loop, cancel);
            time = 0;
        }
Example #3
0
        string FileNameToPath(string fileName, AdvBootSetting settingData)
        {
            string root = null;

            if (CallbackParseCustomFileTypeRootDir != null)
            {
                CallbackParseCustomFileTypeRootDir(this.graphic.FileType, ref root);
            }
            if (root != null)
            {
                return(FilePathUtil.Combine(settingData.ResorceDir, root, fileName));
            }
            else
            {
                if (!Graphic.IsDefaultFileType)
                {
                    return(FilePathUtil.Combine(settingData.ResorceDir, fileName));
                }
                else
                {
                    switch (type)
                    {
                    case AdvTextureSettingData.Type.Event:
                        return(settingData.EventDirInfo.FileNameToPath(fileName));

                    case AdvTextureSettingData.Type.Sprite:
                        return(settingData.SpriteDirInfo.FileNameToPath(fileName));

                    case AdvTextureSettingData.Type.Bg:
                    default:
                        return(settingData.BgDirInfo.FileNameToPath(fileName));
                    }
                }
            }
        }
Example #4
0
        //ログファイルを書き込む
        public void WriteLog(bool isAssetBundle)
        {
            string logFileListPath = FilePathUtil.Combine(OutputResourcesPath, Path.GetFileNameWithoutExtension(OutputResourcesPath) + ExtensionUtil.ConvertFileListLog);

            logFileListPath += ExtensionUtil.Txt;
            File.WriteAllText(logFileListPath, ConvertFileList.ToLogString(isAssetBundle));
        }
Example #5
0
 void Convert(string outputDirectiory, List <string> assetPathList)
 {
     foreach (string path in assetPathList)
     {
         StringGridDictionary gridTbl = ExcelParser.Read(path, '#', AdvScenarioDataBuilderWindow.ProjectData.ParseFormula, AdvScenarioDataBuilderWindow.ProjectData.ParseNumreic);
         gridTbl.RemoveSheets(@"^#");
         string outputPath = FilePathUtil.Combine(outputDirectiory, FilePathUtil.GetFileName(path));
         ExcelParser.Write(outputPath, ConvertToLocalized(gridTbl));
     }
 }
Example #6
0
        string ToScenariosFilePath(string rootDir)
        {
            string fileName = ScenariosName;

            if (string.IsNullOrEmpty(fileName))
            {
                fileName = RootResourceDir + ".scenarios.asset";
            }
            return(FilePathUtil.Combine(rootDir, fileName));
        }
 void Convert(string outputDirectiory, List <string> assetPathList)
 {
     foreach (string path in assetPathList)
     {
         StringGridDictionary gridTbl = ExcelParser.Read(path);
         gridTbl.RemoveSheets(@"^#");
         string outputPath = FilePathUtil.Combine(outputDirectiory, FilePathUtil.GetFileName(path));
         ExcelParser.Write(outputPath, ConvertToLocalized(gridTbl));
     }
 }
Example #8
0
        internal void CheckError(string rootPath, bool checkExt)
        {
            string fullPath = FilePathUtil.Combine(rootPath, path);

            if (!Exist(fullPath, checkExt))
            {
                string errorMsg = string.Format("{0} is not exit", fullPath);
                Debug.LogError(ToErrorString(errorMsg));
            }
        }
        //アセットバンドルのビルド
        void BuildAssetBundles(FileIOManager fileIOManager)
        {
            if (buildMode == AssetBundleBuildMode.None)
            {
                return;
            }

            //アセットバンドルをプラットフォーム別にビルド
            List <BuildTarget> buildTargets = new List <BuildTarget>();

            switch (buildMode)
            {
            case AssetBundleBuildMode.OnlyEditor:                    //エディタ上のみ
                buildTargets.Add(AssetBundleHelper.BuildTargetFlagToBuildTarget(AssetBundleHelper.EditorAssetBundleTarget()));
                break;

            case AssetBundleBuildMode.AllPlatform:                    //全プラットフォーム
            {
                buildTargets = AssetBundleHelper.BuildTargetFlagsToBuildTargetList(buildTargetFlags);
            }
            break;

            default:
                break;
            }

            MainAssetInfo        inputDirAsset = new MainAssetInfo(this.ResourcesDirectory);
            List <MainAssetInfo> assets        = GetAssetBudleList(inputDirAsset);

            RenameAssetBundles(inputDirAsset.AssetPath, assets);
            AssetBundleBuild[] builds = ToAssetBundleBuilds(assets);
            if (builds.Length <= 0)
            {
                return;
            }


            foreach (BuildTarget buildTarget in buildTargets)
            {
                string outputPath = FilePathUtil.Combine(OutputPath, AssetBundleHelper.BuildTargetToBuildTargetFlag(buildTarget).ToString());
                //出力先のディレクトリを作成
                if (!Directory.Exists(outputPath))
                {
                    Directory.CreateDirectory(outputPath);
                }
                //アセットバンドルを作成
                AssetBundleManifest manifest = BuildPipeline.BuildAssetBundles(outputPath, builds, buildOptions, buildTarget);
                Debug.Log("BuildAssetBundles to " + buildTarget.ToString());
                if (isOutputLog)
                {
                    WriteManifestLog(manifest, outputPath);
                }
            }
        }
            //ファイルの書き込み
            internal void Write(string folderPath)
            {
                string path = FilePathUtil.Combine(folderPath, this.Path + ExtensionUtil.TSV);
                string dir  = FilePathUtil.GetDirectoryPath(path);

                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }
                // ファイルにテキストを書き出し。
                File.WriteAllText(path, this.Grid.ToText());
            }
Example #11
0
        //フォルダのアセットをロード。なかったらCreate
        static public Object GetFolderAssetCreateIfMissing(string parentFolder, string newFolderName)
        {
            string path  = FilePathUtil.Combine(parentFolder, newFolderName);
            var    asset = AssetDatabase.LoadAssetAtPath <Object>(path);

            if (asset == null)
            {
                AssetDatabase.CreateFolder(parentFolder, newFolderName);
                return(AssetDatabase.LoadAssetAtPath <Object>(path));
            }
            return(asset);
        }
Example #12
0
        public AdvCommandVideo(StringGridRow row, AdvSettingDataManager dataManager)
            : base(row)
        {
            this.label      = ParseCell <string>(AdvColumnName.Arg1);
            this.cameraName = ParseCell <string>(AdvColumnName.Arg2);
            this.loop       = ParseCellOptional <bool>(AdvColumnName.Arg3, false);
            this.cancel     = ParseCellOptional <bool>(AdvColumnName.Arg4, true);

            string path = FilePathUtil.Combine(dataManager.BootSetting.ResourceDir, "Video");

            path      = FilePathUtil.Combine(path, label);
            this.file = AddLoadFile(path, new AdvCommandSetting(this));
        }
Example #13
0
 public override void DoCommand(AdvEngine engine)
 {
     if (WrapperMoviePlayer.GetInstance().OverrideRootDirectory)
     {
         WrapperMoviePlayer.Play(FilePathUtil.Combine(WrapperMoviePlayer.GetInstance().RootDirectory, label), loop, cancel);
     }
     else
     {
         string root = FilePathUtil.Combine(engine.DataManager.SettingDataManager.BootSetting.ResourceDir, "Movie");
         WrapperMoviePlayer.Play(FilePathUtil.Combine(root, label), loop, cancel);
     }
     time = 0;
 }
Example #14
0
        public AdvCommandVideo(StringGridRow row, AdvSettingDataManager dataManager) : base(row)
        {
            this.isEndPlay  = true;
            this.label      = base.ParseCell <string>(AdvColumnName.Arg1);
            this.cameraName = base.ParseCell <string>(AdvColumnName.Arg2);
            this.loop       = base.ParseCellOptional <bool>(AdvColumnName.Arg3, false);
            this.cancel     = base.ParseCellOptional <bool>(AdvColumnName.Arg4, true);
            string[] args = new string[] { dataManager.BootSetting.ResourceDir, "Video" };
            string   path = FilePathUtil.Combine(args);

            string[] textArray2 = new string[] { path, this.label };
            path      = FilePathUtil.Combine(textArray2);
            this.file = base.AddLoadFile(path, new AdvCommandSetting(this));
        }
        //コンバートファイルリストのファイルを読み込む
        void Read()
        {
            //出力先のアセットバンドル情報を読み込む
            string convertFileListPath = FilePathUtil.Combine(OutputResourcesPath, Path.GetFileNameWithoutExtension(OutputResourcesPath) + ExtensionUtil.ConvertFileList);

            convertFileListPath += ExtensionUtil.UtageFile;
            ConvertFileList      = new ConvertFileList(convertFileListPath);
            //ファイルから読み込む
            if (File.Exists(convertFileListPath))
            {
                byte[] bytes = File.ReadAllBytes(convertFileListPath);
                bytes = FileIOManager.Decode(bytes);
                BinaryUtil.BinaryRead(bytes, ConvertFileList.Read);
            }
        }
        string FileNameToPath(string fileName, string fileType, AdvBootSetting settingData)
        {
            string root = null;

            if (CallbackParseCustomFileTypeRootDir != null)
            {
                CallbackParseCustomFileTypeRootDir(fileType, ref root);
                if (root != null)
                {
                    return(FilePathUtil.Combine(settingData.ResourceDir, root, fileName));
                }
            }

            return(settingData.CharacterDirInfo.FileNameToPath(fileName));
        }
Example #17
0
        public void CreateScenariosIfMissing()
        {
            if (this.scenarios != null)
            {
                return;
            }

            string path = AssetDatabase.GetAssetPath(this);

            path = FilePathUtil.Combine(FilePathUtil.GetDirectoryPath(path), ProjectName + ".scenarios.asset");
            //設定データのアセットをロードまたは作成
            this.scenarios           = UtageEditorToolKit.GetImportedAssetCreateIfMissing <AdvImportScenarios>(path);
            this.scenarios.hideFlags = HideFlags.NotEditable;
            EditorUtility.SetDirty(this);
        }
 public override void DoCommand(AdvEngine engine)
 {
     if (WrapperMoviePlayer.GetInstance().OverrideRootDirectory)
     {
         string[] args = new string[] { WrapperMoviePlayer.GetInstance().RootDirectory, this.label };
         WrapperMoviePlayer.Play(FilePathUtil.Combine(args), this.loop, this.cancel);
     }
     else
     {
         string[] textArray2 = new string[] { engine.DataManager.SettingDataManager.BootSetting.ResourceDir, "Movie" };
         string   str        = FilePathUtil.Combine(textArray2);
         string[] textArray3 = new string[] { str, this.label };
         WrapperMoviePlayer.Play(FilePathUtil.Combine(textArray3), this.loop, this.cancel);
     }
     this.time = 0f;
 }
Example #19
0
 //アセットバンドルマニフェストの情報を追加
 public void AddAssetBundleManifest(string rootUrl, AssetBundleManifest manifest)
 {
     foreach (string name in manifest.GetAllAssetBundles())
     {
         Hash128 assetBundleHash = manifest.GetAssetBundleHash(name);
         string  path            = FilePathUtil.Combine(rootUrl, name);
         try
         {
             dictionary.Add(path, new AssetBundleInfo(path, assetBundleHash));
         }
         catch
         {
             Debug.LogError(path + "is already contains in assetbundleManger");
         }
     }
 }
Example #20
0
        public bool TryVersionUpFileFromMem(string fileKey, byte[] buffer, out ConvertFileList.CusomFileVersionUpInfo versionUpInfo)
        {
            string outputFileName = FilePathUtil.Combine(OutputResourcesPath, fileKey);

            AssetFileSetting setting = Settings.FindSettingFromPath(outputFileName);

            if (setting.EncodeType == AssetFileEncodeType.AlreadyEncoded)
            {
                outputFileName += ExtensionUtil.UtageFile;
            }

            bool isVersionUp = TryConvertFileFromMem(outputFileName, buffer);

            versionUpInfo = new ConvertFileList.CusomFileVersionUpInfo(fileKey, isVersionUp);
            return(isVersionUp);
        }
Example #21
0
 public AdvLocalVideoFile(AdvVideoLoadPathChanger pathChanger, AssetFileManager assetFileManager, AssetFileInfo fileInfo, IAssetFileSettingData settingData)
     : base(assetFileManager, fileInfo, settingData)
 {
     fileInfo.StrageType = AssetFileStrageType.Resources;
     if (settingData is AdvCommandSetting)
     {
         AdvCommandSetting setting  = settingData as AdvCommandSetting;
         string            fileName = setting.Command.ParseCell <string>(AdvColumnName.Arg1);
         this.LoadPath = FilePathUtil.Combine(pathChanger.RootPath, fileName);
     }
     else
     {
         AdvGraphicInfo info     = settingData as AdvGraphicInfo;
         string         fileName = info.FileName;
         this.LoadPath = FilePathUtil.Combine(pathChanger.RootPath, fileName);
     }
 }
 public void AddAssetBundleManifest(string rootUrl, AssetBundleManifest manifest)
 {
     foreach (string str in manifest.GetAllAssetBundles())
     {
         Hash128  assetBundleHash = manifest.GetAssetBundleHash(str);
         string[] args            = new string[] { rootUrl, str };
         string   key             = FilePathUtil.Combine(args);
         try
         {
             this.dictionary.Add(key, new AssetBundleInfo(key, assetBundleHash));
         }
         catch
         {
             Debug.LogError(key + "is already contains in assetbundleManger");
         }
     }
 }
Example #23
0
        //アセットバンドルマニフェストのロード
        IEnumerator LoadAssetBundleManifestAsync(bool fromCache, Action onFailed)
        {
            if (Strage == StrageType.Local)
            {
                //ローカルなら必要ない
                yield break;
            }

            // マニフェストファイルをロードする
            // マニフェストファイルは
            // 「ルートパス/プラッフォーム名にある
            if (fromCache)
            {
                yield return(AssetFileManager.GetInstance().AssetBundleInfoManager.LoadCacheManifestAsync(
                                 GetDynamicStrageRoot(),
                                 AssetBundleHelper.RuntimeAssetBundleTarget().ToString(),
                                 //onComplete
                                 () =>
                {
                },
                                 //onFailed
                                 () =>
                {
                    onFailed();
                }
                                 ));
            }
            else
            {
                yield return(AssetFileManager.GetInstance().AssetBundleInfoManager.DownloadManifestAsync(
                                 FilePathUtil.Combine(GetDynamicStrageRoot(), this.RootResourceDir + "_Root"), // GetDynamicStrageRoot(),
                                 this.RootResourceDir + "_Root",                                               // AssetBundleHelper.RuntimeAssetBundleTarget().ToString(),
                                 //onComplete
                                 () =>
                {
                    Debug.Log("[AdvEngineStarter] DownloadManifestAsync Success!!");
                },
                                 //onFailed
                                 () =>
                {
                    onFailed();
                }
                                 ));
            }
        }
Example #24
0
        //ルートパスを取得
        string GetDynamicStrageRoot()
        {
            switch (Strage)
            {
            case StrageType.Server:
            case StrageType.ServerAndLocalScenario:
            case StrageType.LocalAndServerScenario:
                return(FilePathUtil.Combine(this.ServerUrl, AssetBundleHelper.RuntimeAssetBundleTarget().ToString()));

            case StrageType.StreamingAssets:
            case StrageType.StreamingAssetsAndLocalScenario:
                string root = FilePathUtil.Combine(this.RootResourceDir, AssetBundleHelper.RuntimeAssetBundleTarget().ToString());
                return(FilePathUtil.ToStreamingAssetsPath(root));

            default:
                Debug.LogError("UnDefine");
                return("");
            }
        }
Example #25
0
        protected virtual bool TryReadSaveData()
        {
            if (DontUseSystemSaveData)
            {
                return(false);
            }

            string saveDir = FilePathUtil.Combine(FileIOManager.SdkPersistentDataPath, DirectoryName);

            //セーブデータのディレクトリがなければ作成
            FileIOManager.CreateDirectory(saveDir);

            Path = FilePathUtil.Combine(saveDir, FileName);
            if (!FileIOManager.Exists(Path))
            {
                return(false);
            }

            return(FileIOManager.ReadBinaryDecode(Path, ReadBinary));
        }
        //ログファイルを書き込む
        void WriteManifestLog(AssetBundleManifest manifest, string outputPath)
        {
            System.Text.StringBuilder builder = new System.Text.StringBuilder();
            foreach (string assetBundleName in manifest.GetAllAssetBundles())
            {
                builder.Append(assetBundleName);
                builder.AppendLine();

                Hash128 hash = manifest.GetAssetBundleHash(assetBundleName);
                builder.AppendFormat("  Hash128: {1}", assetBundleName, hash.ToString());
                builder.AppendLine();


                builder.AppendLine();
            }
            string logFilePath = FilePathUtil.Combine(outputPath, Path.GetFileNameWithoutExtension(outputPath));

            logFilePath += ExtensionUtil.Log + ExtensionUtil.Txt;
            File.WriteAllText(logFilePath, builder.ToString());
        }
        public void LoadInitFileList(int version)
        {
            string        dir = ResourceDir;
            bool          useConvertFileList     = ResourceLoadType == LoadType.Server ? useConvertFileListOnServer : useConvertFileListOnLocal;
            bool          useAssetBundleFileList = ResourceLoadType == LoadType.Server ? useAssetBundleListOnServer : useAssetBundleListOnLocal;
            List <string> pathList = new List <string>();

            if (useConvertFileList)
            {
                string path = FilePathUtil.Combine(dir, FilePathUtil.GetDirectoryNameOnly(ResourceDir + "/") + ExtensionUtil.ConvertFileList);
                pathList.Add(path);
            }
            if (useAssetBundleFileList)
            {
                string AssetBundleTarget = AssetBundleHelper.RuntimeAssetBundleTraget().ToString();
                string assetBundlePath   = FilePathUtil.Combine(AssetBundleTarget, AssetBundleTarget + ExtensionUtil.ConvertFileList);
                string path = FilePathUtil.Combine(dir, assetBundlePath);
                pathList.Add(path);
            }
            AssetFileManager.LoadInitFileList(pathList, version);
        }
        //アセットバンドルマニフェストをDLして情報を追加
        public IEnumerator DownloadManifestAsync(string rootUrl, string relativeUrl, Action onComplete, Action onFailed)
        {
            string url = FilePathUtil.Combine(rootUrl, relativeUrl);

            url = DLCManager.CreateDLCUrlForUtage(url);  //url = FilePathUtil.ToVersionManagerUrl(url);
            WWWEx wwwEx = new WWWEx(url);

            wwwEx.StoreBytes = true;
            wwwEx.OnUpdate   = OnDownloadingManifest;
            wwwEx.RetryCount = retryCount;
            wwwEx.TimeOut    = timeOut;
//			Debug.Log("Load Start " + url);
            return(wwwEx.LoadAssetBundleByNameAsync <AssetBundleManifest>(
                       AssetBundleManifestName,
                       false,
                       (manifest) =>
            {
                AddAssetBundleManifest(rootUrl, manifest);
                if (UseCacheManifest)
                {
                    string path = GetCachePath(relativeUrl);
                    FileIOManager.CreateDirectory(FilePathUtil.GetDirectoryPath(path) + "/");
                    FileIOManager.Write(path, wwwEx.Bytes);
                }
                if (onComplete != null)
                {
                    onComplete();
                }
            },
                       () =>
            {
                if (onFailed != null)
                {
                    onFailed();
                }
            }
                       ));
        }
Example #29
0
        //コンバートファイルリストのファイルを読み込む
        void Read()
        {
            //出力先のアセットバンドル情報を読み込む
            string convertFileListPath = FilePathUtil.Combine(OutputResourcesPath, Path.GetFileNameWithoutExtension(OutputResourcesPath) + ExtensionUtil.ConvertFileList);
            bool   isEncoded           = Settings.FindSettingFromPath(convertFileListPath).EncodeType == AssetFileEncodeType.AlreadyEncoded;

            if (isEncoded)
            {
                convertFileListPath += ExtensionUtil.UtageFile;
            }

            ConvertFileList = new ConvertFileList(convertFileListPath);
            //ファイルから読み込む
            if (File.Exists(convertFileListPath))
            {
                byte[] bytes = File.ReadAllBytes(convertFileListPath);
                if (isEncoded)
                {
                    bytes = FileIOManager.Decode(bytes);
                }
                BinaryUtil.BinaryRead(bytes, ConvertFileList.Read);
            }
        }
Example #30
0
        /// <summary>
        /// ファイル名をパスに
        /// </summary>
        /// <param name="fileName">ファイル名</param>
        /// <returns>ファイルパス</returns>
        public string ScenaioFileToPath(string scenaioFile)
        {
            //既に絶対URLならそのまま
            if (FilePathUtil.IsAbsoluteUri(scenaioFile))
            {
                return(scenaioFile);
            }
            else
            {
                //拡張子がなければデフォルト拡張子を追加
                if (string.IsNullOrEmpty(FilePathUtil.GetExtension(scenaioFile)))
                {
                    scenaioFile += defaultExt;
                }

                //旧形式(ファイル分割なし)に対応
                if (!scenaioFile.Contains("/"))
                {
                    scenaioFile = "Scenario/" + scenaioFile;
                }
                return(FilePathUtil.Combine(defaultDir, scenaioFile));
            }
        }