/// <summary> /// ノベルコマンドDo処理コルーチン /// </summary> private IEnumerator RunCoroutine(NovelCommand.SharedData data, NovelCommand.SharedVariable variable) { yield return(executer.SetupCoroutine(data)); yield return(executer.RunCoroutine(variable, data.data.commands.Count)); yield break; }
private IEnumerator RunCoroutine(NovelCommand.CommonData commonData, NovelCommand.CommonVariable commonVariable) { yield return(executer.SetupCoroutine(commonData)); yield return(executer.RunCoroutine(commonVariable)); yield break; }
public IEnumerator Do(SharedData share, SharedVariable variable) { // メタデータの取得(ない場合は処理できない) NovelMetaData.GroupData data; if (!share.meta.groupDic.TryGetValue(share.command.parameters[0], out data)) { yield break; } // 呼び出し履歴確認 var currentGroup = variable.groupHistory.TryDequeue(); var nextGroup = variable.groupHistory.TryPeek(); // 呼び出し履歴に残っている = 既にPushされている if (currentGroup == null) { // 呼び出し履歴登録 share.system.history.PushGroup(true, variable.index); } // 開始位置の決定 var startIndex = data.startIndex; if (currentGroup != null) { if (nextGroup != null) { startIndex += nextGroup.historyID - currentGroup.historyID; } else { // 自分自身(GroupRun)が実行されるとともに履歴に追加されているので、その分を引く var historyID = share.system.history.GetCurrentHistoryID(); startIndex += historyID - currentGroup.historyID; } } // 実行準備 this.executer = new NovelExecuter(share.data, share.system.commandTypeDic); this.variable = new SharedVariable() { // グループ引数はグループ内でしか用いらない変数なので、複製する必要がある groupValues = new Dictionary <string, string>(variable.groupValues), groupHistory = variable.groupHistory, values = variable.values, handles = variable.handles, index = startIndex, }; // グループ引数の登録 var parameterCount = share.command.parameters[1].ParseInt(); for (int i = 0; i < parameterCount; ++i) { var name = share.command.parameters[i * 2 + 2]; var value = share.command.parameters[i * 2 + 3]; this.variable.values[name] = value; } // グループの実行 yield return(executer.SetupCoroutine(share)); yield return(executer.RunCoroutine(this.variable, data.endIndex)); // 呼び出し履歴登録 share.system.history.PushGroup(false, variable.index); yield break; }