private IEnumerator DoBranch(IEnumerable <BranchInformation> branchInfos, Action onFinish) { foreach (var branchInfo in branchInfos) { if (branchInfo.mode == BranchMode.Jump) { if (branchInfo.condition == null || branchInfo.condition.Invoke <bool>()) { SelectBranch(branchInfo.name, onFinish); yield break; } } } var selections = new List <SelectionOccursData.Selection>(); var selectionNames = new List <string>(); foreach (var branchInfo in branchInfos) { if (branchInfo.mode == BranchMode.Jump) { continue; } if (branchInfo.mode == BranchMode.Show && !branchInfo.condition.Invoke <bool>()) { continue; } var selection = new SelectionOccursData.Selection(branchInfo.texts, branchInfo.imageInfo, active: branchInfo.mode != BranchMode.Enable || branchInfo.condition.Invoke <bool>()); selections.Add(selection); selectionNames.Add(branchInfo.name); } AcquireActionPause(); RaiseSelections(selections); while (coroutineHelper.fence == null) { yield return(null); } ReleaseActionPause(); var index = (int)coroutineHelper.TakeFence(); SelectBranch(selectionNames[index], onFinish); }
public void Add(SelectionOccursData.Selection selection) { _selections.Add(selection); }