public Property <T> RegisterProperty <T>(String propertyName) where T : struct { IUpdateable property; if (typeof(T) == typeof(Boolean)) { property = new BoolProperty(this, m_Animator, propertyName); } else if (typeof(T) == typeof(Int32)) { property = new IntProperty(this, m_Animator, propertyName); } else if (typeof(T) == typeof(Single)) { property = new FloatProperty(this, m_Animator, propertyName); } else if (typeof(T) == typeof(Vector3)) { property = new Vector3Property(this, m_Animator, propertyName); } else { if (typeof(T) != typeof(Quaternion)) { throw new NotSupportedException("'" + typeof(T).Name + "' Type not supported!"); } property = new QuaternionProperty(this, m_Animator, propertyName); } m_Properties.Add(propertyName, property); return((Property <T>)property); }
public SFXNav_LadderNode(int idx, float x, float y, IMEPackage p, PathingGraphEditor grapheditor) : base(idx, p, grapheditor) { string s = export.ObjectName; // = getType(s); float w = 50; float h = 50; BoolProperty bTopNode = export.GetProperty <BoolProperty>("bTopNode"); PointF[] shapetouse = laddertopshape; if (bTopNode == null || bTopNode.Value == false) { shapetouse = ladderbottomshape; } shape = PPath.CreatePolygon(shapetouse); outlinePen = new Pen(color); shape.Pen = outlinePen; shape.Brush = pathfindingNodeBrush; shape.Pickable = false; this.AddChild(shape); this.Bounds = new RectangleF(0, 0, w, h); val = new SText(idx.ToString()); val.Pickable = false; val.TextAlignment = StringAlignment.Center; val.X = w / 2 - val.Width / 2; val.Y = h / 2 - val.Height / 2; this.AddChild(val); var props = export.GetProperties(); this.TranslateBy(x, y); }
/// <inheritdoc /> public override BlendConstraintJob Create(Animator animator, ref T data, Component component) { var job = new BlendConstraintJob(); job.driven = ReadWriteTransformHandle.Bind(animator, data.constrainedObject); job.sourceA = ReadOnlyTransformHandle.Bind(animator, data.sourceObjectA); job.sourceB = ReadOnlyTransformHandle.Bind(animator, data.sourceObjectB); job.sourceAOffset = job.sourceBOffset = AffineTransform.identity; if (data.maintainPositionOffsets) { var drivenPos = data.constrainedObject.position; job.sourceAOffset.translation = drivenPos - data.sourceObjectA.position; job.sourceBOffset.translation = drivenPos - data.sourceObjectB.position; } if (data.maintainRotationOffsets) { var drivenRot = data.constrainedObject.rotation; job.sourceAOffset.rotation = Quaternion.Inverse(data.sourceObjectA.rotation) * drivenRot; job.sourceBOffset.rotation = Quaternion.Inverse(data.sourceObjectB.rotation) * drivenRot; } job.blendPosition = BoolProperty.Bind(animator, component, data.blendPositionBoolProperty); job.blendRotation = BoolProperty.Bind(animator, component, data.blendRotationBoolProperty); job.positionWeight = FloatProperty.Bind(animator, component, data.positionWeightFloatProperty); job.rotationWeight = FloatProperty.Bind(animator, component, data.rotationWeightFloatProperty); return(job); }
public CProperty GetProperty() { // First, read the length and value of the following property name string int propNameLength = GetInt(); string propName = GetString(propNameLength); SkipPadding(); // If this is a "None" ending type property, just return - nothing else will follow this if (propName == "None") { return(null); } // Get the property type string int typeNameLength = GetInt(); string typeName = GetString(typeNameLength); SkipPadding(); // Skip past the size of the following data and its padding GetInt(); SkipPadding(); // Finally, read the data based on the property type CProperty returnProperty; switch (typeName) { case "ArrayProperty": returnProperty = new ArrayProperty(propName, this); break; case "IntProperty": returnProperty = new IntProperty(propName, this); break; case "StrProperty": returnProperty = new StrProperty(propName, this); break; case "NameProperty": returnProperty = new NameProperty(propName, this); break; case "StructProperty": returnProperty = new StructProperty(propName, this, _outputter); break; case "BoolProperty": returnProperty = new BoolProperty(propName, this); break; default: throw new Exception($"Unexpected property type: {typeName}"); } returnProperty.ParseData(); return(returnProperty); }
private void duplicateGuidList_SelectionChanged(object sender, EventArgs e) { if (duplicatesListBox.SelectedIndex >= 0) { UnrealGUID guid = duplicateGuids[duplicatesListBox.SelectedIndex]; aLabel.Text = "A: " + guid.A; bLabel.Text = "B: " + guid.B; cLabel.Text = "C: " + guid.C; dLabel.Text = "D: " + guid.D; generateButton.Enabled = true; BoolProperty bHasCrossLevelPaths = guid.export.GetProperty <BoolProperty>("bHasCrossLevelPaths"); if (bHasCrossLevelPaths != null && bHasCrossLevelPaths == true) { crossLevelPathsLabel.Visible = true; } else { crossLevelPathsLabel.Visible = false; } } else { generateButton.Enabled = false; aLabel.Text = "A: "; bLabel.Text = "B: "; cLabel.Text = "C: "; dLabel.Text = "D: "; crossLevelPathsLabel.Visible = false; } }
public override int GetHashCode() { unchecked { // Choose large primes to avoid hashing collisions const int HashingBase = (int)2166136261; const int HashingMultiplier = 16777619; int hash = HashingBase; hash = (hash * HashingMultiplier) ^ ByteProperty.GetHashCode(); hash = (hash * HashingMultiplier) ^ ShortByteProperty.GetHashCode(); hash = (hash * HashingMultiplier) ^ IntProperty.GetHashCode(); hash = (hash * HashingMultiplier) ^ UIntProperty.GetHashCode(); hash = (hash * HashingMultiplier) ^ ShortProperty.GetHashCode(); hash = (hash * HashingMultiplier) ^ UShortProperty.GetHashCode(); hash = (hash * HashingMultiplier) ^ LongProperty.GetHashCode(); hash = (hash * HashingMultiplier) ^ ULongProperty.GetHashCode(); hash = (hash * HashingMultiplier) ^ FloatPropertyOne.GetHashCode(); hash = (hash * HashingMultiplier) ^ FloatPropertyTwo.GetHashCode(); hash = (hash * HashingMultiplier) ^ DoublePropertyOne.GetHashCode(); hash = (hash * HashingMultiplier) ^ DoublePropertyTwo.GetHashCode(); hash = (hash * HashingMultiplier) ^ CharProperty.GetHashCode(); hash = (hash * HashingMultiplier) ^ BoolProperty.GetHashCode(); hash = (hash * HashingMultiplier) ^ DecimalProperty.GetHashCode(); return(hash); } }
public void SetBool(string tag, bool val) { value[tag] = new BoolProperty() { value = val }; }
private void CheckBox_Click(object sender, RoutedEventArgs e) { if (this.DataContext is BoolProperty) { BoolProperty prop = this.DataContext as BoolProperty; prop.Value = checkboxBool.IsChecked.GetValueOrDefault(false); } }
public void Boolをモデルに読み込むことができる() { var boolModel = new BoolProperty(); Load(boolModel, true); boolModel.BoolValue.Value.Is(true); }
// Generate the properties for the persian turbine void GenerateProperties() { controller = GetComponent <PropertiesController>(); // Wall wallProperty = new BoolProperty(wallPropertyName, wallIsOn, GetType().GetMethod("WallPower"), GetType().GetMethod("CreateWall"), GetType().GetMethod("WallCost"), null, this); controller.specificProperties.boolProperty.Add(wallProperty); }
public static BoolProperty GetProperty(StringBuilder name, ITerminalProperty <bool> property, PropertyBlock block) { BoolProperty prop = block.boolPropPool.Get(); prop.SetProperty(name, property, block); return(prop); }
public void ModifyBoolSame() { BoolProperty prop = new BoolProperty("test", true); AttachEvents(prop); prop.Value = true; Assert.AreEqual(EventFlags.None, _eventsFired); }
internal bool _v_BoolProperty(Property obj) { BoolProperty bool_prop = obj as BoolProperty; if (!_IsValid((byte)bool_prop.Value, 0, 1)) { _AddError(obj, string.Format("0 <= {0} <= 1", bool_prop.Value)); return(false); } return(true); }
public override PPath GetDefaultShape() { BoolProperty bTopNode = export.GetProperty <BoolProperty>("bTopNode"); PointF[] shapetouse = ladderbottomshape; if (bTopNode?.Value == true) { shapetouse = laddertopshape; } return(PPath.CreatePolygon(shapetouse)); }
private static object UnpackBool(Property property) { BoolProperty p = property as BoolProperty; if (p != null) { return(p.Value); } return(null); }
public override int GetHashCode() { unchecked { var hashCode = (StringProperty != null ? StringProperty.GetHashCode() : 0); hashCode = (hashCode * 397) ^ IntProperty; hashCode = (hashCode * 397) ^ BoolProperty.GetHashCode(); hashCode = (hashCode * 397) ^ (ListOfSimpleTypes != null ? ListOfSimpleTypes.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (SimpleTypes != null ? SimpleTypes.GetHashCode() : 0); return(hashCode); } }
public override int GetHashCode() { unchecked { int hashCode = DateProperty.GetHashCode(); hashCode = (hashCode * 397) ^ DateOffsetProperty.GetHashCode(); hashCode = (hashCode * 397) ^ BoolProperty.GetHashCode(); hashCode = (hashCode * 397) ^ IntProperty; hashCode = (hashCode * 397) ^ StringProperty.GetHashCode(); return(hashCode); } }
public void OnBoolChangedTest() { bool isCalled = false; var boolProp = new BoolProperty(); var vm = new BoolViewModel(boolProp); vm.OnChanged.Subscribe(x => isCalled = true); vm.BoolValue.Value = true; isCalled.IsTrue(); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void AppendBoolProperty(ref CommandLineBuilder builder, Rule rule, BoolProperty property, bool value) { string switchPrefix = !string.IsNullOrWhiteSpace(property.SwitchPrefix) ? property.SwitchPrefix : rule.SwitchPrefix; if (value) { builder.AppendSwitch($"{switchPrefix}{property.Switch}"); } else if (!string.IsNullOrWhiteSpace(property.ReverseSwitch)) { builder.AppendSwitch($"{switchPrefix}{property.ReverseSwitch}"); } }
public static void RandBool(PropertyCollection props, string propname, bool createIfMissing) { var prop = props.GetProp <BoolProperty>(propname); if (prop == null && createIfMissing) { prop = new BoolProperty(false, propname); props.Add(prop); } if (prop != null) { prop.Value = ThreadSafeRandom.Next(2) == 1; } }
public bool Equals(TestResource other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } if (!DateProperty.Equals(other.DateProperty)) { return(false); } if (!DateOffsetProperty.Equals(other.DateOffsetProperty) && DateOffsetProperty != DateTimeOffset.MinValue && other.DateOffsetProperty != DateTimeOffset.MinValue) { return(false); } if (!BoolProperty.Equals(other.BoolProperty)) { return(false); } if (IntProperty != other.IntProperty) { return(false); } if (!string.Equals(StringProperty, other.StringProperty)) { return(false); } if (ReferenceEquals(Links, other.Links)) { return(true); } if (ReferenceEquals(null, other.Links)) { return(false); } if (ReferenceEquals(null, Links)) { return(false); } if (!Links.Equals(other.Links)) { return(false); } return(true); }
public void CopyConstructBool() { BoolProperty prop = new BoolProperty("test", true); AttachEvents(prop); BoolProperty prop2 = new BoolProperty("new", prop); Assert.AreEqual("new", prop2.Name); Assert.AreEqual(prop.Value, prop2.Value); // Make sure events were not cloned. prop2.Name = "test2"; prop2.Value = false; Assert.AreEqual(EventFlags.None, _eventsFired); }
public void BoolPropertyWrite() { using (var stream = new MemoryStream()) using (var writer = new BinaryWriter(stream)) { var prop = new BoolProperty(BoolTrueName) { Value = BoolTrueValue }; prop.Serialize(writer); Assert.AreEqual(0, prop.SerializedLength); CollectionAssert.AreEqual(BoolTrueBytes, stream.ToArray()); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Sets the property to value. /// </summary> /// ------------------------------------------------------------------------------------ private static void SetEnabled(string value, BoolProperty property) { if (string.IsNullOrEmpty(value)) { return; } try { property(bool.Parse(value)); } catch (FormatException) { // just ignore } }
public void ModifyBool() { BoolProperty prop = new BoolProperty("test", true); AttachEvents(prop); prop.ValueChanged += (s, e) => { Assert.AreSame(prop, s); Assert.AreEqual(false, prop.Value); }; prop.Value = false; Assert.AreEqual(false, prop.Value); Assert.AreEqual(EventFlags.ValueChanged | EventFlags.Modified, _eventsFired); }
public bool GetBoolProperty(string name, int index = 0, bool?defaultValue = null) { BoolProperty p = GetPropertyByName <BoolProperty>(name, index); if (p == null && defaultValue == null) { throw new Exception($"No values found for {name}:{index}, and no defaults were given!"); } else if (p == null) { return(defaultValue.Value); } else { return(p.value); } }
public void ParseBoolTrue() { Property prop = new BoolProperty("test", false); AttachEvents(prop); prop.ValueChanged += (s, e) => { Assert.AreSame(prop, s); Assert.AreEqual(true, ((BoolProperty)prop).Value); }; prop.Parse("true"); Assert.AreEqual(true, ((BoolProperty)prop).Value); Assert.AreEqual(EventFlags.ValueChanged | EventFlags.Modified, _eventsFired); }
public bool Equals(TestRequest other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(DateProperty.Equals(other.DateProperty) && DateOffsetProperty.Equals(other.DateOffsetProperty) && BoolProperty.Equals(other.BoolProperty) && IntProperty == other.IntProperty && string.Equals(StringProperty, other.StringProperty)); }
public void CloneBool() { Property prop = new BoolProperty("test", true); AttachEvents(prop); Property prop2 = prop.Clone() as Property; BoolProperty sp1 = prop as BoolProperty; BoolProperty sp2 = prop2 as BoolProperty; Assert.AreEqual(sp1.Name, sp2.Name); Assert.AreEqual(sp1.Value, sp2.Value); // Make sure events were not cloned. sp2.Name = "test2"; sp2.Value = false; Assert.AreEqual(EventFlags.None, _eventsFired); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void GenerateArgumentBool(ref CommandLineBuilder builder, Rule rule, BoolProperty property, object value) { if (value == null) { return; } else if (Nullable.GetUnderlyingType(value.GetType()) == typeof(bool) && (value as bool?).HasValue) { AppendBoolProperty(ref builder, rule, property, (value as bool?).Value); } else if (value.GetType() == typeof(bool)) { AppendBoolProperty(ref builder, rule, property, (bool)value); } else { throw new NotImplementedException($"{nameof(value)} is unexpected type: {value.GetType()}"); } }
public static void GetElementTypeString(BoolProperty obj, MethodReturnEventArgs<string> e) { e.Result = "bool"; PropertyActions.DecorateElementType(obj, e, true); }
public static Property Clone(Property target) { Property prop = null; int id = target.PropertyId; PropertyBag bag = target.Owner; switch (target.PropertyType) { case (int)PropertyKind.WispObject: prop = new WispProperty(target.Name, id, ((WispProperty)target).Value, bag); break; case (int)PropertyKind.WispArray: prop = new WispArrayProperty(target.Name, id, ((WispArrayProperty)target).Value, bag); break; case (int)PropertyKind.Int32: prop = new Int32Property(target.Name, id, ((Int32Property)target).Value, bag); break; case (int)PropertyKind.String: prop = new StringProperty(target.Name, id, ((StringProperty)target).Value, bag); break; case (int)PropertyKind.Bool: prop = new BoolProperty(target.Name, id, ((BoolProperty)target).Value, bag); break; case (int)PropertyKind.Guid: prop = new GuidProperty(target.Name, id, ((GuidProperty)target).Value, bag); break; case (int)PropertyKind.Single: prop = new SingleProperty(target.Name, id, ((SingleProperty)target).Value, bag); break; case (int)PropertyKind.Int32Array: prop = new Int32ArrayProperty(target.Name, id, ((Int32ArrayProperty)target).Value, bag); break; case (int)PropertyKind.StringArray: prop = new StringArrayProperty(target.Name, id, ((StringArrayProperty)target).Value, bag); break; case (int)PropertyKind.DateTime: prop = new DateTimeProperty(target.Name, id, ((DateTimeProperty)target).Value, bag); break; case (int)PropertyKind.GuidArray: prop = new GuidArrayProperty(target.Name, id, ((GuidArrayProperty)target).Value, bag); break; case (int)PropertyKind.Double: prop = new DoubleProperty(target.Name, id, ((DoubleProperty)target).Value, bag); break; case (int)PropertyKind.Byte: prop = new ByteProperty(target.Name, id, ((ByteProperty)target).Value, bag); break; case (int)PropertyKind.Component: prop = new ComponentProperty(target.Name, id, ((ComponentProperty)target).Value, bag); break; case (int)PropertyKind.SingleArray: prop = new SingleArrayProperty(target.Name, id, ((SingleArrayProperty)target).Value, bag); break; case (int)PropertyKind.Int64: prop = new Int64Property(target.Name, id, ((Int64Property)target).Value, bag); break; case (int)PropertyKind.ComponentArray: prop = new ComponentArrayProperty(target.Name, id, ((ComponentArrayProperty)target).Value, bag); break; case (int)PropertyKind.DateTimeArray: prop = new DateTimeArrayProperty(target.Name, id, ((DateTimeArrayProperty)target).Value, bag); break; case (int)PropertyKind.ByteArray: prop = new ByteArrayProperty(target.Name, id, ((ByteArrayProperty)target).Value, bag); break; case (int)PropertyKind.DoubleArray: prop = new DoubleArrayProperty(target.Name, id, ((DoubleArrayProperty)target).Value, bag); break; case (int)PropertyKind.Int16Array: prop = new Int16ArrayProperty(target.Name, id, ((Int16ArrayProperty)target).Value, bag); break; case (int)PropertyKind.Int16: prop = new Int16Property(target.Name, id, ((Int16Property)target).Value, bag); break; case (int)PropertyKind.Int64Array: prop = new Int64ArrayProperty(target.Name, id, ((Int64ArrayProperty)target).Value, bag); break; case (int)PropertyKind.BoolArray: prop = new BoolArrayProperty(target.Name, id, ((BoolArrayProperty)target).Value, bag); break; } prop.Name = target.Name; return prop; }
public static void GetPropertyType(BoolProperty obj, MethodReturnEventArgs<Type> e) { e.Result = typeof(bool); PropertyActions.DecorateParameterType(obj, e, true, obj.IsList, obj.HasPersistentOrder); }
public static void GetPropertyTypeString(BoolProperty obj, MethodReturnEventArgs<string> e) { GetElementTypeString(obj, e); PropertyActions.DecorateParameterType(obj, e, true, obj.IsList, obj.HasPersistentOrder); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Sets the property to value. /// </summary> /// ------------------------------------------------------------------------------------ private static void SetEnabled(string value, BoolProperty property) { if (string.IsNullOrEmpty(value)) return; try { property(bool.Parse(value)); } catch (FormatException) { // just ignore } }