IEnumerator CallWrapper() { yield return(null); IEnumerator e = coroutine; while (running) { if (paused) { yield return(null); } else { if (e != null && e.MoveNext()) { yield return(e.Current); } else { running = false; } } } FinishHandler handler = Finished; if (handler != null) { handler(stopped); } }
/// <summary> /// シリアライズ保存 /// </summary> /// <param name="saveInterface">シリアライズするクラス</param> /// <param name="finishHandler">終了ハンドラ(null指定可)</param> /// <param name="async">非同期実行するか</param> public void Save(ISerializer saveInterface, FinishHandler finishHandler, bool async = true) { DataInfo dataInfo = new DataInfo(); dataInfo.serializer = saveInterface; dataInfo.filePath = Application.persistentDataPath + saveInterface.fileName; dataInfo.finishHandler = finishHandler; dataInfo.async = async; if (saveInterface == null || string.IsNullOrEmpty(saveInterface.fileName)) { this.FinishAccessing(IO_RESULT.NONE, ref dataInfo); return; } // 非同期処理 if (async) { ThreadPool.QueueUserWorkItem(this.saveThreadHandler, dataInfo); } else { this.SaveThreadMain(dataInfo); } }
public void RaiseFinishEvent(string step, string message) { FinishHandler?.Invoke(this, new WorkItemEventArgs { Id = Id, WorkflowId = WorkflowId, Step = step, ErrorMessage = message }); }
/// <summary> /// 初期化 /// </summary> void Start() { this.control = this.GetComponent <StorageControl>(); this.ioHandler = new FinishHandler(this.IOHandler); this.storageManager = new StorageManager(); this.usedSettings = this.procSettings = new UserSettings(); this.saveAllyStatus = this.procSaveAllyStatus = new SaveAllyStatus(); // 例外 this.UpdateDataInfo((IO_RESULT)999); }
private IEnumerator ExecuteAsync(FinishHandler OnFinish) { ExuteStarted?.Invoke(); yield return(StartCoroutine(OnExecuteAsync())); if (Next != null) { Next.Execute(OnFinish); } else { OnFinish?.Invoke(); } ExecuteEnded?.Invoke(); }
public DownloadTask( string fileName, string url, ContentType type, FinishHandler finishHandler, TimeoutHandler timeoutHandler, float timeout) { FileName = fileName; Url = url; Type = type; Timeout = timeout; FinishHandler = finishHandler; TimeoutHandler = timeoutHandler; Started = false; Finished = false; }
public LevelController( MonoBehaviour coroutineRunner, LevelControls levelControls, EventBus gameEventBus, StartHandler startHandler, PauseHandler pauseHandler, DeathHandler deathHandler, ResetHandler resetHandler, FinishHandler finishHandler) { _coroutineRunner = coroutineRunner; _levelControls = levelControls; _gameEventBus = gameEventBus; _startHandler = startHandler; _pauseHandler = pauseHandler; _deathHandler = deathHandler; _resetHandler = resetHandler; _finishHandler = finishHandler; }
public DownloadTask StartDownload( string fileName, string url, ContentType contentType, FinishHandler finishHandler, TimeoutHandler timeoutHandler = null, float timeout = 60) { if (string.IsNullOrEmpty(fileName) || string.IsNullOrEmpty(url)) { return(null); } if (_currentTask != null && _currentTask.FileName == fileName) { return(_currentTask); } lock (_taskQueue) { foreach (var t in _taskQueue) { if (t.FileName == fileName) { return(t); } } var task = new DownloadTask( fileName, url, contentType, finishHandler, timeoutHandler, timeout); _taskQueue.Enqueue(task); MyLog.InfoWithFrame(name, string.Format("Start download: {0}", fileName)); return(task); } }
/// <summary> /// デシリアライズ読込 /// </summary> /// <param name="saveInterface">デシリアライズするクラス</param> /// <param name="finishHandler">終了ハンドラ(null指定可)</param> /// <param name="async">非同期で実行するか</param> public void Load(ISerializer loadInterface, FinishHandler finishHandler, bool async = true) { DataInfo dataInfo = new DataInfo(); dataInfo.serializer = loadInterface; dataInfo.filePath = Application.persistentDataPath + loadInterface.fileName; dataInfo.finishHandler = finishHandler; dataInfo.async = async; if (loadInterface == null || string.IsNullOrEmpty(loadInterface.fileName) || !File.Exists(dataInfo.filePath)) { this.FinishAccessing(IO_RESULT.NONE, ref dataInfo); return; } if (async) { ThreadPool.QueueUserWorkItem(this.loadThreadHandler, dataInfo); } else { this.LoadThreadMain(dataInfo); } }
public void SetFinishHandler(FinishHandler handler) { this.m_finishHandler = handler; }
private void Start() { dead = false; fh = GameObject.Find("GameSetup").GetComponent <FinishHandler>(); }
public void Execute(FinishHandler onFinish) { StopAllCoroutines(); StartCoroutine(ExecuteAsync(onFinish)); }