/// <summary> /// 暗い状態から透明に /// </summary> public void FadeIn(Action didEnd = null, bool bImmediate = false) { if (bImmediate) { var col = m_sptShade.color; col.a = 0f; m_sptShade.color = col; if (didEnd != null) { didEnd(); } return; } CoroutineAgent.Execute(this.FadeProc(false, didEnd)); }
/// <summary> /// 透明な状態から暗くなる. /// </summary> public void FadeOut(Action didEnd = null, bool bImmediate = false) { this.GetScript <Canvas>("canvas").gameObject.SetActive(true); if (bImmediate) { var col = m_sptShade.color; col.a = 1f; m_sptShade.color = col; if (didEnd != null) { didEnd(); } return; } CoroutineAgent.Execute(this.FadeProc(true, didEnd)); // 立て続けに呼ばれる状況などを加味してコルーチンを追加していき順番に処理させたい為CroutineAgentを使用する. }
private IEnumerator Process() { // サーバ時刻を取得する yield return(ServerTime.SetFromTimeServer()); CoroutineAgent.Execute(TickTime()); IsReady = true; while (true) { if (downloadQueue.Count > 0) { currentDownload = CoroutineAgent.Execute(downloader.Download(downloadQueue.Dequeue())); yield return(currentDownload); currentDownload = null; } yield return(new WaitForEndOfFrame()); } }
/// <summary> /// 初期化処理 /// baseURLに http://drive.google.com が指定された場合、サーバにGoogleDriveを使用する。 /// </summary> public static void Init(string baseURL, string localCachePath, string fileDictFileID = null) { if (instance == null) { instance = new DownloadManager(); } instance.downloader = WWWDownloader.Create(URLBuilder, localCachePath); instance.downloadQueue = new Queue <WWWDownloader.Params>(); instance.useGoogleDrive = (baseURL == "http://drive.google.com"); if (instance.useGoogleDrive) { instance.baseURL = baseURL + "/uc?export=view&id="; } else { instance.baseURL = baseURL; } CoroutineAgent.Execute(instance.SetFilePathDictionary(fileDictFileID)) .Next(instance.Process()); }