Browse Source

Command colours are specified in a virtual function

master
chrisgregan 10 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",
"Play Music",
"Plays game music. If any game music is already playing, it is stopped. Music continues playing across scene loads.",
242, 209, 176)]
"Plays game music. If any game music is already playing, it is stopped. Music continues playing across scene loads.")]
public class PlayMusic : FungusCommand
{
public AudioClip musicClip;
@ -31,6 +30,11 @@ namespace Fungus.Script
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",
"Play Sound",
"Plays a sound effect. Multiple sound effects can play at the same time.",
242, 209, 176)]
"Plays a sound effect. Multiple sound effects can play at the same time.")]
public class PlaySound : FungusCommand
{
public AudioClip soundClip;
@ -34,6 +33,11 @@ namespace Fungus.Script
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",
"Set Music Volume",
"Sets the game music volume level.",
242, 209, 176)]
"Sets the game music volume level.")]
public class SetMusicVolume : FungusCommand
{
[Range(0,1)]
@ -30,6 +29,11 @@ namespace Fungus.Script
{
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",
"Stop Music",
"Stops the currently playing game music.",
242, 209, 176)]
"Stops the currently playing game music.")]
public class StopMusic : FungusCommand
{
public override void OnEnter()
@ -19,6 +18,11 @@ namespace Fungus.Script
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",
"Fade To View",
"Fades the camera out and in again at a location specified by a View object.",
216, 228, 170)]
"Fades the camera out and in again at a location specified by a View object.")]
public class FadeToView : FungusCommand
{
public float duration;
@ -65,6 +64,11 @@ namespace Fungus.Script
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",
"Move To View",
"Moves the camera to a location specified by a View object.",
216, 228, 170)]
"Moves the camera to a location specified by a View object.")]
public class MoveToView : FungusCommand
{
public float duration;
@ -52,6 +51,11 @@ namespace Fungus.Script
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",
"Add Option",
"Adds an option for the player to select, displayed by the next Say command.",
184, 210, 235)]
"Adds an option for the player to select, displayed by the next Say command.")]
public class AddOption : FungusCommand
{
public string optionText;
@ -56,6 +55,11 @@ namespace Fungus.Script
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",
"Choose",
"Presents a list of options for the player to choose from, with an optional timeout. Add options using preceding AddOption commands.",
184, 210, 235)]
"Presents a list of options for the player to choose from, with an optional timeout. Add options using preceding AddOption commands.")]
public class Choose : FungusCommand
{
public ChooseDialog dialog;
@ -164,6 +163,11 @@ namespace Fungus.Script
GUILayout.FlexibleSpace();
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",
"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.",
184, 210, 235)]
"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.")]
public class Say : FungusCommand
{
public SayDialog dialog;
@ -110,6 +109,11 @@ namespace Fungus.Script
GUILayout.FlexibleSpace();
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",
"Call",
"Execute another sequence.",
255, 255, 255)]
"Execute another sequence.")]
public class Call : FungusCommand
{
public Sequence targetSequence;
@ -41,6 +40,11 @@ namespace Fungus.Script
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",
"Else",
"Marks the start of a sequence block to be executed when the preceding If statement is false.",
253, 253, 150)]
"Marks the start of a sequence block to be executed when the preceding If statement is false.")]
public class Else : FungusCommand
{
public override void OnEnter()
@ -47,6 +46,11 @@ namespace Fungus.Script
{
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",
"EndIf",
"Marks the end of an If statement block.",
253, 253, 150)]
"Marks the end of an If statement block.")]
public class EndIf : FungusCommand
{
public override void OnEnter()
@ -19,6 +18,11 @@ namespace Fungus.Script
{
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",
"If",
"If the test expression is true, execute the following block of commands.",
253, 253, 150)]
"If the test expression is true, execute the following block of commands.")]
public class If : FungusCommand
{
public FungusVariable variable;
@ -222,6 +221,11 @@ namespace Fungus.Script
{
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",
"Load Globals",
"Loads a set of global variables previously saved using the SaveGlobals command.",
255, 255, 255)]
"Loads a set of global variables previously saved using the SaveGlobals command.")]
public class LoadGlobals : FungusCommand
{
public string saveName = "";
@ -21,6 +20,11 @@ namespace Fungus.Script
{
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 " +
"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." +
"The scene to be loaded must be added to the scene list in Build Settings.",
255, 255, 255)]
"The scene to be loaded must be added to the scene list in Build Settings.")]
public class LoadScene : FungusCommand
{
public string sceneName = "";
@ -31,6 +30,11 @@ namespace Fungus.Script
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",
"Save Globals",
"Saves all current global variables to be loaded again later using the LoadGlobals command. This provides a basic save game system.",
255, 255, 255)]
"Saves all current global variables to be loaded again later using the LoadGlobals command. This provides a basic save game system.")]
public class SaveGlobals : FungusCommand
{
public string saveName = "";
@ -21,6 +20,11 @@ namespace Fungus.Script
{
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",
"Set",
"Sets a variable to a new value using simple arithmetic operations. The value can be a constant or another variable.",
255, 255, 255)]
"Sets a variable to a new value using simple arithmetic operations. The value can be a constant or another variable.")]
public class Set : FungusCommand
{
public enum SetOperator
@ -178,6 +177,11 @@ namespace Fungus.Script
{
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",
"Wait",
"Waits for period of time before executing the next command in the sequence.",
255, 255, 255)]
"Waits for period of time before executing the next command in the sequence.")]
public class Wait : FungusCommand
{
public float duration = 1;
@ -26,6 +25,11 @@ namespace Fungus.Script
{
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);
if (t.enabled)
{
GUI.backgroundColor = commandInfoAttr.ButtonColor;
GUI.backgroundColor = t.GetButtonColor();
}
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)
}
Color buttonBackgroundColor = commandInfoAttr.ButtonColor;
Color buttonBackgroundColor = command.GetButtonColor();
Color summaryBackgroundColor = Color.white;
if (selected)

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

@ -11,19 +11,16 @@ namespace Fungus.Script
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.CommandName = commandName;
this.HelpText = helpText;
this.ButtonColor = new Color32(red, green, blue, 255);
}
public string Category { get; set; }
public string CommandName { get; set; }
public string HelpText { get; set; }
public Color ButtonColor { get; set; }
public Color IndentOffset { get; set; }
}
[RequireComponent(typeof(Sequence))]
@ -142,6 +139,11 @@ namespace Fungus.Script
{
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",
"Fade Sprite",
"Fades a sprite to a target color over a period of time.",
212, 178, 211)]
"Fades a sprite to a target color over a period of time.")]
public class FadeSprite : FungusCommand
{
public SpriteRenderer spriteRenderer;
@ -47,6 +46,11 @@ namespace Fungus.Script
return spriteRenderer.name + " to " + targetColor.ToString();
}
public override Color GetButtonColor()
{
return new Color32(221, 184, 169, 255);
}
}
}
Loading…
Cancel
Save