private void Awake() { if (instance == null) { instance = this; } }
/// <param name="hue">0f~360f</param> public void SetColorHue(int hue) { bgColor = ColorManager.HSVtoRGB(hue, 0.6f, 1f); memoText.BackColor = ColorManager.HSVtoRGB(hue, 0.2f, 0.9f); PeriodDaysText.color = BGColor.Lighting(-80); mainPanel.BackColor = bgColor; }
public void CycleBGColor() { m_bg_color = (BGColor)(((int)m_bg_color + 1) % (int)BGColor.NUM); UpdateOptionLabels(); RefreshGrid(); this.Refresh(); }
public BGColor Get() { using (SqlConnection conn = Connection) { conn.Open(); using (SqlCommand cmd = conn.CreateCommand()) { cmd.CommandText = @"SELECT * FROM ColorConfig c WHERE c.id = 1"; BGColor bgcolor = null; SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { if (bgcolor == null) { bgcolor = new BGColor() { Id = reader.GetInt32(reader.GetOrdinal("Id")), ColorOption = reader.GetString(reader.GetOrdinal("ColorOption")) }; } } reader.Close(); return(bgcolor); } } }
public IUserInterfaceManager Execute() { Console.WriteLine("Background Color Menu"); Console.WriteLine(" 1) White"); Console.WriteLine(" 2) Blue"); Console.WriteLine(" 3) Red"); Console.WriteLine(" 4) Green"); Console.WriteLine(" 5) Reset to Default"); Console.WriteLine(" 0) Go Back"); Console.Write("> "); BGColor choice = new BGColor(); choice.ColorOption = Console.ReadLine(); switch (choice.ColorOption) { case "1": bgColor = ConsoleColor.White; fgColor = ConsoleColor.Black; Color(choice); return(this); case "2": bgColor = ConsoleColor.DarkBlue; fgColor = ConsoleColor.White; Color(choice); return(this); case "3": bgColor = ConsoleColor.DarkRed; fgColor = ConsoleColor.White; Color(choice); return(this); case "4": bgColor = ConsoleColor.DarkGreen; fgColor = ConsoleColor.White; Color(choice); return(this); case "5": Console.ResetColor(); Console.Clear(); Console.WriteLine(""); return(this); case "0": Console.Clear(); return(_parentUI); default: Console.Clear(); Console.WriteLine("Invalid Selection"); return(this); } }
private void Color(BGColor option) { Console.BackgroundColor = bgColor; Console.ForegroundColor = fgColor; _bgColorRepository.Update(option); Console.Clear(); // this is just to get the color to show. Console.WriteLine(""); }
private void BGColorButton_Click(object sender, EventArgs e) { BGColor.ShowDialog(); DrawingAreaState drawingArea = client.clientMachine.drawingArea; drawingArea.Access(); drawingArea.BackgroundColor = Color.FromArgb(drawingArea.BackgroundColor.A, BGColor.Color); drawingArea.Exit(); BGColorButton.BackColor = BGColor.Color; }
public void Update(BGColor bgcolor) { using (SqlConnection conn = Connection) { conn.Open(); using (SqlCommand cmd = conn.CreateCommand()) { cmd.CommandText = @"UPDATE ColorConfig SET ColorOption = @colorOption WHERE id = 1"; cmd.Parameters.AddWithValue("@colorOption", bgcolor.ColorOption); cmd.ExecuteNonQuery(); } } }
public void LoadPreferences() { Directory.SetCurrentDirectory(m_filepath_root); //m_filepath_root = UserPrefs.GetString("filepath_root", m_filepath_root); m_filepath_decal_textures = UserPrefs.GetString("filepath_decal_textures", m_filepath_decal_textures); m_filepath_level_textures = UserPrefs.GetString("filepath_level_textures", m_filepath_level_textures); m_filepath_decals = UserPrefs.GetString("filepath_decals", m_filepath_decals); m_grid_display = (GridDisplay)UserPrefs.GetInt("grid_display", (int)m_grid_display); m_grid_spacing = UserPrefs.GetFloat("grid_spacing", m_grid_spacing); SetGridLines(); m_grid_snap = UserPrefs.GetFloat("grid_snap", m_grid_snap); m_extrude_length = UserPrefs.GetFloat("extrude_length", m_extrude_length); m_inset_pct = UserPrefs.GetInt("inset_pct", m_inset_pct); m_inset_length = UserPrefs.GetFloat("inset_length", m_inset_length); m_bevel_width = UserPrefs.GetFloat("bevel_width", m_bevel_width); m_coplanar_tol = UserPrefs.GetInt("coplanar_tol", m_coplanar_tol); m_side_select = (SideSelect)UserPrefs.GetInt("side_select", (int)m_side_select); m_drag_mode = (DragMode)UserPrefs.GetInt("drag_mode", (int)m_drag_mode); m_view_mode_ortho = (ViewMode)UserPrefs.GetInt("view_mode_ortho", (int)m_view_mode_ortho); m_view_mode_persp = (ViewMode)UserPrefs.GetInt("view_mode_persp", (int)m_view_mode_persp); m_view_persp_fov = UserPrefs.GetInt("view_persp_fov", m_view_persp_fov); m_view_layout = (ViewLayout)UserPrefs.GetInt("view_layout", (int)m_view_layout); m_bg_color = (BGColor)UserPrefs.GetInt("bg_color", (int)m_bg_color); m_gimbal_display = (GimbalDisplay)UserPrefs.GetInt("gimbal_display", (int)m_gimbal_display); m_lighting_type = (LightingType)UserPrefs.GetInt("lighting_type", (int)m_lighting_type); m_pivot_mode = (PivotMode)UserPrefs.GetInt("pivot_mode", (int)m_pivot_mode); m_low_res_force = UserPrefs.GetBool("low_res_force", m_low_res_force); forceLowResTexturesToolStripMenuItem.Checked = m_low_res_force; m_tex_list_loc = UserPrefs.GetPoint("tex_list_loc", texture_list.Location); m_tex_list_sz = UserPrefs.GetPoint("tex_list_sz", (Point)texture_list.Size); m_tunnel_builder_loc = UserPrefs.GetPoint("tunnel_builder_loc", tunnel_builder.Location); texture_list.Size = (Size)m_tex_list_sz; for (int i = 0; i < RECENT_NUM; i++) { m_recent_files[i] = UserPrefs.GetString("recent" + i.ToString(), m_recent_files[i]); } UpdateRecentFileMenu(); }
public void UpdateBGColor(BGColor bg) { switch (bg) { default: C_bg = Color.FromArgb(255, 200, 200, 200); C_grid1 = Color.FromArgb(255, 215, 215, 215); C_grid2 = Color.FromArgb(255, 230, 230, 230); C_grid3 = Color.FromArgb(255, 245, 245, 245); break; case BGColor.DARK: C_bg = Color.FromArgb(255, 0, 0, 0); C_grid1 = Color.FromArgb(255, 15, 15, 15); C_grid2 = Color.FromArgb(255, 25, 25, 25); C_grid3 = Color.FromArgb(255, 35, 35, 35); break; } }
protected override void OnPaintSurface(SKPaintSurfaceEventArgs e) { base.OnPaintSurface(e); var canvas = e.Surface.Canvas; canvas.Clear(); int width = e.Info.Width; int height = e.Info.Height; SKPaint backPaint = new SKPaint { Style = SKPaintStyle.Fill, Color = SKColors.WhiteSmoke, }; canvas.DrawRect(new SKRect(0, 0, width, height), backPaint); canvas.Save(); canvas.Translate(width / 2, height / 2); canvas.Scale(Math.Min(width / 210f, height / 520f)); var rect = new SKRect(-100, -100, 100, 100); // Add a buffer for the rectangle rect.Inflate(-10, -10); var bgColorPaint = new SKPaint { Color = BGColor.ToSKColor(), IsAntialias = true, Style = SKPaintStyle.Fill, StrokeWidth = 0 }; var barColorPaint = new SKPaint { Color = BarColor.ToSKColor(), IsAntialias = true, Style = SKPaintStyle.Fill, StrokeWidth = 0 }; var frameColorPaint = new SKPaint { Color = FrameColor.ToSKColor(), IsAntialias = true, Style = SKPaintStyle.Stroke, StrokeWidth = 2 }; var skrect = new SKRect(0, 0, PGWidth, PGHeight); var skRoundRect = new SKRoundRect(skrect, PGHeight / 2, PGHeight / 2); canvas.DrawRoundRect(0, 0, PGWidth, PGHeight, PGHeight / 2, PGHeight / 2, bgColorPaint); canvas.DrawRoundRect(skRoundRect, frameColorPaint); canvas.ClipRoundRect(skRoundRect, SKClipOperation.Intersect); if (StartColor != Color.Default && EndColor != Color.Default) { barColorPaint.Shader = SKShader.CreateLinearGradient( new SKPoint(skrect.Left, skrect.Bottom), new SKPoint(skrect.Right, skrect.Top), new SKColor[] { StartColor.ToSKColor(), EndColor.ToSKColor() }, new float[] { 0, 1 }, SKShaderTileMode.Repeat); } canvas.DrawRoundRect(0, 0, PGWidth * Progress / 100, PGHeight, PGWidth / 2, 0, barColorPaint); canvas.Restore(); }
public void LoadPreferences() { Directory.SetCurrentDirectory(m_filepath_root); m_grid_display = (GridDisplay)UserPrefs.GetInt("grid_display", (int)m_grid_display); m_grid_spacing = UserPrefs.GetInt("grid_spacing", m_grid_spacing); m_grid_snap = UserPrefs.GetFloat("grid_snap", m_grid_snap); m_coplanar_tol = UserPrefs.GetInt("coplanar_tol", m_coplanar_tol); m_rotate_angle = UserPrefs.GetInt("rotate_angle", m_rotate_angle); m_side_select = (SideSelect)UserPrefs.GetInt("side_select", (int)m_side_select); m_insert_advance = UserPrefs.GetBool("insert_advance", m_insert_advance); m_drag_mode = (DragMode)UserPrefs.GetInt("drag_mode", (int)m_drag_mode); m_view_mode_ortho = (ViewMode)UserPrefs.GetInt("view_mode_ortho", (int)m_view_mode_ortho); m_view_mode_persp = (ViewMode)UserPrefs.GetInt("view_mode_persp", (int)m_view_mode_persp); m_view_persp_fov = UserPrefs.GetInt("view_persp_fov", m_view_persp_fov); m_view_layout = (ViewLayout)UserPrefs.GetInt("view_layout", (int)m_view_layout); m_bg_color = (BGColor)UserPrefs.GetInt("bg_color", (int)m_bg_color); m_gimbal_display = (GimbalDisplay)UserPrefs.GetInt("gimbal_display", (int)m_gimbal_display); m_lighting_type = (LightingType)UserPrefs.GetInt("lighting_type", (int)m_lighting_type); m_cp_display = (ClipPlaneDisplay)UserPrefs.GetInt("clip_decal", (int)m_cp_display); m_insert_decal = (InsertDecal)UserPrefs.GetInt("insert_decal", (int)m_insert_decal); m_show_3d_text_type = (ShowTextType)UserPrefs.GetInt("show_segment_numbers", (int)m_show_3d_text_type); m_auto_center = UserPrefs.GetBool("auto_center", m_auto_center); m_decal_list_loc = UserPrefs.GetPoint("decal_list_loc", decal_list.Location); m_decal_list_sz = UserPrefs.GetPoint("decal_list_sz", (Point)decal_list.Size); m_tex_list_loc = UserPrefs.GetPoint("tex_list_loc", texture_list.Location); m_tex_list_sz = UserPrefs.GetPoint("tex_list_sz", (Point)texture_list.Size); m_texture_set_list_loc = UserPrefs.GetPoint("texture_set_list_loc", texture_list.Location); m_texture_set_list_sz = UserPrefs.GetPoint("texture_set_list_sz", (Point)texture_list.Size); m_uv_editor_loc = UserPrefs.GetPoint("uv_editor_loc", uv_editor.Location); m_uv_editor_sz = UserPrefs.GetPoint("uv_editor_sz", (Point)uv_editor.Size); decal_list.Size = (Size)m_decal_list_sz; texture_list.Size = (Size)m_tex_list_sz; uv_editor.Size = (Size)m_uv_editor_sz; for (int i = 0; i < NumRecentFiles; i++) { string recent_file = GetRecentFile(i); SetRecentFile(i, UserPrefs.GetString("recent" + i.ToString(), recent_file)); } Shell.UpdateRecentFileMenu(); m_pivot_mode = (PivotMode)UserPrefs.GetInt("entity_pivot", (int)m_pivot_mode); m_editor_layout = UserPrefs.GetString("layout", string.Empty); //Save whether pop-up windows are open at startup m_decal_list_visible = UserPrefs.GetBool("decal_list_vis", false); m_texture_list_visible = UserPrefs.GetBool("tex_list_vis", false); m_texture_set_list_visible = UserPrefs.GetBool("texture_set_list_vis", false); m_uv_editor_visible = UserPrefs.GetBool("uv_editor_vis", false); #if !PUBLIC_RELEASE Overload.Perforce.m_cached_username = UserPrefs.GetString("m_cached_username", string.Empty); Overload.Perforce.m_cached_clientname = UserPrefs.GetString("m_cached_clientname", string.Empty); #endif // !PUBLIC_RELEASE m_mm_edit_type = (EditMode)UserPrefs.GetInt("mm_edit_type", (int)m_mm_edit_type); m_mm_op_mode = (OperationMode)UserPrefs.GetInt("mm_op_mode", (int)m_mm_op_mode); //Read texture collections int num_texture_collections = UserPrefs.GetInt("num_texture_collections", 0); for (int c = 0; c < num_texture_collections; c++) { TextureCollections.Add(new TextureCollection(UserPrefs.GetString("texture_collection_" + c), true)); } }
public IUserInterfaceManager Execute() { BGColorRepository bgColorRepository = new BGColorRepository(CONNECTION_STRING); ConsoleColor bgColor = new ConsoleColor(); ConsoleColor fgColor = new ConsoleColor(); BGColor savedColor = bgColorRepository.Get(); void Color(BGColor option) { Console.BackgroundColor = bgColor; Console.ForegroundColor = fgColor; bgColorRepository.Update(option); Console.Clear(); // this is just to get the color to show. Console.WriteLine(""); } switch (savedColor.ColorOption) { case "1": bgColor = ConsoleColor.White; fgColor = ConsoleColor.Black; Color(savedColor); break; case "2": bgColor = ConsoleColor.DarkBlue; fgColor = ConsoleColor.White; Color(savedColor); break; case "3": bgColor = ConsoleColor.DarkRed; fgColor = ConsoleColor.White; Color(savedColor); break; case "4": bgColor = ConsoleColor.DarkGreen; fgColor = ConsoleColor.White; Color(savedColor); break; case "5": Console.ResetColor(); Console.Clear(); Console.WriteLine(""); break; } // Main menu header Console.WriteLine(@" ██╗ ██╗ ██████╗ ██╗ ██╗██████╗ ██╗ ██╗ ██╗ .~~~~`\~~\ ██║ ██║██╔═══██╗██║ ██║██╔══██╗╚██╗ ██╔╝ ██║ ; ~~ \ ███████║██║ ██║██║ █╗ ██║██║ ██║ ╚████╔╝ ██║ | ; ██╔══██║██║ ██║██║███╗██║██║ ██║ ╚██╔╝ ╚═╝ ,--------,______|---. ██║ ██║╚██████╔╝╚███╔███╔╝██████╔╝ ██║ ██╗ / \-----` \ ╚═╝ ╚═╝ ╚═════╝ ╚══╝╚══╝ ╚═════╝ ╚═╝ ╚═╝ `.__________`-_______-'"); Console.WriteLine("Main Menu"); Console.WriteLine(" 1) My Journal Management"); Console.WriteLine(" 2) Blog Management"); Console.WriteLine(" 3) Author Management"); Console.WriteLine(" 4) Post Management"); Console.WriteLine(" 5) Tag Management"); Console.WriteLine(" 6) Search by Tag"); Console.WriteLine(" 7) Color Themes"); Console.WriteLine(" 0) Exit"); Console.Write("> "); string choice = Console.ReadLine(); switch (choice) { case "1": Console.Clear(); return(new JournalManager(this, CONNECTION_STRING)); case "2": Console.Clear(); return(new BlogManager(this, CONNECTION_STRING)); case "3": Console.Clear(); return(new AuthorManager(this, CONNECTION_STRING)); case "4": Console.Clear(); return(new PostManager(this, CONNECTION_STRING)); case "5": Console.Clear(); return(new TagManager(this, CONNECTION_STRING)); case "6": Console.Clear(); return(new SearchManager(this, CONNECTION_STRING)); case "0": Console.WriteLine("Good bye"); return(null); case "7": Console.Clear(); return(new ColorManager(this, CONNECTION_STRING)); default: Console.WriteLine("Invalid Selection"); return(this); } }
private void UpdateCalculate() { int totalAsset = 0; int totalHope = 0; for (int i = 0; i < AssetItemContext.Children.Count; ++i) { string text = ((CostItem)AssetItemContext.Children[i]).CostEditText.Text.Replace(",", ""); int cost; bool success = int.TryParse(text, out cost); if (success) { totalAsset += cost; } } for (int i = 0; i < HopeItemContext.Children.Count; ++i) { string text = ((CostItem)HopeItemContext.Children[i]).CostEditText.Text.Replace(",", ""); int cost; bool success = int.TryParse(text, out cost); if (success) { totalHope += cost; } } TotalAssetText.Text = string.Format("{0:#,###}", totalAsset); TotalHopeText.Text = string.Format("{0:#,###}", totalHope); int balance = totalAsset - totalHope; float usePercent = (float)Math.Round(totalHope * 100f / totalAsset, 1); float balancePercent = (float)Math.Round(balance * 100f / totalAsset, 1); BalanceText.Text = string.Format("{0:#,###}", balance); ResultDescriptText.Text = string.Format("가진 돈의 {0}%를 소비하고,\n{1}%가 남습니다.", usePercent, balancePercent); string result; Color BGColor; if (balancePercent > 80f) { result = "사"; BGColor = "679979".ToColor(); resultState = 0; } else if (balancePercent > 60f) { result = "아껴써라"; BGColor = "8f9967".ToColor(); resultState = 1; } else if (balancePercent > 20f) { result = "사면거지됨"; BGColor = "997467".ToColor(); resultState = 2; } else { result = "사지마"; BGColor = "996767".ToColor(); resultState = 3; } ResultText.Text = result; ResultContext.Background = BGColor.ToBrush(); if (resultState != resultStateCompare) { resultStateCompare = resultState; resultFXFrame = 0f; } }