Browse Source

Edited property names and descriptions on Set Sprite and Set UI Image commands

master
Chris Gregan 6 years ago
parent
commit
c8526d55da
  1. 26
      Assets/Fungus/Scripts/Commands/SetSprite.cs
  2. 32
      Assets/Fungus/Scripts/Commands/SetUIImage.cs

26
Assets/Fungus/Scripts/Commands/SetSprite.cs

@ -13,24 +13,24 @@ namespace Fungus
/// </summary>
[CommandInfo("Sprite",
"Set Sprite",
"Changes the sprite of a SpriteRenderer.")]
"Changes the sprite property of a list of Sprite Renderers.")]
[AddComponentMenu("")]
public class SetSprite : Command
{
[Tooltip("List of sprites to set the sprite property on")]
[SerializeField] protected List<SpriteRenderer> targetSprites = new List<SpriteRenderer>();
[SerializeField] protected List<SpriteRenderer> spriteRenderers = new List<SpriteRenderer>();
[Tooltip("The sprite set on the target sprites")]
[SerializeField] protected Sprite spriteRendererSprite;
[Tooltip("The sprite set on the target sprite renderers")]
[SerializeField] protected Sprite sprite;
#region Public members
public override void OnEnter()
{
for (int i = 0; i < targetSprites.Count; i++)
for (int i = 0; i < spriteRenderers.Count; i++)
{
var spriteRenderer = targetSprites[i];
spriteRenderer.sprite = spriteRendererSprite;
var spriteRenderer = spriteRenderers[i];
spriteRenderer.sprite = sprite;
}
Continue();
@ -39,9 +39,9 @@ namespace Fungus
public override string GetSummary()
{
string summary = "";
for (int i = 0; i < targetSprites.Count; i++)
for (int i = 0; i < spriteRenderers.Count; i++)
{
var spriteRenderer = targetSprites[i];
var spriteRenderer = spriteRenderers[i];
if (spriteRenderer == null)
{
continue;
@ -55,10 +55,10 @@ namespace Fungus
if (summary.Length == 0)
{
return "Error: No cursor sprite selected";
return "Error: No sprite selected";
}
return summary + " = " + spriteRendererSprite;
return summary + " = " + sprite;
}
public override Color GetButtonColor()
@ -68,7 +68,7 @@ namespace Fungus
public override bool IsReorderableArray(string propertyName)
{
if (propertyName == "targetSprites")
if (propertyName == "spriteRenderers")
{
return true;
}
@ -79,7 +79,7 @@ namespace Fungus
public override void OnCommandAdded(Block parentBlock)
{
// Add a default empty entry
targetSprites.Add(null);
spriteRenderers.Add(null);
}
#endregion

32
Assets/Fungus/Scripts/Commands/SetUIImage.cs

@ -8,28 +8,28 @@ using UnityEngine.UI;
namespace Fungus
{
/// <summary>
/// Changes the Image on a UI-element.
/// Changes the Image property on a UI element.
/// </summary>
[CommandInfo("UI",
"Set UI-Image",
"Changes the Image of a UI-Element.")]
"Set UI Image",
"Changes the Image property of a list of UI Images.")]
[AddComponentMenu("")]
public class SetUIImage : Command
{
[Tooltip("List of UI-objects to set the image property on")]
[SerializeField] protected List<Image> targetImages = new List<Image>();
[Tooltip("List of UI Images to set the source image property on")]
[SerializeField] protected List<Image> images = new List<Image>();
[Tooltip("The sprite set on the target Image")]
[SerializeField] protected Sprite imageSprite;
[Tooltip("The sprite set on the source image property")]
[SerializeField] protected Sprite sprite;
#region Public members
public override void OnEnter()
{
for (int i = 0; i < targetImages.Count; i++)
for (int i = 0; i < images.Count; i++)
{
var targetImage = targetImages[i];
targetImage.sprite = imageSprite;
var image = images[i];
image.sprite = sprite;
}
Continue();
@ -38,9 +38,9 @@ namespace Fungus
public override string GetSummary()
{
string summary = "";
for (int i = 0; i < targetImages.Count; i++)
for (int i = 0; i < images.Count; i++)
{
var targetImage = targetImages[i];
var targetImage = images[i];
if (targetImage == null)
{
continue;
@ -54,10 +54,10 @@ namespace Fungus
if (summary.Length == 0)
{
return "Error: No cursor sprite selected";
return "Error: No sprite selected";
}
return summary + " = " + imageSprite;
return summary + " = " + sprite;
}
public override Color GetButtonColor()
@ -67,7 +67,7 @@ namespace Fungus
public override bool IsReorderableArray(string propertyName)
{
if (propertyName == "targetImages")
if (propertyName == "images")
{
return true;
}
@ -78,7 +78,7 @@ namespace Fungus
public override void OnCommandAdded(Block parentBlock)
{
// Add a default empty entry
targetImages.Add(null);
images.Add(null);
}
#endregion

Loading…
Cancel
Save