Browse Source

Custom editor for Dialog Input

master
chrisgregan 10 years ago
parent
commit
3a1862d07f
  1. 49
      Assets/Fungus/Narrative/Editor/DialogInputEditor.cs
  2. 12
      Assets/Fungus/Narrative/Editor/DialogInputEditor.cs.meta

49
Assets/Fungus/Narrative/Editor/DialogInputEditor.cs

@ -0,0 +1,49 @@
using UnityEditor;
using UnityEngine;
using System.Collections;
using Rotorz.ReorderableList;
using System.Collections.Generic;
namespace Fungus
{
[CustomEditor (typeof(DialogInput))]
public class DialogInputEditor : Editor
{
protected SerializedProperty clickModeProp;
protected SerializedProperty nextClickDelayProp;
protected SerializedProperty keyPressModeProp;
protected SerializedProperty shiftKeyEnabledProp;
protected SerializedProperty keyListProp;
protected virtual void OnEnable()
{
clickModeProp = serializedObject.FindProperty ("clickMode");
nextClickDelayProp = serializedObject.FindProperty ("nextClickDelay");
keyPressModeProp = serializedObject.FindProperty ("keyPressMode");
shiftKeyEnabledProp = serializedObject.FindProperty ("shiftKeyEnabled");
keyListProp = serializedObject.FindProperty ("keyList");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
DialogInput t = target as DialogInput;
EditorGUILayout.PropertyField(clickModeProp);
EditorGUILayout.PropertyField(nextClickDelayProp);
EditorGUILayout.PropertyField(keyPressModeProp);
if (t.keyPressMode == DialogInput.KeyPressMode.KeyPressed)
{
EditorGUILayout.PropertyField(shiftKeyEnabledProp);
ReorderableListGUI.Title(new GUIContent("Key List", "Keycodes to check for user input"));
ReorderableListGUI.ListField(keyListProp);
}
serializedObject.ApplyModifiedProperties();
}
}
}

12
Assets/Fungus/Narrative/Editor/DialogInputEditor.cs.meta

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 2a336080b178f4c239754dd614d6d6b4
timeCreated: 1440156410
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Loading…
Cancel
Save