/// <summary>スクリプトの実行を要求します。</summary> /// <param name="scriptName">実行してほしいスクリプトの名前</param> /// <param name="requestPriority">実行の優先度</param> public void Request(string scriptName, ScriptPriority requestPriority) { if(requestPriority > _currentPriority) { RequestedScriptName = scriptName; RequestedScriptPriority = requestPriority; IsScriptRequested = true; ScriptReader.CancelRead(); ScriptRequested?.Invoke(this, EventArgs.Empty); } }
/// <summary>スクリプトの実行を要求します。</summary> /// <param name="scriptName">実行してほしいスクリプトの名前</param> /// <param name="requestPriority">実行の優先度</param> public void Request(string scriptName, ScriptPriority requestPriority) { if (requestPriority > _currentPriority) { RequestedScriptName = scriptName; RequestedScriptPriority = requestPriority; IsScriptRequested = true; ScriptReader.CancelRead(); ScriptRequested?.Invoke(this, EventArgs.Empty); } }
/// <summary>ブロッキングしてスクリプトを実行します。</summary> /// <param name="scriptName">実行するスクリプト名</param> /// <param name="priority">スクリプトの優先度</param> public void Read(string scriptName, ScriptPriority priority) { try { _currentPriority = priority; ScriptReader.ReadAsync(GetScriptPath(scriptName)).Wait(); } catch (AggregateException ex) { if (ex.InnerExceptions.Count == 1 && ex.InnerExceptions[0] is OperationCanceledException) { } } finally { //待ち状態にしとかないとリクエストが通らない事に注意 _currentPriority = ScriptPriority.Idle; } }
public ScriptResource ScriptPriority(ScriptPriority scriptPriority) { _scriptPriority = scriptPriority; //+ return this; }
private ScriptResource() { _scriptPriority = Nalarium.Client.ScriptPriority.Normal; }
/// <summary>リクエスト内容でインスタンスを初期化します。</summary> /// <param name="scriptName">実行したいスクリプト名</param> /// <param name="priority">実行の優先度</param> public ScriptRequestorEventArgs(string scriptName, ScriptPriority priority=ScriptPriority.Normal) { ScriptName = scriptName; Priority = priority; }
/// <summary>スクリプトの実行を要求します。</summary> /// <param name="scriptName">実行したいスクリプト名</param> /// <param name="priority">実行の優先度</param> public void Request(string scriptName, ScriptPriority priority = ScriptPriority.Normal) { ScriptRequested?.Invoke(this, new ScriptRequestorEventArgs(scriptName, priority)); }
/// <summary>リクエスト内容でインスタンスを初期化します。</summary> /// <param name="scriptName">実行したいスクリプト名</param> /// <param name="priority">実行の優先度</param> public ScriptRequestorEventArgs(string scriptName, ScriptPriority priority = ScriptPriority.Normal) { ScriptName = scriptName; Priority = priority; }
public void Request(string scriptName, ScriptPriority priority) => _scriptStateManager.Request(scriptName, priority);