public static void Display(string[] textBlock, ColourPalette colourPalette) { Console.ForegroundColor = colourPalette.primaryColour; Console.BackgroundColor = colourPalette.secondaryColour; foreach (var text in textBlock) { var splitString = text.ParseString("*", "*"); var test = text.Replace("*", string.Empty).Split(new string[] { splitString }, StringSplitOptions.None); Console.Write(test[0]); if (test.GetLength(0) > 1) { Console.ForegroundColor = colourPalette.highlightColour; Console.Write(splitString); Console.ForegroundColor = colourPalette.primaryColour; Console.Write(test[1]); } Console.Write("\n"); } Console.ResetColor(); }
// Constructors: public ChestColouringPanel(ICustomItemGrabMenu hostMenu) : base(hostMenu, GlobalVars.GameViewport, true, Colours.Default) { _isShowingColourEditors = false; /* * * * game_viewport.Width - this.ItemsToGrabMenu.width - Convert.ToInt32(game_viewport.Width / (12 * StardewValley.Game1.options.zoomLevel)), * game_viewport.Height / Convert.ToInt32(8 * StardewValley.Game1.options.zoomLevel), * * */ var source_menu_bounds = this.HostMenu.SourceInventoryOptions.Bounds; var player_menu_bounds = this.HostMenu.PlayerInventoryOptions.Bounds; var menu_chest_size = new Point( source_menu_bounds.Width / Convert.ToInt32(5.83f * StardewValley.Game1.options.zoomLevel), source_menu_bounds.Width / Convert.ToInt32(2.91f * StardewValley.Game1.options.zoomLevel) // using 'width' here since Chest.height is basically Chest.width * 2 ); _panelButton = new ExtendedSVObjects.ExtendedChestInCustomItemGrabMenu(this, new Rectangle( (source_menu_bounds.X / 2) - (menu_chest_size.X / 2), (this.Bounds.Height / 2) - Convert.ToInt32(menu_chest_size.Y / 1.85f), menu_chest_size.X, menu_chest_size.Y), "openPanelBTN", _componentOnClick, "Configure this chest", BaseTypes.Colours.TurnSlightlyTranslucentOnAction); _colourPalette = new ColourPalette(this, this.HostMenu.ItemsToGrabMenu.GetNormalizedInventoryMenuBounds(), _panelButton.MenuChest, "palette", _componentOnClick); _colourPalette.SetVisible(false); this.Colours = new Colours(Color.FromNonPremultiplied(50, 60, 70, 255), Color.White, Color.White, Color.White); this.Components.Add(_panelButton); this.Components.Add(_colourPalette); }
void Update() { if (Input.GetKeyDown(KeyCode.Alpha1)) { colourPalette = ColourPalette.Standard; cam.TurnOffWeatherEffect(); } if (Input.GetKeyDown(KeyCode.Alpha2)) { colourPalette = ColourPalette.Night; cam.TurnOffWeatherEffect(); } if (Input.GetKeyDown(KeyCode.Alpha3)) { colourPalette = ColourPalette.Sunset; cam.TurnOffWeatherEffect(); } if (Input.GetKeyDown(KeyCode.Alpha4)) { cam.TurnOnWeatherEffect(); colourPalette = ColourPalette.Rain; } if (colourPalette != _colourPalette) { _colourPalette = colourPalette; SetColourPalette(); } }
void OnEnable() { hairNames = AssetManager.instance.hairMeshes.Select(o => o.name).ToArray(); bodyNames = AssetManager.instance.bodyMeshes.Select(o => o.name).ToArray(); handsNames = AssetManager.instance.handMeshes.Select(o => o.name).ToArray(); hatNames = AssetManager.instance.hatMeshes.Select(o => o.name).ToArray(); skinColors = AssetManager.instance.skinColours; }
protected override void setValues() { ColourPalette palette = ((ColourWeightMap)target).ColourPalette; if (palette != null) { initValues(palette.colours, palette.colours.Select(o => o.name).ToArray()); } }
public void PaletteSelect_NoInitialSelectedPalette_SelectedPalette_SetTrue() { var selectedPalette = new ColourPalette { IsSelected = false }; model.PaletteSelect(selectedPalette); Assert.IsTrue(selectedPalette.IsSelected); }
public async Task Run(string[] args) { Console.WriteLine("Greg's Fractal renderer test"); Console.WriteLine("Setting up..."); var timer = new Stopwatch(); timer.Start(); const int width = 1000; // Real Axis const int height = 1000; // Imaginary Axis var centre = new Complex(0m, 0m); var range = new Complex(3m, 3m); var arrayBuilder = new ComplexPlaneBuilder(); var bitmapConverter = new ByteArrayToBitmapConverter(); var iterator = new Iterator(); var renderer = new JuliaRenderer(arrayBuilder, iterator); renderer.C = new Complex(0.285m, 0.01m); await renderer.SetupAsync(width, height, centre, range); Console.WriteLine("Iterating..."); var iterationTimer = new Stopwatch(); for (var i = 0; i < 200; i++) { iterationTimer.Start(); await renderer.IterateAsync(); Console.WriteLine($"Iteration {i} complete taking {iterationTimer.Elapsed.TotalSeconds} seconds."); iterationTimer.Reset(); } Console.WriteLine("Drawing..."); var palette = new ColourPalette(); palette.AddMarker(Colour.Black(), 0); palette.AddMarker(Colour.White(), 99.999m); palette.AddMarker(Colour.Black(), 100); // Get byte array of 32bpp colour data var imageBytes = await renderer.Get32BppImageByteArrayAsync(palette); // Convert byte array to bitmap var image = await bitmapConverter.ConvertAsync(imageBytes, width, height); // Encode to png var imageData = image.Encode(SKEncodedImageFormat.Png, int.MaxValue); // Save to file system await using var fs = new FileStream($@"C:\FractalOutput\Julia{DateTime.Now:yyyyMMddHHmmss}.png", FileMode.CreateNew); imageData.SaveTo(fs); Console.WriteLine($"Finished, took {timer.Elapsed.TotalSeconds} seconds."); }
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 Awake() { healthBarTransform = transform.GetChild(0); backgroundBar = GetComponent <SpriteRenderer>(); healthBar = healthBarTransform.GetComponent <SpriteRenderer>(); palette = Resources.Load <ColourPalette>("Palette"); setup = true; }
public void NextPage_PaletteSelected_NotRandomStripeType_NavigateToNextPage_RandomParamFalse() { _navigationService.Setup(n => n.NavigateAsync(It.IsAny <string>())); _appDataService.Setup(a => a.SelectedColours); var selectedPalette = new ColourPalette(); model.PaletteSelect(selectedPalette); model.NextPage("notRandom"); _navigationService.Verify(n => n.NavigateAsync("StripesPage?random=False"), Times.Once); }
private string[] getColourNames(ColourPalette palette) { if (colourNames.ContainsKey(palette)) { return(colourNames[palette]); } else { string[] names = palette.colours.Select(o => o.name).ToArray(); colourNames.Add(palette, names); return(names); } }
// private bool waitForJuliaSetToRender = false; // Use this for initialization void Start() { IFormConfiguration formConfig1 = new FormConfig1(); IFormConfiguration formConfig2 = new FormConfig2(); IFormConfiguration formConfig3 = new FormConfig3(); IFormConfiguration formConfig4 = new FormConfig4(); IFormConfiguration formConfig5 = new FormConfig5(); IFormConfiguration formConfig6 = new FormConfig6(); IFormConfiguration formConfig7 = new FormConfig7(); IFormConfiguration formConfig8 = new FormConfig8(); IFormConfiguration formConfig9 = new FormConfig9(); allConfigs.Add(formConfig1); allConfigs.Add(formConfig2); allConfigs.Add(formConfig3); allConfigs.Add(formConfig4); allConfigs.Add(formConfig5); allConfigs.Add(formConfig6); allConfigs.Add(formConfig7); allConfigs.Add(formConfig8); allConfigs.Add(formConfig9); currentConfig = formConfig1; dawnMaterial = Resources.Load("DawnDusk Skybox") as Material; eerieMaterial = Resources.Load("Eerie Skybox") as Material; nightMaterial = Resources.Load("StarryNight Skybox") as Material; mainCamera = Camera.main; mainCamera.clearFlags = CameraClearFlags.Skybox; RenderSettings.skybox = dawnMaterial; backgroundCamera = GameObject.Find("Background Camera").GetComponent <Camera>(); backgroundCamera.enabled = false; formBuilderPalette = new FormBuilderPalette(this); colourPalette = new ColourPalette(this); helpPalette = new HelpPalette(); //initialiase with something createNewBrush(); //slot 1 //make it colourful colourConfig.setCycle(true); colourConfig.setPulse(true); colourConfig.setFadeColour(true); autoPreset = true; autoMutate1 = true; }
public void PaletteSelect_CurrentPaletteDeselected_SelectedPalette_SetTrue() { var currentPalette = new ColourPalette { IsSelected = false }; model.PaletteSelect(currentPalette); var selectedPalette = new ColourPalette { IsSelected = false }; model.PaletteSelect(selectedPalette); Assert.IsTrue(selectedPalette.IsSelected); Assert.IsFalse(currentPalette.IsSelected); }
// private bool waitForJuliaSetToRender = false; // Use this for initialization void Start() { IFormConfiguration formConfig1 = new FormConfig1 (); IFormConfiguration formConfig2 = new FormConfig2 (); IFormConfiguration formConfig3 = new FormConfig3 (); IFormConfiguration formConfig4 = new FormConfig4 (); IFormConfiguration formConfig5 = new FormConfig5 (); IFormConfiguration formConfig6 = new FormConfig6 (); IFormConfiguration formConfig7 = new FormConfig7 (); IFormConfiguration formConfig8 = new FormConfig8 (); IFormConfiguration formConfig9 = new FormConfig9 (); allConfigs.Add (formConfig1); allConfigs.Add (formConfig2); allConfigs.Add (formConfig3); allConfigs.Add (formConfig4); allConfigs.Add (formConfig5); allConfigs.Add (formConfig6); allConfigs.Add (formConfig7); allConfigs.Add (formConfig8); allConfigs.Add (formConfig9); currentConfig = formConfig1; dawnMaterial = Resources.Load("DawnDusk Skybox") as Material; eerieMaterial = Resources.Load("Eerie Skybox") as Material; nightMaterial = Resources.Load("StarryNight Skybox") as Material; mainCamera = Camera.main; mainCamera.clearFlags = CameraClearFlags.Skybox; RenderSettings.skybox = dawnMaterial; backgroundCamera = GameObject.Find ("Background Camera").GetComponent<Camera>(); backgroundCamera.enabled = false; formBuilderPalette = new FormBuilderPalette (this); colourPalette = new ColourPalette (this); helpPalette = new HelpPalette (); //initialiase with something createNewBrush(); //slot 1 //make it colourful colourConfig.setCycle (true); colourConfig.setPulse (true); colourConfig.setFadeColour (true); autoPreset = true; autoMutate1 = true; }
public void Awake() { Instance = this; }
private void Awake() { Instance = this; }