Esempio n. 1
0
        protected virtual void OnCurrentDialogueNodeChanged(NodeBase before, NodeBase after)
        {
            if (currentNodeUI != null)
            {
                Destroy(currentNodeUI.gameObject);
            }

            if (after.uiPrefab == null)
            {
                DevdogLogger.LogWarning("No prefab found for node. Make sure to assign your UI prefabs to the manager", this);
                return;
            }

            if (after.ownerType != DialogueOwnerType.DialogueOwner)
            {
                SetDialogueSpeakerIcon(hideDialogueOwnerIconOnPlayerNode ? null : QuestManager.instance.settingsDatabase.playerDialogueIcon);
                if (dialogueOwnerName != null)
                {
                    dialogueOwnerName.text = (hideDialogueOwnerNameOnPlayerNode ? string.Empty : QuestManager.instance.settingsDatabase.playerName);
                }
            }
            else
            {
                var owner = DialogueManager.instance.currentDialogueOwner;
                if (owner != null)
                {
                    SetDialogueSpeakerIcon(owner.ownerIcon);
                    if (dialogueOwnerName != null)
                    {
                        dialogueOwnerName.text = owner.ownerName;
                    }
                }
            }

            currentNodeUI = UnityEngine.Object.Instantiate <NodeUIBase>(after.uiPrefab);
            currentNodeUI.transform.SetParent(nodeUIContainer);
            UIUtility.ResetTransform(currentNodeUI.transform);
            UIUtility.InheritParentSize(currentNodeUI.transform);

            currentNodeUI.Repaint(after);
        }
Esempio n. 2
0
        protected virtual void OnCurrentDialogueNodeChanged(NodeBase before, NodeBase after)
        {
            if (currentNodeUI != null)
            {
                Destroy(currentNodeUI.gameObject);
            }

            if (after.uiPrefab == null)
            {
                return;
            }

            if (after.ownerType != DialogueOwnerType.DialogueOwner)
            {
                SetDialogueSpeakerIcon(hideDialogueOwnerIconOnPlayerNode ? null : QuestManager.instance.settingsDatabase.playerDialogueIcon);
            }
            else
            {
                var owner = DialogueManager.instance.currentDialogueOwner;
                if (owner != null)
                {
                    SetDialogueSpeakerIcon(owner.ownerIcon);
                    if (dialogueOwnerName != null)
                    {
                        dialogueOwnerName.text = owner.ownerName;
                    }
                }
            }

            currentNodeUI = UnityEngine.Object.Instantiate <NodeUIBase>(after.uiPrefab);
            currentNodeUI.transform.SetParent(nodeUIContainer);
            UIUtility.ResetTransform(currentNodeUI.transform);
            UIUtility.InheritParentSize(currentNodeUI.transform);

            currentNodeUI.Repaint(after);
        }