8 changed files with 152 additions and 36 deletions
@ -0,0 +1,51 @@ |
|||||||
|
using UnityEngine; |
||||||
|
using System; |
||||||
|
using System.Collections; |
||||||
|
using System.Collections.Generic; |
||||||
|
|
||||||
|
namespace Fungus.Script |
||||||
|
{ |
||||||
|
[CommandName("Add Option")] |
||||||
|
[CommandCategory("Dialog")] |
||||||
|
[HelpText("Adds an option for the player to select, displayed by the next Say command.")] |
||||||
|
public class AddOption : FungusCommand |
||||||
|
{ |
||||||
|
public string optionText; |
||||||
|
public Sequence targetSequence; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
Say.SayOption option = new Say.SayOption(); |
||||||
|
option.optionText = optionText; |
||||||
|
option.targetSequence = targetSequence; |
||||||
|
Say.options.Add(option); |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
string summaryText = optionText; |
||||||
|
|
||||||
|
if (targetSequence == null) |
||||||
|
{ |
||||||
|
summaryText += " ( <Continue> )"; |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
summaryText += " (" + targetSequence.name + ")"; |
||||||
|
} |
||||||
|
|
||||||
|
return summaryText; |
||||||
|
} |
||||||
|
|
||||||
|
public override void GetConnectedSequences(ref List<Sequence> connectedSequences) |
||||||
|
{ |
||||||
|
if (targetSequence != null) |
||||||
|
{ |
||||||
|
connectedSequences.Add (targetSequence); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 9a61ea20fbb744ca2a363c33ad65cd89 |
||||||
|
MonoImporter: |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
@ -0,0 +1,37 @@ |
|||||||
|
using UnityEditor; |
||||||
|
using UnityEditorInternal; |
||||||
|
using UnityEngine; |
||||||
|
using System.Collections; |
||||||
|
using System.Collections.Generic; |
||||||
|
using Rotorz.ReorderableList; |
||||||
|
|
||||||
|
namespace Fungus.Script |
||||||
|
{ |
||||||
|
|
||||||
|
[CustomEditor (typeof(AddOption))] |
||||||
|
public class AddOptionEditor : FungusCommandEditor |
||||||
|
{ |
||||||
|
public override void DrawCommandGUI() |
||||||
|
{ |
||||||
|
AddOption t = target as AddOption; |
||||||
|
|
||||||
|
EditorGUI.BeginChangeCheck(); |
||||||
|
|
||||||
|
string optionText = EditorGUILayout.TextField(new GUIContent("Option Text", "Text display on the option button."), |
||||||
|
t.optionText); |
||||||
|
|
||||||
|
Sequence targetSequence = SequenceEditor.SequenceField(new GUIContent("Target Sequence", "Sequence to execute when this option is selected by the player."), |
||||||
|
new GUIContent("<Continue>"), |
||||||
|
t.GetFungusScript(), |
||||||
|
t.targetSequence); |
||||||
|
|
||||||
|
if (EditorGUI.EndChangeCheck()) |
||||||
|
{ |
||||||
|
Undo.RecordObject(t, "Set Add Option"); |
||||||
|
t.optionText = optionText; |
||||||
|
t.targetSequence = targetSequence; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 40a93fe42338b42e7a0215379d219400 |
||||||
|
MonoImporter: |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
Binary file not shown.
Loading…
Reference in new issue