Ejemplo n.º 1
0
        // Finds the stat of the given name and compares it to is_
        // If the stat is not found, false is given as the stat value
        // Equals checks if the strings are the same, or if they are different
        public static bool Compare_String_Stat_To(string stat_name, string is_, bool equals)
        {
            // Check if the stat exists
            if (!StatsManager.String_Stat_Exists(stat_name))
            {
                Debug.Log("Comparing string stat. " + stat_name + " does not exist");
            }

            return(equals == (StatsManager.Get_String_Stat(stat_name).Equals(is_)));
        }
Ejemplo n.º 2
0
        void Update()
        {
            // Don't do anything if no Stat name is defined
            if (string.IsNullOrEmpty(name_of_stat_to_retrieve))
            {
                return;
            }


            string stat = "";

            // Retrieve the correct stat
            switch (type_of_stat_to_retrieve)
            {
            case Type_of_Stat.Numbered_Stat:
                // Check if we should display nothing if the stat does not exist
                if (display_nothing_if_stat_not_present && !StatsManager.Numbered_Stat_Exists(name_of_stat_to_retrieve))
                {
                    text_element.text = "";
                    return;
                }

                stat = "" + StatsManager.Get_Numbered_Stat(name_of_stat_to_retrieve);
                break;

            case Type_of_Stat.String_Stat:
                if (display_nothing_if_stat_not_present && !StatsManager.String_Stat_Exists(name_of_stat_to_retrieve))
                {
                    text_element.text = "";
                    return;
                }

                stat = StatsManager.Get_String_Stat(name_of_stat_to_retrieve);
                break;

            case Type_of_Stat.Boolean_Stat:
                if (display_nothing_if_stat_not_present && !StatsManager.Boolean_Stat_Exists(name_of_stat_to_retrieve))
                {
                    text_element.text = "";
                    return;
                }

                stat = "" + StatsManager.Get_Boolean_Stat(name_of_stat_to_retrieve);
                break;
            }

            // Construct the actual string
            text_element.text = message_before_stat + stat + message_after_stat;
        }
Ejemplo n.º 3
0
        public override void Run_Node()
        {
            sceneName      = String.Empty;
            activityNumber = StatsManager.Get_Numbered_Stat("intActivity");
            activityName   = StatsManager.Get_String_Stat("strActivity");
            //EX: conversation_to_start = GameObject.Find("ArtActivityManager").GetComponent<ConversationManager>();

            switch (activityName)
            {
            case "study":
                sceneName += "s_";
                break;

            case "workout":
                sceneName      += "w_";
                activityNumber += 600;
                break;

            case "art":
                sceneName      += "a_";
                activityNumber += 1200;
                break;

            case "talk":
                sceneName      += "t_";
                activityNumber += 1800;
                break;

            case "play":
                sceneName      += "p_";
                activityNumber += 2400;
                break;
            }

            IsNewScene();
            seenScenes.Add(activityNumber);

            //sceneName += activityNumber;
            sceneName += 1;

            conversation_to_start = GameObject.Find(sceneName).GetComponent <ConversationManager>();

            StartCoroutine(Check_If_Actors_Have_Exited());

            Finish_Node();
        }
Ejemplo n.º 4
0
        public string Insert_Stats_into_Text(string in_text)
        {
            // Find any [ ] characters
            string[] splits = in_text.Split('[', ']');

            // Now check each split if it's legitimate
            foreach (string original_s in splits)
            {
                bool   is_variable = false;
                string new_s       = "";
                string modified_s;
                if (original_s.StartsWith("b:"))
                {
                    is_variable = true;
                    modified_s  = original_s.Replace("b:", "");
                    new_s       = StatsManager.Get_Boolean_Stat(modified_s).ToString();
                }
                else if (original_s.StartsWith("f:"))
                {
                    is_variable = true;
                    modified_s  = original_s.Replace("f:", "");
                    new_s       = StatsManager.Get_Numbered_Stat(modified_s) + "";
                }
                else if (original_s.StartsWith("s:"))
                {
                    is_variable = true;
                    modified_s  = original_s.Replace("s:", "");
                    new_s       = StatsManager.Get_String_Stat(modified_s);
                }

                if (is_variable)
                {
                    in_text = in_text.Replace("[" + original_s + "]", new_s);
                }
            }

            return(in_text);
        }
Ejemplo n.º 5
0
        // force_change means the language was changed, immediately stop animating the text and just set the text to done
        public void GetLocalizedText(bool force_change)
        {
            // Localize and/or insert stats into the title of the text box if needed
            if (!string.IsNullOrEmpty(textbox_title))
            {
                string speaker_title = "";

                if (speaker_name_from == Dialogue_Source.Text_From_Editor)
                {
                    speaker_title = textbox_title;
                }
                else if (speaker_name_from == Dialogue_Source.Localized_Text_From_CSV)
                {
                    // Get the key associated with the speaker's name
                    speaker_title = UIManager.ui_manager.Get_Localized_UI_Entry(textbox_title);
                }
                else if (speaker_name_from == Dialogue_Source.Text_From_String_Stat)
                {
                    // Is there a string stat of this name?
                    string stat_val = StatsManager.Get_String_Stat(textbox_title);

                    // Check if it's valid
                    if (string.IsNullOrEmpty(stat_val))
                    {
                        Debug.LogError("String stat " + textbox_title + " does not exist, please set the Stat before using it in a DialogueNode", this.gameObject);
                        UIManager.ui_manager.speaker_panel.text = textbox_title;
                    }
                    else
                    {
                        if (fetch_localized_stat_value)
                        {
                            stat_val = UIManager.ui_manager.Get_Localized_UI_Entry(textbox_title);
                        }
                        speaker_title = stat_val;
                    }
                }

                UIManager.ui_manager.speaker_panel.text = speaker_title;
            }



            // If using text from a CSV, grab it now
            if (dialogue_from == Dialogue_Source.Localized_Text_From_CSV)
            {
                if (string.IsNullOrEmpty(localized_key))
                {
                    Debug.LogError("Localized key is null. Please enter a key", this.gameObject);
                    return;
                }

                text = VNSceneManager.scene_manager.Get_Localized_Dialogue_Entry(this.localized_key);
                if (string.IsNullOrEmpty(text))
                {
                    Debug.LogError("Retrieved localized dialogue is null or empty. Please ensure you have entered a row with the key matching: " + this.localized_key, this.gameObject);
                }

                // If done printing, just change the text
                if (!force_change && done_printing)
                {
                    UIManager.ui_manager.text_panel.text = text;
                }

                if (force_change && !done_printing)
                {
                    Button_Pressed();
                }

                // Go through text, checking to see if we need to insert Stats values
                text = Insert_Stats_into_Text(text);

                UIManager.ui_manager.text_panel.text = text;
            }
            else
            {
                // Go through text, checking to see if we need to insert Stats values
                text = Insert_Stats_into_Text(text);
            }
        }