示例#1
0
    public static void CreateSpell(CS_SpellGraph curGraph, Vector3 mousePosition)
    {
        if (curGraph == null)
        {
            return;
        }

        CS_SpellBase currentSpell = null;

        currentSpell           = ScriptableObject.CreateInstance <CS_SpellBox>();
        currentSpell.SpellName = "Name";
        currentSpell.sprite    = Resources.Load("view_bg_normal", typeof(Sprite)) as Sprite;

        if (currentSpell != null)
        {
            currentSpell.InitSpell();

            Rect charRect = GetBoxPosition(curGraph);

            currentSpell.SpellRect = charRect;

            currentSpell.ParentGraph = curGraph;
            curGraph.Spells.Add(currentSpell);

            AssetDatabase.AddObjectToAsset(currentSpell, curGraph);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
    }
示例#2
0
    private void ProcessEvents(Event e, Rect viewRect)
    {
        if (viewRect.Contains(e.mousePosition))
        {
            if (e.button == 0 && e.type == EventType.MouseDown)
            {
                DeselectAllDialogs();
                ShowProperties = false;
                bool setDialog = false;

                for (int i = 0; i < Spells.Count; i++)
                {
                    if (Spells[i].SpellRect.Contains(e.mousePosition))
                    {
                        Spells[i].IsSelected = true;
                        selectedSpell        = Spells[i];
                        setDialog            = true;
                    }
                }

                if (!setDialog)
                {
                    DeselectAllDialogs();
                }
            }
        }
    }
示例#3
0
    public static void DeleteSpell(int SpellID, CS_SpellGraph curGraph)
    {
        if (curGraph != null)
        {
            if (curGraph.Spells.Count >= SpellID)
            {
                CS_SpellBase deleteDialog = curGraph.Spells[SpellID];
                if (deleteDialog != null)
                {
                    curGraph.Spells.RemoveAt(SpellID);
                    GameObject.DestroyImmediate(deleteDialog, true);

                    AssetDatabase.SaveAssets();
                    AssetDatabase.Refresh();
                }
            }
        }
    }