private bool? ExecuteColorAction(ColorAction action) { IDrawn drawObject = GameGraphics.GetDrawable(action.Drawable); switch (drawObject.DrawnType) { case DrawnType.Animation: return true; case DrawnType.Shape: IDrawnShape shape = (IDrawnShape)drawObject; shape.Color = action.Value; return GameGraphics.SetLoadedDrawn(shape); case DrawnType.String: DrawnString drawString = (DrawnString) drawObject; drawString.Color = action.Value; return GameGraphics.SetLoadedDrawn(drawString); } return null; }
//Frame color button click private void btn_FrameColor_Click(object sender, EventArgs e) { ColorPickerDialog colorDialog = new ColorPickerDialog(); DialogResult result = colorDialog.ShowDialog(); switch (result) { case DialogResult.OK: ColorAction action = new ColorAction { Name = "Frame color", Drawable = FrameRectangleName, Value = GameGraphics.ConvertSystemColorToXNA(colorDialog.Color) }; textureManager.ExecuteAction(action); _textureGame.RunOneFrame(); return; default: return; } }