示例#1
0
    public static void CreateSpellGraph(string WantedName)
    {
        CS_SpellGraph curGraph = ScriptableObject.CreateInstance <CS_SpellGraph>();

        if (curGraph != null)
        {
            curGraph.GraphName = WantedName;

            curGraph.InitGraph();

            AssetDatabase.CreateAsset(curGraph, "Assets/CS_RPG-data/Database/" + WantedName + ".asset");
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();

            CS_SpellEditorWindow curWindows = EditorWindow.GetWindow <CS_SpellEditorWindow>();
            if (curWindows != null)
            {
                curWindows.currentGraph = curGraph;
            }
        }
        else
        {
            EditorUtility.DisplayDialog("Dialog Message", "Unable to create new graph, please see your friendly programmer!", "OK");
        }
    }
示例#2
0
    public static void InitEditorWindow()
    {
        curWindow = GetWindow <CS_SpellEditorWindow>();
        curWindow.titleContent.text = "Spell Editor";

        CreateView();
    }
示例#3
0
    public static void UnloadGraph()
    {
        CS_SpellEditorWindow curWindows = EditorWindow.GetWindow <CS_SpellEditorWindow>();

        if (curWindows != null)
        {
            curWindows.currentGraph = null;
        }
    }
示例#4
0
 static void CreateView()
 {
     if (curWindow != null)
     {
         curWindow.propertyView = new CS_SpellPropertyView();
         curWindow.workView     = new CS_SpellWorkView();
     }
     else
     {
         curWindow = GetWindow <CS_SpellEditorWindow>();
     }
 }
示例#5
0
    public static void LoadGraph()
    {
        CS_SpellGraph curGraph = null;

        string grapPath = EditorUtility.OpenFilePanel("Load Graph", Application.dataPath + "/CS_RPG-Data/Database/", "");

        int    appPathLen = Application.dataPath.Length;
        string finalPath  = grapPath.Substring(appPathLen - 6);

        curGraph = (CS_SpellGraph)AssetDatabase.LoadAssetAtPath(finalPath, typeof(CS_SpellGraph));

        if (curGraph != null)
        {
            CS_SpellEditorWindow curWindows = EditorWindow.GetWindow <CS_SpellEditorWindow>();
            if (curWindows != null)
            {
                curWindows.currentGraph = curGraph;
            }
        }
        else
        {
            EditorUtility.DisplayDialog("Dialog Message", "Unable to load selected graph!", "ok");
        }
    }
示例#6
0
 public static void InitSpellEditor()
 {
     CS_SpellEditorWindow.InitEditorWindow();
 }