public MyGuiScreenOptionsVideo() : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null) { MyMwcLog.WriteLine("MyGuiScreenOptionsVideo.ctor START"); m_enableBackgroundFade = true; m_size = new Vector2(0.59f, 0.68544f); m_size *= 1.1f; m_backgroundTexture = MyTextureManager.GetTexture <MyTexture2D>("Textures\\GUI\\BackgroundScreen\\VideoBackground", flags: TextureFlags.IgnoreQuality); AddCaption(MyTextsWrapperEnum.VideoOptions, new Vector2(0, 0.005f)); //Controls.Add(new MyGuiControlLabel(this, -m_size.Value / 2.0f + MyGuiConstants.SCREEN_CAPTION_DELTA_Y, null, MyTextsWrapperEnum.VideoOptions, MyGuiConstants.SCREEN_CAPTION_TEXT_COLOR, MyGuiConstants.SCREEN_CAPTION_TEXT_SCALE)); Vector2 controlsOriginLeft = new Vector2(-m_size.Value.X / 2.0f + 0.05f, -m_size.Value.Y / 2.0f + 0.145f) + new Vector2(0.02f, 0f); Vector2 controlsOriginRight = new Vector2(-m_size.Value.X / 2.0f + 0.185f, -m_size.Value.Y / 2.0f + 0.145f) + new Vector2(0.043f, 0f); controlsOriginRight.X += 0.04f; int controlIndex = 0; // Adapter Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.VideoAdapter, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue())); m_videoAdapterCombobox = new MyGuiControlCombobox(this, controlsOriginRight + controlIndex++ *MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); m_videoAdapterCombobox.OnSelect += OnVideoAdapterSelected; AddAdaptersToComboBox(); Controls.Add(m_videoAdapterCombobox); // Video Mode Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.VideoMode, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue())); m_videoModeCombobox = new MyGuiControlCombobox(this, controlsOriginRight + controlIndex++ *MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); // Populating Video Mode with supported DisplayMode reported by XNA framework m_videoModeCombobox.OnSelect += OnVideoModeSelected; //Added on UpdateSettings //AddDisplayModesToComboBox(MyMinerGame.GraphicsDeviceManager.GraphicsAdapter.AdapterOrdinal); Controls.Add(m_videoModeCombobox); // Recommended aspect ratio m_recommendAspectRatioLabel = new MyGuiControlLabel(this, new Vector2(controlsOriginRight.X + MyGuiConstants.COMBOBOX_TEXT_OFFSET.X, controlsOriginRight.Y + controlIndex++ *MyGuiConstants.CONTROLS_DELTA.Y - 0.015f), null, new StringBuilder(), MyGuiConstants.LABEL_TEXT_COLOR * 0.9f, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS * 0.85f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()); //Added on UpdateSettings //UpdateRecommendecAspectRatioLabel(MyMinerGame.GraphicsDeviceManager.GraphicsAdapter.AdapterOrdinal); Controls.Add(m_recommendAspectRatioLabel); // reduce the spacing between "Recommended aspect ratio" and items below it Vector2 offSet = new Vector2(0, MyGuiConstants.CONTROLS_DELTA.Y / 2); controlsOriginLeft -= offSet; controlsOriginRight -= offSet; // Fullscreen Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Fullscreen, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue())); m_fullscreenCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight + controlIndex++ *MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0), MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE, MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null, true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null); //m_fullscreenCheckbox.OnCheck = OnFullScreenCheck; Controls.Add(m_fullscreenCheckbox); // Vertical Sync Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.VerticalSync, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue())); //m_verticalSyncCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight + 3 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); m_verticalSyncCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight + controlIndex++ *MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0), MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE, MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null); Controls.Add(m_verticalSyncCheckbox); // Hardware Cursor Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.HardwareCursor, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue())); m_hardwareCursorCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight + controlIndex++ *MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0), MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE, MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null, false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null); Controls.Add(m_hardwareCursorCheckbox); // Render Quality Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.RenderQuality, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue())); m_renderQualityCombobox = new MyGuiControlCombobox(this, controlsOriginRight + controlIndex++ *MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); m_renderQualityCombobox.AddItem((int)MyRenderQualityEnum.LOW, MyTextsWrapperEnum.RenderQualityLow); m_renderQualityCombobox.AddItem((int)MyRenderQualityEnum.NORMAL, MyTextsWrapperEnum.RenderQualityNormal); m_renderQualityCombobox.AddItem((int)MyRenderQualityEnum.HIGH, MyTextsWrapperEnum.RenderQualityHigh); m_renderQualityCombobox.AddItem((int)MyRenderQualityEnum.EXTREME, MyTextsWrapperEnum.RenderQualityExtreme); Controls.Add(m_renderQualityCombobox); // Field of View Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + controlIndex * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.FieldOfView, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue())); const float fovSliderSize = MyGuiConstants.SLIDER_WIDTH * 1.1f; m_fieldOfViewSlider = new MyGuiControlSlider(this, controlsOriginRight + controlIndex * MyGuiConstants.CONTROLS_DELTA + new Vector2(fovSliderSize / 2.0f, 0), fovSliderSize, MyConstants.FIELD_OF_VIEW_CONFIG_MIN, MyConstants.FIELD_OF_VIEW_CONFIG_MAX, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS * 0.85f); m_fieldOfViewSlider.OnChange = OnFovChanged; Controls.Add(m_fieldOfViewSlider); m_fieldOfViewLabel = new MyGuiControlLabel(this, controlsOriginRight + controlIndex++ *MyGuiConstants.CONTROLS_DELTA + new Vector2(fovSliderSize * 1.1f, 0), null, new StringBuilder("{0:F1}"), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue()); Controls.Add(m_fieldOfViewLabel); m_fieldOfViewDefaultLabel = new MyGuiControlLabel(this, controlsOriginRight + controlIndex++ *MyGuiConstants.CONTROLS_DELTA + new Vector2(0.009f, 0), null, MyTextsWrapper.Get(MyTextsWrapperEnum.DefaultFOV), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM, MyGuiManager.GetFontMinerWarsBlue()); m_fieldOfViewDefaultLabel.UpdateParams(MathHelper.ToDegrees(MyConstants.FIELD_OF_VIEW_CONFIG_DEFAULT)); Controls.Add(m_fieldOfViewDefaultLabel); //MyGuiManager.GetFontMinerWarsBlue() // Brightness //Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 8 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Brightness, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); // Contrast //Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 9 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Contrast, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); //m_contrastTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 9 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_WIDTH / 2.0f, 0), MyGuiConstants.TEXTBOX_WIDTH, "Opicka©123456", 20, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE_OPTIONS, MyGuiControlTextboxType.NORMAL); //Controls.Add(m_contrastTextbox); // Buttons APPLY and BACK var m_okButton = new MyGuiControlButton(this, new Vector2(-0.1379f, 0.2269f), MyGuiConstants.OK_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnApplyClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(m_okButton); //Controls.Add(new MyGuiControlButton(this, new Vector2(-buttonDelta.X, buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, // MyTextsWrapperEnum.Apply, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnApplyClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); //Controls.Add(new MyGuiControlButton(this, new Vector2(+buttonDelta.X, buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, // MyTextsWrapperEnum.Back, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnBackClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); var m_cancelButton = new MyGuiControlButton(this, new Vector2(0.1428f, 0.2269f), MyGuiConstants.OK_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Back, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnBackClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(m_cancelButton); // Update controls with values from config file UpdateFromConfig(); UpdateControls(m_settingsOld); // Update OLD settings UpdateSettings(m_settingsOld); UpdateSettings(m_settingsNew); MyMwcLog.WriteLine("MyGuiScreenOptionsVideo.ctor END"); }
private void RecreateControls() { m_size = new Vector2(1100f / 1600f, 1200 / 1200f); Controls.Clear(); string prevName = MyConfig.LastFriendName; if (m_findPlayerName != null && m_findPlayerName.Text != null) { prevName = m_findPlayerName.Text; } AddCaption(MyTextsWrapperEnum.FriendsSectorMap, new Vector2(0, 0.04f)); Vector2 controlsOriginLeft = new Vector2(-m_size.Value.X / 2.0f + 0.1f, -m_size.Value.Y / 2.0f + 0.1f); Vector2 controlsDelta = new Vector2(0, 0.0525f); // controls for typing friend name to search Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 1f * controlsDelta, null, MyTextsWrapperEnum.FriendName, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_findPlayerName = new MyGuiControlTextbox(this, controlsOriginLeft + 1f * controlsDelta + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f + 0.15f, 0), MyGuiControlPreDefinedSize.MEDIUM, prevName, 20, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(m_findPlayerName); var searchButton = new MyGuiControlButton(this, m_findPlayerName.GetPosition() + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f - 0.0208f, 0), MyGuiConstants.SEARCH_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetButtonSearchTexture(), null, null, MyTextsWrapperEnum.Search, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE * 0.8f, MyGuiControlButtonTextAlignment.CENTERED, OnSearchClick, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, true, true); Controls.Add(searchButton); // friend maps available for selection //Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 3* controlsDelta, null, MyTextsWrapperEnum.Map, MyGuiConstants.LABEL_TEXT_COLOR, // MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); if (m_sectorIdentifiers != null && m_userDetails != null && m_sectorIdentifiers.Count > 0) { m_mapsCombobox = new MyGuiControlListbox(this, new Vector2(0, -0.010f), new Vector2(0.43f, 0.1f), MyGuiConstants.LISTBOX_BACKGROUND_COLOR, null, MyGuiConstants.LABEL_TEXT_SCALE, 1, 6, 1, true, true, false, null, null, MyGuiManager.GetScrollbarSlider(), MyGuiManager.GetHorizontalScrollbarSlider(), 1, 0, MyGuiConstants.LISTBOX_BACKGROUND_COLOR_BLUE, 0f, 0f, 0f, 0f, 0, 0f, -0.01f, -0.01f, -0.02f, 0.02f); for (int i = 0; i < m_sectorIdentifiers.Count; i++) { MyMwcSectorIdentifier sectorIdentifier = m_sectorIdentifiers[i]; foreach (MyMwcUserDetail userDetail in m_userDetails) { if (sectorIdentifier.UserId.HasValue && sectorIdentifier.UserId.Value == userDetail.UserId) { if (string.IsNullOrEmpty(sectorIdentifier.SectorName)) { m_mapsCombobox.AddItem(i, new StringBuilder(string.Format("{0} - {1}", userDetail.DisplayName, sectorIdentifier.Position.ToString())), null); } else { m_mapsCombobox.AddItem(i, new StringBuilder(string.Format("{0} - {1} ({2})", userDetail.DisplayName, sectorIdentifier.SectorName, sectorIdentifier.Position.ToString())), null); } } } } SortSectors(); m_mapsCombobox.ItemDoubleClick += OnItemDoubleClick; Controls.Add(m_mapsCombobox); } else { Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 3 * controlsDelta + new Vector2(0.21f, 0), null, MyTextsWrapperEnum.NoSectorsAvailable, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); } // Buttons OK and CANCEL var m_okButton = new MyGuiControlButton(this, new Vector2(-0.0879f, 0.35f), MyGuiConstants.OK_BUTTON_SIZE * 0.75f, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnOkClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(m_okButton); var m_cancelButton = new MyGuiControlButton(this, new Vector2(0.0879f, 0.35f), MyGuiConstants.OK_BUTTON_SIZE * 0.75f, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Cancel, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnCancelClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(m_cancelButton); m_findPlayerName.MoveCartrigeToEnd(); this.SetControlIndex(Controls.IndexOf(m_findPlayerName)); }
private void RecreateControls() { Controls.Clear(); m_size = new Vector2(1100f / 1600f, 1200 / 1200f); Vector2 controlsOriginLeft = new Vector2(-m_size.Value.X / 2.0f + 0.07f, -m_size.Value.Y / 2.0f + 0.2f - 0.0360f); Vector2 controlsOriginRight = new Vector2(-m_size.Value.X / 2.0f + 0.07f + 0.355f, -m_size.Value.Y / 2.0f + 0.2f - 0.0360f); AddCaption(MyTextsWrapperEnum.TemporarySectorMap, new Vector2(0, 0.035f)); //Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft, null, MyTextsWrapperEnum.Map, MyGuiConstants.LABEL_TEXT_COLOR, // MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); if (m_sectors != null && m_sectors.Count > 0) { // When editing global story sectors, add some unused sector AddUnusedSector(); int selectedIndex = 0; /*m_sectorsCombobox = new MyGuiControlCombobox(this, new Vector2(0, -0.17f), MyGuiControlPreDefinedSize.LONGMEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 6, true, false, true); * for (int i = 0; i < m_sectors.Count; i++) * { * MyMwcSectorIdentifier sectorIdentifier = m_sectors[i]; * * if (m_lastSandboxSector.HasValue && sectorIdentifier.Position.Equals(m_lastSandboxSector.Value)) * { * selectedIndex = i; * } * * if (string.IsNullOrEmpty(sectorIdentifier.SectorName)) * { * m_sectorsCombobox.AddItem(i, GetSectorScreenshot(sectorIdentifier), new StringBuilder(string.Format("{0}", sectorIdentifier.Position.ToString()))); * } * else * { * m_sectorsCombobox.AddItem(i, GetSectorScreenshot(sectorIdentifier), new StringBuilder(string.Format("{0} ({1})", sectorIdentifier.SectorName, sectorIdentifier.Position.ToString()))); * } * } * * SortSectors(); * * m_sectorsCombobox.SelectItemByKey(selectedIndex); * m_sectorsCombobox.OnSelectItemDoubleClick += OnItemDoubleClick; * Controls.Add(m_sectorsCombobox);*/ //Listbox m_sectorsListbox = new MyGuiControlListbox(this, new Vector2(0, -0.025f), new Vector2(0.43f, 0.1f), MyGuiConstants.LISTBOX_BACKGROUND_COLOR, null, MyGuiConstants.LABEL_TEXT_SCALE, 1, 6, 1, true, true, false, null, null, MyGuiManager.GetScrollbarSlider(), MyGuiManager.GetHorizontalScrollbarSlider(), 1, 0, MyGuiConstants.LISTBOX_BACKGROUND_COLOR_BLUE, 0f, 0f, 0f, 0f, 0, 0f, -0.01f, -0.01f, -0.02f, 0.02f) { IconScale = new Vector2(0.97f) }; for (int i = 0; i < m_sectors.Count; i++) { MyMwcSectorIdentifier sectorIdentifier = m_sectors[i]; if (m_lastSandboxSector.HasValue && sectorIdentifier.Position.Equals(m_lastSandboxSector.Value)) { selectedIndex = i; } if (string.IsNullOrEmpty(sectorIdentifier.SectorName)) { m_sectorsListbox.AddItem(i, new StringBuilder(string.Format("{0}", sectorIdentifier.Position.ToString())), GetSectorScreenshot(sectorIdentifier)); } else { m_sectorsListbox.AddItem(i, new StringBuilder(string.Format("{0} ({1})", sectorIdentifier.SectorName, sectorIdentifier.Position.ToString())), GetSectorScreenshot(sectorIdentifier)); } } SortSectors(); m_sectorsListbox.SetSelectedItem(selectedIndex); m_sectorsListbox.ItemDoubleClick += OnItemDoubleClick; Controls.Add(m_sectorsListbox); } else { var text = m_loadingSectors.HasValue ? MyTextsWrapperEnum.LoadingPleaseWait : MyTextsWrapperEnum.NoSectorsAvailable; Controls.Add(new MyGuiControlLabel(this, new Vector2(0, -0.03f), null, text, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); } // Buttons OK and CANCEL var m_okButton = new MyGuiControlButton(this, new Vector2(-0.0879f, 0.35f), MyGuiConstants.OK_BUTTON_SIZE * 0.75f, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnOkClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(m_okButton); var m_cancelButton = new MyGuiControlButton(this, new Vector2(0.0879f, 0.35f), MyGuiConstants.OK_BUTTON_SIZE * 0.75f, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Cancel, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnCancelClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(m_cancelButton); }
public MyGuiScreenMission(MyMission missionBase, bool canDecline = true) : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(0.75f, 0.75f)) { Debug.Assert(missionBase != null); m_mission = missionBase; m_backgroundTexture = MyTextureManager.GetTexture <MyTexture2D>("Textures\\GUI\\BackgroundScreen\\MissionAcceptBackground", flags: TextureFlags.IgnoreQuality); m_size = new Vector2(1010 / 1600f, 855 / 1200f); // Title var titleLabel = new MyGuiControlLabel( this, new Vector2(0, -0.3052f), null, MyTextsWrapperEnum.Mission, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.SCREEN_CAPTION_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); // append mission name to the title of the screen titleLabel.UpdateParams(new[] { missionBase.Name }); Controls.Add(titleLabel); // mission description on the left Controls.Add(new MyGuiControlLabel( this, new Vector2(-m_size.Value.X / 4.5f, -0.2501f), null, MyTextsWrapperEnum.Description, MyGuiConstants.LABEL_TEXT_COLOR, .8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER)); var multiLineText = new MyGuiControlMultilineText( this, new Vector2(-m_size.Value.X / 4.5f - 28 / 1600f, -0.0167f), new Vector2(370 / 1600f, 489 / 1200f), null, MyGuiManager.GetFontMinerWarsBlue(), .66f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, m_mission.DescriptionTemp, false, true); Controls.Add(multiLineText); multiLineText.ScrollbarOffset = 71 / 1600f; // mission objectives (submissions) on the right Controls.Add(new MyGuiControlLabel( this, new Vector2(m_size.Value.X / 4.5f, -0.2501f), null, MyTextsWrapperEnum.Objectives, MyGuiConstants.LABEL_TEXT_COLOR, .8f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER)); var objectives = new StringBuilder(); foreach (MyObjective t in m_mission.Objectives) { objectives.Append("- "); objectives.Append(t.DescriptionTemp.ToString()); objectives.AppendLine("\n"); //objectives.AppendLine(); } var textControl = new MyGuiControlMultilineText( this, new Vector2(m_size.Value.X / 4.5f - 28 / 1600f, -0.0167f), new Vector2(370 / 1600f, 489 / 1200f), null, MyGuiManager.GetFontMinerWarsBlue(), .66f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, objectives, false, true) { ScrollbarOffset = 64 / 1600f }; Controls.Add(textControl); textControl.Clear(); textControl.AppendText(objectives); var okButton = new MyGuiControlButton(this, new Vector2(-0.1379f, 0.2489f), MyGuiConstants.OK_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Accept, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnAccept_Click, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(okButton); // decline button if (canDecline) { var declineButton = new MyGuiControlButton(this, new Vector2(0.1379f, 0.2489f), MyGuiConstants.OK_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Decline, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnDecline_Click, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(declineButton); } else { m_closeOnEsc = canDecline; } }
public MyGuiScreenRegister(MyGuiScreenBase openAfterSuccesfullRegistration, string login, string password) : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null) { m_enableBackgroundFade = true; m_backgroundTexture = MyTextureManager.GetTexture <MyTexture2D>("Textures\\GUI\\BackgroundScreen\\VideoBackground", flags: TextureFlags.IgnoreQuality); m_size = new Vector2(1030f / 1600f, 897f / 1200f); m_openAfterSuccesfullRegistration = openAfterSuccesfullRegistration; // If user presses enter in any control, we call this method. It's default ENTER. this.OnEnterCallback = delegate { OnOkClick(null); }; Vector2 controlsOriginLeft = new Vector2(-m_size.Value.X / 2.0f + 0.07f, -m_size.Value.Y / 2.0f + 0.125f + 0.018f); Vector2 controlsOriginRight = new Vector2(-m_size.Value.X / 2.0f + 0.32f, -m_size.Value.Y / 2.0f + 0.125f + 0.018f); Vector2 checkboxControlsOriginRight = new Vector2(-m_size.Value.X / 2.0f + 0.35f, -m_size.Value.Y / 2.0f + 0.125f); AddCaption(MyTextsWrapperEnum.Registration, new Vector2(0, 0.005f)); // Choose a username Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 0.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.ChooseUsername, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_usernameTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 0.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", MyMwcValidationConstants.USERNAME_LENGTH_MAX, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(m_usernameTextbox); // Choose a password Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 1.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.ChoosePassword, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_passwordTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 1.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", MyMwcValidationConstants.PASSWORD_LENGTH_MAX, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.PASSWORD); Controls.Add(m_passwordTextbox); // Retype password Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 2.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.RetypePassword, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_retypePasswordTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 2.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", MyMwcValidationConstants.PASSWORD_LENGTH_MAX, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.PASSWORD); Controls.Add(m_retypePasswordTextbox); // Email address Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 3.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.EmailAddress, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_emailTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 3.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", MyMwcValidationConstants.EMAIL_LENGTH_MAX, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL); Controls.Add(m_emailTextbox); // Send me newsletters Controls.Add(new MyGuiControlLabel(this, (new Vector2(0.05f, 0) + controlsOriginLeft) + 5.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.SendNewsletters, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_sendNewslettersCheckbox = new MyGuiControlCheckbox(this, controlsOriginLeft + 5.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0), MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE, MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null, true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null); //m_sendNewslettersCheckbox = new MyGuiControlCheckbox(this, controlsOriginLeft + 6f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(m_sendNewslettersCheckbox); bool remember = MyConfig.RememberUsernameAndPassword; // Remember me Controls.Add(new MyGuiControlLabel(this, (new Vector2(0.05f, 0) + controlsOriginLeft) + 6.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.RememberMe, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_rememberCheckbox = new MyGuiControlCheckbox(this, controlsOriginLeft + 6.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0), MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE, MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null, remember, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null); Controls.Add(m_rememberCheckbox); /* * // Buttons APPLY and BACK * Vector2 buttonDelta = new Vector2(0.05f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f); * Controls.Add(new MyGuiControlButton(this, new Vector2(-buttonDelta.X, buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, * MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnOkClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); * Controls.Add(new MyGuiControlButton(this, new Vector2(+buttonDelta.X, buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, * MyTextsWrapperEnum.Cancel, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnCancelClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); */ var okButton = new MyGuiControlButton(this, new Vector2(-0.1379f, 0.2558f), MyGuiConstants.OK_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnOkClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(okButton); var cancelButton = new MyGuiControlButton(this, new Vector2(0.1418f, 0.2558f), MyGuiConstants.OK_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Cancel, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnCancelClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(cancelButton); if (login != null) { m_usernameTextbox.Text = login; } if (password != null) { m_passwordTextbox.Text = password; m_retypePasswordTextbox.Text = password; } }
public MyGuiScreenOptionsAudio() : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null) { m_enableBackgroundFade = true; m_size = new Vector2(1030f / 1600f, 572f / 1200f); m_backgroundTexture = MyTextureManager.GetTexture <MyTexture2D>("Textures\\GUI\\BackgroundScreen\\AudioBackground", flags: TextureFlags.IgnoreQuality); AddCaption(MyTextsWrapperEnum.AudioOptions, new Vector2(0, 0.005f)); Vector2 controlsOriginLeft = new Vector2(-m_size.Value.X / 2.0f + 0.07f, -m_size.Value.Y / 2.0f + 0.149f); Vector2 controlsOriginRight = new Vector2(-m_size.Value.X / 2.0f + 0.325f, -m_size.Value.Y / 2.0f + 0.149f); Vector2 controlsDelta = new Vector2(0, 0.0525f); // Game Volume Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 0 * controlsDelta, null, MyTextsWrapperEnum.GameVolume, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_gameVolumeSlider = new MyGuiControlSlider(this, controlsOriginRight + 0 * controlsDelta + new Vector2(MyGuiConstants.SLIDER_WIDTH / 2.0f, 0), MyGuiConstants.SLIDER_WIDTH, MyAudioConstants.GAME_MASTER_VOLUME_MIN, MyAudioConstants.GAME_MASTER_VOLUME_MAX, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f); m_gameVolumeSlider.OnChange = OnGameVolumeChange; Controls.Add(m_gameVolumeSlider); // Music Volume Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 1 * controlsDelta, null, MyTextsWrapperEnum.MusicVolume, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_musicVolumeSlider = new MyGuiControlSlider(this, controlsOriginRight + 1 * controlsDelta + new Vector2(MyGuiConstants.SLIDER_WIDTH / 2.0f, 0), MyGuiConstants.SLIDER_WIDTH, MyAudioConstants.MUSIC_MASTER_VOLUME_MIN, MyAudioConstants.MUSIC_MASTER_VOLUME_MAX, MyGuiConstants.SLIDER_BACKGROUND_COLOR, new StringBuilder(), MyGuiConstants.SLIDER_WIDTH_LABEL, 0, MyGuiConstants.LABEL_TEXT_SCALE * 0.85f); m_musicVolumeSlider.OnChange = OnMusicVolumeChange; Controls.Add(m_musicVolumeSlider); /* * // Buttons OK and CANCEL * Vector2 buttonDelta = new Vector2(0.05f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f); * Controls.Add(new MyGuiControlButton(this, new Vector2(-buttonDelta.X, buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, * MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnOkClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); * Controls.Add(new MyGuiControlButton(this, new Vector2(+buttonDelta.X, buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, * MyTextsWrapperEnum.Cancel, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnCancelClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true)); * */ var m_okButton = new MyGuiControlButton(this, new Vector2(-0.1379f, 0.1041f), MyGuiConstants.OK_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnOkClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(m_okButton); var m_cancelButton = new MyGuiControlButton(this, new Vector2(0.141f, 0.1041f), MyGuiConstants.OK_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Cancel, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnCancelClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true); Controls.Add(m_cancelButton); // Update controls with values from config file UpdateFromConfig(m_settingsOld); UpdateFromConfig(m_settingsNew); UpdateControls(m_settingsOld); }