public void UpdateTheme(Theme theme) { Theme = theme; int squareWidth = 50; int squareHeight = 50; if (Theme.PieceSet is PieceSet) { squareWidth = Theme.PieceSet.Width + 6; squareHeight = Theme.PieceSet.Height + 6; pieceSetPresentation = new BitmapPieceSetPresentation(Game, (PieceSet)Theme.PieceSet); pieceSetPresentation.Initialize(Theme); } else { throw new Exception("Non-Bitmap piece sets not implemented yet"); } int squareSize = squareWidth > squareHeight ? squareWidth : squareHeight; if (Theme.CustomThemeName != null) { Game.GetThemeSquareSize(theme.CustomThemeName, ref squareSize); } mapping = CreateMapping(24, squareSize); }
public void UpdateTheme(Theme theme) { Theme = theme; squareWidth = 50; squareHeight = 50; if (Theme.PieceSet is PieceSet) { squareWidth = ((PieceSet)Theme.PieceSet).Width + 5; squareHeight = ((PieceSet)Theme.PieceSet).Height + 5; pieceSetPresentation = new BitmapPieceSetPresentation(Game, (PieceSet)Theme.PieceSet); pieceSetPresentation.Initialize(Theme); } else { throw new Exception("Non-Bitmap piece sets not implemented yet"); } Invalidate(); }