Example #1
0
    public override void UpdateView(Rect editorRect, Rect percentageRect, Event e, CS_CharacterGraph currentGraph)
    {
        base.UpdateView(editorRect, percentageRect, e, currentGraph);
        GUI.Box(viewRect, viewTitle, viewSkin.GetStyle("ViewBG"));

        GUILayout.BeginArea(viewRect);

        GUILayout.Space(60);
        GUILayout.BeginHorizontal();
        GUILayout.Space(30);
        if (currentGraph == null || currentGraph.ShowProperties == false)
        {
            EditorGUILayout.LabelField("None Dialog Selected.");
        }
        else
        {
            currentGraph.selectedCharacter.DrawCharacterProperties(viewRect);
        }
        GUILayout.Space(30);
        GUILayout.EndHorizontal();

        GUILayout.EndArea();

        ProcessEvents(e);
    }
Example #2
0
    public virtual void UpdateView(Rect editorRect, Rect percentageRect, Event e, CS_CharacterGraph CurrentGraph)
    {
        if (viewSkin == null)
        {
            GetEditorSkin();
        }

        currentGraph = CurrentGraph;

        if (currentGraph != null)
        {
            viewTitle = currentGraph.GraphName;
        }
        else
        {
            viewTitle = "No Graph!";
        }

        if (currentGraph != null)
        {
            viewTitle = currentGraph.GraphName;
        }
        else
        {
            viewTitle = "No Graph!";
        }

        viewRect = new Rect(editorRect.x * percentageRect.x,
                            editorRect.y * percentageRect.y,
                            editorRect.width * percentageRect.width,
                            editorRect.height * percentageRect.height);
    }
Example #3
0
    public static void CreateCharacter(CS_CharacterGraph curGraph, Vector3 mousePosition)
    {
        if (curGraph == null)
        {
            return;
        }

        CS_CharacterBase currentCharacter = null;

        currentCharacter = ScriptableObject.CreateInstance <CS_CharacterBox>();
        currentCharacter.CharacterName = "Name";
        currentCharacter.sprite        = Resources.Load("view_bg_normal", typeof(Sprite)) as Sprite;

        if (currentCharacter != null)
        {
            currentCharacter.InitCharacter();

            Rect charRect = GetBoxPosition(curGraph);

            currentCharacter.CharacterRect = charRect;

            currentCharacter.ParentGraph = curGraph;
            curGraph.Characters.Add(currentCharacter);

            AssetDatabase.AddObjectToAsset(currentCharacter, curGraph);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
    }
Example #4
0
    public static void CreateCharacterGraph(string WantedName)
    {
        CS_CharacterGraph curGraph = ScriptableObject.CreateInstance <CS_CharacterGraph>();

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

            curGraph.InitGraph();

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

            CS_CharacterEditorWindow curWindows = EditorWindow.GetWindow <CS_CharacterEditorWindow>();
            if (curWindows != null)
            {
                curWindows.currentGraph = curGraph;
            }
        }
        else
        {
            EditorUtility.DisplayDialog("Dialog Message", "Unable to create new graph, please see your friendly programmer!", "OK");
        }
    }
Example #5
0
    public override void UpdateView(Rect editorRect, Rect percentageRect, Event e, CS_CharacterGraph currentGraph)
    {
        base.UpdateView(editorRect, percentageRect, e, currentGraph);

        GUI.Box(viewRect, viewTitle, viewSkin.GetStyle("ViewBG"));

        GUILayout.BeginArea(viewRect);
        if (currentGraph != null)
        {
            currentGraph.UpdateGraphGUI(e, viewRect, viewSkin);
        }
        GUILayout.EndArea();

        ProcessEvents(e);
    }
Example #6
0
    public static void DeleteCharacter(int characterID, CS_CharacterGraph curGraph)
    {
        if (curGraph != null)
        {
            if (curGraph.Characters.Count >= characterID)
            {
                CS_CharacterBase deleteDialog = curGraph.Characters[characterID];
                if (deleteDialog != null)
                {
                    curGraph.Characters.RemoveAt(characterID);
                    GameObject.DestroyImmediate(deleteDialog, true);

                    AssetDatabase.SaveAssets();
                    AssetDatabase.Refresh();
                }
            }
        }
    }
Example #7
0
    public static void ReplaceCharacter(CS_CharacterGraph curGraph)
    {
        int i = 0;
        int x = 0;
        int y = 0;

        while (i < curGraph.Characters.Count)
        {
            curGraph.Characters[i].CharacterRect = new Rect(x, y, 100, 150);
            i = i + 1;

            x += 120;
            if (i % 5 == 0 && i != 0)
            {
                y += 170;
                x  = 0;
            }
        }
    }
Example #8
0
    public static Rect GetBoxPosition(CS_CharacterGraph curGraph)
    {
        int i = 0;
        int x = 0;
        int y = 0;

        while (i < curGraph.Characters.Count)
        {
            x += 120;
            if (i % 5 == 0 && i != 0)
            {
                y += 170;
                x  = 0;
            }
            i = i + 1;
        }

        return(new Rect(x, y, 100, 150));
    }
Example #9
0
    public static void LoadGraph()
    {
        CS_CharacterGraph 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_CharacterGraph)AssetDatabase.LoadAssetAtPath(finalPath, typeof(CS_CharacterGraph));

        if (curGraph != null)
        {
            CS_CharacterEditorWindow curWindows = EditorWindow.GetWindow <CS_CharacterEditorWindow>();
            if (curWindows != null)
            {
                curWindows.currentGraph = curGraph;
            }
        }
        else
        {
            EditorUtility.DisplayDialog("Dialog Message", "Unable to load selected graph!", "ok");
        }
    }