Example #1
0
        private void ShowSolutionDialogue(params string[] text)
        {
            var form = new DialogueCreator(OnSubmitDialogue);

            form.AddControl("tbSolution", "Возможное решение", typeof(TextBox), text[0]);
            form.AddControl("tbParam", "Параметр воздействия", typeof(TextBox), text[1]);
            form.AddControl("tbSolSensID", "Идентификатор датчика", typeof(TextBox), text[2]);
            form.AddControl("tbSolNumber", "Номер по регламенту", typeof(TextBox), text[3]);
            form.ShowDialog();
        }
Example #2
0
        private void ShowReasonDialogue(params string[] text)
        {
            var form = new DialogueCreator(OnSubmitDialogue);

            form.AddControl("tbReason", "Описание причины", typeof(TextBox), text[0]);
            form.AddControl("tbSensor", "Идентификатор датчика", typeof(TextBox), text[1]);
            form.AddControl("tbReasRule", "Условие", typeof(TextBox), text[2]);
            form.AddControl("tbReasValue", "Значение", typeof(TextBox), text[3]);
            form.AddControl("tbProb", "Веротность возникновения", typeof(TextBox), text[4]);
            form.AddControl("tbReasNumber", "Номер по регламенту", typeof(TextBox), text[5]);
            form.ShowDialog();
        }
Example #3
0
        private void ShowRulesDialogue(params string[] text)
        {
            var form = new DialogueCreator(OnSubmitDialogue);

            form.AddControl("tbSensId", "Идентификатор датчика", typeof(TextBox), text[0]);
            form.AddControl("tbCondition", "Условие", typeof(TextBox), text[1]);
            form.AddControl("tbValue", "Значение", typeof(TextBox), text[2]);
            form.AddControl("tbBoundValue", "Граница", typeof(TextBox), text[3]);
            form.AddControl("tbProblem", "Описание проблемы", typeof(TextBox), text[4]);
            form.AddControl("tbNumber", "Номер по регламенту", typeof(TextBox), text[5]);
            form.ShowDialog();
        }
Example #4
0
 static void ShowEditor()
 {
     DialogueCreator editor = EditorWindow.GetWindow <DialogueCreator>();
 }
Example #5
0
    void OnGUI()
    {   //AudioClip au = Resources.Load<AudioClip>("Audio/LF Mix");
        //AudioSource as = new AudioSource();
        // Editor ed = Editor.CreateEditor(au);
        // ed.OnInteractivePreviewGUI(new Rect(350, 250, 100, 100), EditorStyles.inspectorDefaultMargins);

        if (clearAudio)
        {
            ClearAudioObjects();
        }

        //set current scroll position and start scroll area
        scrollPos = GUI.BeginScrollView(new Rect(0, 0, position.width, position.height), scrollPos, new Rect(0, 0, 500f, 1000f), true, true);

        lastSelection = fileSelection;
        fileSelection = EditorGUILayout.Popup(fileSelection, files, GUILayout.Width(250)); //file dropdown

        if (lastSelection != fileSelection)
        {
            ClearAudioObjects();
        }

        //selection is to create new
        if (fileSelection == 0)
        {
            dialogueCreator = null;

            GUILayout.BeginHorizontal();
            createName = GUILayout.TextField(createName, GUILayout.Width(250));
            if (GUILayout.Button("Create", GUILayout.Width(250)))
            {
                //check to see if filename is already in use
                if (DialogueCreator.CheckForFile(createName))
                {
                    Debug.Log("This filename is already in use, use new name or delete dialogue file.");
                }
                else
                {
                    dialogueCreator = new DialogueCreator(createName, false);
                    tree            = dialogueCreator.GetTree();
                    refNode         = tree.GetRoot();

                    files = FindDialogueFiles();

                    int ct = 0;
                    foreach (string s in files)
                    {
                        if (s == createName)
                        {
                            fileSelection = ct;
                        }

                        ct++;
                    }
                }
                createName = "";
                AssetDatabase.Refresh();
            }
            GUILayout.EndHorizontal();
        }

        //selection is to open file
        else if ((dialogueCreator == null || lastSelection != fileSelection) && fileSelection != 0)
        {
            dialogueCreator = new DialogueCreator(files[fileSelection], true);
            tree            = dialogueCreator.GetTree();
            refNode         = tree.GetRoot();
        }

        //save changes to tree
        if (GUILayout.Button("Save", GUILayout.Width(250)) && dialogueCreator != null)
        {
            dialogueCreator.Save();
        }

        //if tree is set, render tree
        if (dialogueCreator != null && dialogueCreator.tree != null && dialogueCreator.tree.GetRoot() != null)
        {
            title = dialogueCreator.dialogueID;
            GUILayout.Label(title, EditorStyles.boldLabel);
            GUILayout.Label("(Always Set Statement After Response)", EditorStyles.miniBoldLabel);

            DrawSpeakerForm();
            GenerateTree(); //make graphical representation of dialogue tree
        }

        GUI.EndScrollView();
    }