From 62a85356149cd64c327c4b719fddd4823de82457 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Wed, 13 Aug 2014 17:36:47 +0100 Subject: [PATCH] Improved descriptions of commands --- .../Fungus/VisualScripting/BooleanVariable.cs | 12 ++++ .../Fungus/VisualScripting/FloatVariable.cs | 12 ++++ .../Fungus/VisualScripting/IntegerVariable.cs | 12 ++++ Assets/Fungus/VisualScripting/Set.cs | 52 ++++++++++++++++++ .../Fungus/VisualScripting/StringVariable.cs | 12 ++++ Assets/Fungus/VisualScripting/View.cs | 26 +++++++++ Assets/Shuttle/ShuttleGame.unity | Bin 81956 -> 81956 bytes 7 files changed, 126 insertions(+) diff --git a/Assets/Fungus/VisualScripting/BooleanVariable.cs b/Assets/Fungus/VisualScripting/BooleanVariable.cs index 01d799bd..32a58c85 100644 --- a/Assets/Fungus/VisualScripting/BooleanVariable.cs +++ b/Assets/Fungus/VisualScripting/BooleanVariable.cs @@ -30,6 +30,18 @@ namespace Fungus.Script get { return (booleanReference == null) ? booleanValue : booleanReference.Value; } set { if (booleanReference == null) { booleanValue = value; } else { booleanReference.Value = value; } } } + + public string GetDescription() + { + if (booleanReference == null) + { + return booleanValue.ToString(); + } + else + { + return booleanReference.key; + } + } } } \ No newline at end of file diff --git a/Assets/Fungus/VisualScripting/FloatVariable.cs b/Assets/Fungus/VisualScripting/FloatVariable.cs index a3606230..e4da5c73 100644 --- a/Assets/Fungus/VisualScripting/FloatVariable.cs +++ b/Assets/Fungus/VisualScripting/FloatVariable.cs @@ -29,6 +29,18 @@ namespace Fungus.Script get { return (floatReference == null) ? floatValue : floatReference.Value; } set { if (floatReference == null) { floatValue = value; } else { floatReference.Value = value; } } } + + public string GetDescription() + { + if (floatReference == null) + { + return floatValue.ToString(); + } + else + { + return floatReference.key; + } + } } } \ No newline at end of file diff --git a/Assets/Fungus/VisualScripting/IntegerVariable.cs b/Assets/Fungus/VisualScripting/IntegerVariable.cs index b1543cf0..f8bcb22d 100644 --- a/Assets/Fungus/VisualScripting/IntegerVariable.cs +++ b/Assets/Fungus/VisualScripting/IntegerVariable.cs @@ -29,6 +29,18 @@ namespace Fungus.Script get { return (integerReference == null) ? integerValue : integerReference.Value; } set { if (integerReference == null) { integerValue = value; } else { integerReference.Value = value; } } } + + public string GetDescription() + { + if (integerReference == null) + { + return integerValue.ToString(); + } + else + { + return integerReference.key; + } + } } } \ No newline at end of file diff --git a/Assets/Fungus/VisualScripting/Set.cs b/Assets/Fungus/VisualScripting/Set.cs index d93fbfc4..3a6f6d46 100644 --- a/Assets/Fungus/VisualScripting/Set.cs +++ b/Assets/Fungus/VisualScripting/Set.cs @@ -118,6 +118,58 @@ namespace Fungus.Script Continue(); } + + public override string GetDescription() + { + if (variable == null) + { + return ""; + } + + string description = variable.key; + + switch (setOperator) + { + default: + case SetOperator.Assign: + description += " = "; + break; + case SetOperator.Negate: + description += " != "; + break; + case SetOperator.Add: + description += " += "; + break; + case SetOperator.Subtract: + description += " -= "; + break; + case SetOperator.Multiply: + description += " *= "; + break; + case SetOperator.Divide: + description += " /= "; + break; + } + + if (variable.GetType() == typeof(BooleanVariable)) + { + description += booleanData.GetDescription(); + } + else if (variable.GetType() == typeof(IntegerVariable)) + { + description += integerData.GetDescription(); + } + else if (variable.GetType() == typeof(FloatVariable)) + { + description += floatData.GetDescription(); + } + else if (variable.GetType() == typeof(StringVariable)) + { + description += stringData.GetDescription(); + } + + return description; + } } } diff --git a/Assets/Fungus/VisualScripting/StringVariable.cs b/Assets/Fungus/VisualScripting/StringVariable.cs index 0a732a58..8ff58961 100644 --- a/Assets/Fungus/VisualScripting/StringVariable.cs +++ b/Assets/Fungus/VisualScripting/StringVariable.cs @@ -29,6 +29,18 @@ namespace Fungus.Script get { return (stringReference == null) ? stringValue : stringReference.Value; } set { if (stringReference == null) { stringValue = value; } else { stringReference.Value = value; } } } + + public string GetDescription() + { + if (stringReference == null) + { + return stringValue; + } + else + { + return stringReference.key; + } + } } } \ No newline at end of file diff --git a/Assets/Fungus/VisualScripting/View.cs b/Assets/Fungus/VisualScripting/View.cs index 619e2b75..69177247 100644 --- a/Assets/Fungus/VisualScripting/View.cs +++ b/Assets/Fungus/VisualScripting/View.cs @@ -57,6 +57,32 @@ namespace Fungus.Script Continue(); } } + + public override string GetDescription() + { + string description = ""; + + switch (transition) + { + case Transition.Move: + description = "Move to "; + break; + case Transition.Fade: + description = "Fade to "; + break; + } + + if (targetView == null) + { + description = ""; + } + else + { + description += targetView.name; + } + + return description; + } } } \ No newline at end of file diff --git a/Assets/Shuttle/ShuttleGame.unity b/Assets/Shuttle/ShuttleGame.unity index 905a1040e5412a1a60944e8ae1ba7057d1be2e92..9cceb709cb4fbb7919cfe928795dfe3a4c448a5d 100644 GIT binary patch delta 34 qcmZ3|z`CS?wP6cmA1mX6?ftBbA2lX__{%l@oB$)+_6d57Qv?C