chrisgregan
10 years ago
16 changed files with 384 additions and 200 deletions
@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 805471f08101f4ad8a705fc863435758 |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -0,0 +1,86 @@
|
||||
using UnityEditor; |
||||
using UnityEditorInternal; |
||||
using UnityEngine; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
using Rotorz.ReorderableList; |
||||
|
||||
namespace Fungus.Script |
||||
{ |
||||
|
||||
[CustomEditor (typeof(Say))] |
||||
public class SayEditor : FungusCommandEditor |
||||
{ |
||||
public override void DrawCommandGUI() |
||||
{ |
||||
serializedObject.Update(); |
||||
|
||||
SerializedProperty optionListProperty = serializedObject.FindProperty("options"); |
||||
|
||||
Say t = target as Say; |
||||
|
||||
EditorGUI.BeginChangeCheck(); |
||||
|
||||
EditorGUILayout.PrefixLabel(new GUIContent("Say Text", "Text to display in dialog")); |
||||
GUIStyle sayStyle = new GUIStyle(EditorStyles.textArea); |
||||
sayStyle.wordWrap = true; |
||||
string text = EditorGUILayout.TextArea(t.storyText, sayStyle, GUILayout.MinHeight(30)); |
||||
|
||||
DialogController dialogController = EditorGUILayout.ObjectField(new GUIContent("Dialog", "Dialog to display story text with"), |
||||
t.dialogController, |
||||
typeof(DialogController), true) as DialogController; |
||||
|
||||
Character character = EditorGUILayout.ObjectField(new GUIContent("Character", "Character to display in dialog"), |
||||
t.character, |
||||
typeof(Character), true) as Character; |
||||
|
||||
bool displayOnce = EditorGUILayout.Toggle(new GUIContent("Display Once", "Display this text once and never show it again."), t.displayOnce); |
||||
|
||||
if (EditorGUI.EndChangeCheck()) |
||||
{ |
||||
Undo.RecordObject(t, "Set Say"); |
||||
t.dialogController = dialogController; |
||||
t.character = character; |
||||
t.storyText = text; |
||||
t.displayOnce = displayOnce; |
||||
} |
||||
|
||||
ReorderableListGUI.Title("Options"); |
||||
ReorderableListGUI.ListField(optionListProperty); |
||||
|
||||
serializedObject.ApplyModifiedProperties(); |
||||
} |
||||
} |
||||
|
||||
[CustomPropertyDrawer (typeof(Say.SayOption))] |
||||
public class SayOptionDrawer : PropertyDrawer |
||||
{ |
||||
public override void OnGUI (Rect position, SerializedProperty property, GUIContent label) |
||||
{ |
||||
EditorGUI.BeginProperty(position, label, property); |
||||
|
||||
SerializedProperty optionTextProp = property.FindPropertyRelative("optionText"); |
||||
SerializedProperty targetSequenceProp = property.FindPropertyRelative("targetSequence"); |
||||
|
||||
Rect optionTextRect = position; |
||||
optionTextRect.width *= 0.5f; |
||||
Rect targetSequenceRect = position; |
||||
targetSequenceRect.width *= 0.5f; |
||||
targetSequenceRect.x += optionTextRect.width; |
||||
|
||||
FungusScript fungusScript = FungusScriptWindow.GetFungusScript(); |
||||
|
||||
optionTextProp.stringValue = EditorGUI.TextField(optionTextRect, optionTextProp.stringValue); |
||||
if (fungusScript != null) |
||||
{ |
||||
targetSequenceProp.objectReferenceValue = SequenceEditor.SequenceField(targetSequenceRect, |
||||
new GUIContent("<Continue>"), |
||||
fungusScript, |
||||
targetSequenceProp.objectReferenceValue as Sequence); |
||||
} |
||||
|
||||
EditorGUI.EndProperty(); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,15 @@
|
||||
using UnityEngine; |
||||
using System.Collections; |
||||
|
||||
namespace Fungus.Script |
||||
{ |
||||
|
||||
public class Character : MonoBehaviour |
||||
{ |
||||
public string characterName; |
||||
public Sprite characterImage; |
||||
public DialogController.DialogSide dialogSide; |
||||
public Color characterColor; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 25fb867d2049d41f597aefdd6b19f598 |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -1,51 +0,0 @@
|
||||
using UnityEditor; |
||||
using UnityEditorInternal; |
||||
using UnityEngine; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace Fungus.Script |
||||
{ |
||||
|
||||
[CustomEditor (typeof(Say))] |
||||
public class SayEditor : FungusCommandEditor |
||||
{ |
||||
public override void DrawCommandGUI() |
||||
{ |
||||
Say t = target as Say; |
||||
|
||||
EditorGUI.BeginChangeCheck(); |
||||
|
||||
string character = EditorGUILayout.TextField(new GUIContent("Character", "Character to display in dialog"), t.character); |
||||
|
||||
EditorGUILayout.PrefixLabel(new GUIContent("Say Text", "Text to display in dialog")); |
||||
GUIStyle sayStyle = new GUIStyle(EditorStyles.textArea); |
||||
sayStyle.wordWrap = true; |
||||
string text = EditorGUILayout.TextArea(t.text, sayStyle, GUILayout.MinHeight(30)); |
||||
|
||||
Say.ShowCondition showCondition = (Say.ShowCondition)EditorGUILayout.EnumPopup(new GUIContent("Show Condition", "Condition when this say text should be visible."), t.showCondition); |
||||
|
||||
BooleanVariable booleanVariable = t.booleanVariable; |
||||
|
||||
if (showCondition == Say.ShowCondition.BooleanIsFalse || |
||||
showCondition == Say.ShowCondition.BooleanIsTrue) |
||||
{ |
||||
booleanVariable = FungusVariableEditor.VariableField (new GUIContent ("Boolean Variable", "Boolean variable to test for condition"), |
||||
t.GetFungusScript (), |
||||
t.booleanVariable, |
||||
v => { return v.GetType() == typeof(BooleanVariable); }) as BooleanVariable; |
||||
} |
||||
|
||||
if (EditorGUI.EndChangeCheck()) |
||||
{ |
||||
Undo.RecordObject(t, "Set Say"); |
||||
t.character = character; |
||||
t.text = text; |
||||
t.showCondition = showCondition; |
||||
t.booleanVariable = booleanVariable; |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
} |
Binary file not shown.
@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 4417bf892b8c448528ef7c527b82338a |
||||
NativeFormatImporter: |
||||
userData: |
Binary file not shown.
@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 9ffd6f62d04cb4c33aedde50a56aa90c |
||||
DefaultImporter: |
||||
userData: |
Binary file not shown.
Loading…
Reference in new issue