private void FindAsset(AssetFileManager mangager, AssetFileInfo fileInfo, IAssetFileSettingData settingData, ref AssetFileBase asset)
 {
     if (this.IsVideoType(fileInfo, settingData))
     {
         asset = new AdvLocalVideoFile(this, mangager, fileInfo, settingData);
     }
 }
        //ロード処理
        IEnumerator CoLoad(int version, System.Action onComplete)
        {
            foreach (string path in localPathList)
            {
                files.Add(AssetFileManager.Load(FilePathUtil.ToStreamingAssetsPath(path), this));
            }
            foreach (string url in serverUrlList)
            {
                files.Add(AssetFileManager.Load(url, version, this));
            }

            while (IsLoading)
            {
                yield return(0);
            }

            foreach (AssetFile file in files)
            {
                ConvertFileList infoList = new ConvertFileList(file.FileName);
                BinaryUtil.BinaryRead(file.Bytes, infoList.Read);
                infoLists.Add(infoList);
                file.Unuse(this);
            }
            files.Clear();
            IsInitialized = true;
            if (onComplete != null)
            {
                onComplete();
            }
        }
 private void Awake()
 {
     if (null == instance)
     {
         instance = this;
     }
 }
        //**************************** CSVのロード用 ****************************//

        /// <summary>
        /// CSVファイルからロードして初期化
        /// </summary>
        /// <param name="parent">コルーチンをまわすためのMonoBehaviour</param>
        /// <param name="url">ファイルパス</param>
        /// <param name="version">シナリオバージョン(-1以下で必ずサーバーからデータを読み直す)</param>
        /// <returns></returns>
        public IEnumerator LoadCsvAsync(MonoBehaviour parent, string url, int version)
        {
            //起動ファイルの読み込み
            {
                AssetFile file = AssetFileManager.GetFileCreateIfMissing(url);
                if (version < 0)
                {
                    file.Version = file.CacheVersion + 1;
                }
                AssetFileManager.Load(file, this);
                while (!file.IsLoadEnd)
                {
                    yield return(0);
                }
                SettingData.InitFromCsv(file.Csv, url);
                file.Unuse(this);
            }

            parent.StartCoroutine(ScenarioSetting.LoadCsvAsync(SettingData.ScenarioSettingUrlList));
            parent.StartCoroutine(CharacterSetting.LoadCsvAsync(SettingData.CharacterSettingUrlList));
            parent.StartCoroutine(TextureSetting.LoadCsvAsync(SettingData.TextureSettingUrlList));
            parent.StartCoroutine(SoundSetting.LoadCsvAsync(SettingData.SoundSettingUrlList));
            parent.StartCoroutine(DefaultParam.LoadCsvAsync(SettingData.ParamSettingUrlList));
            parent.StartCoroutine(LayerSetting.LoadCsvAsync(SettingData.LayerSettingUrlList));
            parent.StartCoroutine(SceneGallerySetting.LoadCsvAsync(SettingData.SceneGallerySettingUrlList));


            while (!IsLoadEndCsv())
            {
                yield return(0);
            }
        }
Example #5
0
 public override void DownloadAll()
 {
     foreach (AdvSceneGallerySettingData data in base.List)
     {
         AssetFileManager.Download(data.ThumbnailPath);
     }
 }
        //先読みかけておく
        void UpdatePreLoadFiles(string scenarioLabel, int page)
        {
            //直前までの先読みファイルリスト
            HashSet <AssetFile> lastPreloadFileSet = preloadFileSet;

            //今回の先読みファイルリスト
            preloadFileSet = Engine.DataManager.MakePreloadFileList(scenarioLabel, page, maxFilePreload);

            if (preloadFileSet == null)
            {
                preloadFileSet = new HashSet <AssetFile>();
            }

            //リストに従って先読み
            foreach (AssetFile file in preloadFileSet)
            {
                //先読み
                AssetFileManager.Preload(file, this);
            }

            //直前の先読みファイルのうち、今回の先読みファイルからなくなったものは使用状態を解除する
            foreach (AssetFile file in lastPreloadFileSet)
            {
                //もうプリロードされなくなったリストを作るために
                if (!(preloadFileSet.Contains(file)))
                {
                    file.Unuse(this);
                }
            }
        }
Example #7
0
        /// <summary>
        /// テクスチャファイルを設定
        /// </summary>
        /// <param name="path">ファイルパス</param>
        /// <param name="pixelsToUnits">スプライトを作成する際の、座標1.0単位辺りのピクセル数</param>
        public void SetTextureFile(string path, float pixelsToUnits)
        {
            AssetFile file = AssetFileManager.Load(path, this);

            SetTextureFile(file, pixelsToUnits);
            file.Unuse(this);
        }
 public override void DownloadAll()
 {
     foreach (AdvSoundSettingData data in base.List)
     {
         AssetFileManager.Download(data.FilePath);
     }
 }
 public override void DownloadAll()
 {
     foreach (AdvVideoSettingData data in base.List)
     {
         AssetFileManager.Download(data.Graphic.File);
     }
 }
 /// <summary>
 /// 全てのリソースをダウンロード
 /// </summary>
 public override void DownloadAll()
 {
     foreach (AdvParticleSettingData data in List)
     {
         AssetFileManager.Download(data.Graphic.File);
     }
 }
Example #11
0
 /// <summary>
 /// 全てのリソースをダウンロード
 /// </summary>
 public void DownloadAll()
 {
     foreach (AdvCharacterSettingData data in List)
     {
         AssetFileManager.Download(data.FilePath);
     }
 }
Example #12
0
        //セーブデータ用のバイナリ読み込み
        internal void Read(BinaryReader reader)
        {
            int version = reader.ReadInt32();

            if (version <= Version)
            {
                PlayMode       = (SoundPlayMode)reader.ReadInt32();
                IsLoop         = reader.ReadBoolean();
                PlayVolume     = reader.ReadSingle();
                ResourceVolume = reader.ReadSingle();
                IntroTime      = reader.ReadSingle();
                Tag            = reader.ReadString();
                string filePath = reader.ReadString();
                if (version <= Version0)
                {
                    File = AssetFileManager.GetFileCreateIfMissing(filePath);
                }
                else
                {
                    string key = reader.ReadString();
                    File = AssetFileManager.GetSoundFileCreateIfMissing(filePath, key);
                }
            }
            else
            {
                Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
            }
        }
Example #13
0
        AssetFile errorFile;                    // ロードエラーしたファイル

        // ロードエラー時のデフォルトコールバック
        void CallbackFileLoadError(AssetFile file)
        {
            errorFile = file;
            string errorMsg = file.LoadErrorMsg + "\n" + file.FileName;

            Debug.LogError(errorMsg);

            if (SystemUi.GetInstance() != null)
            {
                //リロードを促すダイアログを表示
                SystemUi.GetInstance().OpenDialog1Button(
                    errorMsg, LanguageSystemText.LocalizeText(SystemText.Retry),
                    OnCloseFileLoadErrorDialog);
                AssetFileManager.SetActive(false);
            }
            else if (LegacyUiSystemUi.GetInstance() != null)
            {
                //リロードを促すダイアログを表示
                LegacyUiSystemUi.GetInstance().OpenDialog1Button(
                    errorMsg, LanguageSystemText.LocalizeText(SystemText.Retry),
                    this.gameObject, "OnCloseFileLoadErrorDialog");
                AssetFileManager.SetActive(false);
            }
            else
            {
                AssetFileManager.ReloadFile(errorFile);
            }
        }
        /// <summary>
        /// CSV設定ファイルをロードして、データ作成
        /// </summary>
        /// <param name="filePathInfoList">ロードするパスのリスト</param>
        /// <returns></returns>
        public virtual IEnumerator LoadCsvAsync(List <AssetFilePathInfo> filePathInfoList)
        {
            isLoadEnd = false;
            Clear();
            ParseBeign();

            List <AssetFile> fileList = new List <AssetFile>();

            foreach (AssetFilePathInfo filePathInfo in filePathInfoList)
            {
                fileList.Add(AssetFileManager.Load(filePathInfo.Path, filePathInfo.Version, this));
            }
            foreach (AssetFile file in fileList)
            {
                while (!file.IsLoadEnd)
                {
                    yield return(0);
                }
                if (!file.IsLoadError)
                {
                    ParseFromStringGrid(file.Csv);
                }
                file.Unuse(this);
            }

            ParseEnd();
            isLoadEnd = true;
        }
        //**************************** CSVのロード用 ****************************//

        /// <summary>
        /// CSVファイルからロードして初期化
        /// </summary>
        /// <param name="parent">コルーチンをまわすためのMonoBehaviour</param>
        /// <param name="url">ファイルパス</param>
        /// <param name="version">シナリオバージョン(-1以下で必ずサーバーからデータを読み直す)</param>
        /// <returns></returns>
        public IEnumerator LoadCsvAsync(MonoBehaviour parent, string url, int version)
        {
            //起動ファイルの読み込み
            {
                AssetFile file = AssetFileManager.Load(url, version, this);
                Debug.Log("Boot Scenario Version:" + file.Version);
                while (!file.IsLoadEnd)
                {
                    yield return(0);
                }
                SettingData.InitFromCsv(file.Csv, url);
                file.Unuse(this);
            }

            importVersion = Version;

            parent.StartCoroutine(ScenarioSetting.LoadCsvAsync(SettingData.ScenarioSettingUrlList));
            parent.StartCoroutine(CharacterSetting.LoadCsvAsync(SettingData.CharacterSettingUrlList));
            parent.StartCoroutine(TextureSetting.LoadCsvAsync(SettingData.TextureSettingUrlList));
            parent.StartCoroutine(SoundSetting.LoadCsvAsync(SettingData.SoundSettingUrlList));
            parent.StartCoroutine(DefaultParam.LoadCsvAsync(SettingData.ParamSettingUrlList));
            parent.StartCoroutine(LayerSetting.LoadCsvAsync(SettingData.LayerSettingUrlList));
            parent.StartCoroutine(SceneGallerySetting.LoadCsvAsync(SettingData.SceneGallerySettingUrlList));


            while (!IsLoadEndCsv())
            {
                yield return(0);
            }
        }
 //ファイルのコンバート
 void Convert()
 {
     try
     {
         AssetFileManager assetFileManager = FindObjectOfType <AssetFileManager>();
         if (assetFileManager == null)
         {
             Debug.LogError("FileManager is not found in current scene");
             return;
         }
         //ファイルの入出力に使う
         FileIOManager fileIOManager = assetFileManager.FileIOManager;
         switch (outputType)
         {
         case OutputType.Default:
         default:
             //アセットバンドルをビルド
             BuildAssetBundles(fileIOManager);
             break;
         }
         AssetDatabase.Refresh();
     }
     catch (System.Exception e)
     {
         Debug.LogException(e);
     }
 }
Example #17
0
        /// <summary>
        /// 起動用TSVをロード
        /// </summary>
        /// <param name="url">CSVのパス</param>
        /// <param name="version">シナリオバージョン(-1以下で必ずサーバーからデータを読み直す)</param>
        /// <returns></returns>
        public IEnumerator LoadChapterAsync(string url)
        {
            AssetFile file = AssetFileManager.Load(url, this);

            while (!file.IsLoadEnd)
            {
                yield return(null);
            }

            AdvChapterData chapter = file.UnityObject as AdvChapterData;

            if (chapter == null)
            {
                Debug.LogError(url + " is  not scenario file");
                yield break;
            }

            if (this.DataManager.SettingDataManager.ImportedScenarios == null)
            {
                this.DataManager.SettingDataManager.ImportedScenarios = new AdvImportScenarios();
            }
            if (this.DataManager.SettingDataManager.ImportedScenarios.TryAddChapter(chapter))
            {
                //シナリオデータの初期化
                DataManager.BootInitChapter(chapter);
            }
        }
Example #18
0
        IEnumerator CoLoadAndInitScenariodData(AdvScenarioSettingData scenarioSetting)
        {
            string scenaioFileName = scenarioSetting.ScenaioFile;

            //既にある(エクスポートされたデータの可能性あり)
            if (scenarioDataTbl.ContainsKey(scenaioFileName))
            {
                yield break;
            }

            string          path = SettingDataManager.ScenarioSetting.ScenaioFileToPath(scenaioFileName);
            AdvScenarioData data = new AdvScenarioData();
            AssetFile       file = AssetFileManager.BackGroundLoad(path, this);

            while (!file.IsLoadEnd)
            {
                yield return(0);
            }

            data.Init(scenaioFileName, file.Csv, SettingDataManager);
            file.Unuse(this);
            scenarioDataTbl.Add(scenaioFileName, data);

            --loadingScenarioCount;
        }
Example #19
0
 /// <summary>
 /// テクスチャファイルを設定
 /// </summary>
 /// <param name="graphic">グラフィック情報</param>
 public void LoadTextureFile(GraphicInfo graphic)
 {
     this.graphicInfo = graphic;
     AssetFileManager.Load(graphic.File, this);
     SetTextureFile(graphic.File);
     graphic.File.Unuse(this);
 }
Example #20
0
        /// <summary>
        /// テクスチャファイルを設定
        /// </summary>
        /// <param name="path">ファイルパス</param>
        public void LoadTextureFile(string path)
        {
            AssetFile file = AssetFileManager.Load(path, this);

            SetTextureFile(file);
            file.Unuse(this);
        }
Example #21
0
 public void BootInit(System.Func <string, string> fileNameToPath)
 {
     if (!string.IsNullOrEmpty(this.FileName))
     {
         File = AssetFileManager.GetFileCreateIfMissing(fileNameToPath(FileName));
     }
 }
 internal void DownloadAll()
 {
     foreach (var item in infoList)
     {
         AssetFileManager.Download(item.File);
     }
 }
Example #23
0
 //ファイルのロードを上書き
 void FindAsset(AssetFileManager mangager, AssetFileInfo fileInfo, IAssetFileSettingData settingData, ref AssetFileBase asset)
 {
     if (IsVideoType(fileInfo, settingData))
     {
         //宴形式の通常ファイルロード
         asset = new AdvLocalVideoFile(this, mangager, fileInfo, settingData);
     }
 }
Example #24
0
 //起動時の初期化
 public void BootInit(System.Func <string, string> FileNameToPath)
 {
     File = AssetFileManager.GetFileCreateIfMissing(FileNameToPath(fileName), RowData);
     if (File != null)
     {
         File.Version = Version;
     }
 }
Example #25
0
 public AssetFile AddLoadFile(string path, AssetFileType assetFileType, IAssetFileSettingData settingData)
 {
     if (IsEntityType)
     {
         return(null);
     }
     return(AddLoadFileSub(AssetFileManager.GetFileCreateIfMissing(path, assetFileType, settingData)));
 }
Example #26
0
 //ロードの必要があるファイルを追加
 public AssetFile AddLoadFile(string path, StringGridRow settingData = null)
 {
     if (IsEntityType)
     {
         return(null);
     }
     return(AddLoadFile(AssetFileManager.GetFileCreateIfMissing(path, settingData)));
 }
Example #27
0
 /// <summary>
 /// 起動時の初期化
 /// </summary>
 /// <param name="settingData">設定データ</param>
 public override void BootInit(AdvBootSetting settingData)
 {
     foreach (AdvScenarioSettingData data in List)
     {
         AssetFile file = AssetFileManager.GetFileCreateIfMissing(ScenaioFileToPath(data.ScenaioFile));
         file.Version = data.Version;
     }
 }
Example #28
0
 public AssetFileBase(AssetFileManager mangager, AssetFileInfo fileInfo, IAssetFileSettingData settingData)
 {
     this.FileManager = mangager;
     this.FileInfo    = fileInfo;
     this.FileType    = fileInfo.FileType;
     this.SettingData = settingData;
     this.Priority    = AssetFileLoadPriority.DownloadOnly;
 }
Example #29
0
 /// <summary>
 /// 全てのリソースをダウンロード
 /// </summary>
 public override void DownloadAll()
 {
     //ファイルマネージャーにバージョンの登録
     foreach (AdvSoundSettingData data in List)
     {
         AssetFileManager.Download(data.FilePath);
     }
 }
Example #30
0
 /// <summary>
 /// 全てのリソースをダウンロード
 /// </summary>
 public void DownloadAll()
 {
     //ファイルマネージャーにバージョンの登録
     foreach (AdvSceneGallerySettingData data in List)
     {
         AssetFileManager.Download(data.ThumbnailPath);
     }
 }
		static AssetFileManager GetInstance()
		{
			if (instance==null)
			{
				instance = FindObjectOfType<AssetFileManager>();
				if(instance==null)
				{
					GameObject go = new GameObject("FileManager");
					instance = go.AddComponent<AssetFileManager>();
				}
			}
			return instance;
		}
		void Awake()
		{
			if (null == instance)
			{
				instance = this;
			}
//			else
//			{
//				Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.SingletonError));
//				Destroy(this);
//			}
			ReadCacheTbl();
			if (isDebugBootDeleteChacheAll)
			{
				DeleteCacheFileAllSub();
			}
			else if (isDebugBootDeleteChacheTextAndBinary)
			{
				DeleteCacheFileAllSub(AssetFileType.Text);
				DeleteCacheFileAllSub(AssetFileType.Bytes);
				DeleteCacheFileAllSub(AssetFileType.Csv);
			}
		}