public void Start() { if (IsPlaying) { return; } IsPlaying = true; Elapsed = 0.0f; bool valid = Validate(); if (!valid) { Kill(); return; } if (firstTime) { firstTime = false; initialValue = currValueGetter.Invoke(); finalValue = finalValueGetter.Invoke(); firstTimeInitialValue = initialValue; firstTimeFinalValue = finalValue; } CompleteIfInstant(); }
public virtual void SetValue(object value) { if (!CheckInstanceIsValid()) { return; } CheckValueType(value); object obj = Getter.Invoke(GetInternalStrongInstance(), null); value = CheckRange((T)value); if (obj == value) { return; } try { Setter.Invoke(GetInternalStrongInstance(), new object[1] { value }); if (this.ValueChanged != null) { this.ValueChanged(obj, value); } } catch (Exception inner) { throw new TweakableSetException(base.Name, value.ToString(), inner); } }
public override void Get(object source, BinaryWriter writer) { List <T> list = Getter.Invoke(source); if (list == null) { if (!defaultNull) { writer.Write((byte)0); } return; } if (list.Count == 0) { if (defaultNull) { writer.Write((byte)1); } return; } for (int i = 0; i < list.Count; i++) { DatabaseManager.SaveSubobject(list[i], writer); } }
public override void Get(object source, BinaryWriter writer) { int currentValue = Getter.Invoke(source); if (!hasDefault || defaultInt != currentValue) { writer.Write(Getter.Invoke(source)); } }
public override void Get(object source, BinaryWriter writer) { T value = Getter.Invoke(source); if (!hasDefault || !defaultValue.Equals(value)) { writer.Write(value.ToInt32(null)); } }
public override void Get(object source, BinaryWriter writer) { bool currentValue = Getter.Invoke(source); if (currentValue != defaultValue) { writer.Write(currentValue); } }
public override void Get(object source, BinaryWriter writer) { string str = Getter.Invoke(source); if (str != null && str != defaultValue) { writer.Write(str); } }
public override void Get(object source, BinaryWriter writer) { ISubobject child = Getter.Invoke(source); if (child == null) { return; } DatabaseManager.SaveSubobject(child, writer); }
public override void Get(object source, BinaryWriter writer) { T list = Getter.Invoke(source); int[] saveIDs = list.GetIDs(); foreach (int i in saveIDs) { writer.Write(i); } }
/// <summary> /// Gets the value of the property. Null if the property cannot be read. /// </summary> /// <param name="viewModel">Instance of <see cref="BaseViewModel" /> from which to read data from.</param> /// <returns>Instance of the value.</returns> public object GetValue(BaseViewModel viewModel) { if (viewModel == null) { throw new ArgumentNullException(nameof(viewModel)); } var value = Getter.Invoke(viewModel); return(value); }
public override void Get(object source, BinaryWriter writer) { int[] array = Getter.Invoke(source); if (array != null) { foreach (int i in array) { writer.Write(i); } } }
private static IEnumerator To(Getter <float> getter, Setter <float> setter, float endValue, float duration) { float f = getter.Invoke(); while (f != endValue) { yield return(null); f = Mathf.MoveTowards(f, endValue, Time.deltaTime / duration); setter.Invoke(f); } }
public override void Get(object source, BinaryWriter writer) { T reference = Getter.Invoke(source); if (reference == null) { return; } int saveID = reference.GetSaveID(); writer.Write(saveID); }
public virtual object GetValue() { if (CheckInstanceIsValid()) { try { return(Getter.Invoke(GetInternalStrongInstance(), null)); } catch (Exception inner) { throw new TweakableGetException(base.Name, inner); } } return(null); }
public override Object GetValue(Object obj) { if (Getter == null) { return(null); } try { return(Getter.Invoke(obj, EMPTY_ARGS)); } catch (Exception e) { throw RuntimeExceptionUtil.Mask(e, "Error occured while calling '" + Getter + "' on object '" + obj + "' of type '" + obj.GetType().ToString() + "'"); } }
public override GameObject GetGui(GameObject prefab) { var current = GameObject.Instantiate(prefab); current.name = Name; current.transform.Find("Title").GetComponent <Text>().text = Name; Slider currentSlider = current.GetComponentInChildren <Slider>(); currentSlider.minValue = Minimum; currentSlider.maxValue = Maximum; currentSlider.value = Getter.Invoke(); Text currentValue = current.transform.Find("CurrentValue").GetComponent <Text>(); currentValue.text = String.Format(DisplayFormat, Getter.Invoke()); currentSlider.onValueChanged.AddListener(delegate { Slider localSlider = currentSlider; Text localCurrentValue = currentValue; Setter.Invoke(localSlider.value); localCurrentValue.text = String.Format(DisplayFormat, Getter.Invoke()); }); Button resetButton = current.transform.Find("ResetButton").GetComponent <Button>(); resetButton.onClick.AddListener(delegate { Slider localSlider = currentSlider; Text localCurrentValue = currentValue; localSlider.value = Default; localCurrentValue.text = Default.ToString(); Setter.Invoke(Default); }); return(current); }
public virtual object GetValue(object target, IContainer container) { return(Getter.Invoke(target, container)); }
// -------------------------------------------------------------------------------------------------------------------------- public override object GetPropData() { return(Getter.Invoke(Source, null)); }
public object Get(T context) => Getter.Invoke(context);
/// <summary> /// Gets the value of this property, for a given target object /// </summary> public dynamic GetValue(object target) => Getter?.Invoke(target);
public TValue GetValue <TValue>(MethodParameterValue[] parameters) { return((TValue)Getter?.Invoke(parameters)); }
public override GameObject GetGui(GameObject prefab) { var current = GameObject.Instantiate(prefab); current.name = Name; current.transform.Find("Title").GetComponent <Text>().text = Name; Slider redSlider = current.transform.Find("Colors/Red/RedSlider").GetComponent <Slider>(); Slider greenSlider = current.transform.Find("Colors/Green/GreenSlider").GetComponent <Slider>(); Slider blueSlider = current.transform.Find("Colors/Blue/BlueSlider").GetComponent <Slider>(); Text redValue = current.transform.Find("Colors/Red/RedValue").GetComponent <Text>(); Text greenValue = current.transform.Find("Colors/Green/GreenValue").GetComponent <Text>(); Text blueValue = current.transform.Find("Colors/Blue/BlueValue").GetComponent <Text>(); Image colorPreview = current.transform.Find("ColorPreview").GetComponent <Image>(); UnityAction <float> sliderUpdate = delegate { Color toSet = new Color(redSlider.value, greenSlider.value, blueSlider.value); Setter.Invoke(toSet); redValue.text = Mathf.FloorToInt(redSlider.value * 255).ToString(); greenValue.text = Mathf.FloorToInt(greenSlider.value * 255).ToString(); blueValue.text = Mathf.FloorToInt(blueSlider.value * 255).ToString(); colorPreview.color = toSet; }; redSlider.onValueChanged.AddListener(sliderUpdate); greenSlider.onValueChanged.AddListener(sliderUpdate); blueSlider.onValueChanged.AddListener(sliderUpdate); redSlider.value = Getter.Invoke().r; greenSlider.value = Getter.Invoke().g; blueSlider.value = Getter.Invoke().b; redValue.text = Mathf.FloorToInt(redSlider.value * 255).ToString(); greenValue.text = Mathf.FloorToInt(greenSlider.value * 255).ToString(); blueValue.text = Mathf.FloorToInt(blueSlider.value * 255).ToString(); colorPreview.color = Getter.Invoke(); Button resetButton = current.transform.Find("ResetButton").GetComponent <Button>(); resetButton.onClick.AddListener(delegate { redSlider.value = Default.r; greenSlider.value = Default.g; blueSlider.value = Default.b; redValue.text = Default.r.ToString(); greenValue.text = Default.g.ToString(); blueValue.text = Default.b.ToString(); colorPreview.color = Default; Setter.Invoke(Default); }); return(current); }
public override void Get(object source, BinaryWriter writer) { writer.Write(Getter.Invoke(source)); }
public object GetValue(object source) { return(Getter.Invoke(source, null)); }
protected override void GetInitialValueFromSubject() { OriginValue = Getter?.Invoke() ?? Color.black; }
/// <summary> /// Gets the value of this property, for a given target object /// </summary> public virtual object GetValue(object target) => Getter?.Invoke(target);
protected override void GetInitialValueFromSubject() { OriginValue = Getter?.Invoke() ?? Quaternion.identity; }
protected override void GetInitialValueFromSubject() { OriginValue = Getter?.Invoke() ?? Vector2.zero; }
public object GetValue(object parent) { return(Getter.Invoke(parent, null)); }
public object GetValue(object target) { object value = Getter.Invoke(target, null); return(value); }