Ejemplo n.º 1
0
        // PROTECTED METHODS: ---------------------------------------------------------------------

        protected DatabaseDialogue.ConfigData GetConfigData()
        {
            DatabaseDialogue.ConfigData defaultConfig = DatabaseDialogue.Load().defaultConfig;
            DatabaseDialogue.ConfigData result        = new DatabaseDialogue.ConfigData(defaultConfig);

            if (this.dialogue.overrideConfig)
            {
                if (this.dialogue.config.dialogueSkin != null)
                {
                    result.dialogueSkin = this.dialogue.config.dialogueSkin;
                }

                result.skipKey = this.dialogue.config.skipKey;
                result.revisitChoiceOpacity = this.dialogue.config.revisitChoiceOpacity;

                result.enableTypewriterEffect = this.dialogue.config.enableTypewriterEffect;
                result.charactersPerSecond    = this.dialogue.config.charactersPerSecond;
            }

            if (this.overrideDefaultConfig)
            {
                if (this.config.dialogueSkin != null)
                {
                    result.dialogueSkin = this.config.dialogueSkin;
                }

                result.skipKey = this.config.skipKey;
                result.revisitChoiceOpacity = this.config.revisitChoiceOpacity;

                result.enableTypewriterEffect = this.config.enableTypewriterEffect;
                result.charactersPerSecond    = this.config.charactersPerSecond;
            }

            return(result);
        }
Ejemplo n.º 2
0
        protected bool SetupChoices(DialogueItemChoiceGroup item, DatabaseDialogue.ConfigData config)
        {
            this.CleanChoices();
            int choicesSetup = 0;

            for (int i = 0; i < item.children.Count; ++i)
            {
                DialogueItemChoice choice = item.children[i] as DialogueItemChoice;
                if (!choice || (choice.showOnce && choice.IsRevisit()))
                {
                    continue;
                }

                bool conditions = choice.CheckConditions();
                if (!conditions && choice.onFailChoice == DialogueItemChoice.FailChoiceCondition.HideChoice)
                {
                    continue;
                }

                GameObject choiceInstance = Instantiate <GameObject>(this.prefabChoice);
                choiceInstance.GetComponent <RectTransform>().SetParent(this.choiceContainer, false);

                DialogueChoiceUI choiceUI = choiceInstance.GetComponent <DialogueChoiceUI>();
                bool             disabled = (
                    !conditions &&
                    choice.onFailChoice == DialogueItemChoice.FailChoiceCondition.DisableChoice
                    );

                if (choiceUI != null)
                {
                    choiceUI.Setup(config, item, i, disabled);
                }
                choicesSetup++;
            }

            if (item.shuffleChoices)
            {
                this.ShuffleChoices();
            }

            if (this.choiceContainer.childCount > 0)
            {
                EventSystem.current.SetSelectedGameObject(null);

                if (DatabaseDialogue.Load().autoFocusFirstChoice)
                {
                    Transform selection = this.choiceContainer.GetChild(0);
                    EventSystem.current.SetSelectedGameObject(selection.gameObject);
                }
            }

            return(choicesSetup != 0);
        }
Ejemplo n.º 3
0
        // PROTECTED METHODS: ---------------------------------------------------------------------

        protected DatabaseDialogue.ConfigData GetConfigData()
        {
            DatabaseDialogue.ConfigData defaultConfig = DatabaseDialogue.Load().defaultConfig;
            DatabaseDialogue.ConfigData result        = defaultConfig;
            if (this.overrideDefaultConfig)
            {
                if (this.config.dialogueSkin != null)
                {
                    result.dialogueSkin = this.config.dialogueSkin;
                }
                result.enableTypewritterEffect = this.config.enableTypewritterEffect;
                result.charactersPerSecond     = this.config.charactersPerSecond;
            }

            return(result);
        }