public static void Start() { Tortoise.Show(); Tortoise.SetSpeed(10); ColorWheel.AddColor(Colors.BlueViolet); ColorWheel.AddColor(Colors.Violet); ColorWheel.AddColor(Colors.Purple); for (int i = 0; i < 75; i++) { try { //var aaa = 100 / i; var nextColor = ColorWheel.GetNextColor(); Tortoise.SetPenColor(nextColor); Tortoise.Move((i + 1) * 5); Tortoise.Turn(360.0 / 3); } catch (Exception re) { MessageBox.ShowMessage("Hold up: " + re); } } }
public static void Start() { Tortoise.Show(); Tortoise.Hide(); Tortoise.SetX(225); Tortoise.SetY(150); Tortoise.SetSpeed(10); ColorWheel.AddColor(Colors.Crimson); ColorWheel.AddColor(Colors.DarkRed); ColorWheel.AddColor(Colors.FireBrick); for (int i = 0; i < 6; i++) { Tortoise.SetPenColor(ColorWheel.GetNextColor()); Tortoise.Move((i + 1) * 4); Tortoise.Turn(-360.0 / 6); for (int j = 0; j < 15; j++) { Tortoise.SetPenWidth(17); Tortoise.Move((j + 1) * 8); Tortoise.Turn(360.0 / 5); } //--Tortoise.getBackgroundWindow().setBackground(PenColors.Yellows.PeachPuff); } Tortoise.SetX(300); Tortoise.SetY(200); for (int i = 0; i < 5; i++) { Tortoise.SetPenColor("Black"); Tortoise.Move(25); Tortoise.Turn(360.0 / 5); } }
/// <summary> /// Adds custom options to the series, such as color or properties. /// </summary> /// <param name="key">The key.</param> /// <param name="series">The series.</param> protected virtual void CustomizeSeries(SessionActivityGroupKey key, Series series) { if (key == null) { throw new ArgumentNullException("key"); } if (series == null) { throw new ArgumentNullException("series"); } string updateType = key.Status; switch (updateType) { case "Failed": case "Error": series.Color = ColorWheel.NextColor(ColorMoods.Failure, ColorMoods.Neutral); break; case "Passed": series.Color = ColorWheel.NextColor(ColorMoods.Success, ColorMoods.Neutral); break; default: series.Color = ColorWheel.NextColor(ColorMoods.Neutral); break; } }
public void SetColor(ColorWheel color, bool colorFX) { GameObject bodyToColor = colorFX ? fxLimbs [(int)Limb.Body] : limbs [(int)Limb.Body]; // Get materials to color limbs with Material armLegMat = ColorManager.Instance.red; //Material bodyMat = ColorManager.Instance.red; if (color == ColorWheel.red) { armLegMat = ColorManager.Instance.red; bodyMaterials = redBodyMaterials; } else if (color == ColorWheel.green) { armLegMat = ColorManager.Instance.green; bodyMaterials = greenBodyMaterials; } else if (color == ColorWheel.blue) { armLegMat = ColorManager.Instance.blue; bodyMaterials = blueBodyMaterials; } else if (color == ColorWheel.neutral) { armLegMat = ColorManager.Instance.neutral; bodyMaterials = bwBodyMaterials; } ColorLimbs(armLegMat, colorFX); bodyToColor.renderer.materials = bodyMaterials; currentColor = color; }
private void ColorChooserLoad(object sender, EventArgs e) { // Turn on double-buffering, so the form looks better. SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); // These properties are set in design view, as well, but they // have to be set to false in order for the Paint // event to be able to display their contents. // Never hurts to make sure they're invisible. pnlSelectedColor.Visible = false; pnlBrightness.Visible = false; pnlColor.Visible = false; // Calculate the coordinates of the three // required regions on the form. Rectangle selectedColorRectangle = new Rectangle(pnlSelectedColor.Location, pnlSelectedColor.Size); Rectangle brightnessRectangle = new Rectangle(pnlBrightness.Location, pnlBrightness.Size); Rectangle colorRectangle = new Rectangle(pnlColor.Location, pnlColor.Size); // Create the new ColorWheel class, indicating // the locations of the color wheel itself, the // brightness area, and the position of the selected color. myColorWheel = new ColorWheel(colorRectangle, brightnessRectangle, selectedColorRectangle); myColorWheel.ColorChanged += MyColorWheelColorChanged; // Set the RGB and HSV values // of the NumericUpDown controls. SetRGB(argb); SetHSV(hsv); }
/// <summary> /// Adds custom options to the point, such as color or properties. /// </summary> /// <param name="record">The record.</param> /// <param name="point">The point.</param> protected override void CustomizePoint(SessionActivityGroupKey key, DataPoint point) { if (key == null) { throw new ArgumentNullException("key"); } if (point == null) { throw new ArgumentNullException("point"); } string category = key.ResultCategory; string updateType = key.Status; point.SetCustomProperty("Category", category); point.SetCustomProperty("UpdateType", updateType); switch (updateType) { case "Failed": case "Error": point.Color = ColorWheel.NextColor(ColorMoods.Failure, ColorMoods.Neutral); break; case "Passed": point.Color = ColorWheel.NextColor(ColorMoods.Success, ColorMoods.Neutral); break; default: point.Color = ColorWheel.NextColor(ColorMoods.Neutral); break; } }
private void PrefabInstantiation() { Debug.Log(collection.Count); for (float x = -1f; x <= 1f; x += 0.1f) { for (float z = -1f; z <= 1f; z += 0.1f) { GameObject prefabInstance = Instantiate(prefabCanvasPixel, new Vector3(x, 0.02f, z), Quaternion.identity); meshRenderer = prefabInstance.GetComponent <MeshRenderer>(); //Debug.Log("INSTANTIATION!!!"); string prefabId = string.Format("m-{0}-{1}", Mathf.Round(x * 100), Mathf.Round(z * 100)); ColorWheel colorObj = new ColorWheel(); colorObj = JsonUtility.FromJson <ColorWheel>(collection[prefabId]); r = colorObj.r; g = colorObj.g; b = colorObj.b; a = colorObj.a; Globals.pixelColor.r = r; Globals.pixelColor.g = g; Globals.pixelColor.b = b; Globals.pixelColor.a = a; prefabInstance.GetComponent <Renderer>().material.name = prefabId; prefabInstance.transform.name = prefabId; meshRenderer.material.color = Globals.pixelColor; prefabInstance.transform.parent = parentImageTarget.transform; GameObject.Find(prefabId).GetComponent <changeColor>(); } } }
private void ColorWheel_OnMouseDown(object sender, MouseButtonEventArgs e) { _hookId = SetHook(_proc); ViewModel.MovingPicker = true; if (IsColorTemperature) { ViewModel.ChangeTemperature(new System.Windows.Point( (int)Math.Round(PointToScreen(e.GetPosition(this)).X) - Left - ColorWheel.TransformToAncestor(this).Transform(new System.Windows.Point(0, 0)).X - (double)ViewModel.ColorWheelSize / 2, (int)Math.Round(PointToScreen(e.GetPosition(this)).Y) - Top - ColorWheel.TransformToAncestor(this).Transform(new System.Windows.Point(0, 0)).Y - (double)ViewModel.ColorWheelSize / 2)); } else { _approximate = false; ViewModel.ChangeHueSaturation(new System.Windows.Point( (int)Math.Round(PointToScreen(e.GetPosition(this)).X) - Left - ColorWheel.TransformToAncestor(this).Transform(new System.Windows.Point(0, 0)).X - (double)ViewModel.ColorWheelSize / 2, (int)Math.Round(PointToScreen(e.GetPosition(this)).Y) - Top - ColorWheel.TransformToAncestor(this).Transform(new System.Windows.Point(0, 0)).Y - (double)ViewModel.ColorWheelSize / 2), _approximate); } }
/* * Return if the player has the magnet powerup for the * provided color. */ public bool HasMagnetForColor(ColorWheel color) { switch (color) { case ColorWheel.red: if (inventory.HasItem(ItemNames.RED_MAGNET)) { return(true); } break; case ColorWheel.green: if (inventory.HasItem(ItemNames.GREEN_MAGNET)) { return(true); } break; case ColorWheel.blue: if (inventory.HasItem(ItemNames.BLUE_MAGNET)) { return(true); } break; } return(false); }
void Start() { //find wheel _wheel = GameObject.Find("ColorWheel").GetComponent <ColorWheel>(); //init scale at 0 this.transform.localScale = new Vector3(0f, 1f, 1f); }
private static void CreateColorPalette() { ColorWheel.AddColor(Colors.SteelBlue); ColorWheel.AddColor(Colors.DarkOrchid); ColorWheel.AddColor(Colors.DarkSlateBlue); ColorWheel.AddColor(Colors.Teal); ColorWheel.AddColor(Colors.Indigo); }
public override void OnInspectorGUI() { ColorWheel wheel = (ColorWheel)target; if (DrawDefaultInspector()) { wheel.SetLineRenderer(); } }
void Start() { playerHealth = GetComponent <PlayerHealth>(); scoreController = GetComponent <ScoreController>(); sectionSelector = GetComponent <SectionSelector>(); timer.Reset(); currentState = GameState.Generating; colorWheel = GameObject.Find("ColorWheel").GetComponent <ColorWheel>(); colorWheel.Deactivate(); }
private static void DrawOctogon() { for (int i = 0; i < 8; i++) { var nextColor = ColorWheel.GetNextColor(); Tortoise.SetPenColor(nextColor); Tortoise.Move(50); Tortoise.Turn(360.0 / 8); } }
private static void AdjustPen() { Tortoise.SetPenColor(ColorWheel.GetNextColor()); var width = Tortoise.GetPenWidth(); Tortoise.SetPenWidth(width + 1); if (Tortoise.GetPenWidth() > 4) { Tortoise.SetPenWidth(1); } }
private static void CreateColorPalette() { ColorWheel.AddColor(Colors.HotPink); ColorWheel.AddColor(Colors.Red); ColorWheel.AddColor(Colors.Fuchsia); ColorWheel.AddColor(Colors.OrangeRed); ColorWheel.AddColor(Colors.DeepPink); ColorWheel.AddColor(Colors.MediumVioletRed); ColorWheel.AddColor(Colors.Crimson); ColorWheel.AddColor(Colors.Tomato); }
void OnEnable() { p_Mode = serializedObject.FindProperty("Mode"); p_Shadows = serializedObject.FindProperty("Shadows"); p_Midtones = serializedObject.FindProperty("Midtones"); p_Highlights = serializedObject.FindProperty("Highlights"); p_Amount = serializedObject.FindProperty("Amount"); m_ShadowsWheel = new ColorWheel("Shadows"); m_MidtonesWheel = new ColorWheel("Midtones"); m_HighlightsWheel = new ColorWheel("Highlights"); }
protected override void Dispose(bool disposing) { if (disposing) { base.Dispose(true); if (myColorWheel != null) { myColorWheel.Dispose(); myColorWheel = null; } } }
/// <summary> /// Create a new color picker Option. /// </summary> /// <param name="fixedHeight"> /// Whether <c cref="Height">Height</c> should return the maximum possible height given the style, or the current height. /// Older versions of GMCM do not support options dynamically updating height. /// </param> /// <param name="getValue">A function that returns the current value in the underlying configuration object</param> /// <param name="setValue">A function that should save the given value to the underlying configuration object</param> /// <param name="showAlpha">Whether a slider should be shown for setting the Alpha channel or not</param> /// <param name="style">Specify which types of color picker to show</param> public ColorPickerOption(bool fixedHeight, Func <Color> getValue, Action <Color> setValue, bool showAlpha = true, ColorPickerStyle style = 0) { FixedHeight = fixedHeight; GetValue = getValue; SetValue = setValue; ShowAlpha = showAlpha; currentValue = getValue(); if (style == ColorPickerStyle.Default) { style = ColorPickerStyle.AllStyles | ColorPickerStyle.ToggleChooser; } EffectiveStyle = style; ShowStylePicker = (style.HasFlag(ColorPickerStyle.RadioChooser) || style.HasFlag(ColorPickerStyle.ToggleChooser)) && BitOperations.PopCount((uint)(style & ColorPickerStyle.AllStyles)) > 1; Action <IconButton> styleButtonClick = style.HasFlag(ColorPickerStyle.ToggleChooser) ? IconButton.ToggleSelected : StyleButtonRadio; bool defaultSelected = !style.HasFlag(ColorPickerStyle.RadioChooser); RGBStyleButton = new IconButton(rgbStripe, null, "RGB", styleButtonClick, defaultSelected && style.HasFlag(ColorPickerStyle.RGBSliders)); HSVStyleButton = new IconButton(smallColorWheel, null, "HSV", styleButtonClick, defaultSelected && style.HasFlag(ColorPickerStyle.HSVColorWheel)); HSLStyleButton = new IconButton(smallColorWheel, null, "HSL", styleButtonClick, defaultSelected && style.HasFlag(ColorPickerStyle.HSLColorWheel)); StyleButtons = new List <IconButton>(); if (style.HasFlag(ColorPickerStyle.RGBSliders)) { StyleButtons.Add(RGBStyleButton); } if (style.HasFlag(ColorPickerStyle.HSVColorWheel)) { StyleButtons.Add(HSVStyleButton); } if (style.HasFlag(ColorPickerStyle.HSLColorWheel)) { StyleButtons.Add(HSLStyleButton); } if (ShowStylePicker && style.HasFlag(ColorPickerStyle.RadioChooser)) { StyleButtons[0].Selected = true; } sliderR = new ColorSlider((b) => new Color((int)b, 0, 0, 255), currentValue.R, (b) => { currentValue.R = b; RGBChanged(); }); sliderG = new ColorSlider((b) => new Color(0, (int)b, 0, 255), currentValue.G, (b) => { currentValue.G = b; RGBChanged(); }); sliderB = new ColorSlider((b) => new Color(0, 0, (int)b, 255), currentValue.B, (b) => { currentValue.B = b; RGBChanged(); }); sliderA = new ColorSlider((b) => new Color(0, 0, 0, (int)b), currentValue.A, (b) => { currentValue.A = b; }); hsvWheel = new ColorWheel((h, s) => ColorUtil.FromHSV(h, s, vSlider.Value), HSVWheelChanged, 150); vSlider = new VerticalSlider((v) => ColorUtil.FromHSV(hsvWheel.HueRadians, hsvWheel.Saturation, v), VSliderChanged, 150); hslWheel = new ColorWheel((h, s) => ColorUtil.FromHSL(h, s, lSlider.Value), HSLWheelChanged, 150); lSlider = new VerticalSlider((v) => ColorUtil.FromHSL(hslWheel.HueRadians, hslWheel.Saturation, v), LSliderChanged, 150); ResetHSVWheel(); ResetHSLWheel(); }
public static void Start() { Tortoise.Show(); Tortoise.SetSpeed(10); CreateColorPalette(); for (int i = 0; i < 30; i++) { var nextColor = ColorWheel.GetNextColor(); Tortoise.SetPenColor(nextColor); DrawOctagonWithOverlap(); Tortoise.Turn(360.0 / 30); Tortoise.Turn(5); } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.m_colorWheel = new AxiomCoders.PdfTemplateEditor.Controls.ColorWheel(); this.m_colorBar = new AxiomCoders.PdfTemplateEditor.Controls.HSLColorSlider(); this.SuspendLayout(); // // m_colorWheel // this.m_colorWheel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.m_colorWheel.Location = new System.Drawing.Point(3, 3); this.m_colorWheel.Name = "m_colorWheel"; this.m_colorWheel.Size = new System.Drawing.Size(236, 200); this.m_colorWheel.TabIndex = 0; this.m_colorWheel.Text = "colorWheel1"; // // m_colorBar // this.m_colorBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); this.m_colorBar.BarPadding = new System.Windows.Forms.Padding(12, 5, 32, 10); this.m_colorBar.Color1 = System.Drawing.Color.Black; this.m_colorBar.Color2 = System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(127)))), ((int)(((byte)(127))))); this.m_colorBar.Color3 = System.Drawing.Color.White; this.m_colorBar.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.m_colorBar.Location = new System.Drawing.Point(246, 3); this.m_colorBar.Name = "m_colorBar"; this.m_colorBar.Orientation = System.Windows.Forms.Orientation.Vertical; this.m_colorBar.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0); this.m_colorBar.Percent = 0F; this.m_colorBar.RotatePointAlignment = System.Drawing.ContentAlignment.MiddleRight; this.m_colorBar.Size = new System.Drawing.Size(46, 200); this.m_colorBar.TabIndex = 1; this.m_colorBar.Text = "Lightness"; this.m_colorBar.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.m_colorBar.TextAngle = 270F; this.m_colorBar.ValueOrientation = AxiomCoders.PdfTemplateEditor.Controls.ColorSlider.eValueOrientation.MinToMax; // // ColorWheelCtrl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Transparent; this.Controls.Add(this.m_colorWheel); this.Controls.Add(this.m_colorBar); this.Name = "ColorWheelCtrl"; this.Size = new System.Drawing.Size(296, 206); this.ResumeLayout(false); }
private static void CreateColorPalette() { var color1 = Colors.Red; var color2 = Colors.DarkOrange; var color3 = Colors.Gold; var color4 = Colors.Yellow; ColorWheel.AddColor(color1); ColorWheel.AddColor(color2); ColorWheel.AddColor(color3); ColorWheel.AddColor(color4); ColorWheel.AddColor(color4); ColorWheel.AddColor(color3); ColorWheel.AddColor(color2); ColorWheel.AddColor(color1); }
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { var wheelAttribute = (TonemappingColorGrading.ColorWheelGroup)attribute; property.isExpanded = true; m_NumberOfWheels = property.CountInProperty() - 1; if (m_NumberOfWheels == 0) { return(0f); } m_RenderSizePerWheel = Mathf.FloorToInt((EditorGUIUtility.currentViewWidth) / m_NumberOfWheels) - 30; m_RenderSizePerWheel = Mathf.Clamp(m_RenderSizePerWheel, wheelAttribute.minSizePerWheel, wheelAttribute.maxSizePerWheel); m_RenderSizePerWheel = Mathf.FloorToInt(pixelRatio * m_RenderSizePerWheel); return(ColorWheel.GetColorWheelHeight(m_RenderSizePerWheel)); }
protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { base.OnApplyTemplate(e); color_W = this.GetControl <ColorWheel>(e, "PART_ColorWheel"); AlphaSL = this.GetControl <Slider>(e, "PART_SliderAlpha"); DarknessSL = this.GetControl <Slider>(e, "PART_SliderDarkness"); //color_W.PreviewColor = PreviewColor; color_W.PreviewColor = PreviewColor; //sets the cursor color_W.PointerMoved += (s, e) => { color_W.Cursor = new Cursor(StandardCursorType.Cross); }; }
protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { base.OnApplyTemplate(e); color_W = this.GetControl <ColorWheel>(e, "PART_ColorWheel"); hSL = this.GetControl <HSLIndicator>(e, "PART_HSL"); rGB = this.GetControl <RGBIndicator>(e, "PART_RGB"); hextext = this.GetControl <TextBlock>(e, "PART_HEXText"); AlphaSL = this.GetControl <Slider>(e, "PART_SliderAlpha"); DarknessSL = this.GetControl <Slider>(e, "PART_SliderDarkness"); PreviewBorder = this.GetControl <Border>(e, "PART_Preview"); color_W.SelectedColor = new ColorPicker.Structures.RGBColor(255, 255, 255); color_W.PropertyChanged += SuperColorPicker_PropertyChanged; AlphaSL.PropertyChanged += SuperColorPicker_PropertyChanged; DarknessSL.PropertyChanged += SuperColorPicker_PropertyChanged; }
//events private void ColorPickerControl_Load(object sender, EventArgs e) { // Turn on double-buffering, so the form looks better. this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.DoubleBuffer, true); Rectangle BrightnessRectangle = new Rectangle(pnlBrightness.Location, pnlBrightness.Size); Rectangle ColorRectangle = new Rectangle(pnlColor.Location, pnlColor.Size); // Create the new ColorWheel class, indicating the locations of the color wheel itself, the // brightness area, and the position of the selected color. colorWheel = new ColorWheel(ColorRectangle, BrightnessRectangle); colorWheel.ColorChanged += ColorChanged; //set initial colors SetCurrentColor(startColor); UpdateCancelButton(RGB); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { if (m_NumberOfWheels == 0) { return; } var width = position.width; Rect newPosition = new Rect(position.x, position.y, width / m_NumberOfWheels, position.height); foreach (SerializedProperty prop in property) { if (prop.propertyType == SerializedPropertyType.Color) { prop.colorValue = ColorWheel.DoGUI(newPosition, prop.displayName, prop.colorValue, m_RenderSizePerWheel); } newPosition.x += width / m_NumberOfWheels; } }
/* * Map our player's power bars to the color passed in by returning * the power associated with the provided color. */ Power GetPowerForColor(RGB rgb) { ColorWheel color = rgb.color; Power returnPower = null; switch (color) { case ColorWheel.blue: returnPower = bluePower; break; case ColorWheel.red: returnPower = redPower; break; case ColorWheel.green: returnPower = greenPower; break; } return(returnPower); }
private void ColorChooser1_Load(object sender, System.EventArgs e) { // Turn on double-buffering, so the form looks better. this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.DoubleBuffer, true); // These properties are set in design view, as well, but they // have to be set to false in order for the Paint // event to be able to display their contents. // Never hurts to make sure they're invisible. pnlSelectedColor.Visible = false; pnlBrightness.Visible = false; pnlColor.Visible = false; // Calculate the coordinates of the three // required regions on the form. Rectangle SelectedColorRectangle = new Rectangle(pnlSelectedColor.Location, pnlSelectedColor.Size); Rectangle BrightnessRectangle = new Rectangle(pnlBrightness.Location, pnlBrightness.Size); Rectangle ColorRectangle = new Rectangle(pnlColor.Location, pnlColor.Size); // Create the new ColorWheel class, indicating // the locations of the color wheel itself, the // brightness area, and the position of the selected color. myColorWheel = new ColorWheel( ColorRectangle, BrightnessRectangle, SelectedColorRectangle); myColorWheel.ColorChanged += new ColorWheel.ColorChangedEventHandler( this.myColorWheel_ColorChanged); // Set the RGB and HSV values // of the NumericUpDown controls. SetRGB(RGB); SetHSV(HSV); }
/* * Remaps color wheel enum to a material in the color manager. * If we have time to come back to this, I'd probably refactor this. */ void ChangeColors(ColorWheel color) { switch (color) { case ColorWheel.blue: Camera.main.backgroundColor = ColorManager.Instance.blue.color; break; case ColorWheel.red: Camera.main.backgroundColor = ColorManager.Instance.red.color; break; case ColorWheel.green: Camera.main.backgroundColor = ColorManager.Instance.green.color; break; case ColorWheel.neutral: Camera.main.backgroundColor = ColorManager.Instance.black.color; break; } playerRGB.color = color; }
private IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam) { if (MouseMessages.WmLbuttonup == (MouseMessages)wParam) { UnhookWindowsHookEx(_hookId); ViewModel.MovingPicker = false; } if (nCode < 0 || MouseMessages.WmMousemove != (MouseMessages)wParam) { return(CallNextHookEx(_hookId, nCode, wParam, lParam)); } var hookStruct = (Msllhookstruct)Marshal.PtrToStructure(lParam, typeof(Msllhookstruct)); if (IsColorTemperature) { ViewModel.ChangeTemperature(new System.Windows.Point( hookStruct.Position.X - Left - ColorWheel.TransformToAncestor(this).Transform(new System.Windows.Point(0, 0)).X - (double)ViewModel.ColorWheelSize / 2, hookStruct.Position.Y - Top - ColorWheel.TransformToAncestor(this).Transform(new System.Windows.Point(0, 0)).Y - (double)ViewModel.ColorWheelSize / 2)); } else { ViewModel.ChangeHueSaturation(new System.Windows.Point( hookStruct.Position.X - Left - ColorWheel.TransformToAncestor(this).Transform(new System.Windows.Point(0, 0)).X - (double)ViewModel.ColorWheelSize / 2, hookStruct.Position.Y - Top - ColorWheel.TransformToAncestor(this).Transform(new System.Windows.Point(0, 0)).Y - (double)ViewModel.ColorWheelSize / 2), _approximate); } return(CallNextHookEx(_hookId, nCode, wParam, lParam)); }
Vector3 GetInput(Rect bounds, Vector3 hsv) { Event e = Event.current; if (e.type == EventType.MouseDown && e.button == 0) { Vector2 mousePos = e.mousePosition; if (bounds.Contains(mousePos)) { Vector2 center = new Vector2(bounds.x + m_Radius, bounds.y + m_Radius); float dist = Vector2.Distance(center, mousePos); if (dist <= m_Radius) { e.Use(); Vector2 relativePos = mousePos - new Vector2(bounds.x, bounds.y); m_Cursor = relativePos; GetWheelHueSaturation(m_Cursor.x, m_Cursor.y, ref hsv.x, ref hsv.y); m_Dragging = this; } } } else if (m_Dragging == this && e.type == EventType.MouseDrag && e.button == 0) { e.Use(); float precision = e.alt ? 0.5f : 1f; m_Cursor += e.delta * precision; GetWheelHueSaturation(Mathf.Clamp(m_Cursor.x, 0f, m_Diameter), Mathf.Clamp(m_Cursor.y, 0f, m_Diameter), ref hsv.x, ref hsv.y); } else if (m_Dragging == this && e.type == EventType.MouseUp && e.button == 0) { e.Use(); m_Dragging = null; } return(hsv); }
/* * Return if the player has the magnet powerup for the * provided color. */ public bool HasMagnetForColor(ColorWheel color) { switch (color) { case ColorWheel.red: if (inventory.HasItem (ItemNames.RED_MAGNET)) { return true; } break; case ColorWheel.green: if (inventory.HasItem (ItemNames.GREEN_MAGNET)) { return true; } break; case ColorWheel.blue: if (inventory.HasItem (ItemNames.BLUE_MAGNET)) { return true; } break; } return false; }
/// <summary> /// The load ent controls. /// </summary> /// <param name="entArray">The ent array.</param> /// <remarks></remarks> private void LoadENTControls(object[] entArray) { this.selectedTagType = map.SelectedMeta.type; this.toolStripTagType.Text = "[" + this.selectedTagType + "]"; this.toolStripTagName.Text = map.SelectedMeta.name; // this.Padding = new Padding(10); int colorSpaceCount = 4; // Custom Plugins access //ra = new RegistryAccess( // Registry.CurrentUser, // RegistryAccess.RegPaths.Halo2CustomPlugins + pluginName + "\\" + this.selectedTagType); //if (pluginName == null) //{ // ra.CloseReg(); //} if (entArray != null) foreach (object o in entArray) { IFPIO.BaseObject tempbase = (IFPIO.BaseObject)o; if (tempbase.visible == false) { if (ShowInvisibles == false) { continue; } } // skip hidden custom plugins variables (mark reflexives to be removed if empty) bool skipEmptyReflex = false; //if (ra.isOpen && ra.getValue(tempbase.offset.ToString()) == bool.FalseString) //{ // if (tempbase.ObjectType == IFPIO.ObjectEnum.Struct) // { // skipEmptyReflex = true; // } // else // { // continue; // } //} switch (tempbase.ObjectType) { case IFPIO.ObjectEnum.Struct: { if (ShowReflexives == false) { break; } // tempLabel is a blank space located above reflexives Label tempLabel = new Label(); tempLabel.AutoSize = true; tempLabel.Location = new Point(0, 0); tempLabel.Name = "label1"; tempLabel.Dock = DockStyle.Top; tempLabel.Size = new Size(35, 13); tempLabel.TabIndex = tabIndex; // tempReflexive is the reflexive and all data (incl other reflexives) within it ReflexiveControl tempReflexive = new ReflexiveControl( map, map.SelectedMeta.offset, ((IFPIO.Reflexive)tempbase).HasCount, tempbase.lineNumber, this); // tempReflexive.Location = new System.Drawing.Point(10, 0); tempReflexive.Name = "reflexive"; tempReflexive.TabIndex = tabIndex; tempReflexive.LoadENTControls( (IFPIO.Reflexive)tempbase, ((IFPIO.Reflexive)tempbase).items, true, 0, ref tabIndex, tempbase.offset.ToString()); // Label, Combobox & Button are always added ( = 3) if (!(tempReflexive.Controls.Count <= 2 && skipEmptyReflex)) { this.Controls[0].Controls.Add(tempLabel); tempLabel.BringToFront(); this.Controls[0].Controls.Add(tempReflexive); tempReflexive.BringToFront(); } break; } case IFPIO.ObjectEnum.Ident: { if (ShowIdents == false) { break; } Ident tempident = new Ident( tempbase.name, map, tempbase.offset, ((IFPIO.Ident)tempbase).hasTagType, tempbase.lineNumber); tempident.Name = "ident"; tempident.TabIndex = tabIndex; tempident.Populate(map.SelectedMeta.offset); tempident.Tag = "[" + tempident.Controls[2].Text + "] " + tempident.Controls[1].Text; tempident.Controls[1].ContextMenuStrip = identContext; this.Controls[0].Controls.Add(tempident); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.StringID: { if (ShowSIDs == false) { break; } SID tempSID = new SID(tempbase.name, map, tempbase.offset, tempbase.lineNumber); tempSID.Name = "sid"; tempSID.TabIndex = tabIndex; tempSID.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempSID); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Float: { if (ShowFloats == false) { break; } DataValues tempFloat = new DataValues( tempbase.name, map, tempbase.offset, IFPIO.ObjectEnum.Float, tempbase.lineNumber); tempFloat.TabIndex = tabIndex; tempFloat.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempFloat); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.String32: { if (ShowString32s == false && tempbase.ObjectType == IFPIO.ObjectEnum.String32) { break; } EntStrings tempstring = new EntStrings( tempbase.name, map, tempbase.offset, ((IFPIO.IFPString)tempbase).size, ((IFPIO.IFPString)tempbase).type, tempbase.lineNumber); tempstring.Name = "string"; tempstring.TabIndex = tabIndex; tempstring.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempstring); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.UnicodeString256: { if (ShowUnicodeString256s == false) { break; } goto case IFPIO.ObjectEnum.String32; } case IFPIO.ObjectEnum.String256: { if (ShowString256s == false) { break; } goto case IFPIO.ObjectEnum.String32; } case IFPIO.ObjectEnum.UnicodeString64: { if (ShowUnicodeString64s == false) { break; } goto case IFPIO.ObjectEnum.String32; } case IFPIO.ObjectEnum.String: { if (ShowString32s == false && tempbase.ObjectType == IFPIO.ObjectEnum.String32) { break; } EntStrings tempstring = new EntStrings( tempbase.name, map, tempbase.offset, ((IFPIO.IFPString)tempbase).size, ((IFPIO.IFPString)tempbase).type, tempbase.lineNumber); tempstring.Name = "string"; tempstring.TabIndex = tabIndex; tempstring.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempstring); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Int: { if (((IFPIO.IFPInt)tempbase).entIndex.nulled) { if ((ShowInts == false && tempbase.ObjectType == IFPIO.ObjectEnum.Int) || (ShowShorts == false && tempbase.ObjectType == IFPIO.ObjectEnum.Short) || (ShowUshorts == false && tempbase.ObjectType == IFPIO.ObjectEnum.UShort) || (ShowUints == false && tempbase.ObjectType == IFPIO.ObjectEnum.UInt)) { break; } DataValues tempdatavalues = new DataValues( tempbase.name, map, tempbase.offset, tempbase.ObjectType, tempbase.lineNumber); tempdatavalues.TabIndex = tabIndex; tempdatavalues.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempdatavalues); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); } else { if ((ShowBlockIndex32s == false && (tempbase.ObjectType == IFPIO.ObjectEnum.Int | tempbase.ObjectType == IFPIO.ObjectEnum.UInt)) || (ShowBlockIndex16s == false && (tempbase.ObjectType == IFPIO.ObjectEnum.Short | tempbase.ObjectType == IFPIO.ObjectEnum.UShort)) || (ShowBlockIndex8s == false && tempbase.ObjectType == IFPIO.ObjectEnum.Byte)) { break; } Indices tempdatavalues = new Indices( tempbase.name, map, tempbase.offset, tempbase.ObjectType, ((IFPIO.IFPInt)tempbase).entIndex); tempdatavalues.TabIndex = tabIndex; this.Controls[0].Controls.Add(tempdatavalues); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); } break; } case IFPIO.ObjectEnum.Short: { goto case IFPIO.ObjectEnum.Int; } case IFPIO.ObjectEnum.UShort: { goto case IFPIO.ObjectEnum.Int; } case IFPIO.ObjectEnum.UInt: { goto case IFPIO.ObjectEnum.Int; } case IFPIO.ObjectEnum.Unknown: { if (ShowUndefineds == false) { break; } DataValues tempUnknown = new DataValues( tempbase.name, map, tempbase.offset, IFPIO.ObjectEnum.Unknown, tempbase.lineNumber); tempUnknown.TabIndex = tabIndex; tempUnknown.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempUnknown); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Byte_Flags: { if (ShowBitmask8s == false) { break; } Bitmask tempbitmask = new Bitmask( tempbase.name, map, tempbase.offset, ((IFPIO.Bitmask)tempbase).bitmaskSize, ((IFPIO.Bitmask)tempbase).options, tempbase.lineNumber); tempbitmask.TabIndex = tabIndex; tempbitmask.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempbitmask); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Word_Flags: { if (ShowBitmask16s == false) { break; } Bitmask tempbitmask = new Bitmask( tempbase.name, map, tempbase.offset, ((IFPIO.Bitmask)tempbase).bitmaskSize, ((IFPIO.Bitmask)tempbase).options, tempbase.lineNumber); tempbitmask.TabIndex = tabIndex; tempbitmask.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempbitmask); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Long_Flags: { if (ShowBitmask32s == false) { break; } Bitmask tempbitmask = new Bitmask( tempbase.name, map, tempbase.offset, ((IFPIO.Bitmask)tempbase).bitmaskSize, ((IFPIO.Bitmask)tempbase).options, tempbase.lineNumber); tempbitmask.TabIndex = tabIndex; tempbitmask.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempbitmask); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Char_Enum: { if (ShowEnum8s == false) { break; } Enums tempenum = new Enums( tempbase.name, map, tempbase.offset, ((IFPIO.IFPEnum)tempbase).enumSize, ((IFPIO.IFPEnum)tempbase).options, tempbase.lineNumber); tempenum.TabIndex = tabIndex; tempenum.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempenum); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Enum: { if (ShowEnum16s == false) { break; } Enums tempenum = new Enums( tempbase.name, map, tempbase.offset, ((IFPIO.IFPEnum)tempbase).enumSize, ((IFPIO.IFPEnum)tempbase).options, tempbase.lineNumber); tempenum.TabIndex = tabIndex; tempenum.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempenum); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Long_Enum: { if (ShowEnum32s == false) { break; } Enums tempenum = new Enums( tempbase.name, map, tempbase.offset, ((IFPIO.IFPEnum)tempbase).enumSize, ((IFPIO.IFPEnum)tempbase).options, tempbase.lineNumber); tempenum.TabIndex = tabIndex; tempenum.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempenum); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.Byte: { if (((IFPIO.IFPByte)tempbase).entIndex.nulled) { if (ShowBytes == false) { break; } DataValues tempByte = new DataValues( tempbase.name, map, tempbase.offset, IFPIO.ObjectEnum.Byte, tempbase.lineNumber); tempByte.TabIndex = tabIndex; this.Controls[0].Controls.Add(tempByte); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); } else { if (ShowBlockIndex8s == false) { break; } Indices tempdatavalues = new Indices( tempbase.name, map, tempbase.offset, tempbase.ObjectType, ((IFPIO.IFPByte)tempbase).entIndex); tempdatavalues.TabIndex = tabIndex; this.Controls[0].Controls.Add(tempdatavalues); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); } break; } case IFPIO.ObjectEnum.Unused: { DataValues tempUnknown = new DataValues( tempbase.name, map, tempbase.offset, IFPIO.ObjectEnum.Unused, tempbase.lineNumber); tempUnknown.TabIndex = tabIndex; tempUnknown.Populate(map.SelectedMeta.offset); this.Controls[0].Controls.Add(tempUnknown); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); break; } case IFPIO.ObjectEnum.TagType: continue; } if (!(tempbase is IFPIO.Reflexive)) { ToolTip1.SetToolTip(this.Controls[0].Controls[0].Controls[0], "offset: " + tempbase.offset); } if (this.Controls[0].Controls.Count > 0 && this.Controls[0].Controls[0] is DataValues) { // if (((tempbase.name.ToLower().Contains(" a") & tempbase.name[tempbase.name.ToLower().IndexOf(" a")]) || // tempbase.name.ToLower().Contains("alpha"))& alphaControl == null) if (ColorWheel.checkForColor(tempbase.name, alphaControl, " a", "alpha")) { alphaControl = (DataValues)this.Controls[0].Controls[0]; colorSpaceCount = 0; } // if (tempbase.name.ToLower().Contains(" r") & redControl == null) else if (ColorWheel.checkForColor(tempbase.name, redControl, " r", "red")) { redControl = (DataValues)this.Controls[0].Controls[0]; colorSpaceCount = 0; } // if (tempbase.name.ToLower().Contains(" g") & greenControl == null) else if (ColorWheel.checkForColor(tempbase.name, greenControl, " g", "green")) { greenControl = (DataValues)this.Controls[0].Controls[0]; colorSpaceCount = 0; } // if (tempbase.name.ToLower().Contains(" b") & blueControl == null) else if (ColorWheel.checkForColor(tempbase.name, blueControl, " b", "blue")) { blueControl = (DataValues)this.Controls[0].Controls[0]; colorSpaceCount = 0; } else { colorSpaceCount++; if (colorSpaceCount == 1) { alphaControl = null; redControl = null; greenControl = null; blueControl = null; } } if (redControl != null & greenControl != null & blueControl != null) { // Create the new ColorWheel class, indicating // the locations of the color wheel itself, the // brightness area, and the position of the selected color. ColorWheel cw = new ColorWheel(); if (alphaControl != null) { cw.setTextBox(alphaControl.textBox1, Color.White); } cw.setTextBox(redControl.textBox1, Color.Red); cw.setTextBox(greenControl.textBox1, Color.Green); cw.setTextBox(blueControl.textBox1, Color.Blue); // p.I.AddRange(new Rectangle[] { SelectedColorRectangle }); cw.Dock = DockStyle.Top; this.Controls[0].Controls.Add(cw); this.Controls[0].Controls[this.Controls[0].Controls.Count - 1].BringToFront(); // Reset for next batch colorSpaceCount++; alphaControl = null; redControl = null; greenControl = null; blueControl = null; } } else { colorSpaceCount++; } tabIndex++; } //ra.CloseReg(); }
private void BrightnessSaturationControl_SelectColored( object sender, ColorWheel.Controls.EventArg<int> e ) { m_selectedColor = e.Value; UpdateSelectedColor(); }
private void ColorWheelControl_ColorSelected( object sender, ColorWheel.Controls.EventArg<int> e ) { m_selectedColor = e.Value; UpdateSelectedColor(); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.okButton = new System.Windows.Forms.Button(); this.cancelButton = new System.Windows.Forms.Button(); this.previewPanel = new System.Windows.Forms.Panel(); this.loadPaletteButton = new System.Windows.Forms.Button(); this.savePaletteButton = new System.Windows.Forms.Button(); this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.screenColorPicker = new Cyotek.Windows.Forms.ScreenColorPicker(); this.colorWheel = new Cyotek.Windows.Forms.ColorWheel(); this.colorEditor = new Cyotek.Windows.Forms.ColorEditor(); this.colorGrid = new Cyotek.Windows.Forms.ColorGrid(); this.colorEditorManager = new Cyotek.Windows.Forms.ColorEditorManager(); this.SuspendLayout(); // // okButton // this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.okButton.Location = new System.Drawing.Point(453, 12); this.okButton.Name = "okButton"; this.okButton.Size = new System.Drawing.Size(75, 23); this.okButton.TabIndex = 1; this.okButton.Text = "OK"; this.okButton.UseVisualStyleBackColor = true; this.okButton.Click += new System.EventHandler(this.okButton_Click); // // cancelButton // this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.cancelButton.Location = new System.Drawing.Point(453, 41); this.cancelButton.Name = "cancelButton"; this.cancelButton.Size = new System.Drawing.Size(75, 23); this.cancelButton.TabIndex = 2; this.cancelButton.Text = "Cancel"; this.cancelButton.UseVisualStyleBackColor = true; this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click); // // previewPanel // this.previewPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.previewPanel.Location = new System.Drawing.Point(453, 203); this.previewPanel.Name = "previewPanel"; this.previewPanel.Size = new System.Drawing.Size(75, 47); this.previewPanel.TabIndex = 3; // // loadPaletteButton // this.loadPaletteButton.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.loadPaletteButton.Image = global::YnoteThemeGenerator.Properties.Resources.palette_load; this.loadPaletteButton.Location = new System.Drawing.Point(12, 147); this.loadPaletteButton.Name = "loadPaletteButton"; this.loadPaletteButton.Size = new System.Drawing.Size(23, 23); this.loadPaletteButton.TabIndex = 5; this.toolTip.SetToolTip(this.loadPaletteButton, "Load Palette"); this.loadPaletteButton.UseVisualStyleBackColor = false; this.loadPaletteButton.Click += new System.EventHandler(this.loadPaletteButton_Click); // // savePaletteButton // this.savePaletteButton.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.savePaletteButton.Image = global::YnoteThemeGenerator.Properties.Resources.palette_save; this.savePaletteButton.Location = new System.Drawing.Point(34, 147); this.savePaletteButton.Name = "savePaletteButton"; this.savePaletteButton.Size = new System.Drawing.Size(23, 23); this.savePaletteButton.TabIndex = 6; this.toolTip.SetToolTip(this.savePaletteButton, "Save Palette"); this.savePaletteButton.UseVisualStyleBackColor = false; this.savePaletteButton.Click += new System.EventHandler(this.savePaletteButton_Click); // // screenColorPicker // this.screenColorPicker.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.screenColorPicker.Color = System.Drawing.Color.Black; this.screenColorPicker.Image = global::YnoteThemeGenerator.Properties.Resources.eyedropper1; this.screenColorPicker.Location = new System.Drawing.Point(453, 83); this.screenColorPicker.Name = "screenColorPicker"; this.screenColorPicker.Size = new System.Drawing.Size(73, 85); this.toolTip.SetToolTip(this.screenColorPicker, "Click and drag to select screen color"); this.screenColorPicker.Zoom = 6; // // colorWheel // this.colorWheel.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.colorWheel.Location = new System.Drawing.Point(12, 12); this.colorWheel.Name = "colorWheel"; this.colorWheel.Size = new System.Drawing.Size(192, 147); this.colorWheel.TabIndex = 4; // // colorEditor // this.colorEditor.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.colorEditor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.colorEditor.Location = new System.Drawing.Point(210, 12); this.colorEditor.Name = "colorEditor"; this.colorEditor.Size = new System.Drawing.Size(230, 238); this.colorEditor.TabIndex = 0; // // colorGrid // this.colorGrid.AutoAddColors = false; this.colorGrid.CellBorderStyle = Cyotek.Windows.Forms.ColorCellBorderStyle.None; this.colorGrid.EditMode = Cyotek.Windows.Forms.ColorEditingMode.Both; this.colorGrid.Location = new System.Drawing.Point(12, 176); this.colorGrid.Name = "colorGrid"; this.colorGrid.Padding = new System.Windows.Forms.Padding(0); this.colorGrid.Palette = Cyotek.Windows.Forms.ColorPalette.Paint; this.colorGrid.SelectedCellStyle = Cyotek.Windows.Forms.ColorGridSelectedCellStyle.Standard; this.colorGrid.ShowCustomColors = false; this.colorGrid.Size = new System.Drawing.Size(192, 72); this.colorGrid.Spacing = new System.Drawing.Size(0, 0); this.colorGrid.TabIndex = 7; // // colorEditorManager // this.colorEditorManager.ColorEditor = this.colorEditor; this.colorEditorManager.ColorGrid = this.colorGrid; this.colorEditorManager.ColorWheel = this.colorWheel; this.colorEditorManager.ScreenColorPicker = this.screenColorPicker; this.colorEditorManager.ColorChanged += new System.EventHandler(this.colorEditorManager_ColorChanged); // // ColorPickerDialog // this.AcceptButton = this.okButton; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.cancelButton; this.ClientSize = new System.Drawing.Size(540, 262); this.Controls.Add(this.savePaletteButton); this.Controls.Add(this.loadPaletteButton); this.Controls.Add(this.previewPanel); this.Controls.Add(this.cancelButton); this.Controls.Add(this.okButton); this.Controls.Add(this.screenColorPicker); this.Controls.Add(this.colorWheel); this.Controls.Add(this.colorEditor); this.Controls.Add(this.colorGrid); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "ColorPickerDialog"; this.ShowIcon = false; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Color Picker"; this.ResumeLayout(false); this.PerformLayout(); }
public void SetColor(ColorWheel color) { SetColor (color, false); }
public void SetColor(ColorWheel color, bool colorFX) { GameObject bodyToColor = colorFX ? fxLimbs [(int)Limb.Body] : limbs [(int)Limb.Body]; // Get materials to color limbs with Material armLegMat = ColorManager.Instance.red; //Material bodyMat = ColorManager.Instance.red; if (color == ColorWheel.red) { armLegMat = ColorManager.Instance.red; bodyMaterials = redBodyMaterials; } else if (color == ColorWheel.green) { armLegMat = ColorManager.Instance.green; bodyMaterials = greenBodyMaterials; } else if (color == ColorWheel.blue) { armLegMat = ColorManager.Instance.blue; bodyMaterials = blueBodyMaterials; } else if (color == ColorWheel.neutral) { armLegMat = ColorManager.Instance.neutral; bodyMaterials = bwBodyMaterials; } ColorLimbs (armLegMat, colorFX); bodyToColor.renderer.materials = bodyMaterials; currentColor = color; }
Vector3 GetInput(Rect bounds, Vector3 hsv) { Event e = Event.current; if (e.type == EventType.MouseDown && e.button == 0) { Vector2 mousePos = e.mousePosition; if (bounds.Contains(mousePos)) { Vector2 center = new Vector2(bounds.x + m_Radius, bounds.y + m_Radius); float dist = Vector2.Distance(center, mousePos); if (dist <= m_Radius) { e.Use(); Vector2 relativePos = mousePos - new Vector2(bounds.x, bounds.y); m_Cursor = relativePos; GetWheelHueSaturation(m_Cursor.x, m_Cursor.y, ref hsv.x, ref hsv.y); m_Dragging = this; } } } else if (m_Dragging == this && e.type == EventType.MouseDrag && e.button == 0) { e.Use(); float precision = e.alt ? 0.5f : 1f; m_Cursor += e.delta * precision; GetWheelHueSaturation(Mathf.Clamp(m_Cursor.x, 0f, m_Diameter), Mathf.Clamp(m_Cursor.y, 0f, m_Diameter), ref hsv.x, ref hsv.y); } else if (m_Dragging == this && e.type == EventType.MouseUp && e.button == 0) { e.Use(); m_Dragging = null; } return hsv; }