Ejemplo n.º 1
0
        private void OnEnable()
        {
            if (debug)
            {
                Debug.Log("<color=green>Dialogue Editor: OnEnable (Selection.activeObject=" + Selection.activeObject + ", database=" + database + ")</color>", Selection.activeObject);
            }
            instance = this;
            template = TemplateTools.LoadFromEditorPrefs();
            minSize  = new Vector2(720, 240);
            if (Selection.activeObject != null)
            {
                SelectObject(Selection.activeObject);
            }
            else if (EditorWindow.focusedWindow == this)
            {
                SelectObject(database);
            }
            toolbar.UpdateTabNames(template.treatItemsAsQuests);
            if (database != null)
            {
                ValidateConversationMenuTitleIndex();
            }
#if UNITY_2017_2_OR_NEWER
            EditorApplication.playModeStateChanged -= OnPlayModeStateChanged;
            EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
#else
            EditorApplication.playmodeStateChanged -= OnPlaymodeStateChanged;
            EditorApplication.playmodeStateChanged += OnPlaymodeStateChanged;
#endif
            //nodeStyle = null;
            showQuickDialogueTextEntry = false;
            LoadEditorSettings();
        }
 void OnEnable()
 {
     instance = this;
     minSize  = new Vector2(320, 128);
     template = TemplateTools.LoadFromEditorPrefs();
     prefs    = ConverterPrefsTools.Load();
 }
Ejemplo n.º 3
0
        private Variable CreateNewVariable(string group)
        {
            if (template == null)
            {
                template = TemplateTools.LoadFromEditorPrefs();
            }
            var id = template.GetNextVariableID(database);
            var newVariableName = "New Variable " + id;
            var addGroup        = !(string.IsNullOrEmpty(group) || group == UngroupedVariableGroup);

            if (addGroup)
            {
                newVariableName = group + "." + newVariableName;
            }
            var newVariable = template.CreateVariable(id, newVariableName, string.Empty);

            if (!Field.FieldExists(newVariable.fields, "Name"))
            {
                newVariable.fields.Add(new Field("Name", string.Empty, FieldType.Text));
            }
            if (!Field.FieldExists(newVariable.fields, "Initial Value"))
            {
                newVariable.fields.Add(new Field("Initial Value", string.Empty, FieldType.Text));
            }
            if (!Field.FieldExists(newVariable.fields, "Description"))
            {
                newVariable.fields.Add(new Field("Description", string.Empty, FieldType.Text));
            }
            database.variables.Add(newVariable);
            EditorUtility.SetDirty(database);
            UpdateVariableWindows();
            return(newVariable);
        }
Ejemplo n.º 4
0
 protected virtual void OnEnable()
 {
     prefs    = Prefs.Load();
     database = GetDatabaseFromGuid(prefs.databaseGuid);
     template = TemplateTools.LoadFromEditorPrefs();
     storyInfoReorderableList = new ReorderableList(prefs.storyInfoList, typeof(string), true, true, true, true);
     storyInfoReorderableList.drawHeaderCallback  += OnDrawFilenameListHeader;
     storyInfoReorderableList.drawElementCallback += OnDrawFilenameListElement;
     storyInfoReorderableList.onAddCallback       += OnAddFilenameToList;
     lastDirectory = (prefs.storyInfoList.Count > 0) ? Path.GetDirectoryName(prefs.storyInfoList[0].jsonFilename) : string.Empty;
     RefreshActorPopupData();
 }
        private void OnEnable()
        {
            instance = this;
            minSize  = new Vector2(300, 240);
            database = DialogueEditorWindow.GetCurrentlyEditedDatabase();
            if (database == null)
            {
                EditorTools.FindInitialDatabase();
            }

            if (database == null && EditorPrefs.HasKey(DatabaseGUIDPrefsKey))
            {
                var guid = EditorPrefs.GetString(DatabaseGUIDPrefsKey);
                database = AssetDatabase.LoadAssetAtPath <DialogueDatabase>(guid);
            }
            template = TemplateTools.LoadFromEditorPrefs();
            if (variableView == null)
            {
                variableView = new DialogueEditorVariableView();
            }
            variableView.Initialize(database, template, false);
        }
Ejemplo n.º 6
0
 void LoadTemplate()
 {
     template = TemplateTools.LoadFromEditorPrefs();
 }