コード例 #1
0
        public Image GetCurrentFactionIcon(StoryChoice storyChoice)
        {
            GuardIcon.gameObject.SetActive(false);
            ThiefIcon.gameObject.SetActive(false);
            WitchIcon.gameObject.SetActive(false);

            var factionKey = storyChoice.definition.factionKey;

            if (factionKey == "FACTION_GUARDS")
            {
                return(GuardIcon);
            }
            else if (factionKey == "FACTION_THIEVES")
            {
                return(ThiefIcon);
            }
            else if (factionKey == "FACTION_WITCHES")
            {
                return(WitchIcon);
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
    public void ChoiceSelected(StoryChoice choice)
    {
        DeactivateActive();
        StoryPrompt targetPrompt = story.LookupPrompt(choice.TargetPrompt);

        activePrompt = targetPrompt;
        ActivateActive();
    }
コード例 #3
0
    private void DisplayStoryChoices()
    {
        StoryChoice newStoryChoice = _stateMachine.CurrentStoryEvent.StoryChoice;

        if (newStoryChoice != null)
        {
            _decisionController.Begin(newStoryChoice);
        }
    }
コード例 #4
0
    public void Display(StoryChoice storyDecision)
    {
        _textUI.text = storyDecision.DecisionPrompt;

        _textDelayModifier = storyDecision.TextSpeedModifier;
        // choices
        _calmButton.Display(storyDecision.CalmChoice.ButtonText);
        _survivalButton.Display(storyDecision.SurvivalChoice.ButtonText);
        _tenacityButton.Display(storyDecision.TenacityChoice.ButtonText);
    }
コード例 #5
0
 public void Begin(StoryChoice storyDecision)
 {
     // progression state
     _isRevealingText = false;
     // set up choice buttons
     _calmChoice.SetChoice(storyDecision.CalmChoice);
     _survivalChoice.SetChoice(storyDecision.SurvivalChoice);
     _tenacityChoice.SetChoice(storyDecision.TenacityChoice);
     // display it
     _decisionView.Display(storyDecision);
     _decisionView.Reveal();
 }
コード例 #6
0
ファイル: StoryTeller.cs プロジェクト: Wuzseen/DIGM530-AWT
	public void ChoiceSelected(StoryChoice choice)
	{
		DeactivateActive();
		StoryPrompt targetPrompt = story.LookupPrompt(choice.TargetPrompt);
		activePrompt = targetPrompt;
		ActivateActive();
	}
コード例 #7
0
        public void SetToStoryChoice(ConversationUI conversationUI, StoryChoice storyChoice)
        {
            m_ConversationUI     = conversationUI;
            m_CurrentStoryChoice = storyChoice;

            var factionIcon = GetCurrentFactionIcon(storyChoice);

            if ((storyChoice.conditions.CheckConditions() == false && storyChoice.conditions.Length > 0))
            {
                choiceText.text = "Should not be visible, son";
                state           = State.Hidden;

                gameObject.SetActive(false);
            }
            else if (storyChoice.enabledConditions.CheckConditions() == false && storyChoice.enabledConditions.Length > 0)
            {
                var rawMainText = storyChoice.definition.choiceText;
                rawMainText = rawMainText.Replace("%FACTIONMEMBER", storyChoice.parentStoryNode.parentLocation.owningFaction.definition.memberName);

                rawMainText = rawMainText.Replace("%FACTION", storyChoice.parentStoryNode.parentLocation.owningFaction.definition.name);

                rawMainText = rawMainText.Replace("%RIVALFACTIONMEMBER", Game.instance.definitions.factionDefinitions[storyChoice.parentStoryNode.parentLocation.owningFaction.definition.rivalFaction].memberName);
                rawMainText = rawMainText.Replace("%RIVALFACTION", Game.instance.definitions.factionDefinitions[storyChoice.parentStoryNode.parentLocation.owningFaction.definition.rivalFaction].name);


                rawMainText = rawMainText.Replace("%LOCATION", storyChoice.parentStoryNode.parentLocation.definition.name);
                rawMainText = rawMainText.Replace("%GOLD", Game.instance.world.gold.ToString());
                rawMainText = rawMainText.Replace("%PAWNS", Game.instance.world.pawns.ToString());
                rawMainText = rawMainText.Replace("%REPUTATION", storyChoice.parentStoryNode.parentLocation.owningFaction.reputation.ToString());

                choiceText.text = rawMainText;
                state           = State.Disabled;

                choiceText.fontStyle = FontStyles.Strikethrough;
                choiceText.color     = disabledTextColor;

                m_Button.onClick.AddListener(OnPressedDisabled);

                gameObject.SetActive(true);

                if (factionIcon != null)
                {
                    factionIcon.color = Color.black;
                    factionIcon.gameObject.SetActive(true);
                }
            }
            else
            {
                var rawMainText = storyChoice.definition.choiceText;

                rawMainText = rawMainText.Replace("%FACTIONMEMBER", storyChoice.parentStoryNode.parentLocation.owningFaction.definition.memberName);

                rawMainText = rawMainText.Replace("%FACTION", storyChoice.parentStoryNode.parentLocation.owningFaction.definition.name);

                rawMainText = rawMainText.Replace("%RIVALFACTIONMEMBER", Game.instance.definitions.factionDefinitions[storyChoice.parentStoryNode.parentLocation.owningFaction.definition.rivalFaction].memberName);
                rawMainText = rawMainText.Replace("%RIVALFACTION", Game.instance.definitions.factionDefinitions[storyChoice.parentStoryNode.parentLocation.owningFaction.definition.rivalFaction].name);


                rawMainText = rawMainText.Replace("%LOCATION", storyChoice.parentStoryNode.parentLocation.definition.name);
                rawMainText = rawMainText.Replace("%GOLD", Game.instance.world.gold.ToString());
                rawMainText = rawMainText.Replace("%PAWNS", Game.instance.world.pawns.ToString());
                rawMainText = rawMainText.Replace("%REPUTATION", storyChoice.parentStoryNode.parentLocation.owningFaction.reputation.ToString());

                choiceText.text  = rawMainText;
                state            = State.Visible;
                choiceText.color = regularTextColor;

                m_Button.onClick.AddListener(OnPressedValid);

                gameObject.SetActive(true);

                if (factionIcon != null)
                {
                    factionIcon.gameObject.SetActive(true);
                }
            }
        }
コード例 #8
0
ファイル: PrompterChoice.cs プロジェクト: Wuzseen/DIGM530-AWT
 public void AssignStoryChoice(StoryChoice targetChoice)
 {
     this.choice    = targetChoice;
     this.text.text = targetChoice.Text;
 }
コード例 #9
0
ファイル: StoryPlayer.cs プロジェクト: sfalexrog/VNInky
    /**
     * Create a scene transition, based on the current state
     */
    private SceneTransitionRequest CreateSceneTransition(SceneTransitionRequest prevRequest = null)
    {
        var transitionBuilder = new SceneTransitionRequest.Builder();

        if (prevRequest != null)
        {
            // Copy fileds from the previous transition
            // FIXME: right now we actually only care about background changes...
            transitionBuilder.SetBackground(prevRequest.TransitionBackground);
        }
        var storyText = _story.currentText;
        var storyTags = _story.currentTags;
        // Parse tags first, they will come in handy later
        var actorEmotion   = "default";
        var canUseDefender = false;
        var defenderCost   = 0;

        foreach (var tag in storyTags)
        {
            var tagComponents = tag.Split(':');
            if (tagComponents.Length > 1)
            {
                if (tagComponents[0].Equals("defenderAvailable"))
                {
                    canUseDefender = tagComponents[1].Trim().Equals("true");
                }
                else if (tagComponents[0].Equals("defenderCost"))
                {
                    defenderCost = int.Parse(tagComponents[1]);
                }
            }
            else
            {
                // Keyless tags are interpreted as emotions
                actorEmotion = tag;
            }
        }


        // Parse story text, possibly handling edge cases like location changes
        var splitText = storyText.Split(':');

        if (splitText.Length > 1)
        {
            if (splitText[0].Equals("Location"))
            {
                // Location change. We should probably read the next line and re-run our function.
                transitionBuilder.SetBackground(splitText[1].Trim());
                _story.Continue();
                return(CreateSceneTransition(transitionBuilder.Build()));
            }
            else
            {
                if (splitText[0].Equals(_playerActorName))
                {
                    var speaker = GetGender() == 0 ? _playerBoyName : _playerGirlName;
                    transitionBuilder.SetSpeaker(speaker, actorEmotion);
                    transitionBuilder.SetPhrase(RebuildString(splitText, 1).Trim());
                }
                else if (_registeredActors.Contains(splitText[0]))
                {
                    var speaker = splitText[0];
                    transitionBuilder.SetSpeaker(speaker, actorEmotion);
                    transitionBuilder.SetPhrase(RebuildString(splitText, 1).Trim());
                }
                else
                {
                    // No one is actually speaking, the colon is just part of the text
                    transitionBuilder.SetPhrase(storyText.Trim());
                }
            }
        }
        else
        {
            // Set text only
            transitionBuilder.SetPhrase(storyText.Trim());
        }

        // Parse choices (if there are any)
        foreach (var choice in _story.currentChoices)
        {
            var splitChoice = choice.text.Split('@');
            var choiceType  = "neutral";
            if (splitChoice.Length > 1)
            {
                choiceType = splitChoice[1];
            }
            var storyChoice = new StoryChoice(choice.index, splitChoice[0], choiceType);
            transitionBuilder.AddChoice(storyChoice);
        }

        return(transitionBuilder.Build());
    }
コード例 #10
0
ファイル: PrompterChoice.cs プロジェクト: Wuzseen/DIGM530-AWT
	public void AssignStoryChoice(StoryChoice targetChoice)
	{
		this.choice = targetChoice;
		this.text.text = targetChoice.Text;
	}