Browse Source

Command colours are specified in a virtual function

master
chrisgregan 11 years ago
parent
commit
db928d3a33
  1. 8
      Assets/Fungus/Audio/Commands/PlayMusic.cs
  2. 8
      Assets/Fungus/Audio/Commands/PlaySound.cs
  3. 8
      Assets/Fungus/Audio/Commands/SetMusicVolume.cs
  4. 8
      Assets/Fungus/Audio/Commands/StopMusic.cs
  5. 8
      Assets/Fungus/Camera/Commands/FadeToView.cs
  6. 8
      Assets/Fungus/Camera/Commands/MoveToView.cs
  7. 8
      Assets/Fungus/Dialog/Commands/AddOption.cs
  8. 8
      Assets/Fungus/Dialog/Commands/Choose.cs
  9. 8
      Assets/Fungus/Dialog/Commands/Say.cs
  10. 8
      Assets/Fungus/FungusScript/Commands/Call.cs
  11. 8
      Assets/Fungus/FungusScript/Commands/Else.cs
  12. 8
      Assets/Fungus/FungusScript/Commands/EndIf.cs
  13. 8
      Assets/Fungus/FungusScript/Commands/If.cs
  14. 8
      Assets/Fungus/FungusScript/Commands/LoadGlobals.cs
  15. 8
      Assets/Fungus/FungusScript/Commands/LoadScene.cs
  16. 8
      Assets/Fungus/FungusScript/Commands/SaveGlobals.cs
  17. 8
      Assets/Fungus/FungusScript/Commands/Set.cs
  18. 8
      Assets/Fungus/FungusScript/Commands/Wait.cs
  19. 2
      Assets/Fungus/FungusScript/Editor/FungusCommandEditor.cs
  20. 2
      Assets/Fungus/FungusScript/Editor/FungusCommandListAdaptor.cs
  21. 10
      Assets/Fungus/FungusScript/Scripts/FungusCommand.cs
  22. 8
      Assets/Fungus/Sprite/Commands/FadeSprite.cs

8
Assets/Fungus/Audio/Commands/PlayMusic.cs

@ -5,8 +5,7 @@ namespace Fungus.Script
{ {
[CommandInfo("Audio", [CommandInfo("Audio",
"Play Music", "Play Music",
"Plays game music. If any game music is already playing, it is stopped. Music continues playing across scene loads.", "Plays game music. If any game music is already playing, it is stopped. Music continues playing across scene loads.")]
242, 209, 176)]
public class PlayMusic : FungusCommand public class PlayMusic : FungusCommand
{ {
public AudioClip musicClip; public AudioClip musicClip;
@ -31,6 +30,11 @@ namespace Fungus.Script
return musicClip.name; return musicClip.name;
} }
public override Color GetButtonColor()
{
return new Color32(242, 209, 176, 255);
}
} }
} }

8
Assets/Fungus/Audio/Commands/PlaySound.cs

@ -5,8 +5,7 @@ namespace Fungus.Script
{ {
[CommandInfo("Audio", [CommandInfo("Audio",
"Play Sound", "Play Sound",
"Plays a sound effect. Multiple sound effects can play at the same time.", "Plays a sound effect. Multiple sound effects can play at the same time.")]
242, 209, 176)]
public class PlaySound : FungusCommand public class PlaySound : FungusCommand
{ {
public AudioClip soundClip; public AudioClip soundClip;
@ -34,6 +33,11 @@ namespace Fungus.Script
return soundClip.name; return soundClip.name;
} }
public override Color GetButtonColor()
{
return new Color32(242, 209, 176, 255);
}
} }
} }

8
Assets/Fungus/Audio/Commands/SetMusicVolume.cs

@ -5,8 +5,7 @@ namespace Fungus.Script
{ {
[CommandInfo("Audio", [CommandInfo("Audio",
"Set Music Volume", "Set Music Volume",
"Sets the game music volume level.", "Sets the game music volume level.")]
242, 209, 176)]
public class SetMusicVolume : FungusCommand public class SetMusicVolume : FungusCommand
{ {
[Range(0,1)] [Range(0,1)]
@ -30,6 +29,11 @@ namespace Fungus.Script
{ {
return "Set to " + volume + " over " + fadeDuration + " seconds."; return "Set to " + volume + " over " + fadeDuration + " seconds.";
} }
public override Color GetButtonColor()
{
return new Color32(242, 209, 176, 255);
}
} }
} }

8
Assets/Fungus/Audio/Commands/StopMusic.cs

@ -5,8 +5,7 @@ namespace Fungus.Script
{ {
[CommandInfo("Audio", [CommandInfo("Audio",
"Stop Music", "Stop Music",
"Stops the currently playing game music.", "Stops the currently playing game music.")]
242, 209, 176)]
public class StopMusic : FungusCommand public class StopMusic : FungusCommand
{ {
public override void OnEnter() public override void OnEnter()
@ -19,6 +18,11 @@ namespace Fungus.Script
Continue(); Continue();
} }
public override Color GetButtonColor()
{
return new Color32(242, 209, 176, 255);
}
} }
} }

8
Assets/Fungus/Camera/Commands/FadeToView.cs

@ -6,8 +6,7 @@ namespace Fungus.Script
{ {
[CommandInfo("Camera", [CommandInfo("Camera",
"Fade To View", "Fade To View",
"Fades the camera out and in again at a location specified by a View object.", "Fades the camera out and in again at a location specified by a View object.")]
216, 228, 170)]
public class FadeToView : FungusCommand public class FadeToView : FungusCommand
{ {
public float duration; public float duration;
@ -65,6 +64,11 @@ namespace Fungus.Script
return targetView.name; return targetView.name;
} }
} }
public override Color GetButtonColor()
{
return new Color32(216, 228, 170, 255);
}
} }
} }

8
Assets/Fungus/Camera/Commands/MoveToView.cs

@ -6,8 +6,7 @@ namespace Fungus.Script
{ {
[CommandInfo("Camera", [CommandInfo("Camera",
"Move To View", "Move To View",
"Moves the camera to a location specified by a View object.", "Moves the camera to a location specified by a View object.")]
216, 228, 170)]
public class MoveToView : FungusCommand public class MoveToView : FungusCommand
{ {
public float duration; public float duration;
@ -52,6 +51,11 @@ namespace Fungus.Script
return targetView.name; return targetView.name;
} }
} }
public override Color GetButtonColor()
{
return new Color32(216, 228, 170, 255);
}
} }
} }

8
Assets/Fungus/Dialog/Commands/AddOption.cs

@ -7,8 +7,7 @@ namespace Fungus.Script
{ {
[CommandInfo("Dialog", [CommandInfo("Dialog",
"Add Option", "Add Option",
"Adds an option for the player to select, displayed by the next Say command.", "Adds an option for the player to select, displayed by the next Say command.")]
184, 210, 235)]
public class AddOption : FungusCommand public class AddOption : FungusCommand
{ {
public string optionText; public string optionText;
@ -56,6 +55,11 @@ namespace Fungus.Script
connectedSequences.Add (targetSequence); connectedSequences.Add (targetSequence);
} }
} }
public override Color GetButtonColor()
{
return new Color32(184, 210, 235, 255);
}
} }
} }

8
Assets/Fungus/Dialog/Commands/Choose.cs

@ -7,8 +7,7 @@ namespace Fungus.Script
{ {
[CommandInfo("Dialog", [CommandInfo("Dialog",
"Choose", "Choose",
"Presents a list of options for the player to choose from, with an optional timeout. Add options using preceding AddOption commands.", "Presents a list of options for the player to choose from, with an optional timeout. Add options using preceding AddOption commands.")]
184, 210, 235)]
public class Choose : FungusCommand public class Choose : FungusCommand
{ {
public ChooseDialog dialog; public ChooseDialog dialog;
@ -164,6 +163,11 @@ namespace Fungus.Script
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
} }
public override Color GetButtonColor()
{
return new Color32(184, 210, 235, 255);
}
} }
} }

8
Assets/Fungus/Dialog/Commands/Say.cs

@ -7,8 +7,7 @@ namespace Fungus.Script
{ {
[CommandInfo("Dialog", [CommandInfo("Dialog",
"Say", "Say",
"Writes a line of story text to the dialog. A list of options can be specified for the player to choose from. Use a non-zero timeout to give the player a limited time to choose.", "Writes a line of story text to the dialog. A list of options can be specified for the player to choose from. Use a non-zero timeout to give the player a limited time to choose.")]
184, 210, 235)]
public class Say : FungusCommand public class Say : FungusCommand
{ {
public SayDialog dialog; public SayDialog dialog;
@ -110,6 +109,11 @@ namespace Fungus.Script
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
} }
public override Color GetButtonColor()
{
return new Color32(184, 210, 235, 255);
}
} }
} }

8
Assets/Fungus/FungusScript/Commands/Call.cs

@ -6,8 +6,7 @@ namespace Fungus.Script
{ {
[CommandInfo("Scripting", [CommandInfo("Scripting",
"Call", "Call",
"Execute another sequence.", "Execute another sequence.")]
255, 255, 255)]
public class Call : FungusCommand public class Call : FungusCommand
{ {
public Sequence targetSequence; public Sequence targetSequence;
@ -41,6 +40,11 @@ namespace Fungus.Script
return targetSequence.name; return targetSequence.name;
} }
public override Color GetButtonColor()
{
return new Color32(235, 191, 217, 255);
}
} }
} }

8
Assets/Fungus/FungusScript/Commands/Else.cs

@ -6,8 +6,7 @@ namespace Fungus.Script
{ {
[CommandInfo("Scripting", [CommandInfo("Scripting",
"Else", "Else",
"Marks the start of a sequence block to be executed when the preceding If statement is false.", "Marks the start of a sequence block to be executed when the preceding If statement is false.")]
253, 253, 150)]
public class Else : FungusCommand public class Else : FungusCommand
{ {
public override void OnEnter() public override void OnEnter()
@ -47,6 +46,11 @@ namespace Fungus.Script
{ {
return 1; return 1;
} }
public override Color GetButtonColor()
{
return new Color32(253, 253, 150, 255);
}
} }
} }

8
Assets/Fungus/FungusScript/Commands/EndIf.cs

@ -6,8 +6,7 @@ namespace Fungus.Script
{ {
[CommandInfo("Scripting", [CommandInfo("Scripting",
"EndIf", "EndIf",
"Marks the end of an If statement block.", "Marks the end of an If statement block.")]
253, 253, 150)]
public class EndIf : FungusCommand public class EndIf : FungusCommand
{ {
public override void OnEnter() public override void OnEnter()
@ -19,6 +18,11 @@ namespace Fungus.Script
{ {
return -1; return -1;
} }
public override Color GetButtonColor()
{
return new Color32(253, 253, 150, 255);
}
} }
} }

8
Assets/Fungus/FungusScript/Commands/If.cs

@ -16,8 +16,7 @@ namespace Fungus.Script
[CommandInfo("Scripting", [CommandInfo("Scripting",
"If", "If",
"If the test expression is true, execute the following block of commands.", "If the test expression is true, execute the following block of commands.")]
253, 253, 150)]
public class If : FungusCommand public class If : FungusCommand
{ {
public FungusVariable variable; public FungusVariable variable;
@ -222,6 +221,11 @@ namespace Fungus.Script
{ {
return 1; return 1;
} }
public override Color GetButtonColor()
{
return new Color32(253, 253, 150, 255);
}
} }
} }

8
Assets/Fungus/FungusScript/Commands/LoadGlobals.cs

@ -6,8 +6,7 @@ namespace Fungus.Script
{ {
[CommandInfo("Scripting", [CommandInfo("Scripting",
"Load Globals", "Load Globals",
"Loads a set of global variables previously saved using the SaveGlobals command.", "Loads a set of global variables previously saved using the SaveGlobals command.")]
255, 255, 255)]
public class LoadGlobals : FungusCommand public class LoadGlobals : FungusCommand
{ {
public string saveName = ""; public string saveName = "";
@ -21,6 +20,11 @@ namespace Fungus.Script
{ {
return saveName; return saveName;
} }
public override Color GetButtonColor()
{
return new Color32(235, 191, 217, 255);
}
} }
} }

8
Assets/Fungus/FungusScript/Commands/LoadScene.cs

@ -9,8 +9,7 @@ namespace Fungus.Script
"Loads a new scene and displays an optional loading image. This is useful " + "Loads a new scene and displays an optional loading image. This is useful " +
"for splitting a large game across multiple scene files to reduce peak memory " + "for splitting a large game across multiple scene files to reduce peak memory " +
"usage. All previously loaded assets (including textures and audio) will be released." + "usage. All previously loaded assets (including textures and audio) will be released." +
"The scene to be loaded must be added to the scene list in Build Settings.", "The scene to be loaded must be added to the scene list in Build Settings.")]
255, 255, 255)]
public class LoadScene : FungusCommand public class LoadScene : FungusCommand
{ {
public string sceneName = ""; public string sceneName = "";
@ -31,6 +30,11 @@ namespace Fungus.Script
return sceneName; return sceneName;
} }
public override Color GetButtonColor()
{
return new Color32(235, 191, 217, 255);
}
} }
} }

8
Assets/Fungus/FungusScript/Commands/SaveGlobals.cs

@ -6,8 +6,7 @@ namespace Fungus.Script
{ {
[CommandInfo("Scripting", [CommandInfo("Scripting",
"Save Globals", "Save Globals",
"Saves all current global variables to be loaded again later using the LoadGlobals command. This provides a basic save game system.", "Saves all current global variables to be loaded again later using the LoadGlobals command. This provides a basic save game system.")]
255, 255, 255)]
public class SaveGlobals : FungusCommand public class SaveGlobals : FungusCommand
{ {
public string saveName = ""; public string saveName = "";
@ -21,6 +20,11 @@ namespace Fungus.Script
{ {
return saveName; return saveName;
} }
public override Color GetButtonColor()
{
return new Color32(235, 191, 217, 255);
}
} }
} }

8
Assets/Fungus/FungusScript/Commands/Set.cs

@ -5,8 +5,7 @@ namespace Fungus.Script
{ {
[CommandInfo("Scripting", [CommandInfo("Scripting",
"Set", "Set",
"Sets a variable to a new value using simple arithmetic operations. The value can be a constant or another variable.", "Sets a variable to a new value using simple arithmetic operations. The value can be a constant or another variable.")]
255, 255, 255)]
public class Set : FungusCommand public class Set : FungusCommand
{ {
public enum SetOperator public enum SetOperator
@ -178,6 +177,11 @@ namespace Fungus.Script
{ {
return (variable == this.variable); return (variable == this.variable);
} }
public override Color GetButtonColor()
{
return new Color32(235, 191, 217, 255);
}
} }
} }

8
Assets/Fungus/FungusScript/Commands/Wait.cs

@ -6,8 +6,7 @@ namespace Fungus.Script
{ {
[CommandInfo("Scripting", [CommandInfo("Scripting",
"Wait", "Wait",
"Waits for period of time before executing the next command in the sequence.", "Waits for period of time before executing the next command in the sequence.")]
255, 255, 255)]
public class Wait : FungusCommand public class Wait : FungusCommand
{ {
public float duration = 1; public float duration = 1;
@ -26,6 +25,11 @@ namespace Fungus.Script
{ {
return duration.ToString() + " seconds"; return duration.ToString() + " seconds";
} }
public override Color GetButtonColor()
{
return new Color32(235, 191, 217, 255);
}
} }
} }

2
Assets/Fungus/FungusScript/Editor/FungusCommandEditor.cs

@ -61,7 +61,7 @@ namespace Fungus.Script
GUIStyle commandStyle = new GUIStyle(EditorStyles.miniButton); GUIStyle commandStyle = new GUIStyle(EditorStyles.miniButton);
if (t.enabled) if (t.enabled)
{ {
GUI.backgroundColor = commandInfoAttr.ButtonColor; GUI.backgroundColor = t.GetButtonColor();
} }
else else
{ {

2
Assets/Fungus/FungusScript/Editor/FungusCommandListAdaptor.cs

@ -185,7 +185,7 @@ namespace Fungus.Script
GUIUtility.keyboardControl = 0; // Fix for textarea not refeshing (change focus) GUIUtility.keyboardControl = 0; // Fix for textarea not refeshing (change focus)
} }
Color buttonBackgroundColor = commandInfoAttr.ButtonColor; Color buttonBackgroundColor = command.GetButtonColor();
Color summaryBackgroundColor = Color.white; Color summaryBackgroundColor = Color.white;
if (selected) if (selected)

10
Assets/Fungus/FungusScript/Scripts/FungusCommand.cs

@ -11,19 +11,16 @@ namespace Fungus.Script
public class CommandInfoAttribute : Attribute public class CommandInfoAttribute : Attribute
{ {
public CommandInfoAttribute(string category, string commandName, string helpText, byte red, byte green, byte blue) public CommandInfoAttribute(string category, string commandName, string helpText)
{ {
this.Category = category; this.Category = category;
this.CommandName = commandName; this.CommandName = commandName;
this.HelpText = helpText; this.HelpText = helpText;
this.ButtonColor = new Color32(red, green, blue, 255);
} }
public string Category { get; set; } public string Category { get; set; }
public string CommandName { get; set; } public string CommandName { get; set; }
public string HelpText { get; set; } public string HelpText { get; set; }
public Color ButtonColor { get; set; }
public Color IndentOffset { get; set; }
} }
[RequireComponent(typeof(Sequence))] [RequireComponent(typeof(Sequence))]
@ -142,6 +139,11 @@ namespace Fungus.Script
{ {
return 0; return 0;
} }
public virtual Color GetButtonColor()
{
return Color.white;
}
} }
} }

8
Assets/Fungus/Sprite/Commands/FadeSprite.cs

@ -6,8 +6,7 @@ namespace Fungus.Script
{ {
[CommandInfo("Sprite", [CommandInfo("Sprite",
"Fade Sprite", "Fade Sprite",
"Fades a sprite to a target color over a period of time.", "Fades a sprite to a target color over a period of time.")]
212, 178, 211)]
public class FadeSprite : FungusCommand public class FadeSprite : FungusCommand
{ {
public SpriteRenderer spriteRenderer; public SpriteRenderer spriteRenderer;
@ -47,6 +46,11 @@ namespace Fungus.Script
return spriteRenderer.name + " to " + targetColor.ToString(); return spriteRenderer.name + " to " + targetColor.ToString();
} }
public override Color GetButtonColor()
{
return new Color32(221, 184, 169, 255);
}
} }
} }
Loading…
Cancel
Save