public ColouringHSVMenu(Rectangle bounds, Colours colours, Color activeColour = default, Action <Color> onTryColourAction = null, Action <Color> onFinalColourAction = null) : base(bounds, colours) { if (activeColour == default) { activeColour = Color.Black; } Int32 hue_slider_width = Convert.ToInt32(this.mBounds.Width * 0.15f); Int32 separator_width = Convert.ToInt32(this.mBounds.Width * 0.075f); this.colourPicker = new ColourPicker(new Rectangle(this.mBounds.X + hue_slider_width + separator_width, this.mBounds.Y, this.mBounds.Width - hue_slider_width - separator_width, this.mBounds.Height), colours, c => { this.colourPicker.mData.mHoverText = $"R: {c.R}, G: {c.G}, B: {c.B}{Environment.NewLine}#{c.R:X2}{c.G:X2}{c.B:X2}"; onTryColourAction?.Invoke(c); }, onFinalColourAction); this.hueSlider = new HueSlider(new Rectangle(this.mBounds.X, this.mBounds.Y, hue_slider_width, this.mBounds.Height), this.colourPicker.SetHueColour, this.colourPicker.SetHueColour); this.separatorBounds = new Rectangle(this.hueSlider.mBounds.Right, this.mBounds.Y - 4, separator_width, this.mBounds.Height + 8); this.SetColour(activeColour, false); this.mComponents.AddRange(new ICustomComponent[] { this.hueSlider, this.colourPicker }); }
private void Awake() { // gets all the selectable objects m_selectables = GetComponentsInChildren <Selectable>(); // ensures that there is a delay before input is given m_fInputTimer = m_fInputDelay; m_fHorizontalTimer = 0.0f; // sets the initial dino type, weapon type and colour based on the player number m_iHoverpodType = m_cPlayerNumber - 1; m_iHoverpodColour = m_cPlayerNumber - 1; m_colourPicker = GetComponentInChildren <ColourPicker>(); // sets the character to initially inactive if (CharacterManager.InstanceExists) { CharacterManager.Instance.m_bActivePlayers[m_cPlayerNumber - 1] = false; } // the first 2 players are automatically playing if (m_cPlayerNumber == 3 || m_cPlayerNumber == 4) { m_bPlaying = false; } else { m_bPlaying = true; } m_fOriginalVolume = m_playerMusic.GetComponent <AudioSource>().volume; }
// Use this for initialization void Start() { // headband1 = transform.Find("AccessoriesPanel/Scroll View/Viewport/Content/HeadBand/Button").GetComponent<Button>(); // armL = transform.Find("AccessoriesPanel/Scroll View/Viewport/Content/ArmL/Button").GetComponent<Button>(); // armR = transform.Find("AccessoriesPanel/Scroll View/Viewport/Content/ArmR/Button").GetComponent<Button>(); // // shirtLong = transform.Find("UpperPanel/Scroll View/Viewport/Content/shirt1/Button").GetComponent<Button>(); // // pantsLong = transform.Find("LegsPanel/Scroll View/Viewport/Content/PantsLong/Button").GetComponent<Button>(); // // onesie = transform.Find("OutfitsPanel/Scroll View/Viewport/Content/onesie/Button").GetComponent<Button>(); // // headband1.GetComponent<Button>().onClick.AddListener(delegate {SetClothing(2,ClothingSlot.Head);}); // armL.GetComponent<Button>().onClick.AddListener(delegate {SetClothing(0,ClothingSlot.LeftArm);}); // armR.GetComponent<Button>().onClick.AddListener(delegate {SetClothing(1,ClothingSlot.RightArm);}); // // shirtLong.GetComponent<Button>().onClick.AddListener(delegate {SetClothing(5,ClothingSlot.Upper);}); // pantsLong.GetComponent<Button>().onClick.AddListener(delegate {SetClothing(4,ClothingSlot.Lower);}); // onesie.GetComponent<Button>().onClick.AddListener(delegate {SetClothing(3,ClothingSlot.Costume);}); // playerCus = GameMaster.Instance.CurrentPlayerObject.GetComponent <CharacterCustomizationScript> (); colour = transform.Find("Refresh").GetComponent <ColourPicker> (); CurrentOutfit(); AddUpper(); shelf.SetBool("Shelf1", true); }
private void StartClicking(object sender, KeyPressEventArgs keyEventArguments) { if (keyEventArguments.KeyChar == 'p' && !IsClickingEnabled) { IColourPicker colourPicker = new ColourPicker(); IVideoDisplay display = new WindowsScreen(); IVideoDisplay currentWindow = WindowsApplication.GetForeground(); ICursor cursor = new WindowsCursor(); Color colour = colourPicker.GetFromDisplayPosition(display, cursor.GetPosition()); IPixelFinder pixelFinder = new PixelFinder(); IClicker clicker = new Clicker(); Thread clickingThread = new Thread(() => { IsClickingEnabled = true; while (IsClickingEnabled) { var clickedPosition = pixelFinder.FindPixelPosition(currentWindow, colour); if (clickedPosition.HasValue) { clicker.Click((int)currentWindow.Handle, clickedPosition.Value); } Thread.Sleep(TimeSpan.FromSeconds(1)); } }); clickingThread.Start(); } }
public void TestExternalColourSetAfterCreation() { ColourPicker colourPicker = null; AddStep("create picker", () => Child = colourPicker = new BasicColourPicker()); AddStep("set colour externally", () => colourPicker.Current.Value = Colour4.Goldenrod); AddAssert("colour is correct", () => colourPicker.Current.Value == Colour4.Goldenrod); }
public DebugItemViewer(Rect canvas) { this.GuiCanvas = canvas; colourPicker = new ColourPicker("Colour"); globalPosPicker = new Vector3Picker("Global Pos", -10f, 10f); localPosPicker = new Vector3Picker("Local Pos", -10f, 10f); scalePicker = new Vector3Picker("Scale", 0.001f, 5f); rotationPicker = new RotationPicker("Rotation"); }
private void ColourBtn_Click(object sender, EventArgs e) { var btn = (Button)sender; if (ColourPicker.ShowDialog() == DialogResult.OK) { btn.BackColor = ColourPicker.Color; } }
public DebugItemViewer(Rect canvas) { this.GuiCanvas = canvas; colourPicker = new ColourPicker("Colour"); globalPosPicker = new Vector3Picker("Global Pos", -10f, 10f); localPosPicker = new Vector3Picker("Local Pos", -10f, 10f); scalePicker = new Vector3Picker("Scale", 0.001f, 5f); rotationPicker = new RotationPicker("Rotation"); }
public void FindPixelPosition() { IVideoDisplay videoDisplay = new WindowsDisplay(); ICursor cursor = new WindowsCursor(); IColourPicker colorPicker = new ColourPicker(); Color colourAtCursor = colorPicker.GetFromDisplayPosition(videoDisplay, cursor.GetPosition()); var point = PixelFinder.FindPixelPosition(videoDisplay, colourAtCursor); Assert.IsNotNull(point, "Could not find the pixel you were hovering over on the screen."); }
private void Form1_Load(object sender, EventArgs e) { this.MouseWheel += Form1_MouseWheel; palette = new ColourPalette(10); picker = new ColourPicker(toolStrip1, palette); picker.onPaletteChanged += Picker_onPaletteChanged; // Note: puzzle does not resize / redraw if the user resizes the window. puzzle = new Puzzle(Constants.DEFAULT_GRID_SPACING, palette); puzzle.resizeToFit(pictureBox1); pictureBox1.Invalidate(); }
private void BackColour_Clicked(object sender, RoutedEventArgs e) { ColourPicker picker = new ColourPicker(); if (picker.ShowDialog().IsFalse()) { return; } this.uxHtmlText.Selection.ApplyPropertyValue(TextElement.BackgroundProperty, picker.SelectedColour); }
private void BackColour_Clicked(object sender, RoutedEventArgs e) { if (this.selectedKey.IsNullEmptyOrWhiteSpace() || Formatters.GetVerseFromKey(this.selectedKey) <= 0) { MessageDisplay.Show("Please select a Verse"); return; } try { ColourPicker picker = new ColourPicker(); if (picker.ShowDialog().IsFalse()) { return; } int verseNumber = Formatters.GetVerseFromKey(this.selectedKey); HighlightRitchTextBox textBox = this.loadedTextBoxDictionary[verseNumber]; int start = textBox.GetSelectionStartIndex(); int length = textBox.GetSelectedTextLength(); textBox.HighlightText(start, length, picker.SelectedColour); string bibleVerseKey = Formatters.IsBiblesKey(this.selectedKey) ? this.selectedKey : $"{this.Bible.BibleId}||{this.selectedKey}"; BiblesData.Database.InsertVerseColour(bibleVerseKey, start, length, ColourConverters.GetHexFromBrush(picker.SelectedColour)); } catch (Exception err) { ErrorLog.ShowError(err); } }
public void TestExternalHSVChange() { const float hue = 0.34f; const float saturation = 0.46f; const float value = 0.84f; ColourPicker colourPicker = null; AddStep("create picker", () => Child = colourPicker = new BasicColourPicker { Current = { Value = Colour4.Goldenrod } }); AddStep("hide picker", () => colourPicker.Hide()); AddStep("set HSV manually", () => { var saturationValueControl = this.ChildrenOfType <HSVColourPicker.SaturationValueSelector>().Single(); saturationValueControl.Hue.Value = hue; saturationValueControl.Saturation.Value = saturation; saturationValueControl.Value.Value = value; }); AddUntilStep("colour is correct", () => colourPicker.Current.Value == Colour4.FromHSV(hue, saturation, value)); }
protected void UpdateHueAndControlPicker() { HuePicker.Hue = Hsv.H; ColourPicker.UpdateWithHSV(Hsv); ColourPicker.UpdateDraggerWithHSV(Hsv); }
protected void UpdateControlPicker() { HuePicker.Hue = Hsv.H; ColourPicker.UpdateWithHSV(Hsv); }
void Start() { transform.parent = GameObject.Find("Canvas").transform; Board.master.currentColourSelector = this; colourPicker = transform.GetChild(0).gameObject.AddComponent<ColourPicker>(); colourPicker.parent = this; }
private void load(ApplicationConfigManager config, BackgroundImageStore images, BackgroundVideoStore videos) { type = config.GetBindable <BackgroundType>(ApplicationSetting.Background); ox = config.GetBindable <float>(ApplicationSetting.BackgroundOffsetX); oy = config.GetBindable <float>(ApplicationSetting.BackgroundOffsetY); sx = config.GetBindable <float>(ApplicationSetting.BackgroundScaleXY); colorConfig = config.GetBindable <string>(ApplicationSetting.BackgroundColor); imageConfig = config.GetBindable <string>(ApplicationSetting.BackgroundImageFile); videoConfig = config.GetBindable <string>(ApplicationSetting.BackgroundVideoFile); Children = new Drawable[] { new ThemedSpriteText { Font = SegoeUI.Bold.With(size: 18), Text = "Preview" }, new Container { RelativeSizeAxes = Axes.X, CornerRadius = 5.0f, Masking = true, Margin = new MarginPadding { Bottom = 10 }, Height = 250, Width = 0.95f, Children = new Drawable[] { new Box { Colour = Colour4.Black, RelativeSizeAxes = Axes.Both, }, new Background(false) { RelativeSizeAxes = Axes.Both, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, }, EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Shadow, Colour = Colour4.Black.Opacity(0.2f), Radius = 10.0f, Hollow = true, }, }, new ThemedSpriteText { Font = SegoeUI.Bold.With(size: 18), Text = "Display" }, new LabelledEnumDropdown <BackgroundType> { Label = "Type", Current = type, }, imagesDropdown = new LabelledFileDropdown <Texture> { Label = "Image", ItemSource = images.Loaded, }, videosDropdown = new LabelledFileDropdown <Stream> { Label = "Video", ItemSource = videos.Loaded, }, colourPicker = new ColourPicker { Current = new Bindable <Colour4>(), }, new ThemedTextButton { Text = "Open Folder", Width = 200, Action = () => images.OpenInNativeExplorer(), }, offsetConfigContainer = new FillFlowContainer { Spacing = new Vector2(0, 10), AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Direction = FillDirection.Vertical, Children = new Drawable[] { new ThemedSpriteText { Font = SegoeUI.Bold.With(size: 18), Text = "Offset" }, new FillFlowContainer { Alpha = type.Value != BackgroundType.Color ? 1 : 0, Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Spacing = new Vector2(10, 0), Children = new Drawable[] { new LabelledNumberBox { Label = "X", Width = 50, Current = inputOffsetX, }, new LabelledNumberBox { Label = "Y", Width = 50, Current = inputOffsetY, }, new LabelledNumberBox { Label = "Scale", Width = 50, Current = inputScaleXY, }, new ThemedIconButton { Icon = FluentSystemIcons.Filled.Drag24, Size = new Vector2(25), Style = ButtonStyle.Override, Action = enableBackgroundAdjustments, IconSize = new Vector2(15), LabelColour = ThemeColour.NeutralPrimary, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, }, new ThemedIconButton { Icon = FluentSystemIcons.Filled.ArrowUndo24, Size = new Vector2(25), Style = ButtonStyle.Override, Action = resetBackgroundOffsets, IconSize = new Vector2(15), LabelColour = ThemeColour.NeutralPrimary, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, }, } }, } }, }; type.BindValueChanged(handleTypeChange, true); imagesDropdown.Current.ValueChanged += e => imageConfig.Value = e.NewValue?.Name ?? string.Empty; imagesDropdown.Current.Value = images.GetReference(imageConfig.Value); videosDropdown.Current.ValueChanged += e => videoConfig.Value = e.NewValue?.Name ?? string.Empty; videosDropdown.Current.Value = videos.GetReference(videoConfig.Value); colourPicker.Current.ValueChanged += e => colorConfig.Value = e.NewValue.ToHex(); colourPicker.Current.Value = Colour4.FromHex(colorConfig.Value); inputOffsetX.ValueChanged += e => { if (float.TryParse(e.NewValue, out float x)) { ox.Value = x; } }; inputOffsetY.ValueChanged += e => { if (float.TryParse(e.NewValue, out float y)) { oy.Value = y; } }; inputScaleXY.ValueChanged += e => { if (float.TryParse(e.NewValue, out float s)) { sx.Value = s; } }; ox.ValueChanged += e => inputOffsetX.Value = e.NewValue.ToString(); oy.ValueChanged += e => inputOffsetY.Value = e.NewValue.ToString(); sx.ValueChanged += e => inputScaleXY.Value = e.NewValue.ToString(); }
/// <summary> /// Initializes and populates the grid. /// </summary> void Start() { // Initial settings puzzleFinished = false; winMessage.Hide(); Teleporter.ResetCount(); pauseMenu.SetActive(false); player.GetComponent <Player>().CanMove = true; // get level info TextAsset levelInfo = Level.LevelInfo; string[] txtLines = levelInfo.text.Split('\n'); // read in level info try { width = int.Parse(txtLines[0]); height = int.Parse(txtLines[1]); // create the puzzle grid and solution grid gridTiles = new Tile[width][]; solutionTiles = new Tile[width][]; for (int i = 0; i < width; i += 1) { gridTiles[i] = new Tile[height]; solutionTiles[i] = new Tile[height]; } // create grid game object gridObjects = new GameObject(); gridObjects.transform.parent = gameObject.transform; gridObjects.name = "GridObjects"; // create grid tiles, set default tile colours for (int i = 0; i < width; i += 1) { for (int j = 0; j < height; j += 1) { gridTiles[i][height - 1 - j] = new Tile(ReadTileType(txtLines[j + 2][i]), gridObjects, i, height - 1 - j); } } // place player at start location player.transform.parent = gridObjects.transform; playerStartLocation.x = playerCurrentLocation.x = int.Parse(txtLines[2 + height]); playerStartLocation.y = playerCurrentLocation.y = int.Parse(txtLines[3 + height]); player.transform.localPosition = new Vector2((float)playerStartLocation.x, (float)playerStartLocation.y); // read in tools #region Read in tools and create them int toolNum = int.Parse(txtLines[4 + height]); int lineNum = 5 + height; // create tools gridTools = new Dictionary <IntVector.IntVector2, Tool>(); for (int i = 0; i < toolNum; i += 1) { char toolType = txtLines[lineNum][0]; if (toolType == 'c') // colour picker { ColourPicker.Colour col = ReadColour(txtLines[lineNum][1]); IntVector.IntVector2 loc = new IntVector.IntVector2(int.Parse(txtLines[lineNum + 1]), int.Parse(txtLines[lineNum + 2])); ColourPicker cp = new ColourPicker(loc.x, loc.y, col, gridObjects); gridTools.Add(loc, cp); lineNum += 3; } else if (toolType == 's') // splash { ColourPicker.Colour col = ReadColour(txtLines[lineNum][1]); IntVector.IntVector2 loc = new IntVector.IntVector2(int.Parse(txtLines[lineNum + 1]), int.Parse(txtLines[lineNum + 2])); Splash s = new Splash(loc.x, loc.y, col, this, gridObjects); gridTools.Add(loc, s); lineNum += 3; } else if (toolType == 'l') // line shot { ColourPicker.Colour col = ReadColour(txtLines[lineNum][1]); int numDir = int.Parse(txtLines[lineNum + 1]); List <Direction> dir = new List <Direction>(); for (int j = 0; j < numDir; j += 1) { dir.Add(ReadDirection(txtLines[lineNum + 2][j])); } IntVector.IntVector2 loc = new IntVector.IntVector2(int.Parse(txtLines[lineNum + 3]), int.Parse(txtLines[lineNum + 4])); LineShot l = new LineShot(loc.x, loc.y, this, col, dir, gridObjects); gridTools.Add(loc, l); lineNum += 5; } else if (toolType == 'e') { IntVector.IntVector2 loc = new IntVector.IntVector2(int.Parse(txtLines[lineNum + 1]), int.Parse(txtLines[lineNum + 2])); Eraser e = new Eraser(loc.x, loc.y, gridObjects); gridTools.Add(loc, e); lineNum += 3; } else if (toolType == 't') { IntVector.IntVector2 loc1 = new IntVector.IntVector2(int.Parse(txtLines[lineNum + 1]), int.Parse(txtLines[lineNum + 2])); IntVector.IntVector2 loc2 = new IntVector.IntVector2(int.Parse(txtLines[lineNum + 3]), int.Parse(txtLines[lineNum + 4])); Teleporter t1 = new Teleporter(loc1.x, loc1.y, this, gridObjects); Teleporter t2 = new Teleporter(loc2.x, loc2.y, this, gridObjects, t1); t1.Other = t2; gridTools.Add(loc1, t1); gridTools.Add(loc2, t2); lineNum += 5; } else if (toolType == 'r') { Direction d = ReadDirection(txtLines[lineNum][1]); IntVector.IntVector2 loc = new IntVector.IntVector2(int.Parse(txtLines[lineNum + 1]), int.Parse(txtLines[lineNum + 2])); Redirection r = new Redirection(loc.x, loc.y, gridObjects, d); gridTools.Add(loc, r); lineNum += 3; } else { throw new System.Exception(); } } #endregion // create solution grid object and the mini-guide #region Read in solution and create overlay solutionGrid = new GameObject(); solutionGrid.name = "Solution"; solutionGrid.transform.parent = transform; // create mini-guide GameObject miniGuide = new GameObject(); miniGuide.name = "Mini-Guide"; GameObject guideOutline = new GameObject(); guideOutline.name = "GuideOutline"; guideOutline.transform.localPosition = new Vector2(0.0f, 0.0f); guideOutline.transform.parent = miniGuide.transform; GameObject guideTiles = new GameObject(); guideTiles.name = "GuideTiles"; guideTiles.transform.localPosition = new Vector2(0.0f, 0.0f); guideTiles.transform.parent = miniGuide.transform; // read in solution for (int i = 0; i < width; i += 1) { for (int j = 0; j < height; j += 1) { ColourPicker.Colour col = ReadColour(txtLines[lineNum + j][i]); int x = (i + height - 1 - j) % 2; // overlay solutionTiles[i][height - 1 - j] = new Tile(col, solutionGrid, i, height - 1 - j, gridTiles[i][height - 1 - j].Type); // mini guide Tile.TileType t = gridTiles[i][height - 1 - j].Type; if (t != Tile.TileType.Blank) { if (t == Tile.TileType.Default || t == Tile.TileType.Ice) { ResourceLoader.GetSpriteGameObject("GuideTile", guideTiles, i, height - 1 - j, "Guide", 1, "Sprites/Tiles/Tile-Default-" + x.ToString(), col); } else { ResourceLoader.GetSpriteGameObject("GuideTile", guideTiles, i, height - 1 - j, "Guide", 1, "Sprites/Tiles/Tile-Dark-" + x.ToString(), col); } ResourceLoader.GetSpriteGameObject("GuideOutline", guideOutline, i, height - 1 - j, "Guide", 0, "Sprites/Tiles/Tile-Outline"); } } } // set cursor cursor = ResourceLoader.GetSpriteGameObject("Cursor", miniGuide, playerCurrentLocation.x, playerCurrentLocation.y, "Guide", 2, "Sprites/Tiles/Cursor"); solutionGrid.SetActive(false); // set position and scale miniGuide.transform.position = new Vector2(transform.position.x + ((float)width) + 1.0f, ((float)height) / 4); miniGuide.transform.localScale = new Vector2(0.35f, 0.35f); #endregion // center the camera on the grid float aspectMultiplier = (16.0f / 9.0f) / ((float)Screen.width / Screen.height); cam.transform.position = new Vector3(((float)width) * 1.35f / 2.0f, ((float)height - 1) / 2.0f, -10.0f); cam.GetComponent <Camera>().orthographicSize = Mathf.Max(5.0f, (((float)width) * 0.5f + 0.5f) * aspectMultiplier, (((float)height) * 0.5f + 0.5f) * aspectMultiplier); // count number of correct tiles initially CountCorrectTiles(); defaultCorrectTiles = correctTiles; } catch { Debug.Log("Invalid level information."); } }