예제 #1
0
        public static DialogDatabase Create()
        {
            DialogDatabase asset = ScriptableObject.CreateInstance <DialogDatabase>();

            AssetDatabase.CreateAsset(asset, "Assets/Data/Dialog/DialogDatabase.asset");
            AssetDatabase.SaveAssets();
            return(asset);
        }
예제 #2
0
 /// <summary>
 /// Called every time the editor is focused, load the dialogDatabase.asset and get the default GUI.color.
 /// </summary>
 void OnEnable()
 {
     if (EditorPrefs.HasKey("ObjectPath"))
     {
         string objectPath = EditorPrefs.GetString("ObjectPath");
         dialogDatabase  = AssetDatabase.LoadAssetAtPath(objectPath, typeof(DialogDatabase)) as DialogDatabase;
         defaultGUIColor = GUI.color;
     }
 }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WanzerWeave.DialogEditor.DialogMap"/> class.
        /// </summary>
        /// <param name="DD">The dialogDatabase.asset file being edited.</param>
        public DialogMap(DialogDatabase DD)
        {
            // reset the MapRefId if all speakers have been deleted
            if (DD.maps.Count == 0)
            {
                DD.ResetMapRefId();
            }

            // assign a SpeakerRefId to this speakers RefId
            this.RefId = DD.GetMapRefId();
        }
예제 #4
0
 /// <summary>
 /// Creates the new dialogDatabase.asset file
 /// </summary>
 void CreateNewDialogDatabase()
 {
     // There is no overwrite protection here!
     // There is No "Are you sure you want to overwrite your existing object?" if it exists.
     // This should probably get a string from the user to create a new name and pass it ...
     dialogDatabase = CreateDialog.Create();
     if (dialogDatabase)
     {
         string relPath = AssetDatabase.GetAssetPath(dialogDatabase);
         EditorPrefs.SetString("ObjectPath", relPath);
     }
 }
예제 #5
0
        /// <summary>
        /// Opens a dialogDatabase.asset file
        /// </summary>
        void OpenDialogDatabase()
        {
            string absPath = EditorUtility.OpenFilePanel("Select Dialog Database", "", "");

            if (absPath.StartsWith(Application.dataPath))
            {
                string relPath = absPath.Substring(Application.dataPath.Length - "Assets".Length);
                dialogDatabase = AssetDatabase.LoadAssetAtPath(relPath, typeof(DialogDatabase)) as DialogDatabase;

                // if a list of dialog maps is not already present, make one
                if (dialogDatabase.maps == null)
                {
                    dialogDatabase.maps = new List <DialogMap> ();
                }

                // open the dialog database asset
                if (dialogDatabase)
                {
                    EditorPrefs.SetString("ObjectPath", relPath);
                }
            }
        }