You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
854 B
47 lines
854 B
using UnityEngine; |
|
using UnityEngine.UI; |
|
using System; |
|
using System.Collections; |
|
|
|
namespace Fungus |
|
{ |
|
[CommandInfo("Scripting", |
|
"Set Text", |
|
"Sets the text property on a UI Text object.")] |
|
|
|
[AddComponentMenu("")] |
|
public class SetText : Command |
|
{ |
|
[Tooltip("Text object to set text on")] |
|
public Text textObject; |
|
|
|
[Tooltip("String value to assign to the text object")] |
|
public StringData stringData; |
|
|
|
public override void OnEnter() |
|
{ |
|
if (textObject != null) |
|
{ |
|
textObject.text = stringData.Value; |
|
} |
|
|
|
Continue(); |
|
} |
|
|
|
public override string GetSummary() |
|
{ |
|
if (textObject == null) |
|
{ |
|
return "Error: No text object selected"; |
|
} |
|
|
|
return textObject.name + " : " + stringData.Value; |
|
} |
|
|
|
public override Color GetButtonColor() |
|
{ |
|
return new Color32(235, 191, 217, 255); |
|
} |
|
} |
|
|
|
} |