public CommandCenterZoneList(Game game, int DrawOrder) : base(game) { graphicsCollection = (GraphicsCollection)Game.Services.GetService(typeof(GraphicsCollection)); //-----Zone Buttons------- btnZone1 = new CommandCenterZoneButton(game, new Sprite(game, graphicsCollection.GetPack("Zone")), new Sprite(game, graphicsCollection.GetPack("SelectedZone")), DrawOrder); btnZone1.Position = new Point(470, 190); btnZone1.Name = "ZONE 1"; btnZone1.OnPress += new EventHandler<ButtonEventArgs>(Do_ZoneOnPress); btnZone1.Locked = false; btnZone1.DescriptionString = btnZone1.Name+ "\n\n\n\n Tutorial zone for familiarizing with the game."; btnZone1.MissionBriefingString = " Mission briefing \n\n\n You are in the year 2010 and you are able to travel through time between the years 1960 and 2010. You will be given some small tasks, in order to understand the game mechanics."; btnZone1.RewardsString = " Rewards \n\n\n\n This is a tutorial, there are no rewards for this zone."; btnZone1.ParametersString = " Parameters \n\n\n\n This is a tutorial, parameters are not yet implemented"; AddChild(btnZone1); zones.Add(btnZone1); btnZone2 = new CommandCenterZoneButton(game, new Sprite(game, graphicsCollection.GetPack("Zone")), new Sprite(game, graphicsCollection.GetPack("SelectedZone")), DrawOrder); btnZone2.Position = new Point(210, 390); btnZone2.Name = "ZONE 2"; btnZone2.Locked = false; //needs to be unlocked for the Strings to be set btnZone2.DescriptionString = btnZone2.Name+"\n Description"; btnZone2.MissionBriefingString = btnZone2.Name + "\n Mission briefing"; btnZone2.RewardsString = btnZone2.Name + "\n Rewards"; btnZone2.Locked = true; //it is set back to locked==false; btnZone2.OnPress += new EventHandler<ButtonEventArgs>(Do_ZoneOnPress); AddChild(btnZone2); zones.Add(btnZone2); btnZone3 = new CommandCenterZoneButton(game, new Sprite(game, graphicsCollection.GetPack("Zone")), new Sprite(game, graphicsCollection.GetPack("SelectedZone")), DrawOrder); btnZone3.Position = new Point(500, 330); btnZone3.Name = "ZONE 3"; btnZone3.Locked = false; //needs to be unlocked for the Strings to be set btnZone3.DescriptionString = btnZone3.Name + "\n Description"; btnZone3.MissionBriefingString = btnZone3.Name + "\n Mission briefing"; btnZone3.RewardsString = btnZone3.Name + "\n Rewards"; btnZone3.Locked = true; //it is set back to locked==false; btnZone3.OnPress += new EventHandler<ButtonEventArgs>(Do_ZoneOnPress); AddChild(btnZone3); zones.Add(btnZone3); //----------------------- this.StackOrder = DrawOrder; //timer is used for the Submenu Close-then-Open effect, when switching between 2 different Zones tmr_sleepTime = new Timer(game); tmr_sleepTime.IntervalType = TimerIntervalType.Miliseconds; tmr_sleepTime.Interval = 250; tmr_sleepTime.OnTick += new EventHandler(tmr_sleepTime_OnTick); }
//positions is an 4-size Point vector containing the (x,y) positions of the 4 level buttons public TimeGateUpgradeCategory(Game game, int DrawOrder,Point[] positions) : base(game) { graphicsCollection = (GraphicsCollection)Game.Services.GetService(typeof(GraphicsCollection)); //-----Level Buttons------- btnLevel1 = new TimeGateUpgradeLevel(game, new Sprite(game, graphicsCollection.GetPack("Level1")), DrawOrder); btnLevel1.Position = positions[0]; btnLevel1.Name = "Level1"; btnLevel1.Status = TimeGateUpgradeStatus.Locked; btnLevel1.OnPress += new EventHandler<ButtonEventArgs>(Do_LevelOnPress); AddChild(btnLevel1); levels.Add(btnLevel1); btnLevel2 = new TimeGateUpgradeLevel(game, new Sprite(game, graphicsCollection.GetPack("Level2")), DrawOrder); btnLevel2.Position = positions[1]; btnLevel2.Name = "Level2"; btnLevel2.Status = TimeGateUpgradeStatus.Locked; btnLevel2.OnPress += new EventHandler<ButtonEventArgs>(Do_LevelOnPress); AddChild(btnLevel2); levels.Add(btnLevel2); btnLevel3 = new TimeGateUpgradeLevel(game, new Sprite(game, graphicsCollection.GetPack("Level3")), DrawOrder); btnLevel3.Position = positions[2]; btnLevel3.Name = "Level3"; btnLevel3.Status = TimeGateUpgradeStatus.Locked; btnLevel3.OnPress += new EventHandler<ButtonEventArgs>(Do_LevelOnPress); AddChild(btnLevel3); levels.Add(btnLevel3); btnLevel4 = new TimeGateUpgradeLevel(game, new Sprite(game, graphicsCollection.GetPack("Level4")), DrawOrder); btnLevel4.Position = positions[3]; btnLevel4.Name = "Level4"; btnLevel4.Status = TimeGateUpgradeStatus.Locked; btnLevel4.OnPress += new EventHandler<ButtonEventArgs>(Do_LevelOnPress); AddChild(btnLevel4); levels.Add(btnLevel4); //----------------------- this.StackOrder = DrawOrder; }
public IOManager(Game game) : base(game) { DisplayManager.CameraFreeze(); graphicsCollection = new GraphicsCollection(game); Game.Services.AddService(typeof(GraphicsCollection), graphicsCollection); graphicsCollection.OnProgress += new EventHandler<IOEventArgs>(graphicsCollection_OnProgress); graphicsCollection.OnComplete += new EventHandler<IOEventArgs>(graphicsCollection_OnComplete); graphicsCollection.OnStart += new EventHandler<IOEventArgs>(graphicsCollection_OnStart); fontsCollection = new FontsCollection(game); Game.Services.AddService(typeof(FontsCollection), fontsCollection); fontsCollection.OnStart += new EventHandler<IOEventArgs>(fontsCollection_OnStart); fontsCollection.OnProgress += new EventHandler<IOEventArgs>(fontsCollection_OnProgress); fontsCollection.OnComplete += new EventHandler<IOEventArgs>(fontsCollection_OnComplete); AutosaveTimer = new Timer(game); AutosaveTimer.IntervalType = TimerIntervalType.Seconds; AutosaveTimer.Interval = 0; AutosaveTimer.OnTick += new EventHandler(AutosaveTimer_OnTick); Game.Services.AddService(typeof(IOManager), this); }
public IOManager(Game game) : base(game) { DisplayManager.CameraFreeze(); graphicsCollection = new GraphicsCollection(game); Game.Services.AddService(typeof(GraphicsCollection), graphicsCollection); graphicsCollection.OnProgress += new EventHandler <IOEventArgs>(graphicsCollection_OnProgress); graphicsCollection.OnComplete += new EventHandler <IOEventArgs>(graphicsCollection_OnComplete); graphicsCollection.OnStart += new EventHandler <IOEventArgs>(graphicsCollection_OnStart); fontsCollection = new FontsCollection(game); Game.Services.AddService(typeof(FontsCollection), fontsCollection); fontsCollection.OnStart += new EventHandler <IOEventArgs>(fontsCollection_OnStart); fontsCollection.OnProgress += new EventHandler <IOEventArgs>(fontsCollection_OnProgress); fontsCollection.OnComplete += new EventHandler <IOEventArgs>(fontsCollection_OnComplete); AutosaveTimer = new Timer(game); AutosaveTimer.IntervalType = TimerIntervalType.Seconds; AutosaveTimer.Interval = 0; AutosaveTimer.OnTick += new EventHandler(AutosaveTimer_OnTick); Game.Services.AddService(typeof(IOManager), this); }
public BaseConstruction(Game game, int xRelative, int yRelative, bool isPopulationConstruction, bool isPopulationConstruction_UpgradedLevel) : base(game) { graphicsCollection = (GraphicsCollection)Game.Services.GetService(typeof(GraphicsCollection)); x = xRelative; y = yRelative; this.isPopulationConstruction = isPopulationConstruction; this.isPopulationConstruction_UpgradedLevel = isPopulationConstruction_UpgradedLevel; spriteList = new List<Sprite>(); InitialState(); }
public TimeGateUpgradeLevel(Game game, Sprite boughtSprite, int drawOrder) : base(game) { graphicsCollection = (GraphicsCollection)Game.Services.GetService(typeof(GraphicsCollection)); StatusSprite = new Sprite(game, graphicsCollection.GetPack("LevelStatus")); StatusSprite.XRelative = 0; StatusSprite.YRelative = 0; BoughtSprite = boughtSprite; BoughtSprite.XRelative = 0; BoughtSprite.YRelative = 0; this.StackOrder = drawOrder; AddChild(StatusSprite); AddChild(BoughtSprite); }
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 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 CommandCenterDidYouKnowPanel(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("DidYouKnowPanel_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("DidYouKnowPanel_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("DidYouKnowPanel_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("DidYouKnowPanel_Tab4")), 1); btnTab4.Position = new Point(spritePagesXPoz + 14 + (125 * 3), spritePagesYPoz - 32); btnTab4.OnPress += new EventHandler<ButtonEventArgs>(btnTab_OnPress); btnTabs.Add(btnTab4); AddChild(btnTab4); btnTab5 = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("DidYouKnowPanel_Tab5")), 1); btnTab5.Position = new Point(spritePagesXPoz + 14 + (125 * 4), spritePagesYPoz - 32); btnTab5.OnPress += new EventHandler<ButtonEventArgs>(btnTab_OnPress); btnTabs.Add(btnTab5); AddChild(btnTab5); btnTab6 = new CommandCenterGeneralButton(game, new Sprite(game, graphicsCollection.GetPack("DidYouKnowPanel_Tab6")), 1); btnTab6.Position = new Point(spritePagesXPoz + 14 + (125 * 5), spritePagesYPoz - 32); btnTab6.OnPress += new EventHandler<ButtonEventArgs>(btnTab_OnPress); btnTabs.Add(btnTab6); AddChild(btnTab6); spritePage1 = new Sprite(game, graphicsCollection.GetPack("DidYouKnowPanel_Page1")); spritePage1.StackOrder = 0; spritePage1.XRelative = spritePagesXPoz; spritePage1.YRelative = spritePagesYPoz; spritePages.Add(spritePage1); AddChild(spritePage1); spritePage2 = new Sprite(game, graphicsCollection.GetPack("DidYouKnowPanel_Page2")); spritePage2.StackOrder = 0; spritePage2.XRelative = spritePagesXPoz; spritePage2.YRelative = spritePagesYPoz; spritePages.Add(spritePage2); AddChild(spritePage2); spritePage3 = new Sprite(game, graphicsCollection.GetPack("DidYouKnowPanel_Page3")); spritePage3.StackOrder = 0; spritePage3.XRelative = spritePagesXPoz; spritePage3.YRelative = spritePagesYPoz; spritePages.Add(spritePage3); AddChild(spritePage3); spritePage4 = new Sprite(game, graphicsCollection.GetPack("DidYouKnowPanel_Page4")); spritePage4.StackOrder = 0; spritePage4.XRelative = spritePagesXPoz; spritePage4.YRelative = spritePagesYPoz; spritePages.Add(spritePage4); AddChild(spritePage4); spritePage5 = new Sprite(game, graphicsCollection.GetPack("DidYouKnowPanel_Page5")); spritePage5.StackOrder = 0; spritePage5.XRelative = spritePagesXPoz; spritePage5.YRelative = spritePagesYPoz; spritePages.Add(spritePage5); AddChild(spritePage5); spritePage6 = new Sprite(game, graphicsCollection.GetPack("DidYouKnowPanel_Page6")); spritePage6.StackOrder = 0; spritePage6.XRelative = spritePagesXPoz; spritePage6.YRelative = spritePagesYPoz; spritePages.Add(spritePage6); AddChild(spritePage6); this.StackOrder = DrawOrder; this.Hide(); }
public MainMenu(Game game, ref UsersList list) : base(game) { graphicsCollection = (GraphicsCollection)Game.Services.GetService(typeof(GraphicsCollection)); randomSlot = new Random(); uList = list; usersList = new List<string> { }; for (int i = 0; i < list.Count; i++) usersList.Add(list[i].Name); InitialState(); Game.Components.Add(this); }
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(); }