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; }
public CommandCenterHelpPanel(Game game, int DrawOrder) : base(game) { graphicsCollection = (GraphicsCollection)Game.Services.GetService(typeof(GraphicsCollection)); btnTabs = new List<CommandCenterGeneralButton>(); spritePages = new List<Sprite>(); btnTab1 = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("HelpPanel_Tab1")), 1); btnTab1.Position = new Point(spritePagesXPoz + 14, spritePagesYPoz-32); btnTab1.OnPress += new EventHandler<ButtonEventArgs>(btnTab_OnPress); btnTabs.Add(btnTab1); AddChild(btnTab1); btnTab2 = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("HelpPanel_Tab2")), 1); btnTab2.Position = new Point(spritePagesXPoz + 14 + 125, spritePagesYPoz - 32); btnTab2.OnPress += new EventHandler<ButtonEventArgs>(btnTab_OnPress); btnTabs.Add(btnTab2); AddChild(btnTab2); btnTab3 = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("HelpPanel_Tab3")), 1); btnTab3.Position = new Point(spritePagesXPoz + 14 + (125 * 2), spritePagesYPoz - 32); btnTab3.OnPress += new EventHandler<ButtonEventArgs>(btnTab_OnPress); btnTabs.Add(btnTab3); AddChild(btnTab3); btnTab4 = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("HelpPanel_Tab4")), 1); btnTab4.Position = new Point(spritePagesXPoz + 14 + (125 * 3), spritePagesYPoz - 32); btnTab4.OnPress += new EventHandler<ButtonEventArgs>(btnTab_OnPress); btnTabs.Add(btnTab4); AddChild(btnTab4); spritePage1 = new Sprite(game, graphicsCollection.GetPack("HelpPanel_Page1")); spritePage1.StackOrder = 0; spritePage1.XRelative = spritePagesXPoz; spritePage1.YRelative = spritePagesYPoz; spritePages.Add(spritePage1); AddChild(spritePage1); spritePage2 = new Sprite(game, graphicsCollection.GetPack("HelpPanel_Page2")); spritePage2.StackOrder = 0; spritePage2.XRelative = spritePagesXPoz; spritePage2.YRelative = spritePagesYPoz; spritePages.Add(spritePage2); AddChild(spritePage2); spritePage3 = new Sprite(game, graphicsCollection.GetPack("HelpPanel_Page3")); spritePage3.StackOrder = 0; spritePage3.XRelative = spritePagesXPoz; spritePage3.YRelative = spritePagesYPoz; spritePages.Add(spritePage3); AddChild(spritePage3); spritePage4 = new Sprite(game, graphicsCollection.GetPack("HelpPanel_Page4")); spritePage4.StackOrder = 0; spritePage4.XRelative = spritePagesXPoz; spritePage4.YRelative = spritePagesYPoz; spritePages.Add(spritePage4); AddChild(spritePage4); tab4Scrollbar = new Scrollbar(game, new Sprite(game, graphicsCollection.GetPack("PageScrollBarUpArrow")), new Sprite(game, graphicsCollection.GetPack("PageScrollBarDownArrow")), 2, new int[] {0,0,0,539}); tab4Scrollbar.XRelative = spritePage4.Width + 3; tab4Scrollbar.YRelative = spritePage4.YRelative + 19; tab4Scrollbar.StackOrder = 0; tab4Scrollbar.OnScrollUp += new EventHandler(tab4Scrollbar_OnScrollUp); tab4Scrollbar.OnScrollDown += new EventHandler(tab4Scrollbar_OnScrollDown); AddChild(tab4Scrollbar); this.StackOrder = DrawOrder; this.Hide(); }
public CommandCenterHelpPanel(Game game, int DrawOrder) : base(game) { graphicsCollection = (GraphicsCollection)Game.Services.GetService(typeof(GraphicsCollection)); btnTabs = new List <CommandCenterGeneralButton>(); spritePages = new List <Sprite>(); btnTab1 = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("HelpPanel_Tab1")), 1); btnTab1.Position = new Point(spritePagesXPoz + 14, spritePagesYPoz - 32); btnTab1.OnPress += new EventHandler <ButtonEventArgs>(btnTab_OnPress); btnTabs.Add(btnTab1); AddChild(btnTab1); btnTab2 = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("HelpPanel_Tab2")), 1); btnTab2.Position = new Point(spritePagesXPoz + 14 + 125, spritePagesYPoz - 32); btnTab2.OnPress += new EventHandler <ButtonEventArgs>(btnTab_OnPress); btnTabs.Add(btnTab2); AddChild(btnTab2); btnTab3 = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("HelpPanel_Tab3")), 1); btnTab3.Position = new Point(spritePagesXPoz + 14 + (125 * 2), spritePagesYPoz - 32); btnTab3.OnPress += new EventHandler <ButtonEventArgs>(btnTab_OnPress); btnTabs.Add(btnTab3); AddChild(btnTab3); btnTab4 = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("HelpPanel_Tab4")), 1); btnTab4.Position = new Point(spritePagesXPoz + 14 + (125 * 3), spritePagesYPoz - 32); btnTab4.OnPress += new EventHandler <ButtonEventArgs>(btnTab_OnPress); btnTabs.Add(btnTab4); AddChild(btnTab4); spritePage1 = new Sprite(game, graphicsCollection.GetPack("HelpPanel_Page1")); spritePage1.StackOrder = 0; spritePage1.XRelative = spritePagesXPoz; spritePage1.YRelative = spritePagesYPoz; spritePages.Add(spritePage1); AddChild(spritePage1); spritePage2 = new Sprite(game, graphicsCollection.GetPack("HelpPanel_Page2")); spritePage2.StackOrder = 0; spritePage2.XRelative = spritePagesXPoz; spritePage2.YRelative = spritePagesYPoz; spritePages.Add(spritePage2); AddChild(spritePage2); spritePage3 = new Sprite(game, graphicsCollection.GetPack("HelpPanel_Page3")); spritePage3.StackOrder = 0; spritePage3.XRelative = spritePagesXPoz; spritePage3.YRelative = spritePagesYPoz; spritePages.Add(spritePage3); AddChild(spritePage3); spritePage4 = new Sprite(game, graphicsCollection.GetPack("HelpPanel_Page4")); spritePage4.StackOrder = 0; spritePage4.XRelative = spritePagesXPoz; spritePage4.YRelative = spritePagesYPoz; spritePages.Add(spritePage4); AddChild(spritePage4); tab4Scrollbar = new Scrollbar(game, new Sprite(game, graphicsCollection.GetPack("PageScrollBarUpArrow")), new Sprite(game, graphicsCollection.GetPack("PageScrollBarDownArrow")), 2, new int[] { 0, 0, 0, 539 }); tab4Scrollbar.XRelative = spritePage4.Width + 3; tab4Scrollbar.YRelative = spritePage4.YRelative + 19; tab4Scrollbar.StackOrder = 0; tab4Scrollbar.OnScrollUp += new EventHandler(tab4Scrollbar_OnScrollUp); tab4Scrollbar.OnScrollDown += new EventHandler(tab4Scrollbar_OnScrollDown); AddChild(tab4Scrollbar); this.StackOrder = DrawOrder; this.Hide(); }