public TimeSlider(Game game) : base(game) { frame = new Sprite(game, GraphicsCollection.GetPack("time-bar-bar2")); AddChild(frame); left = new PanelButton(game, PanelButtonType.TimeLeft); left.StackOrder = 1; left.YRelative = 4; left.XRelative = 4; AddChild(left); right = new PanelButton(game, PanelButtonType.TimeRight); right.XRelative = frame.Width - 12; right.YRelative = 4; AddChild(right); year = new SpriteText(game, FontsCollection.GetPack("Calibri 10").Font); year.XRelative = 35; year.YRelative = 2; year.StackOrder = 2; AddChild(year); OnMousePress += new EventHandler <MouseEventArgs>(TimeSlider_OnMousePress); left.OnRelease += new EventHandler <ButtonEventArgs>(left_OnRelease); right.OnRelease += new EventHandler <ButtonEventArgs>(right_OnRelease); }
public Tooltip(Game game, int OneOfThreeSize) : base(game) { if (OneOfThreeSize == 3) { Background = new Sprite(game, GraphicsCollection.GetPack("tooltip_large")); } if (OneOfThreeSize == 2) { Background = new Sprite(game, GraphicsCollection.GetPack("tooltip_small")); } if (OneOfThreeSize == 1) { Background = new Sprite(game, GraphicsCollection.GetPack("tooltip_mini")); } Background.StackOrder = 0; AddChild(Background); text = new SpriteText(game, FontsCollection.GetPack("Calibri 8").Font); text.StackOrder = 1; text.XRelative = 5; text.YRelative = 3; text.MaxLength = 350; AddChild(text); }
public InputBox(Game game) : base(game) { background = new Sprite(game, GraphicsCollection.GetPack("pixel")); cursor = new Sprite(game, GraphicsCollection.GetPack("pixel")); leftBorder = new Sprite(game, GraphicsCollection.GetPack("pixel")); leftBorder.XRelative = 0; rightBorder = new Sprite(game, GraphicsCollection.GetPack("pixel")); topBorder = new Sprite(game, GraphicsCollection.GetPack("pixel")); topBorder.YRelative = 0; bottomBorder = new Sprite(game, GraphicsCollection.GetPack("pixel")); text = new SpriteText(game, FontsCollection.GetPack("Courier New 14").Font); #region Default style VerticalPadding = 5; SidePadding = 5; TextColor = Color.Black; BorderColor = Color.Black; BorderWidth = 1; #endregion background.StackOrder = 0; leftBorder.StackOrder = rightBorder.StackOrder = topBorder.StackOrder = bottomBorder.StackOrder = 1; text.StackOrder = 3; text.XRelative = SidePadding; text.YRelative = VerticalPadding; //text used only for initialization, needed to measure text height text.Text = "Init"; Height = text.Height + 2 * VerticalPadding; cursor.Tint = Color.Black; cursor.Height = text.Height; cursor.Width = 2; cursor.YRelative = VerticalPadding; cursor.XRelative = SidePadding; cursor.StackOrder = 4; cursor.AnimationSpeed = 10; cursor.Visible = false; cursor.OnFirstFrame += new EventHandler(cursor_OnFirstFrame); #region Component init Components.Add(background); Components.Add(cursor); //Components.Add(leftBorder); //Components.Add(rightBorder); Components.Add(topBorder); Components.Add(bottomBorder); Components.Add(text); UpdateComponentsX(); UpdateComponentsY(); #endregion text.Text = String.Empty; }
public MessagePanel(Game game, Rectangle screen) : base(game) { graphicsCollection = (GraphicsCollection)Game.Services.GetService(typeof(GraphicsCollection)); Color AlphaZero = new Color(99, 99, 99, 0);//Alpha = 0 BgSprite = new Sprite(game, graphicsCollection[graphicsCollection.GetPackIndex("pixel")].Frames); BgSprite.XRelative = 0; BgSprite.YRelative = 0; BgSprite.Tint = AlphaZero; BgSprite.Width = screen.Width; BgSprite.Height = screen.Height; BgSprite.StackOrder = 1; PanelSprite = new Sprite(game, graphicsCollection[graphicsCollection.GetPackIndex("message_panel")].Frames); PanelSprite.XRelative = Convert.ToInt32(BgSprite.Width / 2 - PanelSprite.Width / 2); PanelSprite.YRelative = Convert.ToInt32(BgSprite.Height / 2 - PanelSprite.Height / 2); PanelSprite.FrameNumber = 0; PanelSprite.StackOrder = 3; MessageSpriteText = new SpriteText(game, FontsCollection.GetPack("Calibri 10").Font); MessageSpriteText.MaxLength = 500; MessageSpriteText.Tint = Color.WhiteSmoke; MessageSpriteText.XRelative = PanelSprite.XRelative + HPadding; MessageSpriteText.YRelative = PanelSprite.YRelative + VPadding; MessageSpriteText.Text = ""; MessageSpriteText.StackOrder = 5; MessageSpriteText.Visible = false; btnOK = new MessagePanelOKButton(game); btnOK.XRelative = Convert.ToInt32(PanelSprite.XRelative + PanelSprite.Width / 2 - btnOK.Width / 2); btnOK.YRelative = Convert.ToInt32(PanelSprite.YRelative + PanelSprite.Height - btnOK.Height / 2 - 40); btnOK.OnRelease += new EventHandler <ButtonEventArgs>(btnOK_OnRelease); btnOK.StackOrder = 7; btnOK.Visible = false; btnOK.Enabled = false; tmrOpenPanel = new Timer(game); tmrOpenPanel.IntervalType = TimerIntervalType.Miliseconds; tmrOpenPanel.Interval = 50; tmrOpenPanel.OnTick += new EventHandler(tmrOpenPanel_OnTick); tmrOpenPanel.Start(); AddChild(BgSprite); AddChild(PanelSprite); AddChild(MessageSpriteText); AddChild(btnOK); ((DisplayManager)Game.Services.GetService(typeof(DisplayManager))).CameraFreeze(); }
public YearPanel(Game game) : base(game) { frame = new Sprite(game, GraphicsCollection.GetPack("year-panel-frame")); frame.YRelative = -7; AddChild(frame); reset = new PanelButton(game, PanelButtonType.YearReset); reset.XRelative = 245; reset.YRelative = 9; reset.OnRelease += new EventHandler <ButtonEventArgs>(reset_OnRelease); AddChild(reset); year = new SpriteText(game, FontsCollection.GetPack("Trebuchet MS 14").Font); year.XRelative = 173; year.YRelative = 5; year.Text = "2010"; AddChild(year); population = new SpriteText(game, FontsCollection.GetPack("Calibri 11").Font); population.XRelative = 400; population.YRelative = 5; population.TextAlignment = Align.Right; AddChild(population); money = new SpriteText(game, FontsCollection.GetPack("Calibri 11").Font); money.YRelative = 5; money.XRelative = 25; AddChild(money); historicalPeriod = new SpriteText(game, FontsCollection.GetPack("Calibri 8").Font); historicalPeriod.XRelative = 170; historicalPeriod.YRelative = 30; AddChild(historicalPeriod); gologan = new Sprite(game, GraphicsCollection.GetPack("gologan")); gologan.YRelative = 5; gologan.XRelative = 10; gologan.StackOrder = 1; AddChild(gologan); smiley = new Sprite(game, GraphicsCollection.GetPack("smiley")); smiley.XRelative = 280; smiley.YRelative = 5; AddChild(smiley); }
public GraphPanel(Game game) : base(game) { topBar = new Sprite(game, GraphicsCollection.GetPack("pixel")); topBar.Width = 300; topBar.Height = 2; topBar.XRelative = 120; topBar.YRelative = 99; topBar.Tint = Color.Orange; AddChild(topBar); bottomBar = new Sprite(game, GraphicsCollection.GetPack("pixel")); bottomBar.Width = 300; bottomBar.Height = 2; bottomBar.XRelative = 120; bottomBar.YRelative = 201; bottomBar.Tint = Color.Orange; AddChild(bottomBar); startYear = new SpriteText(game, FontsCollection.GetPack("Calibri 11").Font); startYear.XRelative = 120; startYear.YRelative = 180; AddChild(startYear); endYear = new SpriteText(game, FontsCollection.GetPack("Calibri 11").Font); endYear.XRelative = 390; endYear.YRelative = 180; AddChild(endYear); //90, 440 bars = new List <GraphBar>(300); for (int year = 0; year < 300; year++) { GraphBar bar = new GraphBar(game, 0); bar.XRelative = 200 + year; bar.YRelative = 200; bars.Add(bar); AddChild(bar); } selectedYear = new SpriteText(game, FontsCollection.GetPack("Calibri 11").Font); selectedYear.XRelative = 130; selectedYear.YRelative = 55; AddChild(selectedYear); }
public TimeTravelPanel(Game game) : base(game) { #region Elements frame = new Sprite(game, GraphicsCollection.GetPack("time-panel-frame")); AddChild(frame); spriteTextCurrentYear = new SpriteText(game, FontsCollection.GetPack("Calibri 11").Font); spriteTextCurrentYear.Text = GameManager.CurrentYear.ToString(); spriteTextCurrentYear.Tint = Color.WhiteSmoke; spriteTextCurrentYear.XRelative = 55; spriteTextCurrentYear.YRelative = 42; AddChild(spriteTextCurrentYear); minimize = new PanelButton(game, PanelButtonType.TimeMinimize); minimize.XRelative = -10; minimize.YRelative = 27; minimize.StackOrder = 1; minimize.OnMousePress += new EventHandler <Operation_Cronos.Input.MouseEventArgs>(minimize_OnMousePress); AddChild(minimize); upArrow = new PanelButton(game, PanelButtonType.TimeUpArrow); upArrow.StackOrder = 1; upArrow.XRelative = 95; upArrow.YRelative = 32; upArrow.OnMousePress += new EventHandler <Operation_Cronos.Input.MouseEventArgs>(upArrow_OnMousePress); AddChild(upArrow); downArrow = new PanelButton(game, PanelButtonType.TimeDownArrow); downArrow.XRelative = 97; downArrow.YRelative = 55; downArrow.StackOrder = 1; downArrow.OnPress += new EventHandler <ButtonEventArgs>(downArrow_OnPress); AddChild(downArrow); travel = new PanelButton(game, PanelButtonType.TimeTravelButton); travel.XRelative = 33; travel.YRelative = 80; travel.StackOrder = 1; travel.OnPress += new EventHandler <ButtonEventArgs>(travel_OnPress); AddChild(travel); #endregion }
public ResearchPanel(Game game) : base(game) { selectedResearch = null; selectedMG = ConstructionType.None; timeline = new Sprite(game, GraphicsCollection.GetPack("control-research-timeline")); timeline.XRelative = 91; timeline.YRelative = 197; AddChild(timeline); ok = new ControlPanelButton(game, ControlPanelButtonType.ResearchOK); ok.XRelative = 413; ok.YRelative = 64; ok.IsVisible = false; ok.Enabled = false; ok.OnPress += new EventHandler <ButtonEventArgs>(ok_OnPress); AddChild(ok); name = new SpriteText(game, FontsCollection.GetPack("Calibri 11").Font); name.Tint = Color.White; name.XRelative = 101; name.YRelative = 64; AddChild(name); description = new SpriteText(game, FontsCollection.GetPack("Calibri 10").Font); description.Tint = Color.White; description.XRelative = 101; description.YRelative = 82; AddChild(description); price = new SpriteText(game, FontsCollection.GetPack("Calibri 10").Font); price.Tint = Color.Lime; price.XRelative = 101; price.YRelative = 178; AddChild(price); year = new SpriteText(game, FontsCollection.GetPack("Calibri 10").Font); year.Tint = Color.Lime; year.XRelative = 347; year.YRelative = 178; AddChild(year); icons = new List <ControlPanelButton>(); }
public MissionPanel(Game game) : base(game) { frame = new Sprite(game, GraphicsCollection.GetPack("mission-frame")); AddChild(frame); close = new ControlPanelButton(game, ControlPanelButtonType.Close); close.StackOrder = 3; close.XRelative = 428; close.YRelative = 7; close.OnMousePress += new EventHandler <Operation_Cronos.Input.MouseEventArgs>(close_OnMousePress); AddChild(close); text = new SpriteText(game, FontsCollection.GetPack("Calibri 8").Font); text.StackOrder = 3; text.MaxLength = 350; text.XRelative = 30; text.YRelative = 50; AddChild(text); }
public CommandCenterRightButton(Game game, Sprite sprite, int drawOrder) : base(game) { ButtonSprite = sprite; ButtonSprite.XRelative = 0; ButtonSprite.YRelative = 0; this.StackOrder = drawOrder; spriteText = new SpriteText(game, FontsCollection.GetPack("Calibri 8").Font); spriteText.Text = ""; spriteText.XRelative = 0; spriteText.YRelative = 0; spriteText.Tint = MouseLeaveColor; spriteText.StackOrder = drawOrder + 1; AddChild(ButtonSprite); AddChild(spriteText); }
public ConstructionPanel(Game game, BaseConstruction construction) : base(game) { frame = new Sprite(game, GraphicsCollection.GetPack("construction-panel-frame")); frame.StackOrder = 1; AddChild(frame); selectedConstruction = construction; if (Destroyable()) { destroy = new ConstructionPanelButton(game, ConstructionPanelButtonType.Destroy); destroy.StackOrder = 2; destroy.XRelative = buttonsXposition; destroy.YRelative = 45; destroy.OnMouseRelease += new EventHandler <Operation_Cronos.Input.MouseEventArgs>(destroy_OnMouseRelease); destroy.OnMouseOver += new EventHandler <ButtonEventArgs>(Button_OnMouseOver); destroy.OnMouseLeave += new EventHandler <ButtonEventArgs>(Button_OnMouseLeave); AddChild(destroy); } if (GeneralConstructionUpgradeable()) { upgrade = new ConstructionPanelButton(game, ConstructionPanelButtonType.Upgrade); upgrade.StackOrder = 2; upgrade.XRelative = buttonsXposition; upgrade.YRelative = 173; upgrade.OnMouseRelease += new EventHandler <Operation_Cronos.Input.MouseEventArgs>(upgrade_OnMouseRelease); upgrade.OnMouseOver += new EventHandler <ButtonEventArgs>(Button_OnMouseOver); upgrade.OnMouseLeave += new EventHandler <ButtonEventArgs>(Button_OnMouseLeave); AddChild(upgrade); textUpgradeCost = new SpriteText(game, FontsCollection.GetPack("Calibri 10").Font); textUpgradeCost.StackOrder = 2; textUpgradeCost.XRelative = 95; textUpgradeCost.YRelative = 225; textUpgradeCost.Tint = Color.Green; textUpgradeCost.Text = GetUpgradeText() + GetUpgradeCost().ToString(); AddChild(textUpgradeCost); } if (PopulationConstructionUpgradeable()) { upgrade = new ConstructionPanelButton(game, ConstructionPanelButtonType.Upgrade); upgrade.StackOrder = 2; upgrade.XRelative = buttonsXposition; upgrade.YRelative = 173; upgrade.OnMousePress += new EventHandler <Operation_Cronos.Input.MouseEventArgs>(upgrade_OnMouseRelease); upgrade.OnMouseOver += new EventHandler <ButtonEventArgs>(Button_OnMouseOver); upgrade.OnMouseLeave += new EventHandler <ButtonEventArgs>(Button_OnMouseLeave); AddChild(upgrade); textUpgradeCost = new SpriteText(game, FontsCollection.GetPack("Calibri 10").Font); textUpgradeCost.XRelative = 95; textUpgradeCost.YRelative = 225; textUpgradeCost.StackOrder = 2; textUpgradeCost.Tint = Color.Green; textUpgradeCost.Text = GetUpgradeText() + GetUpgradeCost().ToString(); AddChild(textUpgradeCost); } if (Repairable()) { repair = new ConstructionPanelButton(game, ConstructionPanelButtonType.Repair); repair.StackOrder = 2; repair.XRelative = buttonsXposition; repair.YRelative = 108; repair.OnMouseRelease += new EventHandler <Operation_Cronos.Input.MouseEventArgs>(repair_OnMouseRelease); repair.OnMouseOver += new EventHandler <ButtonEventArgs>(Button_OnMouseOver); repair.OnMouseLeave += new EventHandler <ButtonEventArgs>(Button_OnMouseLeave); AddChild(repair); textRepairCost = new SpriteText(game, FontsCollection.GetPack("Calibri 10").Font); textRepairCost.XRelative = 323; textRepairCost.YRelative = 225; textRepairCost.StackOrder = 2; textRepairCost.Tint = Color.Green; textRepairCost.Text = "Repair price: " + GetRepairCost().ToString(); AddChild(textRepairCost); } else //not repairable { if (AlreadyRepairedInCurrentYear()) { textRepairCost = new SpriteText(game, FontsCollection.GetPack("Calibri 10").Font); textRepairCost.XRelative = 323; textRepairCost.YRelative = 225; textRepairCost.Tint = Color.Green; textRepairCost.StackOrder = 2; textRepairCost.Text = "Repaired this year"; AddChild(textRepairCost); } } close = new ConstructionPanelButton(game, ConstructionPanelButtonType.Close); close.StackOrder = 2; close.XRelative = 430; close.YRelative = 7; close.OnMouseRelease += new EventHandler <Operation_Cronos.Input.MouseEventArgs>(close_OnMouseRelease); AddChild(close); textBuildingNameAndStage = new SpriteText(game, FontsCollection.GetPack("Calibri 10").Font); textBuildingNameAndStage.XRelative = 95; textBuildingNameAndStage.YRelative = 20; textBuildingNameAndStage.Tint = Color.Gray; textBuildingNameAndStage.StackOrder = 2; textBuildingNameAndStage.Text = GetDescriptionFromEnum(selectedConstruction.ConstructionName, 0); if (selectedConstruction.ConstructionType != ConstructionType.Population) { textBuildingNameAndStage.Text += " - " + GetDescriptionFromEnum((selectedConstruction.Slot.GetReservation(GameManager.CurrentYear).Status(GameManager.CurrentYear)), 0); } AddChild(textBuildingNameAndStage); textGeneralInfo = new SpriteText(game, FontsCollection.GetPack("Calibri 10").Font); textGeneralInfo.XRelative = 95; textGeneralInfo.YRelative = 60; textGeneralInfo.StackOrder = 2; textGeneralInfo.Tint = Color.White; textGeneralInfo.Text = GetConstructionYear() + "\n" + GetLifetimeLeft() + "\n" + GetConstructionParameters(); AddChild(textGeneralInfo); selectedConstruction.SelectConstruction = true; if (selectedConstruction.ConstructionType == ConstructionType.Education || selectedConstruction.ConstructionType == ConstructionType.Health || selectedConstruction.ConstructionType == ConstructionType.Population || selectedConstruction.ConstructionType == ConstructionType.Energy) { SoundManager.PlaySound((Sounds)Enum.Parse(typeof(Sounds), selectedConstruction.ConstructionType.ToString())); } else { SoundManager.PlaySound((Sounds)Enum.Parse(typeof(Sounds), selectedConstruction.ConstructionName.ToString())); } }
public CommandCenterOptionsPanel(Game game, int DrawOrder) : base(game) { graphicsCollection = (GraphicsCollection)Game.Services.GetService(typeof(GraphicsCollection)); generalButtons = new List <List <CommandCenterGeneralButton> >(); sublistGame = new List <CommandCenterGeneralButton>(); sublistVideo = new List <CommandCenterGeneralButton>(); sublistAudio = new List <CommandCenterGeneralButton>(); sublistControls = new List <CommandCenterGeneralButton>(); //------------------------------ //--Setting Default Options (will be used when initializing objects, in the next instructions) DefaultOptions = new CommandCenterEventArgs(1); //everything is set to a GENERAL default //------------------------------ //---SaveSettings Options Button----- btnSaveOptions = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("SaveOptions")), DrawOrder); btnSaveOptions.Position = new Point(390, 675); btnSaveOptions.OnPress += new EventHandler <ButtonEventArgs>(Do_SaveOptionsPress); btnSaveOptions.OnRelease += new EventHandler <ButtonEventArgs>(Do_SaveOptionsRelease); AddChild(btnSaveOptions); //--------------------------- //-----Primary Buttons------- btnGame = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("Options_Game")), DrawOrder); btnGame.Position = new Point(70, 150); btnGame.OnPress += new EventHandler <ButtonEventArgs>(Do_GeneralBtnPressed); btnGame.OnMouseOver += new EventHandler <ButtonEventArgs>(Do_GeneralBtnMouseOver); btnGame.OnMouseLeave += new EventHandler <ButtonEventArgs>(Do_GeneralBtnMouseLeave); AddChild(btnGame); sublistGame.Add(btnGame); btnVideo = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("Options_Video")), DrawOrder); btnVideo.Position = new Point(70, 300); btnVideo.OnPress += new EventHandler <ButtonEventArgs>(Do_GeneralBtnPressed); btnVideo.OnMouseOver += new EventHandler <ButtonEventArgs>(Do_GeneralBtnMouseOver); btnVideo.OnMouseLeave += new EventHandler <ButtonEventArgs>(Do_GeneralBtnMouseLeave); AddChild(btnVideo); sublistVideo.Add(btnVideo); btnAudio = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("Options_Audio")), DrawOrder); btnAudio.Position = new Point(70, 440); btnAudio.OnPress += new EventHandler <ButtonEventArgs>(Do_GeneralBtnPressed); btnAudio.OnMouseOver += new EventHandler <ButtonEventArgs>(Do_GeneralBtnMouseOver); btnAudio.OnMouseLeave += new EventHandler <ButtonEventArgs>(Do_GeneralBtnMouseLeave); AddChild(btnAudio); sublistAudio.Add(btnAudio); btnControls = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("Options_Controls")), DrawOrder); btnControls.Position = new Point(70, 580); btnControls.OnPress += new EventHandler <ButtonEventArgs>(Do_GeneralBtnPressed); btnControls.OnMouseOver += new EventHandler <ButtonEventArgs>(Do_GeneralBtnMouseOver); btnControls.OnMouseLeave += new EventHandler <ButtonEventArgs>(Do_GeneralBtnMouseLeave); AddChild(btnControls); sublistControls.Add(btnControls); //---GAME Submenu Buttons------- btnGame_SaveGame = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("SaveGame")), DrawOrder); btnGame_SaveGame.Position = new Point(260, 128); btnGame_SaveGame.OnPress += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnPressed); btnGame_SaveGame.OnMouseOver += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnMouseOver); btnGame_SaveGame.OnMouseLeave += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnMouseLeave); AddChild(btnGame_SaveGame); sublistGame.Add(btnGame_SaveGame); btnGame_Difficulty = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("Difficulty")), DrawOrder); btnGame_Difficulty.Position = new Point(260, 181); btnGame_Difficulty.OnPress += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnPressed); btnGame_Difficulty.OnMouseOver += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnMouseOver); btnGame_Difficulty.OnMouseLeave += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnMouseLeave); AddChild(btnGame_Difficulty); sublistGame.Add(btnGame_Difficulty); //---Submenu button SaveGame Options----- btnSave = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("SaveBtn")), DrawOrder); btnSave.Position = new Point(454, 126); btnSave.OnRelease += new EventHandler <ButtonEventArgs>(Do_BtnSaveMouseRelease); AddChild(btnSave); AutosaveSprite = new Sprite(game, graphicsCollection.GetPack("Autosave")); AutosaveSprite.StackOrder = DrawOrder; AutosaveSprite.XRelative = 567; AutosaveSprite.YRelative = 133; AddChild(AutosaveSprite); positions = new int [6] { 746, 127, 705, 127, 820, 127 }; AutosaveScrollbar = new Scrollbar(game, new Sprite(game, graphicsCollection.GetPack("AutosaveTimeDisplay")), new Sprite(Game, graphicsCollection.GetPack("ScrollBarLeftArrow")), new Sprite(Game, graphicsCollection.GetPack("ScrollBarRightArrow")), DrawOrder, positions); AutosaveScrollbar.OnScrollUp += new EventHandler(Do_AutosaveScrollbar_LeftScroll); AutosaveScrollbar.OnScrollDown += new EventHandler(Do_AutosaveScrollbar_RightScroll); AddChild(AutosaveScrollbar); AutosaveTime = new SpriteText(game, FontsCollection.GetPack("Courier New 10").Font); AutosaveTime.XRelative = 754; AutosaveTime.YRelative = 133; TimeValueIndexSelected = DefaultOptions.TimeValueIndex;//by default, autosave every 30 min AutosaveTime.Text = TimeValues[TimeValueIndexSelected].ToString() + " min"; AutosaveTime.Tint = Color.LightGray; AddChild(AutosaveTime); DefaultOptions.AutosaveTimeValue = TimeValues[TimeValueIndexSelected]; //--------------------------------------- //---Submenu button Difficulty Options--- positions = new int[4] { 443, 185, 508, 180 }; rbnEasy = new RadioButton(game, new Sprite(game, graphicsCollection.GetPack("Diff_Easy")), new Sprite(Game, graphicsCollection.GetPack("Checkbox")), DrawOrder, positions); rbnEasy.AllowDirectUncheck = false; rbnEasy.OnCheck += new EventHandler(Do_DifficultyRadioChecked); rbnEasy.Name = "Easy"; AddChild(rbnEasy); DifficultyRadioGroup.Add(rbnEasy); positions = new int[4] { 558, 185, 651, 180 }; rbnMedium = new RadioButton(game, new Sprite(game, graphicsCollection.GetPack("Diff_Medium")), new Sprite(Game, graphicsCollection.GetPack("Checkbox")), DrawOrder, positions); rbnMedium.AllowDirectUncheck = false; rbnMedium.OnCheck += new EventHandler(Do_DifficultyRadioChecked); rbnMedium.Name = "Medium"; AddChild(rbnMedium); DifficultyRadioGroup.Add(rbnMedium); positions = new int[4] { 703, 185, 773, 180 }; rbnHard = new RadioButton(game, new Sprite(game, graphicsCollection.GetPack("Diff_Hard")), new Sprite(Game, graphicsCollection.GetPack("Checkbox")), DrawOrder, positions);; rbnHard.AllowDirectUncheck = false; rbnHard.OnCheck += new EventHandler(Do_DifficultyRadioChecked); rbnHard.Name = "Hard"; AddChild(rbnHard); DifficultyRadioGroup.Add(rbnHard); DifficultyLevelCurrentlySelected = DefaultOptions.DifficultyLevel; switch (DifficultyLevelCurrentlySelected) { case "Easy": rbnEasy.Check(); break; case "Medium": rbnMedium.Check(); break; case "Hard": rbnHard.Check(); break; default: rbnEasy.Check(); break; } //--------------------------------------- //------------------------------ //---VIDEO Submenu Buttons------ btnVideo_Resolution = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("Resolution")), DrawOrder); btnVideo_Resolution.Position = new Point(260, 276); btnVideo_Resolution.OnPress += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnPressed); btnVideo_Resolution.OnMouseOver += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnMouseOver); btnVideo_Resolution.OnMouseLeave += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnMouseLeave); AddChild(btnVideo_Resolution); sublistVideo.Add(btnVideo_Resolution); btnVideo_FullScreen = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("FullScreen")), DrawOrder); btnVideo_FullScreen.Position = new Point(260, 326); btnVideo_FullScreen.OnPress += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnPressed); btnVideo_FullScreen.OnMouseOver += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnMouseOver); btnVideo_FullScreen.OnMouseLeave += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnMouseLeave); AddChild(btnVideo_FullScreen); sublistVideo.Add(btnVideo_FullScreen); //---Submenu button ResolutionIndex Options------- Resolution = new SpriteText(Game, FontsCollection.GetPack("Courier New 10").Font); Resolution.XRelative = 617; Resolution.YRelative = 280; Resolution.Tint = Color.LightGray; ResolutionValueIndexSelected = DefaultOptions.ResolutionIndex; DefaultOptions.ResolutionValue = ResolutionValues[ResolutionValueIndexSelected]; Resolution.Text = ResolutionValues[ResolutionValueIndexSelected].X.ToString() + " X " + ResolutionValues[ResolutionValueIndexSelected].Y.ToString(); AddChild(Resolution); positions = new int[6] { 592, 275, 550, 275, 738, 275 }; ResolutionIndicator = new Scrollbar(game, new Sprite(game, graphicsCollection.GetPack("ResolutionDisplay")), new Sprite(Game, graphicsCollection.GetPack("ScrollBarLeftArrow")), new Sprite(Game, graphicsCollection.GetPack("ScrollBarRightArrow")), DrawOrder, positions); ResolutionIndicator.OnScrollUp += new EventHandler(Do_ResolutionIndicator_LeftScroll); ResolutionIndicator.OnScrollDown += new EventHandler(Do_ResolutionIndicator_RightScroll); AddChild(ResolutionIndicator); //------------------------------ //---Submenu button FullScreen Options------- positions = new int[4] { 465, 330, 505, 322 }; rbnFullScreenOn = new RadioButton(game, new Sprite(game, graphicsCollection.GetPack("On")), new Sprite(Game, graphicsCollection.GetPack("Checkbox")), DrawOrder, positions); rbnFullScreenOn.AllowDirectUncheck = false; rbnFullScreenOn.OnCheck += new EventHandler(Do_FullScreenRadioOnChecked); AddChild(rbnFullScreenOn); positions = new int[4] { 575, 330, 625, 322 }; rbnFullScreenOff = new RadioButton(game, new Sprite(game, graphicsCollection.GetPack("Off")), new Sprite(Game, graphicsCollection.GetPack("Checkbox")), DrawOrder, positions); rbnFullScreenOff.AllowDirectUncheck = false; rbnFullScreenOff.OnCheck += new EventHandler(Do_FullScreenRadioOffChecked); AddChild(rbnFullScreenOff); FullScreenCurrentState = DefaultOptions.FullScreen;//"Off" by default; switch (FullScreenCurrentState) { case "On": rbnFullScreenOn.Check(); break; case "Off": rbnFullScreenOff.Check(); break; default: rbnFullScreenOff.Check(); break; } //------------------------------ //------------------------------ //---AUDIO Submenu Buttons------ btnAudio_Volume = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("Volume")), DrawOrder); btnAudio_Volume.Position = new Point(260, 411); btnAudio_Volume.OnPress += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnPressed); btnAudio_Volume.OnMouseOver += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnMouseOver); btnAudio_Volume.OnMouseLeave += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnMouseLeave); AddChild(btnAudio_Volume); sublistAudio.Add(btnAudio_Volume); btnAudio_Sound = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("Sound")), DrawOrder); btnAudio_Sound.Position = new Point(260, 461); btnAudio_Sound.OnPress += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnPressed); btnAudio_Sound.OnMouseOver += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnMouseOver); btnAudio_Sound.OnMouseLeave += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnMouseLeave); AddChild(btnAudio_Sound); sublistAudio.Add(btnAudio_Sound); //---Submenu button Volume Options------- VolumeValueSprite = new Sprite(game, graphicsCollection.GetPack("Increment")); VolumeValueSprite.StackOrder = DrawOrder; VolumeValueSprite.XRelative = 457; VolumeValueSprite.YRelative = 417; VolumeValueSprite.FrameNumber = DefaultOptions.VolumeValue;//0 by default AddChild(VolumeValueSprite); positions = new int[6] { 450, 410, 410, 410, 545, 410 }; VolumeIndicator = new Scrollbar(game, new Sprite(game, graphicsCollection.GetPack("PlusMinusDisplay")), new Sprite(Game, graphicsCollection.GetPack("Minus")), new Sprite(Game, graphicsCollection.GetPack("Plus")), DrawOrder, positions); VolumeIndicator.OnScrollUp += new EventHandler(Do_VolumeIndicatorLeftScroll); VolumeIndicator.OnScrollDown += new EventHandler(Do_VolumeIndicatorRightScroll); AddChild(VolumeIndicator); //--------------------------------------- //---Submenu button Sound Options------- positions = new int[4] { 395, 465, 435, 459 }; rbnSoundOn = new RadioButton(game, new Sprite(game, graphicsCollection.GetPack("On")), new Sprite(Game, graphicsCollection.GetPack("Checkbox")), DrawOrder, positions); rbnSoundOn.AllowDirectUncheck = false; rbnSoundOn.OnCheck += new EventHandler(Do_SoundRadioOnChecked); AddChild(rbnSoundOn); positions = new int[4] { 507, 465, 557, 459 }; rbnSoundOff = new RadioButton(game, new Sprite(game, graphicsCollection.GetPack("Off")), new Sprite(Game, graphicsCollection.GetPack("Checkbox")), DrawOrder, positions); rbnSoundOff.AllowDirectUncheck = false; rbnSoundOff.OnCheck += new EventHandler(Do_SoundRadioOffChecked); AddChild(rbnSoundOff); rbnSoundOn.Check(); SoundCurrentState = DefaultOptions.SoundState;//"On" by default switch (SoundCurrentState) { case "On": rbnSoundOn.Check(); break; case "Off": rbnSoundOff.Check(); break; default: rbnSoundOn.Check(); break; } //------------------------------ //------------------------------ //---CONTROLS Submenu Buttons--- btnControls_Mouse = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("MouseOptions")), DrawOrder); btnControls_Mouse.Position = new Point(260, 546); btnControls_Mouse.OnPress += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnPressed); btnControls_Mouse.OnMouseOver += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnMouseOver); btnControls_Mouse.OnMouseLeave += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnMouseLeave); AddChild(btnControls_Mouse); sublistControls.Add(btnControls_Mouse); btnControls_Keyboard = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("KeyboardOptions")), DrawOrder); btnControls_Keyboard.Position = new Point(260, 601); btnControls_Keyboard.OnPress += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnPressed); btnControls_Keyboard.OnMouseOver += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnMouseOver); btnControls_Keyboard.OnMouseLeave += new EventHandler <ButtonEventArgs>(Do_SubmenuBtnMouseLeave); AddChild(btnControls_Keyboard); sublistControls.Add(btnControls_Keyboard); //---Submenu button CameraSpeed Options----- CameraSpeedSprite = new Sprite(game, graphicsCollection.GetPack("CameraSpeed")); CameraSpeedSprite.XRelative = 400; CameraSpeedSprite.YRelative = 550; AddChild(CameraSpeedSprite); CameraSpeedValueSprite = new Sprite(game, graphicsCollection.GetPack("Increment")); CameraSpeedValueSprite.XRelative = 637; CameraSpeedValueSprite.YRelative = 550; CameraSpeedValueSprite.FrameNumber = DefaultOptions.CameraSpeed;//0 by default AddChild(CameraSpeedValueSprite); positions = new int[6] { 630, 543, 590, 543, 727, 543 }; CameraSpeedIndicator = new Scrollbar(game, new Sprite(game, graphicsCollection.GetPack("PlusMinusDisplay")), new Sprite(Game, graphicsCollection.GetPack("Minus")), new Sprite(Game, graphicsCollection.GetPack("Plus")), DrawOrder, positions); CameraSpeedIndicator.OnScrollUp += new EventHandler(Do_CameraSpeedIndicator_LeftScroll); CameraSpeedIndicator.OnScrollDown += new EventHandler(Do_CameraSpeedIndicator_RightScroll); AddChild(CameraSpeedIndicator); //--------------------------------------- //---Submenu button KeyShortcuts Options----- btnKeyShortcuts = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("KeyShortcuts")), DrawOrder); btnKeyShortcuts.Position = new Point(440, 600); btnKeyShortcuts.OnMousePress += new EventHandler <MouseEventArgs>(Do_BtnKeyShortcutsPressed); btnKeyShortcuts.OnMouseRelease += new EventHandler <MouseEventArgs>(Do_BtnKeyShortcutsReleased); AddChild(btnKeyShortcuts); KeyShortcutsPanel = new Sprite(game, graphicsCollection.GetPack("KeyShortcutsPanel")); KeyShortcutsPanel.XRelative = 52; KeyShortcutsPanel.YRelative = 125; KeyShortcutsPanel.StackOrder = DrawOrder + 2; KeyShortcutsPanel.Enabled = false; AddChild(KeyShortcutsPanel); btnKeyShortcutsPanel_Back = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("btnKeyShortcutsPanel_Back")), DrawOrder + 3); btnKeyShortcutsPanel_Back.Position = new Point(855, 150); btnKeyShortcutsPanel_Back.OnMouseRelease += new EventHandler <MouseEventArgs>(Do_BtnKeyShortcutsPanel_BackReleased); btnKeyShortcutsPanel_Back.Enabled = false; AddChild(btnKeyShortcutsPanel_Back); //--------------------------------------- //------------------------------ //------------------------------ //--Saving/Setting LastSave Options (which are the Default values, at this point) TimeValueIndexSelected_LastSave = TimeValueIndexSelected; if (rbnEasy.IsChecked) { DifficultyLevel_LastSave = rbnEasy.Name; } else if (rbnMedium.IsChecked) { DifficultyLevel_LastSave = rbnMedium.Name; } else { DifficultyLevel_LastSave = rbnHard.Name; } ResolutionValueIndexSelected_LastSave = ResolutionValueIndexSelected; if (rbnFullScreenOn.IsChecked) { FullScreenState_LastSave = "On"; } else { FullScreenState_LastSave = "Off"; } VolumeValue_LastSave = VolumeValueSprite.FrameNumber; if (rbnSoundOn.IsChecked) { SoundState_LastSave = "On"; } else { SoundState_LastSave = "Off"; } CameraSpeed_LastState = CameraSpeedValueSprite.FrameNumber; //------------------------------ generalButtons.Add(sublistGame); generalButtons.Add(sublistVideo); generalButtons.Add(sublistAudio); generalButtons.Add(sublistControls); this.StackOrder = DrawOrder; }