void UpdateControls(bool constructor) { if (constructor) { m_languageCombobox.SelectItemByKey((int)MySandboxGame.Config.Language); m_buildingModeCombobox.SelectItemByKey((int)MyCubeBuilder.BuildingMode); m_controlHintsCheckbox.IsChecked = MySandboxGame.Config.ControlsHints; if (m_rotationHintsCheckbox != null) { m_rotationHintsCheckbox.IsChecked = MySandboxGame.Config.RotationHints; } m_crosshairCheckbox.IsChecked = MySandboxGame.Config.ShowCrosshair; m_disableHeadbobCheckbox.IsChecked = MySandboxGame.Config.DisableHeadbob; m_compressSavesCheckbox.IsChecked = MySandboxGame.Config.CompressSaveGames; m_showPlayerNamesCheckbox.IsChecked = MySandboxGame.Config.ShowPlayerNamesOnHud; m_UIOpacitySlider.Value = MySandboxGame.Config.UIOpacity; m_UIBkOpacitySlider.Value = MySandboxGame.Config.UIBkOpacity; } else { m_languageCombobox.SelectItemByKey((int)m_settings.Language); m_buildingModeCombobox.SelectItemByKey((int)m_settings.BuildingMode); m_controlHintsCheckbox.IsChecked = m_settings.ControlHints; if (m_rotationHintsCheckbox != null) { m_rotationHintsCheckbox.IsChecked = m_settings.RotationHints; } m_crosshairCheckbox.IsChecked = m_settings.ShowCrosshair; m_disableHeadbobCheckbox.IsChecked = m_settings.DisableHeadbob; m_compressSavesCheckbox.IsChecked = m_settings.CompressSaveGames; m_showPlayerNamesCheckbox.IsChecked = m_settings.ShowPlayerNamesOnHud; m_UIOpacitySlider.Value = m_settings.UIOpacity; m_UIBkOpacitySlider.Value = m_settings.UIBkOpacity; } }
private void ComboResolution_ItemSelected() { int adapterIndex = (int)m_comboVideoAdapter.GetSelectedKey(); var selectedResolution = m_resolutions[(int)m_comboResolution.GetSelectedKey()]; bool fullscreenSupported = false; foreach (var displayMode in MyVideoSettingsManager.Adapters[adapterIndex].SupportedDisplayModes) { if (displayMode.Width == selectedResolution.X && displayMode.Height == selectedResolution.Y) { fullscreenSupported = true; break; } } var selectedWindowMode = (MyWindowModeEnum)m_comboWindowMode.GetSelectedKey(); m_comboWindowMode.ClearItems(); m_comboWindowMode.AddItem((int)MyWindowModeEnum.Window, MySpaceTexts.ScreenOptionsVideo_WindowMode_Window); m_comboWindowMode.AddItem((int)MyWindowModeEnum.FullscreenWindow, MySpaceTexts.ScreenOptionsVideo_WindowMode_FullscreenWindow); if (fullscreenSupported) { m_comboWindowMode.AddItem((int)MyWindowModeEnum.Fullscreen, MySpaceTexts.ScreenOptionsVideo_WindowMode_Fullscreen); } if (!fullscreenSupported && selectedWindowMode == MyWindowModeEnum.Fullscreen) { m_comboWindowMode.SelectItemByKey((long)MyWindowModeEnum.FullscreenWindow); } else { m_comboWindowMode.SelectItemByKey((long)selectedWindowMode); } }
void OnVideoAdapterSelected() { int adapterIndex = m_videoAdapterCombobox.GetSelectedKey(); AddDisplayModesToComboBox(adapterIndex); UpdateRecommendecAspectRatioLabel(adapterIndex); m_videoModeCombobox.SelectItemByKey(MyVideoModeManager.GetVideoModeIndexByWidthAndHeight(adapterIndex, m_settingsOld.VideoMode.Width, m_settingsOld.VideoMode.Height)); }
public MyGuiScreenEditorSmallShip(MySmallShip smallShip) : base(smallShip, new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null, MyTextsWrapperEnum.EditSmallShip) { m_bot = smallShip as MySmallShipBot; Init(); m_selectShipFactionCombobox.SelectItemByKey((int)m_bot.Faction); m_selectAITemplateCombobox.SelectItemByKey((int)m_bot.AITemplate.TemplateId); m_aggresivitySlider.SetValue(m_bot.Aggressivity); m_seeDistanceSlider.SetValue(m_bot.SeeDistance); m_selectSmallShipCombobox.SelectItemByKey((int)m_bot.ShipType); }
void AddVoxelMaterialCombobox(Vector2 labelPosition, Vector2 comboboxPosition, MyMwcVoxelMaterialsEnum?selectedMaterial) { //choose material label m_selectMaterialLabel = new MyGuiControlLabel(this, labelPosition, null, MyTextsWrapperEnum.AsteroidMaterial, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_selectMaterialLabel); //COMBOBOX - voxel materials enum m_selectVoxelMapMaterialCombobox = new MyGuiControlCombobox(this, comboboxPosition, MyGuiControlPreDefinedSize.LONGMEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 11, true, false, true); foreach (MyMwcVoxelMaterialsEnum enumValue in MyGuiAsteroidHelpers.MyMwcVoxelMaterialsEnumValues) { MyGuiVoxelMaterialHelper voxelMaterialHelper = MyGuiAsteroidHelpers.GetMyGuiVoxelMaterialHelper(enumValue); if (voxelMaterialHelper != null) { m_selectVoxelMapMaterialCombobox.AddItem((int)enumValue, voxelMaterialHelper.Icon, voxelMaterialHelper.Description); } } int selectedIndex; if (selectedMaterial == null) { selectedIndex = 0; } else { selectedIndex = (int)selectedMaterial.Value; } m_selectVoxelMapMaterialCombobox.SelectItemByKey(selectedIndex); m_selectVoxelMapMaterialCombobox.OnSelectItemDoubleClick += OnDoubleClick; Controls.Add(m_selectVoxelMapMaterialCombobox); }
protected override void OnUpdateVisual() { base.OnUpdateVisual(); var first = FirstBlock; if (first != null) { // clear current listed items m_comboBox.ClearItems(); m_handlerItems.Clear(); // add items if (ComboBoxContent != null) { ComboBoxContent(m_handlerItems); foreach (var item in m_handlerItems) { m_comboBox.AddItem(item.Key, item.Value); } var value = GetValue(first); if (m_comboBox.GetSelectedKey() != value) { m_comboBox.SelectItemByKey(value); } } } }
private void WriteSettingsToControls(MyGraphicsSettings graphicsSettings) { m_writingSettings = true; int selectedRender = Math.Max(0, Array.IndexOf(m_renderers, graphicsSettings.GraphicsRenderer)); m_comboRenderer.SelectItemByKey(selectedRender); m_checkboxHardwareCursor.IsChecked = graphicsSettings.HardwareCursor; m_sliderFov.Value = MathHelper.ToDegrees(graphicsSettings.FieldOfView); m_comboFoliageDetails.SelectItemByKey((long)graphicsSettings.Render.FoliageDetails, sendEvent: false); m_comboVoxelQuality.SelectItemByKey((long)graphicsSettings.Render.VoxelQuality, sendEvent: false); m_grassDensitySlider.Value = graphicsSettings.Render.GrassDensityFactor; m_vegetationViewDistance.Value = graphicsSettings.VegetationDrawDistance; m_checkboxEnableDamageEffects.IsChecked = graphicsSettings.EnableDamageEffects; m_checkboxRenderInterpolation.IsChecked = graphicsSettings.Render.InterpolationEnabled; // m_checkboxMultithreadedRender.IsChecked = graphicsSettings.Render.MultithreadingEnabled; //m_checkboxTonemapping.IsChecked = graphicsSettings.Render.TonemappingEnabled; m_comboAntialiasing.SelectItemByKey((long)graphicsSettings.Render.AntialiasingMode, sendEvent: false); m_comboAmbientOcclusionHBAO.IsChecked = graphicsSettings.Render.AmbientOcclusionEnabled; m_comboShadowMapResolution.SelectItemByKey((long)graphicsSettings.Render.ShadowQuality, sendEvent: false); m_comboTextureQuality.SelectItemByKey((long)graphicsSettings.Render.TextureQuality, sendEvent: false); m_comboAnisotropicFiltering.SelectItemByKey((long)graphicsSettings.Render.AnisotropicFiltering, sendEvent: false); m_writingSettings = false; }
private void WriteSettingsToControls(MyGraphicsSettings graphicsSettings) { m_comboRenderer.SelectItemByKey(Array.IndexOf(m_renderers, graphicsSettings.GraphicsRenderer)); m_checkboxHardwareCursor.IsChecked = graphicsSettings.HardwareCursor; m_sliderFov.Value = MathHelper.ToDegrees(graphicsSettings.FieldOfView); m_comboFoliageDetails.SelectItemByKey((long)graphicsSettings.Render.FoliageDetails, sendEvent: false); m_comboVoxelQuality.SelectItemByKey((long)graphicsSettings.Render.VoxelQuality, sendEvent: false); m_grassDensitySlider.Value = graphicsSettings.Render.GrassDensityFactor; m_checkboxEnableDamageEffects.IsChecked = graphicsSettings.EnableDamageEffects; m_checkboxRenderInterpolation.IsChecked = graphicsSettings.Render.InterpolationEnabled; // m_checkboxMultithreadedRender.IsChecked = graphicsSettings.Render.MultithreadingEnabled; //m_checkboxTonemapping.IsChecked = graphicsSettings.Render.TonemappingEnabled; m_comboAntialiasing.SelectItemByKey((long)graphicsSettings.Render.AntialiasingMode, sendEvent: false); m_comboShadowMapResolution.SelectItemByKey((long)graphicsSettings.Render.ShadowQuality, sendEvent: false); m_comboTextureQuality.SelectItemByKey((long)graphicsSettings.Render.TextureQuality, sendEvent: false); m_comboAnisotropicFiltering.SelectItemByKey((long)graphicsSettings.Render.AnisotropicFiltering, sendEvent: false); m_comboDx9RenderQuality.SelectItemByKey((int)graphicsSettings.Render.Dx9Quality, sendEvent: false); if (m_comboDx9RenderQuality.GetSelectedKey() == -1) { m_comboDx9RenderQuality.SelectItemByIndex(0); } }
/// <summary> /// Creates the menu to spawn asteroid objects /// </summary> /// <param name="table">Table to add elements to</param> private void CreateAsteroidSpawnMenu(MyGuiControlParentTableLayout table) { m_asteroidTypeCombo = new MyGuiControlCombobox(); foreach (var provider in m_asteroidProviders) { m_asteroidTypeCombo.AddItem(m_asteroidProviders.IndexOf(provider), provider.GetTypeName()); } m_asteroidTypeCombo.SelectItemByKey(m_asteroidType); m_asteroidTypeCombo.ItemSelected += delegate { if (m_asteroidType != m_asteroidTypeCombo.GetSelectedKey()) { m_asteroidProviders[(int)m_asteroidType].GetAdminMenuCreator().Close(); } m_asteroidType = m_asteroidTypeCombo.GetSelectedKey(); RecreateControls(false); }; m_asteroidTypeCombo.Size = new Vector2(m_usableWidth * 0.9f, m_asteroidTypeCombo.Size.Y); m_asteroidTypeCombo.SetToolTip(MyPluginTexts.TOOLTIPS.ADMIN_ROID_TYPE); table.AddTableRow(m_asteroidTypeCombo); m_asteroidProviders[(int)m_asteroidType].GetAdminMenuCreator().CreateSpawnMenu(m_usableWidth, table, this); }
private void PopulateMutuallyConnectedCubeGrids(HashSet <MyAntennaSystem.BroadcasterInfo> playerMutualConnection) { m_shipsInRange.ClearItems(); bool isCubeGrid = m_openInventoryInteractedEntityRepresentative is MyCubeGrid; //You should always be selectable m_shipsInRange.AddItem(m_openInventoryInteractedEntityRepresentative.EntityId, new StringBuilder(m_openInventoryInteractedEntityRepresentative.DisplayName)); foreach (var connection in playerMutualConnection) { if (m_shipsInRange.TryGetItemByKey(connection.EntityId) == null) { m_shipsInRange.AddItem(connection.EntityId, new StringBuilder(connection.Name)); } } m_shipsInRange.Visible = true; m_button.Visible = true; m_shipsInRange.SortItemsByValueText(); //if the interacted entity is not in the combobox, it means we're watching a disconnected ship so it should be red (somehow) if (m_shipsInRange.TryGetItemByKey(m_interactedEntityRepresentative.EntityId) == null) { if (m_interactedEntityRepresentative is MyCubeGrid) { m_shipsInRange.AddItem(m_interactedEntityRepresentative.EntityId, new StringBuilder((m_interactedEntityRepresentative as MyCubeGrid).DisplayName)); } } m_shipsInRange.SelectItemByKey(m_interactedEntityRepresentative.EntityId); }
/// <summary> /// Sets the settings for this menu screen to display. /// </summary> /// <param name="worldSettings">The world settings to display</param> public void SetSettings(MyObjectBuilder_WorldSettings worldSettings) { m_systemGeneratorCombo.SelectItemByKey((long)worldSettings.GeneratorSettings.SystemGenerator); m_asteroidGeneratorCombo.SelectItemByKey((long)worldSettings.GeneratorSettings.AsteroidGenerator); m_enableVanillaPlanetsCheckbox.IsChecked = worldSettings.GeneratorSettings.AllowVanillaPlanets; m_planetCountSlider.SetValues(worldSettings.GeneratorSettings.MinMaxPlanets.Min, worldSettings.GeneratorSettings.MinMaxPlanets.Max); m_asteroidCountSlider.SetValues(worldSettings.GeneratorSettings.MinMaxAsteroidObjects.Min, worldSettings.GeneratorSettings.MinMaxAsteroidObjects.Max); m_orbitDistancesSlider.SetValues(worldSettings.GeneratorSettings.MinMaxOrbitDistance.Min / 1000, worldSettings.GeneratorSettings.MinMaxOrbitDistance.Max / 1000); m_asteroidDensitySlider.Value = worldSettings.GeneratorSettings.AsteroidDensity; if (worldSettings.GeneratorSettings.WorldSize >= 0) { m_worldSizeSlider.Value = worldSettings.GeneratorSettings.WorldSize / 1000; } else { m_worldSizeSlider.Value = -1; } m_planetSizeCapSlider.Value = worldSettings.GeneratorSettings.PlanetSettings.PlanetSizeCap; m_planetSizeMultSlider.Value = worldSettings.GeneratorSettings.PlanetSettings.PlanetSizeMultiplier; m_planetMoonBasePropSlider.Value = worldSettings.GeneratorSettings.PlanetSettings.BaseMoonProbability; m_planetRingBasePropSlider.Value = worldSettings.GeneratorSettings.PlanetSettings.BaseRingProbability; m_planetMoonMinMaxSlider.SetValues(worldSettings.GeneratorSettings.PlanetSettings.MinMaxMoons.Min, worldSettings.GeneratorSettings.PlanetSettings.MinMaxMoons.Max); m_planetGPSModeCombo.SelectItemByKey((long)worldSettings.GeneratorSettings.GPSSettings.PlanetGPSMode); m_asteroidGPSModeCombo.SelectItemByKey((long)worldSettings.GeneratorSettings.GPSSettings.AsteroidGPSMode); m_moonGPSModeCombo.SelectItemByKey((long)worldSettings.GeneratorSettings.GPSSettings.MoonGPSMode); }
public void InitControls() { AddActivatedCheckbox(new Vector2(-0.07f, -0.1f), CargoBox.Activated); AddIdTextBox(new Vector2(-0.16f, -0.15f), CargoBox.EntityId.Value.NumericValue); m_cargoBoxTypeCombobox = new MyGuiControlCombobox( this, new Vector2(0, -0.2f), MyGuiControlPreDefinedSize.LONGMEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE, 6, false, false, false); foreach (MyMwcObjectBuilder_CargoBox_TypesEnum cargoBoxType in Enum.GetValues(typeof(MyMwcObjectBuilder_CargoBox_TypesEnum))) { var cargoBoxHelper = MyGuiObjectBuilderHelpers.GetGuiHelper( MyMwcObjectBuilderTypeEnum.CargoBox, (int)cargoBoxType); m_cargoBoxTypeCombobox.AddItem((int)cargoBoxType, MyGuiManager.GetBlankTexture(), cargoBoxHelper.Description); } m_cargoBoxTypeCombobox.SortItemsByValueText(); m_cargoBoxTypeCombobox.SelectItemByKey((int)CargoBox.CargoBoxType); Controls.Add(m_cargoBoxTypeCombobox); }
void Init() { m_enableBackgroundFade = true; m_size = new Vector2(0.8f, 0.4f); // Add screen title AddCaption(); Vector2 originDelta = new Vector2(0.05f, 0.02f); Vector2 controlsOriginLeft = GetControlsOriginLeftFromScreenSize() + originDelta; AddActivatedCheckbox(controlsOriginLeft, Prefab.Activated); m_onLabel = new MyGuiControlLabel(this, controlsOriginLeft + 1 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.On, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_onLabel); m_on = new MyGuiControlCheckbox(this, controlsOriginLeft + 1 * MyGuiConstants.CONTROLS_DELTA + new Vector2(0.1f, 0f), Prefab.Enabled, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR); Controls.Add(m_on); m_alarmLabel = new MyGuiControlLabel(this, controlsOriginLeft + 2 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Alarm, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); Controls.Add(m_alarmLabel); var alarmComboboxPredefinedSize = MyGuiControlPreDefinedSize.MEDIUM; var alarmComboboxSize = MyGuiControlCombobox.GetPredefinedControlSize(alarmComboboxPredefinedSize); m_alarmComboBox = new MyGuiControlCombobox( this, controlsOriginLeft + 2 * MyGuiConstants.CONTROLS_DELTA + new Vector2(0.075f + alarmComboboxSize.X / 2, 0f), alarmComboboxPredefinedSize, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE); m_alarmComboBox.AddItem(0, MyTextsWrapperEnum.Default); m_alarmComboBox.AddItem(1, MyTextsWrapperEnum.On); m_alarmComboBox.AddItem(2, MyTextsWrapperEnum.Off); if (Prefab.DefaultCausesAlarm()) { m_alarmComboBox.SelectItemByKey(0); } else { m_alarmComboBox.SelectItemByKey(Prefab.CausesAlarm ? 1 : 2); } Controls.Add(m_alarmComboBox); AddOkAndCancelButtonControls(); }
private void WriteSettingsToControls(MyRenderDeviceSettings deviceSettings) { m_comboVideoAdapter.SelectItemByKey(deviceSettings.AdapterOrdinal); m_comboResolution.SelectItemByKey(m_resolutions.FindIndex( (res) => res.X == deviceSettings.BackBufferWidth && res.Y == deviceSettings.BackBufferHeight)); m_comboWindowMode.SelectItemByKey((int)deviceSettings.WindowMode); m_checkboxVSync.IsChecked = deviceSettings.VSync; }
/// <summary> /// Builds the spawn menu /// </summary> private void BuildSpawnMenu() { MyPluginLog.Debug("Create Spawn Menu"); var topCombo = GetCombo(); Vector2 start = topCombo.Position + new Vector2(0, MARGIN_VERT * 2 + GetCombo().Size.Y); Vector2 end = start + new Vector2(topCombo.Size.X, 0.8f - MARGIN_VERT); MyGuiControlParentTableLayout table = new MyGuiControlParentTableLayout(1, false, Vector2.Zero); table.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; m_spawnTypeCombo = new MyGuiControlCombobox(); m_spawnTypeCombo.AddItem(0L, "Planet"); m_spawnTypeCombo.AddItem(1L, "Asteroid object"); m_spawnTypeCombo.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP; m_spawnTypeCombo.SelectItemByKey(m_spawnType); m_spawnTypeCombo.ItemSelected += OnSpawnTypeChange; m_spawnTypeCombo.Size = new Vector2(m_usableWidth * 0.9f, m_spawnTypeCombo.Size.Y); m_spawnTypeCombo.SetToolTip(MyPluginTexts.TOOLTIPS.ADMIN_SPAWN_TYPE); table.AddTableRow(m_spawnTypeCombo); table.AddTableSeparator(); switch (m_spawnType) { case 0L: CreatePlanetSpawnMenu(table); break; case 1L: CreateAsteroidSpawnMenu(table); break; } table.AddTableSeparator(); table.ApplyRows(); MyGuiControlScrollablePanel scrollPane = new MyGuiControlScrollablePanel(table); scrollPane.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP; scrollPane.ScrollbarVEnabled = true; scrollPane.Size = end - start; scrollPane.Size = new Vector2(0.315f, scrollPane.Size.Y); scrollPane.Position = new Vector2(0, start.Y); Controls.Add(scrollPane); MyGuiControlSeparatorList sep = new MyGuiControlSeparatorList(); sep.AddHorizontal(new Vector2(scrollPane.Position.X - scrollPane.Size.X / 2, scrollPane.Position.Y + scrollPane.Size.Y), m_usableWidth); Controls.Add(sep); MyPluginLog.Debug("Added spawn menu"); }
private void RefreshPresetCombo(MyRenderSettings1 renderSettings) { int presetIdx; for (presetIdx = 0; presetIdx < m_presets.Length; ++presetIdx) { var preset = m_presets[presetIdx]; if (preset.AnisotropicFiltering == renderSettings.AnisotropicFiltering && preset.AntialiasingMode == renderSettings.AntialiasingMode && preset.FoliageDetails == renderSettings.FoliageDetails && preset.ShadowQuality == renderSettings.ShadowQuality && preset.TextureQuality == renderSettings.TextureQuality) { break; } } m_comboGraphicsPresets.SelectItemByKey(presetIdx, false); }
public MyGuiControlEditVoxelHand(IMyGuiControlsParent parent, Vector2 position, Vector2 size, Vector4 backgroundColor) : base(parent, position, size, backgroundColor, null) { LoadControls(); if (MyEditorVoxelHand.VoxelHandShape.Material != null) { m_voxelShapeMaterialCombobox.SelectItemByKey((int)MyEditorVoxelHand.VoxelHandShape.Material); } else { m_voxelShapeMaterialCombobox.SelectItemByKey(0); } m_canSelect = true; //MyEditorVoxelHand.OnVoxelShapeSize += OnVoxelHandSizeChanged; //MyEditorVoxelHand.OnVoxelShapeDistance += OnVoxelHandDistanceChanged; }
protected virtual void SetSettingsToControls() { m_onlineMode.SelectItemByKey((int)m_settings.OnlineMode); m_maxPlayersSlider.Value = m_settings.MaxPlayers; m_autoSave.IsChecked = m_settings.AutoSaveInMinutes > 0; UpdateSurvivalState(m_settings.GameMode == MyGameModeEnum.Survival); m_scenarioEditMode.IsChecked = m_settings.ScenarioEditMode; }
/// <summary> /// Rebuilds the UI of the menu, by replacing the combo box at the top, with /// a new one with new selectable options, and checks, if a plugin menu should be shown and when yes, /// which one, otherwise shows the corresponding vanilla menu /// </summary> /// <param name="constructor">Whether this is run from constructor</param> public override void RecreateControls(bool constructor) { base.RecreateControls(constructor); MyGuiControlCombobox modeCombo = GetCombo(); int oldCount = modeCombo.GetItemsCount(); if (MySession.Static.IsUserSpaceMaster(Sync.MyId) && MySession.Static.IsUserAdmin(Sync.MyId)) { modeCombo.AddItem(oldCount, "SEWorldGenPlugin - Rings"); modeCombo.AddItem(oldCount + 1, "SEWorldGenPlugin - Planets"); } MyGuiControlCombobox newCombo = AddCombo(); int count = modeCombo.GetItemsCount(); for (int i = 0; i < count; i++) { var item = modeCombo.GetItemByIndex(i); newCombo.AddItem(item.Key, item.Value); } newCombo.Position = modeCombo.Position; newCombo.SelectItemByKey(m_currentKey); Controls[Controls.IndexOf(modeCombo)] = newCombo; Controls.Remove(modeCombo); newCombo.ItemSelected += delegate { m_currentKey = newCombo.GetSelectedKey(); if (newCombo.GetSelectedKey() >= oldCount) { RecreateControls(false); } else { m_attachedEntity = 0L; m_selectedPlanet = null; modeCombo.SelectItemByKey(newCombo.GetSelectedKey()); RecreateControls(false); } }; if (newCombo.GetSelectedKey() == oldCount) { ClearControls(); CheckBuildPluginControls(BuildRingMenu); } else if (newCombo.GetSelectedKey() == oldCount + 1) { ClearControls(); CheckBuildPluginControls(BuildPlanetMenu); } }
void UpdateControls(MyGuiScreenOptionsVideoSettings settings) { m_videoAdapterCombobox.SelectItemByKey(settings.VideoAdapter); m_videoModeCombobox.SelectItemByKey(MyVideoModeManager.GetVideoModeIndexByWidthAndHeight(settings.VideoAdapter, settings.VideoMode.Width, settings.VideoMode.Height)); m_fullscreenCheckbox.Checked = settings.FullScreen; m_verticalSyncCheckbox.Checked = settings.VerticalSync; m_hardwareCursorCheckbox.Checked = settings.HardwareCursor; m_renderQualityCombobox.SelectItemByKey((int)settings.RenderQuality); m_fieldOfViewSlider.SetValue(settings.FieldOfView); OnFovChanged(m_fieldOfViewSlider); }
protected virtual void SetSettingsToControls() { m_onlineMode.SelectItemByKey((int)m_settings.OnlineMode); m_maxPlayersSlider.Value = m_settings.MaxPlayers; m_autoSave.IsChecked = m_settings.AutoSaveInMinutes > 0; UpdateSurvivalState(m_settings.GameMode == MyGameModeEnum.Survival); m_soundModeCombo.SelectItemByKey(m_settings.RealisticSound ? (int)MySoundModeEnum.Realistic : (int)MySoundModeEnum.Arcade); m_blockLimits.IsChecked = m_settings.EnableBlockLimits; }
private void ComboVideoAdapter_ItemSelected() { int adapterIndex = (int)m_comboVideoAdapter.GetSelectedKey(); { // AddDisplayModesToComboBox LoadResolutions(MyVideoSettingsManager.Adapters[adapterIndex]); m_comboResolution.ClearItems(); var displayAspectRatio = MyVideoSettingsManager.GetRecommendedAspectRatio(adapterIndex); int resolutionToSelect = 0; int counter = 0; for (int i = 0; i < m_resolutions.Count; ++i) { var resolution = m_resolutions[i]; float aspectRatio = (float)resolution.X / (float)resolution.Y; var aspectId = MyVideoSettingsManager.GetClosestAspectRatio(aspectRatio); var aspectDetails = MyVideoSettingsManager.GetAspectRatio(aspectId); var aspectRatioText = aspectDetails.TextShort; var starsMark = aspectDetails.IsSupported ? (aspectId == displayAspectRatio.AspectRatioEnum) ? " ***" // recommended : "" // normal : " *"; // unsupported by UI if (resolution.X == m_settingsOld.BackBufferWidth && resolution.Y == m_settingsOld.BackBufferHeight) { resolutionToSelect = counter; } m_comboResolution.AddItem(counter++, new StringBuilder( string.Format("{0} x {1} - {2}{3}", resolution.X, resolution.Y, aspectRatioText, starsMark))); } m_comboResolution.SelectItemByKey(resolutionToSelect); } { // UpdateRecommendecAspectRatioLabel MyAspectRatio recommendedAspectRatio = MyVideoSettingsManager.GetRecommendedAspectRatio(adapterIndex); StringBuilder sb = new StringBuilder(); sb.AppendFormat(MyTexts.GetString(MyCommonTexts.RecommendedAspectRatio), recommendedAspectRatio.TextShort); m_labelRecommendAspectRatio.Text = string.Format("*** {0}", sb); } }
protected void Matchmaking_LobbyDataUpdate(bool success, Lobby lobby, ulong memberOrLobby) { if (!success) { return; } VRage.Profiler.ProfilerShort.Begin("Matchmaking_LobbyDataUpdate"); var newOwnerId = lobby.GetOwner(); var oldOwnerRow = m_playersTable.Find((row) => (row.GetCell(GameAdminColumn).Text.Length == OWNER_MARKER.Length)); var newOwnerRow = m_playersTable.Find((row) => ((ulong)row.UserData) == newOwnerId); Debug.Assert(oldOwnerRow != null); Debug.Assert(newOwnerRow != null); if (oldOwnerRow != null) { oldOwnerRow.GetCell(GameAdminColumn).Text.Clear(); } if (newOwnerRow != null) { newOwnerRow.GetCell(GameAdminColumn).Text.Clear().Append(OWNER_MARKER); } var lobbyType = lobby.GetLobbyType(); m_lobbyTypeCombo.SelectItemByKey((int)lobbyType, sendEvent: false); MySession.Static.Settings.OnlineMode = GetOnlineMode(lobbyType); UpdateButtonsEnabledState(); if (!Sync.IsServer) { m_maxPlayersSlider.ValueChanged = null; MySession.Static.Settings.MaxPlayers = (short)MyMultiplayer.Static.MemberLimit; m_maxPlayersSlider.Value = MySession.Static.MaxPlayers; m_maxPlayersSlider.ValueChanged = MaxPlayersSlider_Changed; } VRage.Profiler.ProfilerShort.End(); }
protected void SelectFirstHandItem() { MyCharacter playerCharacter = MySession.Static.LocalCharacter; var weapon = playerCharacter.CurrentWeapon; if (weapon == null) { if (m_handItemsCombo.GetItemsCount() > 0) { m_handItemsCombo.SelectItemByIndex(0); } } else { if (m_handItemsCombo.GetItemsCount() > 0) { try { if (weapon.DefinitionId.TypeId != typeof(MyObjectBuilder_PhysicalGunObject)) { var physicalItemId = MyDefinitionManager.Static.GetPhysicalItemForHandItem(weapon.DefinitionId).Id; //def = MyDefinitionManager.Static.GetDefinition(physicalItemId); int index = m_handItemDefinitions.FindIndex(x => x.PhysicalItemId == physicalItemId); m_handItemsCombo.SelectItemByKey(index); } else { MyDefinitionBase def; def = MyDefinitionManager.Static.GetDefinition(weapon.DefinitionId); int index = m_handItemDefinitions.FindIndex(x => x.DisplayNameText == def.DisplayNameText); m_handItemsCombo.SelectItemByKey(index); } } catch (Exception e) { m_handItemsCombo.SelectItemByIndex(0); } } } }
void UpdateCueValues() { m_canUpdateValues = false; m_cueVolumeSlider.Value = m_currentCue.Volume; m_cueVolumeCurveCombo.SelectItemByKey((int)m_currentCue.VolumeCurve); m_cueMaxDistanceSlider.Value = m_currentCue.MaxDistance; m_cueVolumeVariationSlider.Value = m_currentCue.VolumeVariation; m_cuePitchVariationSlider.Value = m_currentCue.PitchVariation; m_soloCheckbox.IsChecked = m_currentCue == MyAudio.Static.SoloCue; m_canUpdateValues = true; }
private void Init() { m_size = new Vector2(0.7f, 1); m_enableBackgroundFade = true; AddCaption(new Vector2(0, 0.003f)); AddOkAndCancelButtonControls(new Vector2(0.03f, -0.02f)); var controlsOrigin = GetControlsOriginLeftFromScreenSize() - new Vector2(-0.018f, 0.025f); m_controlsAdded = 1; CreateControlsBase(controlsOrigin); m_activatedCheckbox.OnCheck += OnActivatedCheckedChanged; CreateControlsDust(controlsOrigin); CreateControlsSound(controlsOrigin); CreateControlsRadioactivity(controlsOrigin); if (HasEntity()) { var influenceSphere = (MyInfluenceSphere)m_entity; m_radiusMinTextBox.Text = influenceSphere.RadiusMin.ToString(CultureInfo.InvariantCulture); m_radiusMaxTextBox.Text = influenceSphere.RadiusMax.ToString(CultureInfo.InvariantCulture); m_enabledCheckBox.Checked = influenceSphere.Enabled; m_activatedCheckbox.Checked = influenceSphere.Activated; m_redColorSlider.SetValue(influenceSphere.DustColor.R); m_greenColorSlider.SetValue(influenceSphere.DustColor.G); m_blueColorSlider.SetValue(influenceSphere.DustColor.B); m_opacitySlider.SetValue(influenceSphere.DustColor.A); m_strengthSlider.SetValue(influenceSphere.Magnitude); var objectBuilder = (MyMwcObjectBuilder_InfluenceSphere)influenceSphere.GetObjectBuilder(false); m_selectSoundCombobox.SelectItemByKey(objectBuilder.SoundCueId); m_dustCheckbox.Checked = influenceSphere.IsDust; m_radioactivityCheckbox.Checked = influenceSphere.IsRadioactivity; m_soundCheckbox.Checked = influenceSphere.IsSound; } else { m_opacitySlider.SetValue(255); } }
void onClick_AddCutsceneButton(MyGuiControlButton sender) { var cutscenes = MySession.Static.GetComponent <MySessionComponentCutscenes>(); string name = "Cutscene" + cutscenes.GetCutscenes().Count; cutscenes.GetCutscenes().Add(name, new Cutscene()); m_comboCutscenes.ClearItems(); foreach (var key in cutscenes.GetCutscenes().Keys) { m_comboCutscenes.AddItem(key.GetHashCode(), key); } m_comboCutscenes.SelectItemByKey(name.GetHashCode()); }
protected virtual void SetSettingsToControls() { m_onlineMode.SelectItemByKey((int)m_settings.OnlineMode); m_environment.SelectItemByKey((int)m_settings.EnvironmentHostility); m_maxPlayersSlider.Value = m_settings.MaxPlayers; m_autoSave.IsChecked = m_settings.AutoSaveInMinutes > 0; UpdateSurvivalState(m_settings.GameMode == MyGameModeEnum.Survival); m_scenarioEditMode.IsChecked = m_settings.ScenarioEditMode; if (m_isNewGame && MyFakes.ENABLE_PLANETS) { m_enablePlanets.IsChecked = m_settings.EnablePlanets; m_floraDensityCombo.SelectItemByKey((int)FloraDensityEnumKey(m_settings.FloraDensity)); } }
public void SetSettings(MyObjectBuilder_PluginSettings settings, bool useGlobal) { m_useGlobalCheck.IsChecked = useGlobal; if (useGlobal || settings == null) { return; } m_useSemiRandomGenerationCheck.IsChecked = settings.GeneratorSettings.SemiRandomizedGeneration; m_useVanillaPlanetsCheck.IsChecked = settings.GeneratorSettings.UseVanillaPlanets; m_planetsOnlyOnceCheck.IsChecked = settings.GeneratorSettings.PlanetsOnlyOnce; m_moonsOnlyOnceCheck.IsChecked = settings.GeneratorSettings.MoonsOnlyOnce; m_planetGpsCheck.IsChecked = settings.GeneratorSettings.PlanetSettings.ShowPlanetGPS; m_moonGpsCheck.IsChecked = settings.GeneratorSettings.PlanetSettings.ShowMoonGPS; m_beltGpsCheck.IsChecked = settings.GeneratorSettings.BeltSettings.ShowBeltGPS; m_ringGpsCheck.IsChecked = settings.GeneratorSettings.PlanetSettings.RingSettings.ShowRingGPS; m_asteroidGeneratorCombo.SelectItemByKey((int)settings.GeneratorSettings.AsteroidGenerator); m_asteroidDensitySlider.Value = settings.GeneratorSettings.AsteroidDensity; m_objAmountSlider.Value = (settings.GeneratorSettings.MinObjectsInSystem + settings.GeneratorSettings.MaxObjectsInSystem) / 2; m_orbDistanceSlider.Value = (settings.GeneratorSettings.MinOrbitDistance / 1000 + settings.GeneratorSettings.MaxOrbitDistance / 1000) / 2; m_sizeMultiplierSlider.Value = settings.GeneratorSettings.PlanetSettings.SizeMultiplier; m_sizeCapSlider.Value = (float)settings.GeneratorSettings.PlanetSettings.PlanetSizeCap / 1000; m_moonProbSlider.Value = settings.GeneratorSettings.PlanetSettings.MoonProbability; m_ringWidthSlider.Value = (settings.GeneratorSettings.PlanetSettings.RingSettings.MinPlanetRingWidth + settings.GeneratorSettings.PlanetSettings.RingSettings.MaxPlanetRingWidth) / 2; m_ringProbSlider.Value = settings.GeneratorSettings.PlanetSettings.RingSettings.PlanetRingProbability; m_beltHeightSlider.Value = (settings.GeneratorSettings.BeltSettings.MinBeltHeight + settings.GeneratorSettings.BeltSettings.MaxBeltHeight) / 2; m_worldSizeSlider.Value = settings.GeneratorSettings.WorldSize / 1000; }
void WriteSettingsToControls(MyRenderDeviceSettings deviceSettings, MyGraphicsSettings graphicsSettings) { m_videoAdapterCombobox.SelectItemByKey(deviceSettings.AdapterOrdinal); m_resolutionCombobox.SelectItemByKey(m_resolutionsForAdapter.FindIndex( (res) => res.X == deviceSettings.BackBufferWidth && res.Y == deviceSettings.BackBufferHeight)); m_windowModeCombobox.SelectItemByKey((int)deviceSettings.WindowMode); m_verticalSyncCheckbox.IsChecked = deviceSettings.VSync; m_hardwareCursorCheckbox.IsChecked = graphicsSettings.HardwareCursor; m_enableDamageEffectsCheckbox.IsChecked = graphicsSettings.EnableDamageEffects; m_renderQualityCombobox.SelectItemByKey((int)graphicsSettings.RenderQuality); if (m_renderQualityCombobox.GetSelectedKey() == -1) { m_renderQualityCombobox.SelectItemByIndex(0); } m_fieldOfViewSlider.Value = MathHelper.ToDegrees(graphicsSettings.FieldOfView); m_renderInterpolationCheckbox.IsChecked = graphicsSettings.RenderInterpolation; }