コード例 #1
0
    private void HandlePopulateById()
    {
        if (!String.IsNullOrEmpty(Id))
        {
            string unformatted = Script_UIText.Text[Id].EN;
            string formatted   = Script_Utils.FormatString(unformatted);

            GetComponent <TextMeshProUGUI>().text = formatted;
        }
    }
    /// <summary>
    /// Handles copying thoughts into slots
    /// </summary>
    public void UpdatePlayerThoughts(
        Model_Thought thought,
        Model_PlayerThoughts thoughts,
        Script_PlayerThoughtsInventoryButton[] thoughtSlots
        )
    {
        foreach (Script_PlayerThoughtsInventoryButton ts in thoughtSlots)
        {
            ts.text.text = string.Empty;
        }

        // works ONLY if thoughts is exactly equal to maxHP
        for (int i = 0; i < thoughts.uglyThoughts.Count; i++)
        {
            string newThoughtText = thoughts.uglyThoughts[i].thought;
            thoughtSlots[i].text.text = Script_Utils.FormatString(newThoughtText);
        }
    }
コード例 #3
0
    public void ShowThought(Model_Thought thought)
    {
        // stop any coroutine here
        if (isShowingThought)
        {
            StopCoroutine(coroutine);
            thoughtText.text = "";
        }

        isShowingThought = true;

        thoughtText.text = Script_Utils.FormatString(thought.thought);

        canvasGroup.gameObject.SetActive(true);
        canvasGroup.alpha          = 1f;
        canvasGroup.blocksRaycasts = true;

        audioSource.PlayOneShot(thoughtStartSoundFX, 1.0f);
    }
コード例 #4
0
    public void StartChoiceMode(Script_DialogueNode node)
    {
        if (node.data.locationType == "top")
        {
            activeCanvas  = choiceCanvasTop;
            activeChoices = choicesTop;
        }
        else
        {
            activeCanvas  = choiceCanvasBottom;
            activeChoices = choicesBottom;
        }

        // to get rid of flash at beginning and hide choice buttons
        foreach (Script_DialogueChoice choice in activeChoices)
        {
            choice.cursor.enabled = false;
            choice.gameObject.SetActive(false);
        }

        for (int i = 0; i < node.data.children.Length; i++)
        {
            activeChoices[i].Id = i;
            TextMeshProUGUI text = Script_Utils.FindComponentInChildWithTag <TextMeshProUGUI>(
                activeChoices[i].gameObject,
                Const_Tags.DialogueChoice
                );
            string unformattedText = node.data.children[i].data.choiceText;
            text.text = Script_Utils.FormatString(unformattedText);

            // show choice buttons with data
            activeChoices[i].gameObject.SetActive(true);
        }

        activeCanvas.gameObject.SetActive(true);
    }
コード例 #5
0
 /// <summary>
 /// Used to set a simple text hint with the text canvas
 /// </summary>
 public void ShowTextHint(string s)
 {
     hintCanvasText.text = Script_Utils.FormatString(s);
     hintCanvasGroup.gameObject.SetActive(true);
 }