protected override void OnConstruct() { Size = new Vector2(1000, 600); Padding = new System.Windows.Forms.Padding(20); Anchor = global::Graphics.Orientation.Center; Clickable = true; ControlBox = false; ClearChildren(); var topBar = new Control { Dock = System.Windows.Forms.DockStyle.Top, Size = new Vector2(0, 70), //Background = new StretchingImageGraphic //{ // Texture = new TextureConcretizer // { // TextureDescription = new Graphics.Software.Textures.SingleColorTexture(System.Drawing.Color.FromArgb(50, 255, 0, 0)) // }, //}, Padding = new System.Windows.Forms.Padding(0, 0, 0, 5) }; AddChild(topBar); Control topLeftBar = new Control { Dock = System.Windows.Forms.DockStyle.Left, Size = new Vector2(500, 0) }; topBar.AddChild(topLeftBar); var winLoseTextBox = new Label { Font = new Graphics.Content.Font { SystemFont = Fonts.HugeSystemFont, Color = System.Drawing.Color.Green, }, AutoSize = AutoSizeMode.Full, TextAnchor = global::Graphics.Orientation.TopLeft, Dock = System.Windows.Forms.DockStyle.Top, Background = null, //Background = new StretchingImageGraphic //{ // Texture = new TextureConcretizer // { // TextureDescription = new Graphics.Software.Textures.SingleColorTexture(System.Drawing.Color.FromArgb(50, 255, 0, 0)) // }, //}, }; topLeftBar.AddChild(winLoseTextBox); if (GameState == GameState.Won) { winLoseTextBox.Text = Locale.Resource.ScoreVictory; winLoseTextBox.Font.Color = System.Drawing.Color.Green; } else { winLoseTextBox.Text = Locale.Resource.ScoreDefeat; winLoseTextBox.Font.Color = System.Drawing.Color.Red; topLeftBar.AddChild(new Label { Font = new Font { SystemFont = Fonts.MediumSystemFont, Color = System.Drawing.Color.White }, Background = null, Dock = System.Windows.Forms.DockStyle.Fill, Text = LostGameReason, TextAnchor = global::Graphics.Orientation.TopLeft, }); } Control trPanel = new Control { Dock = System.Windows.Forms.DockStyle.Right, Size = new Vector2(200, 40) }; topBar.AddChild(trPanel); var gt = new DateTime(TimeSpan.FromSeconds(GameTime).Ticks); var timeLeftTextBox = new Label { Dock = System.Windows.Forms.DockStyle.Bottom, Background = null, Size = new Vector2(120, 20), TextAnchor = global::Graphics.Orientation.BottomRight, }; timeLeftTextBox.Text = Locale.Resource.GenTime + ": " + gt.ToString("mm:ss"); trPanel.AddChild(timeLeftTextBox); if (SilverEnabled) { Control silverTextContainer = new Control { Dock = System.Windows.Forms.DockStyle.Bottom, Size = new Vector2(0, 30), }; trPanel.AddChild(silverTextContainer); silverTextContainer.AddChild(new SilverText { Anchor = Orientation.BottomRight, Size = new Vector2(120, 30), Background = null, SilverYield = SilverYield }); } AddChild(new Control { Background = new StretchingImageGraphic { Texture = new TextureConcretizer { TextureDescription = new Graphics.Software.Textures.SingleColorTexture(System.Drawing.Color.FromArgb(50, 255, 255, 255)) }, SizeMode = SizeMode.AutoAdjust }, Dock = System.Windows.Forms.DockStyle.Top, Size = new Vector2(0, 1) }); Control bottomBar = new Control { Dock = System.Windows.Forms.DockStyle.Bottom, Size = new Vector2(0, 50) }; AddChild(bottomBar); FlowLayout leftBottomFlow = new FlowLayout { AutoSize = true, HorizontalFill = true, Newline = false, Anchor = Orientation.BottomLeft }; bottomBar.AddChild(leftBottomFlow); FlowLayout rightBottomFlow = new FlowLayout { AutoSize = true, HorizontalFill = true, Newline = false, Anchor = Orientation.BottomRight, Origin = FlowOrigin.BottomRight, //Background = new StretchingImageGraphic //{ // Texture = new TextureConcretizer // { // TextureDescription = new Graphics.Software.Textures.SingleColorTexture(System.Drawing.Color.FromArgb(50, 255, 0, 0)) // }, //}, }; bottomBar.AddChild(rightBottomFlow); ButtonBase mainMenuButton = new StoneButton { AutoSize = AutoSizeMode.Horizontal, Padding = new System.Windows.Forms.Padding(5, 0, 5, 0) }; if (FirstTimeCompletedMap) mainMenuButton.Text = Locale.Resource.GenContinue; else mainMenuButton.Text = Locale.Resource.GenMainMenu; rightBottomFlow.AddChild(mainMenuButton); mainMenuButton.Click += new EventHandler(mainMenuButton_Click); ButtonBase playAgainButton = new StoneButton { Text = Locale.Resource.GenPlayAgain, Visible = EarnedGoldCoins == 0, AutoSize = AutoSizeMode.Horizontal, Padding = new System.Windows.Forms.Padding(5, 0, 5, 0) }; rightBottomFlow.AddChild(playAgainButton); playAgainButton.Click += new EventHandler(playAgainButton_Click); if (FirstTimeCompletedMap && Program.Settings.DisplayMapRatingDialog == MapRatingDialogSetup.Optional) { ButtonBase rateMapButton = new StoneButton { Text = Locale.Resource.GenRateMap, AutoSize = AutoSizeMode.Horizontal, Padding = new System.Windows.Forms.Padding(5, 0, 5, 0) }; rightBottomFlow.AddChild(rateMapButton); rateMapButton.Click += new EventHandler(rateMapButton_Click); } AddChild(new Control { Background = new StretchingImageGraphic { Texture = new TextureConcretizer { TextureDescription = new Graphics.Software.Textures.SingleColorTexture(System.Drawing.Color.FromArgb(50, 255, 255, 255)) }, SizeMode = SizeMode.AutoAdjust }, Dock = System.Windows.Forms.DockStyle.Bottom, Size = new Vector2(0, 1) }); Control main = new Control { Dock = System.Windows.Forms.DockStyle.Fill }; AddChild(main); ////////////////////////// // STATS ///////////////// ////////////////////////// StatsControl stats = new StatsControl { Dock = System.Windows.Forms.DockStyle.Fill, Visible = false }; stats.GameState = GameState; stats.LostGameReason = LostGameReason; stats.Statistics = Statistics; stats.Map = Map; main.AddChild(stats); ////////////////////////// // REWARDS /////////////// ////////////////////////// ResultsAndRewardsControl rewards = new ResultsAndRewardsControl { Dock = System.Windows.Forms.DockStyle.Fill, //Background = new StretchingImageGraphic //{ // Texture = new TextureConcretizer // { // TextureDescription = new Graphics.Software.Textures.SingleColorTexture(System.Drawing.Color.FromArgb(50, 255, 0, 0)) // }, //}, Anchor = global::Graphics.Orientation.TopRight }; rewards.GameState = GameState; rewards.EarnedGoldCoins = EarnedGoldCoins; rewards.NPlaythroughs = NPlaythroughs; rewards.AchievementsEarned = AchievementsEarned; rewards.SilverYield = SilverYield; rewards.PreviousMaxSilverYield = PreviousMaxSilverYield; rewards.FirstTimeCompletedMap = FirstTimeCompletedMap; rewards.CurrentStages = CurrentStages; rewards.BestStages = BestStages; rewards.Map = Map; main.AddChild(rewards); ///////////////////// // Switch buttons ///////////////////// CheckboxBase rnrButton = new StoneCheckbox { Text = Locale.Resource.ScoreRewardsAndResults, Font = new Font { SystemFont = Fonts.MediumSystemFont, Color = System.Drawing.Color.White, Backdrop = System.Drawing.Color.Black }, Checked = true, AutoCheck = false, Size = new Vector2(200, 38), AutoSize = AutoSizeMode.Horizontal, Padding = new System.Windows.Forms.Padding(5, 0, 5, 0) }; leftBottomFlow.AddChild(rnrButton); CheckboxBase statsButton = new StoneCheckbox { Text = Locale.Resource.ScoreStats, Font = new Font { SystemFont = Fonts.MediumSystemFont, Color = System.Drawing.Color.White, Backdrop = System.Drawing.Color.Black }, Checked = false, AutoCheck = false, AutoSize = AutoSizeMode.Horizontal, Padding = new System.Windows.Forms.Padding(5, 0, 5, 0) }; leftBottomFlow.AddChild(statsButton); if (HideStats) { leftBottomFlow.Visible = false; stats.Visible = false; } else { statsButton.Click += new EventHandler((o, e) => { rnrButton.Checked = rewards.Visible = false; statsButton.Checked = stats.Visible = true; }); rnrButton.Click += new EventHandler((o, e) => { rnrButton.Checked = rewards.Visible = true; statsButton.Checked = stats.Visible = false; }); } base.OnConstruct(); }
protected override void OnConstruct() { Size = new Vector2(1000, 600); Padding = new System.Windows.Forms.Padding(20); Anchor = global::Graphics.Orientation.Center; Clickable = true; ControlBox = false; ClearChildren(); var topBar = new Control { Dock = System.Windows.Forms.DockStyle.Top, Size = new Vector2(0, 70), //Background = new StretchingImageGraphic //{ // Texture = new TextureConcretizer // { // TextureDescription = new Graphics.Software.Textures.SingleColorTexture(System.Drawing.Color.FromArgb(50, 255, 0, 0)) // }, //}, Padding = new System.Windows.Forms.Padding(0, 0, 0, 5) }; AddChild(topBar); Control topLeftBar = new Control { Dock = System.Windows.Forms.DockStyle.Left, Size = new Vector2(500, 0) }; topBar.AddChild(topLeftBar); var winLoseTextBox = new Label { Font = new Graphics.Content.Font { SystemFont = Fonts.HugeSystemFont, Color = System.Drawing.Color.Green, }, AutoSize = AutoSizeMode.Full, TextAnchor = global::Graphics.Orientation.TopLeft, Dock = System.Windows.Forms.DockStyle.Top, Background = null, //Background = new StretchingImageGraphic //{ // Texture = new TextureConcretizer // { // TextureDescription = new Graphics.Software.Textures.SingleColorTexture(System.Drawing.Color.FromArgb(50, 255, 0, 0)) // }, //}, }; topLeftBar.AddChild(winLoseTextBox); if (GameState == GameState.Won) { winLoseTextBox.Text = Locale.Resource.ScoreVictory; winLoseTextBox.Font.Color = System.Drawing.Color.Green; } else { winLoseTextBox.Text = Locale.Resource.ScoreDefeat; winLoseTextBox.Font.Color = System.Drawing.Color.Red; topLeftBar.AddChild(new Label { Font = new Font { SystemFont = Fonts.MediumSystemFont, Color = System.Drawing.Color.White }, Background = null, Dock = System.Windows.Forms.DockStyle.Fill, Text = LostGameReason, TextAnchor = global::Graphics.Orientation.TopLeft, }); } Control trPanel = new Control { Dock = System.Windows.Forms.DockStyle.Right, Size = new Vector2(200, 40) }; topBar.AddChild(trPanel); var gt = new DateTime(TimeSpan.FromSeconds(GameTime).Ticks); var timeLeftTextBox = new Label { Dock = System.Windows.Forms.DockStyle.Bottom, Background = null, Size = new Vector2(120, 20), TextAnchor = global::Graphics.Orientation.BottomRight, }; timeLeftTextBox.Text = Locale.Resource.GenTime + ": " + gt.ToString("mm:ss"); trPanel.AddChild(timeLeftTextBox); if (SilverEnabled) { Control silverTextContainer = new Control { Dock = System.Windows.Forms.DockStyle.Bottom, Size = new Vector2(0, 30), }; trPanel.AddChild(silverTextContainer); silverTextContainer.AddChild(new SilverText { Anchor = Orientation.BottomRight, Size = new Vector2(120, 30), Background = null, SilverYield = SilverYield }); } AddChild(new Control { Background = new StretchingImageGraphic { Texture = new TextureConcretizer { TextureDescription = new Graphics.Software.Textures.SingleColorTexture(System.Drawing.Color.FromArgb(50, 255, 255, 255)) }, SizeMode = SizeMode.AutoAdjust }, Dock = System.Windows.Forms.DockStyle.Top, Size = new Vector2(0, 1) }); Control bottomBar = new Control { Dock = System.Windows.Forms.DockStyle.Bottom, Size = new Vector2(0, 50) }; AddChild(bottomBar); FlowLayout leftBottomFlow = new FlowLayout { AutoSize = true, HorizontalFill = true, Newline = false, Anchor = Orientation.BottomLeft }; bottomBar.AddChild(leftBottomFlow); FlowLayout rightBottomFlow = new FlowLayout { AutoSize = true, HorizontalFill = true, Newline = false, Anchor = Orientation.BottomRight, Origin = FlowOrigin.BottomRight, //Background = new StretchingImageGraphic //{ // Texture = new TextureConcretizer // { // TextureDescription = new Graphics.Software.Textures.SingleColorTexture(System.Drawing.Color.FromArgb(50, 255, 0, 0)) // }, //}, }; bottomBar.AddChild(rightBottomFlow); ButtonBase mainMenuButton = new StoneButton { AutoSize = AutoSizeMode.Horizontal, Padding = new System.Windows.Forms.Padding(5, 0, 5, 0) }; if (FirstTimeCompletedMap) { mainMenuButton.Text = Locale.Resource.GenContinue; } else { mainMenuButton.Text = Locale.Resource.GenMainMenu; } rightBottomFlow.AddChild(mainMenuButton); mainMenuButton.Click += new EventHandler(mainMenuButton_Click); ButtonBase playAgainButton = new StoneButton { Text = Locale.Resource.GenPlayAgain, Visible = EarnedGoldCoins == 0, AutoSize = AutoSizeMode.Horizontal, Padding = new System.Windows.Forms.Padding(5, 0, 5, 0) }; rightBottomFlow.AddChild(playAgainButton); playAgainButton.Click += new EventHandler(playAgainButton_Click); if (FirstTimeCompletedMap && Program.Settings.DisplayMapRatingDialog == MapRatingDialogSetup.Optional) { ButtonBase rateMapButton = new StoneButton { Text = Locale.Resource.GenRateMap, AutoSize = AutoSizeMode.Horizontal, Padding = new System.Windows.Forms.Padding(5, 0, 5, 0) }; rightBottomFlow.AddChild(rateMapButton); rateMapButton.Click += new EventHandler(rateMapButton_Click); } AddChild(new Control { Background = new StretchingImageGraphic { Texture = new TextureConcretizer { TextureDescription = new Graphics.Software.Textures.SingleColorTexture(System.Drawing.Color.FromArgb(50, 255, 255, 255)) }, SizeMode = SizeMode.AutoAdjust }, Dock = System.Windows.Forms.DockStyle.Bottom, Size = new Vector2(0, 1) }); Control main = new Control { Dock = System.Windows.Forms.DockStyle.Fill }; AddChild(main); ////////////////////////// // STATS ///////////////// ////////////////////////// StatsControl stats = new StatsControl { Dock = System.Windows.Forms.DockStyle.Fill, Visible = false }; stats.GameState = GameState; stats.LostGameReason = LostGameReason; stats.Statistics = Statistics; stats.Map = Map; main.AddChild(stats); ////////////////////////// // REWARDS /////////////// ////////////////////////// ResultsAndRewardsControl rewards = new ResultsAndRewardsControl { Dock = System.Windows.Forms.DockStyle.Fill, //Background = new StretchingImageGraphic //{ // Texture = new TextureConcretizer // { // TextureDescription = new Graphics.Software.Textures.SingleColorTexture(System.Drawing.Color.FromArgb(50, 255, 0, 0)) // }, //}, Anchor = global::Graphics.Orientation.TopRight }; rewards.GameState = GameState; rewards.EarnedGoldCoins = EarnedGoldCoins; rewards.NPlaythroughs = NPlaythroughs; rewards.AchievementsEarned = AchievementsEarned; rewards.SilverYield = SilverYield; rewards.PreviousMaxSilverYield = PreviousMaxSilverYield; rewards.FirstTimeCompletedMap = FirstTimeCompletedMap; rewards.CurrentStages = CurrentStages; rewards.BestStages = BestStages; rewards.Map = Map; main.AddChild(rewards); ///////////////////// // Switch buttons ///////////////////// CheckboxBase rnrButton = new StoneCheckbox { Text = Locale.Resource.ScoreRewardsAndResults, Font = new Font { SystemFont = Fonts.MediumSystemFont, Color = System.Drawing.Color.White, Backdrop = System.Drawing.Color.Black }, Checked = true, AutoCheck = false, Size = new Vector2(200, 38), AutoSize = AutoSizeMode.Horizontal, Padding = new System.Windows.Forms.Padding(5, 0, 5, 0) }; leftBottomFlow.AddChild(rnrButton); CheckboxBase statsButton = new StoneCheckbox { Text = Locale.Resource.ScoreStats, Font = new Font { SystemFont = Fonts.MediumSystemFont, Color = System.Drawing.Color.White, Backdrop = System.Drawing.Color.Black }, Checked = false, AutoCheck = false, AutoSize = AutoSizeMode.Horizontal, Padding = new System.Windows.Forms.Padding(5, 0, 5, 0) }; leftBottomFlow.AddChild(statsButton); if (HideStats) { leftBottomFlow.Visible = false; stats.Visible = false; } else { statsButton.Click += new EventHandler((o, e) => { rnrButton.Checked = rewards.Visible = false; statsButton.Checked = stats.Visible = true; }); rnrButton.Click += new EventHandler((o, e) => { rnrButton.Checked = rewards.Visible = true; statsButton.Checked = stats.Visible = false; }); } base.OnConstruct(); }