Browse Source

Added Set Slider Value command #297

master
chrisgregan 9 years ago
parent
commit
98ecbf19c2
  1. 42
      Assets/Fungus/UI/Scripts/Commands/SetSliderValue.cs
  2. 12
      Assets/Fungus/UI/Scripts/Commands/SetSliderValue.cs.meta
  3. 2
      Assets/Tests/UI/TextTests.unity

42
Assets/Fungus/UI/Scripts/Commands/SetSliderValue.cs

@ -0,0 +1,42 @@
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
namespace Fungus
{
[CommandInfo("UI",
"Set Slider Value",
"Sets the value property of a slider object")]
public class SetSliderValue : Command
{
[Tooltip("Target slider object to set the value on")]
public Slider slider;
[Tooltip("Float value to set the slider value to.")]
public FloatData value;
public override void OnEnter()
{
slider.value = value;
Continue();
}
public override Color GetButtonColor()
{
return new Color32(235, 191, 217, 255);
}
public override string GetSummary()
{
if (slider == null)
{
return "Error: Slider object not selected";
}
return slider.name + " = " + value.GetDescription();
}
}
}

12
Assets/Fungus/UI/Scripts/Commands/SetSliderValue.cs.meta

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 2d82f2f1b848347c19a48abd65541523
timeCreated: 1444656241
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

2
Assets/Tests/UI/TextTests.unity

@ -940,7 +940,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!114 &396899563
MonoBehaviour:
m_ObjectHideFlags: 0

Loading…
Cancel
Save