Browse Source

Custom editor for FungusVariables

master
chrisgregan 10 years ago
parent
commit
8b90d0c301
  1. 31
      Assets/Fungus/Editor/FungusScript/FungusVariableEditor.cs
  2. 8
      Assets/Fungus/Editor/FungusScript/FungusVariableEditor.cs.meta
  3. 18
      Assets/Fungus/VisualScripting/FungusVariable.cs
  4. 8
      Assets/Fungus/VisualScripting/FungusVariable.cs.meta
  5. 20
      Assets/Fungus/VisualScripting/Variable.cs
  6. BIN
      Assets/Shuttle/ShuttleGame.unity

31
Assets/Fungus/Editor/FungusScript/FungusVariableEditor.cs

@ -0,0 +1,31 @@
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Fungus.Script
{
[CustomEditor (typeof(FungusVariable), true)]
public class FungusVariableEditor : FungusCommandEditor
{
public override void OnInspectorGUI()
{
FungusVariable t = target as FungusVariable;
EditorGUI.BeginChangeCheck();
string key = EditorGUILayout.TextField(new GUIContent("Key", "Name to use for this variable"), t.key);
VariableScope scope = (VariableScope)EditorGUILayout.EnumPopup(new GUIContent("Scope", "Local or global access to variable value"), t.scope);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(t, "Set Variable");
t.key = key;
t.scope = scope;
}
}
}
}

8
Assets/Fungus/Editor/FungusScript/FungusVariableEditor.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b234f32a89b314fc68dc92034cdb3346
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

18
Assets/Fungus/VisualScripting/FungusVariable.cs

@ -0,0 +1,18 @@
using UnityEngine;
using System;
using System.Collections;
namespace Fungus.Script
{
public enum VariableScope
{
Local,
Global
};
public class FungusVariable : MonoBehaviour
{
public VariableScope scope;
public string key;
}
}

8
Assets/Fungus/VisualScripting/FungusVariable.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 95c2ee53ce0384b09930cbd112309921
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

20
Assets/Fungus/VisualScripting/Variable.cs

@ -4,26 +4,6 @@ using System.Collections;
namespace Fungus.Script
{
public class FungusVariable : MonoBehaviour
{
public VariableScope scope;
public string key;
}
public enum VariableType
{
Boolean,
Integer,
Float,
String
};
public enum VariableScope
{
Local,
Global
};
[Serializable]
public class VariableData
{

BIN
Assets/Shuttle/ShuttleGame.unity

Binary file not shown.
Loading…
Cancel
Save