private void InitializeOptions() { parcheminSrc = new Rectangle(0, 0, 1024, 768); #if WINDOWS this.optionsSection = new OptionSection("The Great Paper Options", 150, 7, 1); #else this.optionsSection = new OptionSection("The Great Paper Options", 150, 5, 1); #endif //****************************************************************************************************************** soundVolumeControl = new ListControl("OptionsSoundVolume", new Vector2(250, 200), new List<ListElement>() { new ListElement(0f, new Rectangle(600, 600, 95, 15), "0 %"), new ListElement(0.1f, new Rectangle(600, 600, 95, 15),"10 %"), new ListElement(0.2f, new Rectangle(600, 600, 95, 15),"20 %"), new ListElement(0.3f, new Rectangle(600, 600, 95, 15),"30 %"), new ListElement(0.4f, new Rectangle(600, 600, 95, 15),"40 %"), new ListElement(0.5f, new Rectangle(600, 600, 95, 15),"50 %"), new ListElement(0.6f, new Rectangle(600, 600, 95, 15),"60 %"), new ListElement(0.7f, new Rectangle(600, 600, 95, 15),"70 %"), new ListElement(0.8f, new Rectangle(600, 600, 95, 15),"80 %"), new ListElement(0.9f, new Rectangle(600, 600, 95, 15),"90 %"), new ListElement(1f, new Rectangle(600, 600, 95, 15), "100 %") }); //****************************************************************************************************************** musicVolumeControl = new ListControl("OptionsMusicVolume", new Vector2(250, 240), new List<ListElement>() { new ListElement(0f, new Rectangle(600, 600, 95, 15), "0 %"), new ListElement(0.1f, new Rectangle(600, 600, 95, 15),"10 %"), new ListElement(0.2f, new Rectangle(600, 600, 95, 15),"20 %"), new ListElement(0.3f, new Rectangle(600, 600, 95, 15),"30 %"), new ListElement(0.4f, new Rectangle(600, 600, 95, 15),"40 %"), new ListElement(0.5f, new Rectangle(600, 600, 95, 15),"50 %"), new ListElement(0.6f, new Rectangle(600, 600, 95, 15),"60 %"), new ListElement(0.7f, new Rectangle(600, 600, 95, 15),"70 %"), new ListElement(0.8f, new Rectangle(600, 600, 95, 15),"80 %"), new ListElement(0.9f, new Rectangle(600, 600, 95, 15),"90 %"), new ListElement(1f, new Rectangle(600, 600, 95, 15), "100 %") }); //****************************************************************************************************************** rumbleControl = new ListControl("OptionsRumble", new Vector2(250, 280), new List<ListElement>() { new ListElement(true, new Rectangle(600, 600, 95, 15), LocalizedStrings.GetString("Activated")), new ListElement(false, new Rectangle(600, 600, 95, 15), LocalizedStrings.GetString("Deactivated")), }); //****************************************************************************************************************** #if WINDOWS int[] graphicModeWidth = { 1920, 1680, 1600, 1440, 1366, 1280, 1152, 1024, 800, 640 }; int[] graphicModeHeight = { 1200, 1080, 1050, 1024, 900, 960, 800, 768, 600, 480 }; List<ListElement> resolutionsElements = new List<ListElement>(); for (int i = graphicModeWidth.Length - 1; i >= 0; i--) { if (graphicModeWidth[i] <= GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width) { for (int j = graphicModeHeight.Length - 1; j >= 0; j--) { if (graphicModeHeight[j] <= GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height) { resolutionsElements.Add( new ListElement(new OptionResolution(graphicModeWidth[i], graphicModeHeight[j]), new Rectangle(600, 600, 95, 5)) ); } } } } this.screenResolutionListControl = new ListControl("OptionsScreenResolution", new Vector2(250, 320), resolutionsElements, "Apply"); this.screenResolutionListControl.ValueChanged += new ValueChangedEventhandler(TodoOnValueChanging); //****************************************************************************************************************** fullscreenControl = new ListControl("OptionsFullScreen", new Vector2(250, 360), new List<ListElement>() { new ListElement(true, new Rectangle(600, 600, 95, 15), LocalizedStrings.GetString("Activated")), new ListElement(false, new Rectangle(600, 600, 95, 15), LocalizedStrings.GetString("Deactivated")), }); //****************************************************************************************************************** this.p1NameTextboxControl = new Textbox("P1Name", new Vector2(250, 400)); this.p1NameTextboxControl.ValueChanged += new ValueChangedEventhandler(TodoOnValueChanging); this.p1NameTextboxControl.Text = TGPAContext.Instance.Options.Player1Name; //****************************************************************************************************************** this.p1DeviceListControl = new ListControl("P1Device", new Vector2(250, 440), new List<ListElement>() { new ListElement(new Device(),new Rectangle(600, 600, 135, 15),LocalizedStrings.GetString("KeyboardMouse")) }); this.p1DeviceListControl.ValueChanged += new ValueChangedEventhandler(TodoOnValueChanging); //Add connected pads if (GamePad.GetState(PlayerIndex.One).IsConnected) { this.p1DeviceListControl.Elements.Add(new ListElement(new Device(DeviceType.Gamepad, (int)PlayerIndex.One),new Rectangle(600, 600, 135, 15), LocalizedStrings.GetString("Gamepad") + " 1")); } if (GamePad.GetState(PlayerIndex.Two).IsConnected) { this.p1DeviceListControl.Elements.Add(new ListElement(new Device(DeviceType.Gamepad, (int)PlayerIndex.Two),new Rectangle(600, 600, 135, 15), LocalizedStrings.GetString("Gamepad") + " 2")); } if (GamePad.GetState(PlayerIndex.Three).IsConnected) { this.p1DeviceListControl.Elements.Add(new ListElement(new Device(DeviceType.Gamepad, (int)PlayerIndex.Three),new Rectangle(600, 600, 135, 15), LocalizedStrings.GetString("Gamepad") + " 3")); } if (GamePad.GetState(PlayerIndex.Four).IsConnected) { this.p1DeviceListControl.Elements.Add(new ListElement(new Device(DeviceType.Gamepad, (int)PlayerIndex.Four),new Rectangle(600, 600, 135, 15), LocalizedStrings.GetString("Gamepad") + " 4")); } //Add joysticks for (int i = 0; i < TGPAContext.Instance.InputManager.JoystickManager.ConnectedJoystick.Length; i++) { if (TGPAContext.Instance.InputManager.JoystickManager.ConnectedJoystick[i] == true) { this.p1DeviceListControl.Elements.Add(new ListElement(new Device(DeviceType.Joystick, i),new Rectangle(600, 600, 135, 15), LocalizedStrings.GetString("Joystick") + " " + i)); } } #endif //****************************************************************************************************************** this.soundVolumeControl.ValueChanged += new ValueChangedEventhandler(TodoOnValueChanging); this.musicVolumeControl.ValueChanged += new ValueChangedEventhandler(TodoOnValueChanging); this.rumbleControl.ValueChanged += new ValueChangedEventhandler(TodoOnValueChanging); //****************************************************************************************************************** this.optionsSection.AddControl(0, 0, this.soundVolumeControl); this.optionsSection.AddControl(1, 0, this.musicVolumeControl); this.optionsSection.AddControl(2, 0, this.rumbleControl); #if WINDOWS this.screenResolutionListControl.ValueChanged += new ValueChangedEventhandler(TodoOnValueChanging); this.fullscreenControl.ValueChanged += new ValueChangedEventhandler(TodoOnValueChanging); this.optionsSection.AddControl(3, 0, this.screenResolutionListControl); this.optionsSection.AddControl(4, 0, this.fullscreenControl); this.optionsSection.AddControl(5, 0, this.p1NameTextboxControl); this.optionsSection.AddControl(6, 0, this.p1DeviceListControl); #endif //****************************************************************************************************************** buttonOptionsBackSrc = new Rectangle(0, 0, 53, 46); buttonOptionsBackDst = buttonOptionsBackSrc; buttonOptionsBackDst.X = 200; buttonOptionsBackDst.Y = 570; optionsSection.SetFocus(soundVolumeControl); InitializeOptionsValues(true); }
public LevelSelectionScreen() { selectedIndex = 0; arrowSrc = new Rectangle(410, 10, 60, 50); postitSrc = new Rectangle(86, 4, 245, 382); postitDst = postitSrc; postitDst.X = 60; postitDst.Y = 140; postitDst.Width += (postitDst.Width / 3); //Enlarge post-it to display more text postitDst.Height += (postitDst.Width / 3); playSrc = new Rectangle(857, 0, 90, 120); playDst = arrowSrc; playDst.X = postitDst.X + (postitDst.Width / 2) + (arrowSrc.Width / 2); playDst.Y = (postitDst.Y + postitDst.Height) - arrowSrc.Height; backSrc = new Rectangle(677, 0, 120, 120); backDst = arrowSrc; backDst.X = postitDst.X; backDst.Y = 650; levelSrc = new Rectangle(0, 0, 32, 32); shipSrc = new Rectangle(0, 260, 70, 55); waySrc = new Rectangle(4, 46, 25, 15); //Place levels levelPositionOnMap = new Dictionary<int, Vector2>(); levelPositionOnMap.Add(0, new Vector2(895, 272)); levelPositionOnMap.Add(1, new Vector2(796, 167)); levelPositionOnMap.Add(2, new Vector2(796, 475)); levelPositionOnMap.Add(3, new Vector2(210, 600)); levelPositionOnMap.Add(4, new Vector2(586, 354)); levelPositionOnMap.Add(5, new Vector2(640, 145)); levelPositionOnMap.Add(6, new Vector2(410, 230)); //list of bezier's points //2 waypoints per road Vector2[] tmp; pointsBezier = new Dictionary<int, List<Vector2>>(); tmp = new Vector2[] { new Vector2(895, 236), new Vector2(942, 210) }; //between 0 - 1 pointsBezier.Add(0, new List<Vector2>(tmp)); tmp = new Vector2[] { new Vector2(850, 256), new Vector2(870, 220) }; //between 1 - 2 pointsBezier.Add(1, new List<Vector2>(tmp)); tmp = new Vector2[] { new Vector2(672, 610), new Vector2(300, 490) }; //between 2 - 3 pointsBezier.Add(2, new List<Vector2>(tmp)); tmp = new Vector2[] { new Vector2(236, 386), new Vector2(616, 461) }; //between 3 - 4 pointsBezier.Add(3, new List<Vector2>(tmp)); tmp = new Vector2[] { new Vector2(675, 250), new Vector2(600, 200) }; pointsBezier.Add(4, new List<Vector2>(tmp)); tmp = new Vector2[] { new Vector2(560, 265), new Vector2(575, 175) }; pointsBezier.Add(5, new List<Vector2>(tmp)); tmp = new Vector2[] { new Vector2(485, 165), new Vector2(460, 250) }; pointsBezier.Add(6, new List<Vector2>(tmp)); //Set direction for GamePad users to move on the map availableShipDirectionByLevel = new List<AvailableShipDirection>(); AvailableShipDirection dir0 = new AvailableShipDirection(0); dir0.Directions.Add(ShipDirection.Up, ShipAction.GoNext); dir0.Directions.Add(ShipDirection.Left, ShipAction.GoNext); dir0.Directions.Add(ShipDirection.Right, ShipAction.GoBack); dir0.Directions.Add(ShipDirection.Down, ShipAction.GoBack); AvailableShipDirection dir1 = new AvailableShipDirection(1); dir1.Directions.Add(ShipDirection.Left, ShipAction.GoNext); dir1.Directions.Add(ShipDirection.Down, ShipAction.GoNext); dir1.Directions.Add(ShipDirection.Right, ShipAction.GoBack); dir1.Directions.Add(ShipDirection.Up, ShipAction.GoBack); AvailableShipDirection dir2 = new AvailableShipDirection(2); dir2.Directions.Add(ShipDirection.Left, ShipAction.GoNext); dir2.Directions.Add(ShipDirection.Down, ShipAction.GoNext); dir2.Directions.Add(ShipDirection.Right, ShipAction.GoBack); dir2.Directions.Add(ShipDirection.Up, ShipAction.GoBack); AvailableShipDirection dir3 = new AvailableShipDirection(3); dir3.Directions.Add(ShipDirection.Left, ShipAction.GoNext); dir3.Directions.Add(ShipDirection.Right, ShipAction.GoBack); dir3.Directions.Add(ShipDirection.Up, ShipAction.GoNext); dir3.Directions.Add(ShipDirection.Down, ShipAction.GoBack); AvailableShipDirection dir4 = new AvailableShipDirection(4); dir4.Directions.Add(ShipDirection.Left, ShipAction.GoBack); dir4.Directions.Add(ShipDirection.Down, ShipAction.GoBack); dir4.Directions.Add(ShipDirection.Right, ShipAction.GoNext); dir4.Directions.Add(ShipDirection.Up, ShipAction.GoNext); AvailableShipDirection dir5 = new AvailableShipDirection(5); dir5.Directions.Add(ShipDirection.Left, ShipAction.GoBack); dir5.Directions.Add(ShipDirection.Down, ShipAction.GoBack); dir5.Directions.Add(ShipDirection.Right, ShipAction.GoNext); dir5.Directions.Add(ShipDirection.Up, ShipAction.GoNext); AvailableShipDirection dir6 = new AvailableShipDirection(6); dir6.Directions.Add(ShipDirection.Left, ShipAction.GoNext); dir6.Directions.Add(ShipDirection.Down, ShipAction.GoNext); dir6.Directions.Add(ShipDirection.Right, ShipAction.GoBack); dir6.Directions.Add(ShipDirection.Up, ShipAction.GoBack); availableShipDirectionByLevel.Add(dir0); availableShipDirectionByLevel.Add(dir1); availableShipDirectionByLevel.Add(dir2); availableShipDirectionByLevel.Add(dir3); availableShipDirectionByLevel.Add(dir4); availableShipDirectionByLevel.Add(dir5); availableShipDirectionByLevel.Add(dir6); shipDst = shipSrc; shipDst.X = (int)levelPositionOnMap[0].X; shipDst.Y = (int)levelPositionOnMap[0].Y; Vector2 controlLoc = new Vector2(105, 350); difficultyListControl = new ListControl("", controlLoc, new List<ListElement>() { new ListElement(Difficulty.Easy, new Rectangle(600, 600, 95, 5),"Easy"), new ListElement(Difficulty.Normal, new Rectangle(600, 600, 95, 5),"Normal"), new ListElement(Difficulty.Hard, new Rectangle(600, 600, 95, 5),"Hard") }, "StartLevel"); difficultyListControl.Focus = true; foreach (ListElement le in difficultyListControl.Elements) { if (TGPAContext.Instance.Options.Difficulty == (Difficulty)le.Value) { difficultyListControl.FocusedElement = le; } } difficultyListControl.ValueChanged += new ValueChangedEventhandler(this.DifficultyValueChanged); rectDst = new Rectangle(150, 250, 774, 275); Initialize(); }