//ローディング中の表示 IEnumerator CoUpdateLoading() { int maxCountDownLoad = 0; int countDownLoading = 0; loadingBarRoot.SetActive(true); loadingBar.fillAmount = 0.0f; textMain.text = LanguageSystemText.LocalizeText(SystemText.Downloading); textCount.text = string.Format(LanguageSystemText.LocalizeText(SystemText.DownloadCount), 0, 1); while (Engine.IsWaitBootLoading) { yield return(0); } yield return(0); while (!AssetFileManager.IsDownloadEnd()) { yield return(0); countDownLoading = AssetFileManager.CountDownloading(); maxCountDownLoad = Mathf.Max(maxCountDownLoad, countDownLoading); int countDownLoaded = maxCountDownLoad - countDownLoading; textCount.text = string.Format(LanguageSystemText.LocalizeText(SystemText.DownloadCount), countDownLoaded, maxCountDownLoad); if (maxCountDownLoad > 0) { loadingBar.fillAmount = (1.0f * (maxCountDownLoad - countDownLoading) / maxCountDownLoad); } } loadingBarRoot.gameObject.SetActive(false); ChangeState(State.DownlodFinished); }
//サーバーから起動する時にネットワークエラーをチェックする IEnumerator CoStartFromServer() { string url = Starter.UrlScenarioData; int scenarioVersion = Starter.ScenarioVersion; int version = scenarioVersion; bool isRetry = false; do { bool isWaiting = false; isRetry = false; version = scenarioVersion; //ネットワークのチェック(モバイルのみ) switch (Application.internetReachability) { case NetworkReachability.NotReachable: //ネットにつながらない if (scenarioVersion < 0) { AssetFile file = AssetFileManager.GetFileCreateIfMissing(url); if (file.CacheVersion >= 0) { version = 0; if (!isAutoCacheFileLoad) { isWaiting = true; string text = LanguageSystemText.LocalizeText(SystemText.WarningNotOnline); List <ButtonEventInfo> buttons = new List <ButtonEventInfo> { new ButtonEventInfo( LanguageSystemText.LocalizeText(SystemText.Yes) , () => isWaiting = false ), new ButtonEventInfo( LanguageSystemText.LocalizeText(SystemText.Retry) , () => { isWaiting = false; isRetry = true; } ), }; OnOpenDialog.Invoke(text, buttons); } } } break; case NetworkReachability.ReachableViaCarrierDataNetwork: //キャリア case NetworkReachability.ReachableViaLocalAreaNetwork: //Wifi default: break; } while (isWaiting) { yield return(0); } } while (isRetry); Starter.LoadEngine(version); ChangeState(State.Downloding); }
//----- method ----- public ExternalResourcesAssetFile(AssetFileManager mangager, AssetFileInfo fileInfo, IAssetFileSettingData settingData) : base(mangager, fileInfo, settingData) { var setting = settingData as IAssetFileSettingData; if (setting != null) { resourcesPath = settingData.RowData.ParseCellOptional <string>("FileName", null); } }
//サウンドをロードして鳴らす IEnumerator CoPlaySound(string path) { AssetFile file = AssetFileManager.Load(path, this); while (!file.IsLoadEnd) { yield return(0); } Engine.SoundManager.PlayBgm(file); file.Unuse(this); }
protected void SavePreviewButton_Click(object sender, EventArgs e) { BinaryFile file = new BinaryFile(PreviewFileUpload.PostedFile); if (file.IsEmpty) { FeedbackLabel1.SetErrorMessage("No file uploaded"); return; } bool feedbackSet = false; if (!m_AllowedPreviewExtensions.Contains(file.FileExtension)) { string acceptExtensions = string.Join(",", m_AllowedPreviewExtensions.ToArray()); if (m_ForcePreviewFormat) { //allow upload but display warning FeedbackLabel1.SetErrorMessage(String.Format("You have supplied a file with the extension {0}, but only files with {1} extensions are supported by this viewer. Your file may not display correctly.", file.FileExtension, acceptExtensions)); feedbackSet = true; } else { //prevent upload and display warning FeedbackLabel1.SetErrorMessage(String.Format("You have supplied a file with the extension {0}, but only files with {1} extensions are supported by this viewer. Please choose another.", file.FileExtension, acceptExtensions)); return; } } try { // Save the preview AssetFileManager.SaveAssetFile(Asset, file, AssetFileType.AssetPreview); // Mark asset as processed Asset.IsProcessed = true; Asset.Update(Asset); // Update preview AssetPreview1.Asset = Asset; // Update UI if (!feedbackSet) { FeedbackLabel1.SetSuccessMessage("Preview updated successfully"); } ConfigurePreviewSettings(); } catch (Exception ex) { ExceptionHandler.HandleException(ex, "Error saving preview"); FeedbackLabel1.SetErrorMessage("Error saving preview: " + ex.Message); } }
//サウンドをロードして鳴らす IEnumerator CoPlaySound(string path) { AssetFile file = AssetFileManager.Load(path, this); while (!file.IsLoadEnd) { yield return(0); } Engine.SoundManager.Play(SoundManager.StreamType.Bgm, file, true, false); file.Unuse(this); }
//キャッシュクリアして最初のシーンを起動 public void OnTapReDownload() { AssetFileManager.DeleteCacheFileAll(); if (string.IsNullOrEmpty(bootSceneName)) { WrapperUnityVersion.LoadScene(0); } else { WrapperUnityVersion.LoadScene(bootSceneName); } }
protected void ExtendFindAsset(AssetFileManager mangager, AssetFileInfo fileInfo, IAssetFileSettingData settingData, ref AssetFileBase asset) { if (localAssets != null) { asset = GetInternalResourcesAssetFile(mangager, fileInfo, settingData); } if (asset == null) { asset = GetExternalResourcesAssetFile(mangager, fileInfo, settingData); } }
//サウンドをロードして鳴らす protected virtual IEnumerator CoPlaySound(string path) { isChangedBgm = true; AssetFile file = AssetFileManager.Load(path, this); while (!file.IsLoadEnd) { yield return(null); } Engine.SoundManager.PlayBgm(file); file.Unuse(this); }
//キャッシュクリアして最初のシーンを起動 public void OnTapReDownload() { AssetFileManager.DeleteCacheFileAll(); if (string.IsNullOrEmpty(bootSceneName)) { Application.LoadLevel(0); } else { Application.LoadLevel(bootSceneName); } }
//キャッシュクリアして最初のシーンを起動 public virtual void OnTapReDownload() { AssetFileManager.GetInstance().AssetBundleInfoManager.DeleteAllCache(); if (string.IsNullOrEmpty(bootSceneName)) { WrapperUnityVersion.LoadScene(0); } else { WrapperUnityVersion.LoadScene(bootSceneName); } }
/// <summary> /// 宴でBGMを鳴らす /// </summary> /// <param name="bgmLabel">BGMのラベル</param> /// <returns></returns> static public IEnumerator CoUtagePlayBgm(string bgmLabel) { // TODO:ほんとにこれでよい? var engine = GetNazotokiAdvEngine(); var path = engine.DataManager.SettingDataManager.SoundSetting.LabelToFilePath(bgmLabel, SoundType.Bgm); AssetFile file = AssetFileManager.Load(path, null); while (!file.IsLoadEnd) { yield return(null); } engine.SoundManager.PlayBgm(file); }
//----- method ----- public ExternalResourcesSoundAssetFile(AssetFileManager mangager, AssetFileInfo fileInfo, IAssetFileSettingData settingData) : base(mangager, fileInfo, settingData) { var setting = settingData as IAssetFileSoundSettingData; if (setting != null) { resourcesPath = settingData.RowData.ParseCellOptional <string>("FileName", null); if (setting is AdvVoiceSetting) { soundName = settingData.RowData.ParseCellOptional <string>("Voice", null); } else { soundName = settingData.RowData.ParseCellOptional <string>("SoundName", null); } } }
//ボイスの再生 IEnumerator CoPlayVoice(string voiceFileName, string charcterLabel) { AssetFile file = AssetFileManager.Load(voiceFileName, this); if (file == null) { Debug.LogError("Backlog voiceFile is NULL"); yield break; } while (!file.IsLoadEnd) { yield return(0); } SoundManager manager = SoundManager.GetInstance(); if (manager) { manager.PlayVoice(charcterLabel, file); } file.Unuse(this); }
protected void SaveThumbnailButton_Click(object sender, EventArgs e) { BinaryFile file = new BinaryFile(ThumbnailFileUpload.PostedFile); if (file.IsEmpty) { FeedbackLabel1.SetErrorMessage("No file uploaded"); return; } if (!m_AllowedThumbnailExtensions.Contains(file.FileExtension)) { FeedbackLabel1.SetErrorMessage("Invalid file uploaded"); return; } try { // Save the thumbnail AssetFileManager.SaveAssetFile(Asset, file, AssetFileType.AssetThumbnail); // Mark asset as processed Asset.IsProcessed = true; Asset.Update(Asset); // Update thumbnail display AssetThumbnail1.Initialise(Asset); // Update UI FeedbackLabel1.SetSuccessMessage("Thumbnail updated successfully"); } catch (Exception ex) { FeedbackLabel1.SetErrorMessage("Error saving thumbnail: " + ex.Message); ExceptionHandler.HandleException(ex, "Error saving thumbnail"); } }
void Awake() { AssetFileManager.SetLoadErrorCallBack(CustomCallbackFileLoadError); }
protected abstract AssetFileBase GetExternalResourcesAssetFile(AssetFileManager mangager, AssetFileInfo fileInfo, IAssetFileSettingData settingData);
//----- params ----- //----- field ----- //----- property ----- //----- method ----- public ExternalResourcesTextureAssetFile(AssetFileManager mangager, AssetFileInfo fileInfo, IAssetFileSettingData settingData) : base(mangager, fileInfo, settingData) { }
//----- params ----- //----- field ----- //----- property ----- //----- method ----- public ExternalResourcesUnityObjectAssetFile(AssetFileManager mangager, AssetFileInfo fileInfo, IAssetFileSettingData settingData) : base(mangager, fileInfo, settingData) { }
protected override void ProcessFiles() { if (!StringUtils.IsBlank(AdditionalData.AssetBitmapReference)) { Context.Response.Write("ERROR - Asset Bitmap Reference is not blank. Use BitmapProcessingCallbackHandler instead."); return; } if (Asset.IsProcessed) { Context.Response.Write("ERROR - Asset has already been processed"); return; } List <String> warningsList = new List <String>(); #if DEBUG // Save the returned metadata XML string metadataXmlPath = Path.GetTempFileName() + "_" + AssetId + ".xml"; File.WriteAllText(metadataXmlPath, MetadataXml); m_Logger.DebugFormat("Saved Metadata XML to: {0}", metadataXmlPath); #endif try { // Ensure we're saving valid metadata XML by trying to load it before saving XmlDocument doc = new XmlDocument(); doc.LoadXml(MetadataXml); // Save Asset metadata XML Asset.MetadataXml = MetadataXml; Asset.MetadataSearchVals = GetMetadataString(Asset.GetFileMetadata(true)); } catch (Exception ex) { Asset.MetadataXml = string.Empty; Asset.MetadataSearchVals = string.Empty; string error = string.Format("Error parsing metadata returned from APS for Asset: {0}. Error: {1}", AssetId, ex.Message); ExceptionHandler.HandleException(ex, error); warningsList.Add(error); } // Mark Asset as processed Asset.IsProcessed = true; // Save other FileDataItems (FDI) Asset.Height = WebUtils.GetIntRequestParam("FDI_Height", 0); Asset.Width = WebUtils.GetIntRequestParam("FDI_Width", 0); Asset.Duration = WebUtils.GetIntRequestParam("FDI_Duration", 0); // Update database Asset.Update(Asset); Asset.SaveAssetMetadata(Asset); m_Logger.Debug("Updated Asset data"); // Save preview if (StringUtils.IsBlank(PreviewPath)) { m_Logger.Debug("No preview file to save"); warningsList.Add("No preview file to save"); } else if (File.Exists(PreviewPath)) { try { AssetFileManager.SaveAssetFile(Asset, new BinaryFile(PreviewPath, BinaryFile.SaveMode.Move), AssetFileType.AssetPreview); m_Logger.Debug("Saved Asset preview file"); } catch (Exception ex) { string error = string.Format("Error saving preview file {0}. Error: {1}", PreviewPath, ex.Message); m_Logger.Warn(error, ex); warningsList.Add(error); } } else { string error = string.Format("Preview file supplied does not exist: {0}", PreviewPath); m_Logger.Warn(error); warningsList.Add(error); } // Save thumbnail if (StringUtils.IsBlank(ThumbnailPath)) { m_Logger.Warn("No thumbnail file to save"); warningsList.Add("No thumbnail file to save"); } else if (File.Exists(ThumbnailPath)) { try { AssetFileManager.SaveAssetFile(Asset, new BinaryFile(ThumbnailPath, BinaryFile.SaveMode.Move), AssetFileType.AssetThumbnail); m_Logger.Debug("Saved Asset thumbnail file"); } catch (Exception ex) { string error = string.Format("Error saving thumbnail file {0}. Error: {1}", ThumbnailPath, ex.Message); m_Logger.Warn(error, ex); warningsList.Add(error); } } else { string error = string.Format("Thumbnail file supplied does not exist: {0}", ThumbnailPath); m_Logger.Warn(error); warningsList.Add(error); } // Republish the Asset if (ExternalPublisher.Instance.IsPublished(AssetId)) { ExternalPublisher.Instance.Publish(AssetId); } // Notify uploader if required if (AdditionalData.Notify) { NotifyEngine.AssetProcessingComplete(Asset); } // All done WriteLine("OK"); WriteLine(Environment.NewLine); // Write some debug info WriteLine("Date: {0}", DateTime.Now); WriteLine("Server: {0}", Context.Server.MachineName); WriteLine("Notify: {0}", AdditionalData.Notify); WriteLine(Environment.NewLine); // Write warning count WriteLine("Warning Message Count: {0}", warningsList.Count); // Write warning messages if (warningsList.Count > 0) { WriteLine(Environment.NewLine); warningsList.ForEach(WriteLine); } }
void OnRetry(AssetFile file) { AssetFileManager.ReloadFile(file); }
//----- property ----- //----- method ----- void Awake() { // ファイルのロードを上書きするコールバックを登録. AssetFileManager.GetCustomLoadManager().OnFindAsset += ExtendFindAsset; }