コード例 #1
0
 private void OnFocus()
 {
     if (PopulateExistingConversations())
     {
         CurrentDialogue = DialogueList[index : _viewIndex - 1];
     }
 }
コード例 #2
0
 /// <summary>
 ///     create the resource from the dialogue configuration.
 /// </summary>
 ///
 private void Start()
 {
     _dialogueConfig = Instantiate(_dialogueConfig);
     _dialogueCamera.gameObject.SetActive(false);
     _convoBubble.SetActive(false);
     _uiActive = false;
 }
コード例 #3
0
        /// <summary>
        /// update the hud
        /// </summary>
        /// <param name="d"></param>
        private void UpdateDialogueElements(DialogueRootObject d)
        {
            var talker = d.Conversation.Current.ParticipantName;
            var emote  = d.Conversation.Current.EmoteType;
            var side   = d.Conversation.Current.Side;

            // Please note that Enpi Seeki and all of the Nantooki Tribe NPCs will all use the same icon.
            talker = talker.Contains("Enpi") ? "Nantooki" : talker;
            talker = talker.Contains(".") ? talker.Replace(".", string.Empty) : talker; // T.I.M.B.U.R.
            talker = talker.Replace(" ", string.Empty);


            if (side == "Left")
            {
                SetSide(leftImage, leftText, talker, emote, side);
            }
            else if (side == "Right")
            {
                SetSide(rightImage, rightText, talker, emote, side);
            }

            centerTextTop.text = d.Conversation.Current.Line;

            teleType.StartTeleType();
        }
コード例 #4
0
        public bool AddDialogue(string nodeName, DialogueRootObject dialogueRootObject)
        {
            DialogueRootObject dro;
            var contains = _dialogueDictionary.TryGetValue(nodeName, out dro);

            if (!contains)
            {
                _dialogueDictionary.Add(nodeName, dialogueRootObject);
            }
            return(contains);
        }
コード例 #5
0
        private void CreateDialogue(string conversationId)
        {
            if (conversationId == string.Empty)
            {
                conversationId = "CON001-NAME";
            }
            DialogueList = new List <DialogueRootObject>();
            var dro = CreateDialogueRoot.Create(dname: conversationId + "-" + DialogueList.Count);

            CurrentDialogue = dro;
            DialogueList.Add(CurrentDialogue);
            Selection.activeObject = CurrentDialogue;
        }
コード例 #6
0
        private void ClearDialogue()
        {
            var allfiles = new List <string>();
            var absPath  = Application.dataPath + "/Dialogue/ScriptableObjects/";

            // datapath includes the "Assets" string so take it off to get the relative path...
            var relPath = absPath.Substring(startIndex: Application.dataPath.Length - "Assets".Length);

            allfiles.AddRange(collection: Directory.GetFiles(relPath, "*.asset"));

            foreach (var s in allfiles)
            {
                AssetDatabase.DeleteAsset(s);
            }

            DialogueList.Clear();
            CurrentDialogue = null;
        }
コード例 #7
0
        private void OnGUI()
        {
            DialogueGuiStyle.alignment        = TextAnchor.UpperCenter;
            DialogueGuiStyle.fontStyle        = FontStyle.BoldAndItalic;
            DialogueGuiStyle.fontSize         = 25;
            DialogueGuiStyle.normal.textColor = Color.white;

            GUILayout.Label("Dialogue Editor", DialogueGuiStyle);
            GUILayout.Space(25);
            if (GUILayout.Button("Jamies Help Guide Button"))
            {
                Application.OpenURL(url: "file:///" + Application.dataPath + "/Dialogue/DialogueUserGuide.pdf");
            }
            GUILayout.BeginHorizontal();
            {
                GUILayout.Space(10);

                if (GUILayout.Button("Create Dialogue", GUILayout.ExpandWidth(false)))
                {
                    CreateDialogue(_dialogueName);
                }

                GUILayout.Space(10);
                if (GUILayout.Button("Load From File", GUILayout.ExpandWidth(false)))
                {
                    LoadFromFile();
                }

                GUILayout.Space(25);

                GUILayout.EndHorizontal();
            }

            GUILayout.Space(25);


            if (DialogueList == null || CurrentDialogue == null)
            {
                return;
            }

            CurrentDialogue = DialogueList[index : _viewIndex - 1];
            EditorGUILayout.LabelField("Current Conversation", CurrentDialogue.name);
            EditorGUILayout.LabelField("Lines: ", label2: CurrentDialogue.Conversation.Count.ToString());
            GUILayout.BeginHorizontal();
            if (DialogueList.Count > 0)
            {
                if (GUILayout.Button("Prev", GUILayout.ExpandWidth(false)))
                {
                    if (_viewIndex > 1)
                    {
                        _viewIndex--;
                    }
                }
            }

            GUILayout.Space(10);
            if (GUILayout.Button("Next", GUILayout.ExpandWidth(false)))
            {
                if (_viewIndex < DialogueList.Count)
                {
                    _viewIndex++;
                }
            }

            GUILayout.EndHorizontal();


            GUILayout.Space(25);
            if (DialogueList != null && DialogueList.Count > 0 && CurrentDialogue != null)
            {
                DisplayConversation();
            }
        }
コード例 #8
0
 public void Release()
 {
     CurrentDialogue     = null;
     CurrentDialogueName = "none";
     DialogueReleasedEvent.Raise();
 }
コード例 #9
0
 public void Set(DialogueRootObject dro)
 {
     CurrentDialogue     = dro;
     CurrentDialogueName = CurrentDialogue.name;
     DialogueSetEvent.Raise();
 }
コード例 #10
0
 private void OnEnable()
 {
     CurrentDialogue     = null;
     CurrentDialogueName = "";
 }