public static AnimationSequence Set <T>(this AnimationSequence seq, ISettable <T> settable, T value) { seq.Append(new SetTask <T> { settable = settable, value = value }); return(seq); }
/*public void AddProperty<T>(T property) where T : RecordableProperty * { * if (GetProperty<T>() != null) { * Debug.Log("Cannot add an already existing property"); * return; * } * properties.Add(property); * }*/ public void SetToObject(GameObject obj) { foreach (RecordableProperty property in Properties) { if (property is ISettable) { ISettable settable = property as ISettable; settable.SetToObject(obj); } } }
internal static bool TryMarshalGet <TTarget, TEnum>(ISettable source, out TTarget target, TEnum currentEnum, TEnum comparisonEnum) where TTarget : ISettable, new() { target = GetDefault <TTarget>(); if ((int)(object)currentEnum == (int)(object)comparisonEnum) { return(TryConvert(source, out target)); } return(false); }
private void SetState(string state, ISettable device) { try { _logger.LogInformation("Switch {UniqueId} {Name} set to {Status}", device.UniqueId, device.Name, state); device.SetState(state, _lupusecService); } catch (Exception ex) { _logger.LogError(ex, "An error occured while setting switch {UniqueId} {Name} to {Status}", device.UniqueId, device.Name, state); } }
internal static bool TryMarshalSet <TTarget, TEnum>(ref TTarget target, ISettable source, ref TEnum currentEnum, TEnum comparisonEnum, IDisposable disposable = null) where TTarget : ISettable, new() { if (source != null) { TryMarshalDispose(ref disposable); if (TryConvert(source, out target)) { currentEnum = comparisonEnum; return(true); } } return(false); }
public async Task SetInSim(string item, JsonElement value) { ExtendedSimConnect?simConnect = holder.SimConnect; if (simConnect == null) { _logger.LogError($"Can't set {item} to {value}; no SimConnection"); // return; } ISettable rawSettable = settables[item]; var typedValue = JsonSerializer.Deserialize(value.GetRawText(), rawSettable.GetValueType()); _logger.LogDebug($"Setting {item} to {typedValue}"); rawSettable.SetInSim(simConnect !, typedValue); await Task.CompletedTask; }
protected SettableTask(ISettable <T> target, float duration, int esType) : base(target, duration, esType) { }
public ColorSettableTask(ISettable <Color> target, float duration, int esType) : base(target, duration, esType) { }
public Vector2SettableTask(ISettable <Vector2> target, float duration, int esType) : base(target, duration, esType) { }
public override void OutputIL(NitroIL into) { Type type2 = Input1.OutputType(out Input1); // Is it something which is being ["indexed"]? May apply to properties too. bool indexOperation = (Input0.GetType() == typeof(IndexOperation)); bool propertyOperation = (Input0.GetType() == typeof(PropertyOperation)); if (indexOperation || propertyOperation) { // Hook up what we will be setting for the index to handle if it needs to. // Note that the object will not change as we have already run it's OutputType call above. ((Operation)Input0).Input0 = Input1; } // Update input0 by computing the type it outputs: Type type1 = Input0.OutputType(out Input0); object value = Input0.ActiveValue(); if (value.GetType() != typeof(LocalVariable)) { // Local vars can change type so this doesn't affect them. if (type1 == null) { Error("Can't set to nothing."); } if (type2 == null) { if (type1.IsValueType) { Error("Can't set " + type1 + " to null because it's a value type."); } } else if (!type1.IsAssignableFrom(type2)) { Error("Can't implicity convert " + type2 + " to " + type1 + "."); } } if (Types.IsTypeOf(value, typeof(ISettable))) { ISettable Value = (ISettable)value; Value.OutputTarget(into); Input1.OutputIL(into); Value.OutputSet(into, type2); if (Output) { // Daisy chaining these sets. Input0.OutputIL(into); } } else if (indexOperation && value.GetType() == typeof(MethodOperation)) { // This is ok! We've called something like obj["hello"]=input1; // Just output the method call: Input0.OutputIL(into); if (Output) { Error("Can't daisy chain with an indexer. Place your indexed object furthest left."); } } else if (propertyOperation && value.GetType() == typeof(MethodOperation) && ((MethodOperation)value).MethodName == "set_Item") { // This is also ok - we've done something like object.property=value; and it mapped to object["property"]=value; // Just output the method call: Input0.OutputIL(into); if (Output) { Error("Can't daisy chain with a property set here. Place your indexed object furthest left."); } } else { Error("Attempted to set to something (a " + value.GetType() + ") that isn't a variable."); } }
public FloatSettableTask(ISettable <float> target, float duration, int esType) : base(target, duration, esType) { }
public StringSettableTask(ISettable <string> target, float duration, int esType) : base(target, duration, esType) { }
public TrackingLabel(ISettable trackedControl) { TrackedControl = trackedControl; }