Example #1
0
    /// <summary>Populate the narrative panel with the given data object.</summary>
    /// <param name="panelInfo">Data needed for a branch panel.</param>
    private void PopulateBranchPanel(BranchPanelInfo panelInfo)
    {
        // Get relevant properties
        var mergeProp = panelInfo.Properties.GetOrDefault(Property.Merge, "true");

        _ = bool.TryParse(mergeProp, out bool merge);
        var interruptProp = panelInfo.Properties.GetOrDefault(Property.Interrupt, "false");

        _ = bool.TryParse(interruptProp, out bool interrupt);
        var splitProp = panelInfo.Properties.GetOrDefault(Property.Split, "true");

        _ = bool.TryParse(splitProp, out bool canSplitParty);

        var conditionalBranches = new List <ConditionalBranch>();

        foreach (var branchData in panelInfo.Branches)
        {
            var branch = new Branch {
                PlaybackOrder = branchData.playbackOrder
            };
            branch.OnBranch.AddListener(players => StoryboardQueue.Enqueue(branchData.next, players, interrupt, merge));
            conditionalBranches.Add(new ConditionalBranch {
                Condition = branchData.condition,
                Data      = branch
            });
        }

        branchPanel.BranchControl.CanSplitParty       = canSplitParty;
        branchPanel.BranchControl.ConditionalBranches = conditionalBranches;
    }
Example #2
0
    /// <summary>Populate the decision panel with the given data object.</summary>
    /// <param name="panelInfo">Data needed for a decision panel.</param>
    private void PopulateDecisionPanel(DecisionPanelInfo panelInfo)
    {
        // Get relevant properties
        var mergeProp = panelInfo.Properties.GetOrDefault(Property.Merge, "true");

        _ = bool.TryParse(mergeProp, out bool merge);
        var interruptProp = panelInfo.Properties.GetOrDefault(Property.Interrupt, "false");

        _ = bool.TryParse(interruptProp, out bool interrupt);

        // Clear out existing options.
        decisionPanel.Control.Decisions.Clear();
        foreach (var decisionData in panelInfo.Decisions)
        {
            // Create a concrete panel decision from the given data.
            var branch = new Branch(
                decisionData.order,
                players => StoryboardQueue.Enqueue(decisionData.next, players, interrupt, merge)
                );
            var panelDecision = new DecisionControlData {
                OptionText = decisionData.text,
                Condition  = decisionData.condition,
                Data       = branch
            };
            // Add to the decision list.
            decisionPanel.Control.Decisions.Add(panelDecision);
        }
    }
Example #3
0
 public void EnqueueUri(List <int> owningPlayers) => StoryboardQueue.Enqueue(Uri, owningPlayers, Interrupt, Merge);
Example #4
0
 public void EnqueueUri() => StoryboardQueue.Enqueue(Uri, Interrupt, Merge);
Example #5
0
 public void EnqueueBoard(List <int> owningPlayers) => StoryboardQueue.Enqueue(StoryboardPrefab, owningPlayers, Interrupt, Merge);
Example #6
0
 public void EnqueueBoard() => StoryboardQueue.Enqueue(StoryboardPrefab, Interrupt, Merge);
Example #7
0
 /// <summary>
 /// Adds a new instantiation of the referenced storyboard to the queue.
 /// </summary>
 /// <param name="players">A list of all players (by number) that should own the new board.</param>
 /// <param name="storyboard">A GameObject with the Storyboard component.</param>
 public void Queue(List <int> players, Storyboard storyboard)
 {
     StoryboardQueue.Enqueue(storyboard, players);
 }