Example #1
0
    void OnGUI()
    {
        Repaint();
        EditorUtility.SetDirty(this);

        popupselction = EditorGUILayout.Popup(popupselction, currentSpellsAsArray);
        if (workingSpell == null)
        {
            if (popupselction != 0)
            {
                try
                {
                    workingSpell = SpellAction.ParseAndCreateSpell("Spells/" + currentSpellsAsArray[popupselction]);
                }
                catch
                {
                    workingSpell = null;
                }
            }
        }
        else
        {
            workingSpell.DrawEditor();

            if (GUILayout.Button("Save"))
            {
                FileStream f        = File.Open("Assets/Resources/Spells/" + currentSpellsAsArray[popupselction] + ".json", FileMode.OpenOrCreate);
                string     contents = workingSpell.convertToJSONString();
                f.Write(Encoding.ASCII.GetBytes(contents), 0, Encoding.ASCII.GetByteCount(contents));
                f.Close();
            }
        }
    }
Example #2
0
        public override void Execute(Action action)
        {
            SpellAction sp = SpellAction.ParseAndCreateSpell(actionID);

            sp.character = character;
            character.AddAction(sp);
            action();
        }
Example #3
0
 void OnGUI()
 {
     for (int i = 0; i < SpellEditor.currentSpells.Count; i++)
     {
         if (GUILayout.Button(SpellEditor.currentSpells[i]))
         {
             SpellEditor.workingSpell = SpellAction.ParseAndCreateSpell(("Spells/" + SpellEditor.currentSpells[i]).Replace(".txt", ""));
             GUI.FocusWindow(0);
             Close();
         }
     }
 }