private ContextMenu GetContextMenu(ComboColourProject colourSource) { var cm = new ContextMenu(); if (colourSource.ComboColours.Count == 0) { cm.Items.Add(new MenuItem { Header = "Add at least one combo colour before adding colours to this sequence." }); } else { foreach (var comboColour in colourSource.ComboColours) { cm.Items.Add(new MenuItem { Header = comboColour.Name, Icon = new PackIcon { Kind = PackIconKind.Circle, Foreground = new SolidColorBrush(comboColour.Color) }, Command = new CommandImplementation(_ => { ColourSequence.Add(comboColour); }), Tag = comboColour }); } } return(cm); }
public void DumpValues() { ColourSequence seq = new ColourSequence(); seq.Reset(); for (int i = 0; i < 100; i++) { System.Drawing.Color colo = seq.Current; Console.WriteLine("{0} {1} {2}", colo.R, colo.G, colo.B); seq.Increment(); } seq.Reset(); }
/// <summary/> public ParticleEmitter() { Acceleration = Vector3.Zero; Colour = new ColourSequence(dEngine.Colour.White); Drag = 0; EmissionDirection = NormalId.Top; Enabled = true; Lifetime = new NumberRange(5, 10); Blending = 0f; LockedToPart = false; Rate = 20; RotSpeed = new NumberRange(0); Rotation = new NumberRange(0); Size = new NumberSequence(1); Speed = new NumberRange(5); Texture = "rbxassetid://242201991"; Transparency = new NumberSequence(0); VelocityInheritance = 0; VelocitySpread = 0; ZOffset = 0; }
public void Read(BinaryReader propReader) { var encode = propReader.ReadInt32(); short declaringTypeId; short propertyTag; DecodePropertyTag(encode, out declaringTypeId, out propertyTag); EncodeTag = encode; DeclaringTypeId = declaringTypeId; PropertyTag = propertyTag; CachedProperty cached; if (TypeRecord.Type.TaggedProperties.TryGetValue(encode, out cached)) { Name = cached.Name; Property = cached; PropertyType = cached.PropertyType; } DataType = (DataType)propReader.ReadByte(); while (propReader.BaseStream.Position < propReader.BaseStream.Length) { switch (DataType) { case DataType.String: Data.Add(propReader.ReadString()); break; case DataType.Content: Data.Add(propReader.ReadString()); break; case DataType.Boolean: Data.Add(propReader.ReadBoolean()); break; case DataType.Int16: Data.Add(propReader.ReadInt16()); break; case DataType.Int32: Data.Add(propReader.ReadInt32()); break; case DataType.Int64: Data.Add(propReader.ReadInt64()); break; case DataType.Single: Data.Add(propReader.ReadSingle()); break; case DataType.Double: Data.Add(propReader.ReadDouble()); break; case DataType.Enum: Data.Add(propReader.ReadInt16()); break; case DataType.FontFamily: Data.Add(new FontFamily(propReader.ReadString())); break; case DataType.Referent: var referent = propReader.ReadInt32(); Data.Add(referent == -1 ? Referent.Null : Context.GlobalReferents[referent]); break; case DataType.UserData: if (VisualC.CompareMemory(propReader.ReadBytes(3), _nullChars, 3) == 0) { Data.Add(null); } else { propReader.BaseStream.Position -= 3; // go back to start var id = propReader.ReadByte(); IDataType userData; switch (id) { case 0: userData = new Vector3(); break; case 1: userData = new Vector2(); break; case 2: userData = new Vector4(); break; case 3: userData = new Colour(); break; case 4: userData = new Axes(); break; case 5: userData = new CFrame(); break; case 6: userData = new UDim2(); break; case 7: userData = new ColourSequence(); break; case 8: userData = new NumberSequence(); break; case 9: userData = new NumberRange(); break; case 10: userData = new Faces(); break; case 11: userData = new Matrix3(); break; case 12: userData = new PhysicalProperties(); break; case 13: userData = new Plane(); break; case 15: userData = new Ray(); break; case 16: userData = new Region3(); break; case 17: userData = new Vector3int16(); break; case 18: userData = new Region3int16(); break; case 19: userData = new DateTime(); break; case 20: userData = new TimeSpan(); break; case 21: userData = new BinaryData(); break; case 22: userData = new MaterialNodeCollection(); break; case 23: userData = new InstanceId(); break; case 24: userData = new FontFamily(); break; default: throw new IndexOutOfRangeException($"No DataType with data ID \"{id}\" found."); } userData.Load(propReader); Data.Add(userData); } break; default: throw new ArgumentOutOfRangeException(); } } }