Пример #1
0
        private void ComboVideoAdapter_ItemSelected()
        {
            int adapterIndex = (int)m_comboVideoAdapter.GetSelectedKey();
            { // AddDisplayModesToComboBox
                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(MySpaceTexts.RecommendedAspectRatio), recommendedAspectRatio.TextShort);
                m_labelRecommendAspectRatio.Text = string.Format("*** {0}", sb);
            }
        }
Пример #2
0
        void ItemChanged(MyGuiControlSlider slider)
        {
            if (updating)
            {
                return;
            }

            ikSettings.Enabled = enabledIKState.IsChecked;
            ikSettings.BelowReachableDistance = belowReachableDistance.Value;
            ikSettings.AboveReachableDistance = aboveReachableDistance.Value;
            ikSettings.VerticalShiftUpGain    = verticalChangeUpGain.Value;
            ikSettings.VerticalShiftDownGain  = verticalChangeDownGain.Value;
            ikSettings.FootSize.Y             = ankleHeight.Value;
            ikSettings.FootSize.X             = footWidth.Value;
            ikSettings.FootSize.Z             = footLength.Value;

            MyCharacter playerCharacter = MySession.LocalCharacter;

            MyCharacterMovementEnum selected = (MyCharacterMovementEnum)characterMovementStateCombo.GetSelectedKey();

            playerCharacter.Definition.FeetIKSettings[selected] = ikSettings;
        }
        private void SpawnFloatingObjectPreview()
        {
            var itemId = m_physicalItemDefinitions[(int)m_physicalObjectCombobox.GetSelectedKey()].Id;

            MyFixedPoint amount = (MyFixedPoint)(decimal)m_amount;

            var builder = (MyObjectBuilder_PhysicalObject)MyObjectBuilderSerializer.CreateNewObject(itemId);

            if (builder is MyObjectBuilder_PhysicalGunObject || builder is MyObjectBuilder_OxygenContainerObject || builder is MyObjectBuilder_GasContainerObject)
            {
                amount = 1;
            }

            var obj = MyObjectBuilderSerializer.CreateNewObject <MyObjectBuilder_FloatingObject>();

            obj.PositionAndOrientation = MyPositionAndOrientation.Default;
            obj.Item                 = MyObjectBuilderSerializer.CreateNewObject <MyObjectBuilder_InventoryItem>();
            obj.Item.Amount          = amount;
            obj.Item.PhysicalContent = builder;

            MyClipboardComponent.Static.ActivateFloatingObjectClipboard(obj, Vector3.Zero, 1f);
        }
Пример #4
0
        private void SelectTutorials()
        {
            ClearSaves();

            var trainingLevel = (int)m_trainingLevel.GetSelectedKey();

            if (m_tutorials.ContainsKey(trainingLevel))
            {
                var loadedTrainingLevels = m_tutorials[trainingLevel];
                AddSaves(loadedTrainingLevels);
            }

            RefreshGameList();
        }
        /// <returns>Bool indicating a game restart is required</returns>
        private bool ReadSettingsFromControls(ref MyGraphicsSettings graphicsSettings)
        {
            bool restartIsNeeded;

            {
                MyGraphicsSettings read = new MyGraphicsSettings();
                read.GraphicsRenderer            = m_renderers[(int)m_comboRenderer.GetSelectedKey()];
                read.FieldOfView                 = MathHelper.ToRadians(m_sliderFov.Value);
                read.HardwareCursor              = m_checkboxHardwareCursor.IsChecked;
                read.EnableDamageEffects         = m_checkboxEnableDamageEffects.IsChecked;
                read.Render.AntialiasingMode     = (MyAntialiasingMode)m_comboAntialiasing.GetSelectedKey();
                read.Render.ShadowQuality        = (MyShadowsQuality)m_comboShadowMapResolution.GetSelectedKey();
                read.Render.InterpolationEnabled = m_checkboxRenderInterpolation.IsChecked;
                //read.Render.MultithreadingEnabled = m_checkboxMultithreadedRender.IsChecked;
                //read.Render.TonemappingEnabled    = m_checkboxTonemapping.IsChecked;
                read.Render.TextureQuality       = (MyTextureQuality)m_comboTextureQuality.GetSelectedKey();
                read.Render.AnisotropicFiltering = (MyTextureAnisoFiltering)m_comboAnisotropicFiltering.GetSelectedKey();

                if (MyVideoSettingsManager.RunningGraphicsRenderer != MySandboxGame.DirectX11RendererKey)
                {
                    read.Render.Dx9Quality = (MyRenderQualityEnum)m_comboDx9RenderQuality.GetSelectedKey();
                }
                else
                {
                    read.Render.Dx9Quality = graphicsSettings.Render.Dx9Quality;
                }

                read.Render.FoliageDetails     = (MyFoliageDetails)m_comboFoliageDetails.GetSelectedKey();
                read.Render.VoxelQuality       = (MyRenderQualityEnum)m_comboVoxelQuality.GetSelectedKey();
                read.Render.GrassDensityFactor = m_grassDensitySlider.Value;

                restartIsNeeded  = read.GraphicsRenderer != graphicsSettings.GraphicsRenderer;
                graphicsSettings = read;
            }

            return(restartIsNeeded);
        }
        void confirmButton_OnButtonClick(MyGuiControlButton sender)
        {
            MyEntity invObject = MySession.Static.ControlledEntity as MyEntity;

            if (invObject != null && invObject.HasInventory)
            {
                double amountDec = 0;
                double.TryParse(m_amountTextbox.Text, out amountDec);
                m_lastAmount = amountDec;

                MyFixedPoint amount = (MyFixedPoint)amountDec;

                if (m_items.GetSelectedKey() < 0 || (int)m_items.GetSelectedKey() >= m_physicalItemDefinitions.Count)
                {
                    return;
                }

                var itemId = m_physicalItemDefinitions[(int)m_items.GetSelectedKey()].Id;
                m_lastSelectedItem = (int)m_items.GetSelectedKey();
                MyInventory inventory = invObject.GetInventory(0) as MyInventory;
                System.Diagnostics.Debug.Assert(inventory != null, "Null or other inventory type!");

                if (inventory != null)
                {
                    if (!MySession.Static.CreativeMode)
                    {
                        amount = MyFixedPoint.Min(inventory.ComputeAmountThatFits(itemId), amount);
                    }

                    var builder = (MyObjectBuilder_PhysicalObject)MyObjectBuilderSerializer.CreateNewObject(itemId);
                    inventory.DebugAddItems(amount, builder);
                }
            }

            CloseScreen();
        }
        private void ComboResolution_ItemSelected()
        {
            int  adapterIndex        = (int)m_comboVideoAdapter.GetSelectedKey();
            var  selectedResolution  = m_resolutions[(int)m_comboResolution.GetSelectedKey()];
            bool fullscreenSupported = false;

#if !XB1
            foreach (var displayMode in MyVideoSettingsManager.Adapters[adapterIndex].SupportedDisplayModes)
            {
                if (displayMode.Width == selectedResolution.X &&
                    displayMode.Height == selectedResolution.Y)
                {
                    fullscreenSupported = true;
                    break;
                }
            }
#endif

            var selectedWindowMode = (MyWindowModeEnum)m_comboWindowMode.GetSelectedKey();
            m_comboWindowMode.ClearItems();
            m_comboWindowMode.AddItem((int)MyWindowModeEnum.Window, MyCommonTexts.ScreenOptionsVideo_WindowMode_Window);
            m_comboWindowMode.AddItem((int)MyWindowModeEnum.FullscreenWindow, MyCommonTexts.ScreenOptionsVideo_WindowMode_FullscreenWindow);
            if (fullscreenSupported)
            {
                m_comboWindowMode.AddItem((int)MyWindowModeEnum.Fullscreen, MyCommonTexts.ScreenOptionsVideo_WindowMode_Fullscreen);
            }

            if (!fullscreenSupported && selectedWindowMode == MyWindowModeEnum.Fullscreen)
            {
                m_comboWindowMode.SelectItemByKey((long)MyWindowModeEnum.FullscreenWindow);
            }
            else
            {
                m_comboWindowMode.SelectItemByKey((long)selectedWindowMode);
            }
        }
Пример #8
0
        private void UpdateButtonsEnabledState()
        {
            bool  hasTarget      = m_playersTable.SelectedRow != null;
            ulong currentUserId  = SteamAPI.Instance.GetSteamUserId();
            ulong currentOwnerId = MyMultiplayer.Static.GetOwner();
            bool  isAdmin        = MyMultiplayer.Static.IsAdmin(currentUserId);
            bool  isOwner        = (currentUserId == currentOwnerId);
            var   lobbyType      = (LobbyTypeEnum)m_lobbyTypeCombo.GetSelectedKey();

            if (hasTarget && isAdmin)
            {
                var  selectedUserId  = (ulong)m_playersTable.SelectedRow.UserData;
                bool selectedIsAdmin = MyMultiplayer.Static.IsAdmin(selectedUserId);

                m_kickButton.Enabled = selectedUserId != currentUserId && !selectedIsAdmin;
                m_banButton.Enabled  = selectedUserId != currentUserId && !selectedIsAdmin;
            }
            else
            {
                m_kickButton.Enabled = false;
                m_banButton.Enabled  = false;
            }

            m_banButton.Visible = MyMultiplayer.Static is MyMultiplayerClient;

            if (MyMultiplayer.Static.IsServer)
            {
                m_inviteButton.Enabled = (lobbyType == LobbyTypeEnum.Public) || (lobbyType == LobbyTypeEnum.FriendsOnly);
            }
            else
            {
                m_inviteButton.Enabled = (lobbyType == LobbyTypeEnum.Public);
            }
            m_lobbyTypeCombo.Enabled   = isOwner;
            m_maxPlayersSlider.Enabled = isOwner;
        }
        void OnPlayBlendButtonClick(MyGuiControlButton sender)
        {
            MyCharacter playerCharacter = MySession.LocalCharacter;

            playerCharacter.PlayCharacterAnimation(
                m_animationComboA.GetSelectedKey().ToString(),
                false,
                MyPlayAnimationMode.Immediate,
                m_blendSlider.Value);

            playerCharacter.PlayCharacterAnimation(
                m_animationComboB.GetSelectedKey().ToString(),
                true,
                MyPlayAnimationMode.WaitForPreviousEnd,
                m_blendSlider.Value);
        }
Пример #10
0
        void OnPlayBlendButtonClick(MyGuiControlButton sender)
        {
            MyCharacter playerCharacter = MySession.LocalCharacter;

            playerCharacter.PlayCharacterAnimation(
                m_animationComboA.GetSelectedKey().ToString(),
                MyBlendOption.Immediate,
                MyFrameOption.None,
                m_blendSlider.Value);

            playerCharacter.PlayCharacterAnimation(
                m_animationComboB.GetSelectedKey().ToString(),
                MyBlendOption.WaitForPreviousEnd,
                MyFrameOption.Loop,
                m_blendSlider.Value);
        }
        private void OnPresetSelected()
        {
            var preset = (PresetEnum)m_comboGraphicsPresets.GetSelectedKey();

            if (preset == PresetEnum.Custom)
            {
                return;
            }

            var presetSettings = m_presets[(int)preset];

            // presetSettings.MultithreadingEnabled = m_checkboxMultithreadedRender.IsChecked;
            presetSettings.InterpolationEnabled = m_checkboxRenderInterpolation.IsChecked;
            //presetSettings.TonemappingEnabled = m_checkboxTonemapping.IsChecked;
            m_settingsNew.Render = presetSettings;
            WriteSettingsToControls(m_settingsNew);
        }
Пример #12
0
        void m_typeComboBox_OnSelect()
        {
            if (!m_canUpdateValues)
            {
                return;
            }

            if (m_typeComboBox.GetSelectedKey() == 0)
            {
                DummyPoint.Type        = MyDummyPointType.Box;
                DummyPoint.DummyFlags &= ~MyDummyPointFlags.SAFE_AREA;
            }
            else
            {
                DummyPoint.Type = MyDummyPointType.Sphere;
            }

            UpdateValues();
        }
Пример #13
0
        void m_comboNodes_ItemSelected()
        {
            m_selectedCutsceneNode = m_selectedCutscene.SequenceNodes[m_comboNodes.GetSelectedKey()];
            m_nodeTimeSlider.Value = m_selectedCutsceneNode.Time;

            m_comboWaypoints.ClearItems();

            if (m_selectedCutsceneNode.Waypoints != null)
            {
                foreach (var waypoint in m_selectedCutsceneNode.Waypoints)
                {
                    m_comboWaypoints.AddItem(waypoint.Name.GetHashCode(), waypoint.Name);
                }

                if (m_comboWaypoints.GetItemsCount() > 0)
                {
                    m_comboWaypoints.SelectItemByIndex(0);
                }
            }
        }
Пример #14
0
        /// <summary>
        /// Gets the current set settings from the gui elements and sets them in
        /// settings
        /// </summary>
        /// <param name="settings">The plugin settings to set</param>
        /// <returns>If global config should be used</returns>
        public bool GetSettings(ref MyObjectBuilder_PluginSettings settings)
        {
            if (settings == null)
            {
                settings = new MyObjectBuilder_PluginSettings();
            }

            settings.GeneratorSettings.SemiRandomizedGeneration = m_useSemiRandomGenerationCheck.IsChecked;
            settings.GeneratorSettings.UseVanillaPlanets        = m_useVanillaPlanetsCheck.IsChecked;
            settings.GeneratorSettings.PlanetsOnlyOnce          = m_planetsOnlyOnceCheck.IsChecked;
            settings.GeneratorSettings.MoonsOnlyOnce            = m_moonsOnlyOnceCheck.IsChecked;

            settings.GeneratorSettings.MinObjectsInSystem = (int)m_objAmountSlider.Value;
            settings.GeneratorSettings.MaxObjectsInSystem = (int)m_objAmountSlider.Value;

            settings.GeneratorSettings.MinOrbitDistance = (int)m_orbDistanceSlider.Value * 1000 / 10;
            settings.GeneratorSettings.MaxOrbitDistance = (int)(m_orbDistanceSlider.Value * 1000 * 2 - settings.GeneratorSettings.MinOrbitDistance);

            settings.GeneratorSettings.AsteroidGenerator = (AsteroidGenerator)m_asteroidGeneratorCombo.GetSelectedKey();
            settings.GeneratorSettings.AsteroidDensity   = m_asteroidDensitySlider.Value;

            settings.GeneratorSettings.PlanetSettings.SizeMultiplier  = (int)m_sizeMultiplierSlider.Value;
            settings.GeneratorSettings.PlanetSettings.PlanetSizeCap   = (int)m_sizeCapSlider.Value * 1000;
            settings.GeneratorSettings.PlanetSettings.MoonProbability = m_moonProbSlider.Value;
            settings.GeneratorSettings.PlanetSettings.ShowPlanetGPS   = m_planetGpsCheck.IsChecked;
            settings.GeneratorSettings.PlanetSettings.ShowMoonGPS     = m_moonGpsCheck.IsChecked;

            settings.GeneratorSettings.PlanetSettings.RingSettings.MinPlanetRingWidth    = (int)m_ringWidthSlider.Value / 10;
            settings.GeneratorSettings.PlanetSettings.RingSettings.MaxPlanetRingWidth    = (int)m_ringWidthSlider.Value * 2 - settings.GeneratorSettings.PlanetSettings.RingSettings.MinPlanetRingWidth;
            settings.GeneratorSettings.PlanetSettings.RingSettings.PlanetRingProbability = m_ringProbSlider.Value;
            settings.GeneratorSettings.PlanetSettings.RingSettings.ShowRingGPS           = m_ringGpsCheck.IsChecked;

            settings.GeneratorSettings.BeltSettings.MinBeltHeight   = (int)m_beltHeightSlider.Value / 10;
            settings.GeneratorSettings.BeltSettings.MaxBeltHeight   = (int)m_beltHeightSlider.Value * 2 - settings.GeneratorSettings.BeltSettings.MinBeltHeight;
            settings.GeneratorSettings.BeltSettings.BeltProbability = m_beltProbSlider.Value;
            settings.GeneratorSettings.BeltSettings.ShowBeltGPS     = m_beltGpsCheck.IsChecked;

            settings.GeneratorSettings.WorldSize = (long)m_worldSizeSlider.Value * 1000;

            return(m_useGlobalCheck.IsChecked);
        }
Пример #15
0
 void DoChanges()
 {
     MyLanguage.CurrentLanguage = (MyLanguagesEnum)m_languageCombobox.GetSelectedKey();
     if (m_skinCombobox != null)
     {
         MyGuiSkinManager.Static.SelectSkin((int)m_skinCombobox.GetSelectedKey());
     }
     MyScreenManager.RecreateControls();
     MyCubeBuilder.BuildingMode         = (MyCubeBuilder.BuildingModeEnum)m_buildingModeCombobox.GetSelectedKey();
     MySandboxGame.Config.ControlsHints = m_controlHintsCheckbox.IsChecked;
     if (m_rotationHintsCheckbox != null)
     {
         MySandboxGame.Config.RotationHints = m_rotationHintsCheckbox.IsChecked;
     }
     MySandboxGame.Config.ShowCrosshair            = m_crosshairCheckbox.IsChecked;
     MySandboxGame.Config.DisableHeadbob           = m_disableHeadbobCheckbox.IsChecked;
     MySandboxGame.Config.CompressSaveGames        = m_compressSavesCheckbox.IsChecked;
     MySandboxGame.Config.ShowPlayerNamesOnHud     = m_showPlayerNamesCheckbox.IsChecked;
     MySandboxGame.Config.ReleasingAltResetsCamera = m_releasingAltResetsCameraCheckbox.IsChecked;
     MySandboxGame.Config.UIOpacity   = m_UIOpacitySlider.Value;
     MySandboxGame.Config.UIBkOpacity = m_UIBkOpacitySlider.Value;
     MySandboxGame.Config.Save();
 }
Пример #16
0
        public void OnChangeAppearanceClick(MyGuiControlButton sender)
        {
            foreach (MyEntity entity in m_entities)
            {
                var prefabContainer = entity as MyPrefabContainer;
                if (prefabContainer == null)
                {
                    return;
                }

                foreach (MyPrefabBase prefab in prefabContainer.Children)
                {
                    int material = m_appearance.GetSelectedKey();
                    if (material != -1)
                    {
                        if (prefab.HasAvailableFactionMaterial((MyMwcObjectBuilder_Prefab_AppearanceEnum)material))
                        {
                            prefab.MaterialIndex = (ushort)material;
                        }
                    }
                }
            }
        }
Пример #17
0
        public override void OnOkClick(MyGuiControlButton sender)
        {
            base.OnOkClick(sender);

            Prefab.Enabled = m_on.Checked;

            int  alarmKey    = m_alarmComboBox.GetSelectedKey();
            bool?causesAlarm = null;

            if (alarmKey == 1)
            {
                causesAlarm = true;
            }
            else if (alarmKey == 2)
            {
                causesAlarm = false;
            }
            Prefab.SetCausesAlarm(causesAlarm);

            Prefab.Activate(m_activatedCheckbox.Checked, false);

            MyGuiManager.CloseAllScreensExcept(MyGuiScreenGamePlay.Static);
        }
        void confirmButton_OnButtonClick(MyGuiControlButton sender)
        {
            IMyInventoryOwner invObject = MySession.ControlledEntity as IMyInventoryOwner;

            if (invObject != null)
            {
                double amountDec = 0;
                double.TryParse(m_amountTextbox.Text, out amountDec);

                MyFixedPoint amount = (MyFixedPoint)amountDec;

                var         itemId    = m_physicalItemDefinitions[(int)m_items.GetSelectedKey()].Id;
                MyInventory inventory = invObject.GetInventory(0);
                if (!MySession.Static.CreativeMode)
                {
                    amount = MyFixedPoint.Min(inventory.ComputeAmountThatFits(itemId), amount);
                }

                var builder = (MyObjectBuilder_PhysicalObject)MyObjectBuilderSerializer.CreateNewObject(itemId);
                inventory.DebugAddItems(amount, builder);
            }

            CloseScreen();
        }
Пример #19
0
        /// <returns>Bool indicating a game restart is required</returns>
        private bool ReadSettingsFromControls(ref MyGraphicsSettings graphicsSettings)
        {
            if (m_writingSettings)
            {
                return(false);
            }

            bool restartIsNeeded;

            {
                MyGraphicsSettings read = new MyGraphicsSettings();
                read.GraphicsRenderer               = m_renderers[(int)m_comboRenderer.GetSelectedKey()];
                read.FieldOfView                    = MathHelper.ToRadians(m_sliderFov.Value);
                read.HardwareCursor                 = m_checkboxHardwareCursor.IsChecked;
                read.EnableDamageEffects            = m_checkboxEnableDamageEffects.IsChecked;
                read.Render.AntialiasingMode        = (MyAntialiasingMode)m_comboAntialiasing.GetSelectedKey();
                read.Render.AmbientOcclusionEnabled = m_comboAmbientOcclusionHBAO.IsChecked;
                read.Render.ShadowQuality           = (MyShadowsQuality)m_comboShadowMapResolution.GetSelectedKey();
                read.Render.InterpolationEnabled    = m_checkboxRenderInterpolation.IsChecked;
                //read.Render.MultithreadingEnabled = m_checkboxMultithreadedRender.IsChecked;
                //read.Render.TonemappingEnabled    = m_checkboxTonemapping.IsChecked;
                read.Render.TextureQuality       = (MyTextureQuality)m_comboTextureQuality.GetSelectedKey();
                read.Render.AnisotropicFiltering = (MyTextureAnisoFiltering)m_comboAnisotropicFiltering.GetSelectedKey();
                read.Render.Dx9Quality           = graphicsSettings.Render.Dx9Quality;
                read.Render.FoliageDetails       = (MyFoliageDetails)m_comboFoliageDetails.GetSelectedKey();
                read.Render.ModelQuality         = (MyRenderQualityEnum)m_comboModelQuality.GetSelectedKey();
                read.Render.VoxelQuality         = (MyRenderQualityEnum)m_comboVoxelQuality.GetSelectedKey();
                read.Render.GrassDensityFactor   = m_grassDensitySlider.Value;
                read.VegetationDrawDistance      = m_vegetationViewDistance.Value;

                restartIsNeeded  = read.GraphicsRenderer != graphicsSettings.GraphicsRenderer;
                graphicsSettings = read;
            }

            return(restartIsNeeded);
        }
        public override void OnOkClick(MyGuiControlButton sender)
        {
            base.OnOkClick(sender);

            if (HasEntity())
            {
                if (m_changeMaterial.Checked)
                {
                    m_entity.VoxelMaterial = ((MyMwcVoxelMaterialsEnum)m_selectVoxelMapMaterialCombobox.GetSelectedKey());
                }

                float x, y, z;
                if (float.TryParse(m_positionX.Text, out x) && float.TryParse(m_positionY.Text, out y) && float.TryParse(m_positionZ.Text, out z))
                {
                    m_entity.SetPosition(new Vector3(x, y, z));
                }
            }
            else
            {
                if (GetAsteroidType() == MyGuiAsteroidTypesEnum.VOXEL)
                {
                    MyMwcObjectBuilder_SmallShip_TypesEnum shipType = (MyMwcObjectBuilder_SmallShip_TypesEnum)
                                                                      Enum.ToObject(typeof(MyMwcObjectBuilder_SmallShip_TypesEnum), m_selectVoxelMapCombobox.GetSelectedKey());
                    MyMwcVoxelFilesEnum voxelFileEnum = (MyMwcVoxelFilesEnum)
                                                        Enum.ToObject(typeof(MyMwcVoxelFilesEnum), m_selectVoxelMapCombobox.GetSelectedKey());
                    MyMwcVoxelMaterialsEnum materialEnum = (MyMwcVoxelMaterialsEnum)
                                                           Enum.ToObject(typeof(MyMwcVoxelMaterialsEnum), m_selectVoxelMapMaterialCombobox.GetSelectedKey());

                    MyMwcObjectBuilder_VoxelMap voxelMapBuilder = MyMwcObjectBuilder_Base.CreateNewObject(MyMwcObjectBuilderTypeEnum.VoxelMap, null) as MyMwcObjectBuilder_VoxelMap;
                    voxelMapBuilder.VoxelMaterial = materialEnum;
                    voxelMapBuilder.VoxelFile     = voxelFileEnum;
                    MyEditor.Static.CreateFromObjectBuilder(voxelMapBuilder, Matrix.CreateWorld(m_newObjectPosition, Vector3.Forward, Vector3.Up), m_screenPosition);
                }
                else if (GetAsteroidType() == MyGuiAsteroidTypesEnum.STATIC)
                {
                    MyMwcObjectBuilder_StaticAsteroid_TypesEnum staticAsteroidType = (MyMwcObjectBuilder_StaticAsteroid_TypesEnum)
                                                                                     Enum.ToObject(typeof(MyMwcObjectBuilder_StaticAsteroid_TypesEnum), m_selectVoxelMapCombobox.GetSelectedKey());

                    MyMwcVoxelMaterialsEnum?materialEnum = null;
                    int materialKey = m_selectVoxelMapMaterialCombobox.GetSelectedKey();
                    if (materialKey != -1)
                    {
                        materialEnum = (MyMwcVoxelMaterialsEnum)Enum.ToObject(typeof(MyMwcVoxelMaterialsEnum), materialKey);
                    }

                    MyMwcObjectBuilder_StaticAsteroid staticAsteroidBuilder = new MyMwcObjectBuilder_StaticAsteroid(staticAsteroidType, materialEnum);
                    MyEditor.Static.CreateFromObjectBuilder(staticAsteroidBuilder, Matrix.CreateWorld(m_newObjectPosition, Vector3.Forward, Vector3.Up), m_screenPosition);
                }
            }

            MyGuiManager.CloseAllScreensExcept(MyGuiScreenGamePlay.Static);
        }
 MyGuiAsteroidTypesEnum GetAsteroidType()
 {
     return((MyGuiAsteroidTypesEnum)Enum.ToObject(typeof(MyGuiAsteroidTypesEnum), m_selectAsteroidTypeCombobox.GetSelectedKey()));
 }
        private void RecreateServerLimitInfo(MyGuiControlList list)
        {
            var identity = MySession.Static.Players.TryGetIdentity(MySession.Static.LocalPlayerId);
            int built;

            if (MySession.Static.MaxBlocksPerPlayer > 0 || MySession.Static.BlockTypeLimits.Keys.Count > 0)
            {
                MyGuiControlLabel totalBlocksLabel = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.TerminalTab_Info_Overview), textScale: 1.3f);
                list.Controls.Add(totalBlocksLabel);
            }

            if (MySession.Static.MaxBlocksPerPlayer > 0)
            {
                MyGuiControlLabel totalBlocksLabel = new MyGuiControlLabel(text: String.Format("{0} {1}/{2} {3}", MyTexts.Get(MySpaceTexts.TerminalTab_Info_YouBuilt), identity.BlocksBuilt, MySession.Static.MaxBlocksPerPlayer + identity.BlockLimitModifier, MyTexts.Get(MySpaceTexts.TerminalTab_Info_BlocksLower)));
                list.Controls.Add(totalBlocksLabel);
            }
            foreach (var blockType in MySession.Static.BlockTypeLimits)
            {
                identity.BlockTypeBuilt.TryGetValue(blockType.Key, out built);
                var definition = Sandbox.Definitions.MyDefinitionManager.Static.TryGetDefinitionGroup(blockType.Key);
                if (built == null || definition == null)
                {
                    continue;
                }
                MyGuiControlLabel blockTypeLabel = new MyGuiControlLabel(text: String.Format("{0} {1}/{2} {3}", MyTexts.Get(MySpaceTexts.TerminalTab_Info_YouBuilt), built, MySession.Static.GetBlockTypeLimit(blockType.Key), definition.Any.DisplayNameText));
                list.Controls.Add(blockTypeLabel);
            }

            foreach (var grid in m_infoGrids)
            {
                grid.OnAuthorshipChanged -= grid_OnAuthorshipChanged;
            }

            m_infoGrids.Clear();
            foreach (var grid in identity.BlocksBuiltByGrid)
            {
                MyGuiControlParent panel = new MyGuiControlParent();

                if (m_infoGrids.Count == 0)
                {
                    MyGuiControlSeparatorList infoSeparator = new MyGuiControlSeparatorList();
                    infoSeparator.AddHorizontal(new Vector2(-0.2f, -0.052f), 0.4f, width: 0.004f);
                    panel.Controls.Add(infoSeparator);
                }

                MyGuiControlLabel         gridNameLabel       = new MyGuiControlLabel(text: grid.Key.DisplayName, textScale: 0.9f);
                MyGuiControlLabel         gridBlockCountLabel = new MyGuiControlLabel(text: String.Format("{0} {1}", grid.Value, MyTexts.Get(MySpaceTexts.TerminalTab_Info_BlocksLower)), textScale: 0.9f);
                MyGuiControlLabel         assignLabel         = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.TerminalTab_Info_Assign), originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, textScale: 0.9f);
                MyGuiControlCombobox      assignCombobox      = new MyGuiControlCombobox(originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, size: new Vector2(0.11f, 0.008f));
                MyGuiControlSeparatorList lineSeparator       = new MyGuiControlSeparatorList();

                gridNameLabel.Position       = new Vector2(-0.15f, -0.025f);
                gridBlockCountLabel.Position = new Vector2(-0.15f, 0.000f);
                assignLabel.Position         = new Vector2(0.035f, 0.025f);
                assignCombobox.Position      = new Vector2(0.15f, 0.025f);

                assignCombobox.ItemSelected += delegate()
                {
                    assignCombobox_ItemSelected(grid.Key, m_playerIds[(int)assignCombobox.GetSelectedKey()]);
                };

                m_playerIds.Clear();
                foreach (var player in MySession.Static.Players.GetOnlinePlayers())
                {
                    if (MySession.Static.LocalHumanPlayer != player)
                    {
                        assignCombobox.AddItem(m_playerIds.Count, player.DisplayName);
                        m_playerIds.Add(player.Id);
                    }
                }
                lineSeparator.AddHorizontal(new Vector2(-0.15f, 0.05f), 0.3f, width: 0.002f);

                panel.Controls.Add(gridNameLabel);
                panel.Controls.Add(gridBlockCountLabel);
                panel.Controls.Add(assignLabel);
                panel.Controls.Add(assignCombobox);
                panel.Controls.Add(lineSeparator);

                if (MySession.Static.EnableRemoteBlockRemoval)
                {
                    MyGuiControlLabel deleteOwnedBlocksLabel = new MyGuiControlLabel(
                        text: MyTexts.GetString(MySpaceTexts.buttonRemove),
                        originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER,
                        textScale: 0.9f);
                    MyGuiControlButton deleteOwnedBlocksButton = new MyGuiControlButton(
                        text: new StringBuilder("X"),
                        onButtonClick: deleteOwnedBlocksButton_ButtonClicked,
                        buttonIndex: m_infoGrids.Count,
                        visualStyle: MyGuiControlButtonStyleEnum.SquareSmall,
                        originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER);
                    deleteOwnedBlocksLabel.Position  = new Vector2(0.11f, -0.02f);
                    deleteOwnedBlocksButton.Position = new Vector2(0.15f, -0.02f);
                    panel.Controls.Add(deleteOwnedBlocksLabel);
                    panel.Controls.Add(deleteOwnedBlocksButton);
                }

                grid.Key.OnAuthorshipChanged += grid_OnAuthorshipChanged;

                m_infoGrids.Add(grid.Key);

                panel.Size = new Vector2(panel.Size.X, 0.09f);
                list.Controls.Add(panel);
            }
        }
Пример #23
0
        /// <summary>
        /// Retreives the world settings set in this gui screen for the plugin
        /// </summary>
        /// <returns>An object builder containing the currently set world settings</returns>
        public MyObjectBuilder_WorldSettings GetSettings()
        {
            MyObjectBuilder_WorldSettings settings = new MyObjectBuilder_WorldSettings();

            settings.GeneratorSettings.SystemGenerator       = (SystemGenerationMethod)m_systemGeneratorCombo.GetSelectedKey();
            settings.GeneratorSettings.AsteroidGenerator     = (AsteroidGenerationMethod)m_asteroidGeneratorCombo.GetSelectedKey();
            settings.GeneratorSettings.AllowVanillaPlanets   = m_enableVanillaPlanetsCheckbox.IsChecked;
            settings.GeneratorSettings.MinMaxPlanets         = new MySerializableMinMax((long)m_planetCountSlider.CurrentMin, (long)m_planetCountSlider.CurrentMax);
            settings.GeneratorSettings.MinMaxAsteroidObjects = new MySerializableMinMax((long)m_asteroidCountSlider.CurrentMin, (long)m_asteroidCountSlider.CurrentMax);
            settings.GeneratorSettings.MinMaxOrbitDistance   = new MySerializableMinMax((long)(m_orbitDistancesSlider.CurrentMin * 1000), (long)(m_orbitDistancesSlider.CurrentMax * 1000));
            settings.GeneratorSettings.AsteroidDensity       = m_asteroidDensitySlider.Value;
            settings.GeneratorSettings.WorldSize             = m_worldSizeSlider.Value >= 0 ? (long)(m_worldSizeSlider.Value * 1000) : -1;

            settings.GeneratorSettings.PlanetSettings.PlanetSizeCap        = (int)m_planetSizeCapSlider.Value;
            settings.GeneratorSettings.PlanetSettings.PlanetSizeMultiplier = m_planetSizeMultSlider.Value;
            settings.GeneratorSettings.PlanetSettings.BaseMoonProbability  = m_planetMoonBasePropSlider.Value;
            settings.GeneratorSettings.PlanetSettings.BaseRingProbability  = m_planetRingBasePropSlider.Value;
            settings.GeneratorSettings.PlanetSettings.MinMaxMoons          = new MySerializableMinMax((long)m_planetMoonMinMaxSlider.CurrentMin, (long)m_planetMoonMinMaxSlider.CurrentMax);

            settings.GeneratorSettings.GPSSettings.PlanetGPSMode   = (MyGPSGenerationMode)m_planetGPSModeCombo.GetSelectedKey();
            settings.GeneratorSettings.GPSSettings.MoonGPSMode     = (MyGPSGenerationMode)m_moonGPSModeCombo.GetSelectedKey();
            settings.GeneratorSettings.GPSSettings.AsteroidGPSMode = (MyGPSGenerationMode)m_asteroidGPSModeCombo.GetSelectedKey();

            return(settings);
        }
 void m_asteroidAmountCombo_ItemSelected()
 {
     m_asteroidAmount = (int)m_asteroidAmountCombo.GetSelectedKey();
 }
 private void OnItemSelected()
 {
     m_selectedModel = m_models[(int)m_modelPicker.GetSelectedKey()];
     ChangeCharacter(m_selectedModel, m_selectedHSV);
 }
 void voxelsCombo_OnSelect()
 {
     m_currentSelectedVoxelItem = (int)m_voxelsCombo.GetSelectedKey();
 }
Пример #27
0
 void m_buildingModeCombobox_ItemSelected()
 {
     m_settings.BuildingMode = (MyCubeBuilder.BuildingModeEnum)m_buildingModeCombobox.GetSelectedKey();
 }
        void modelsCombo_OnSelect()
        {
            m_currentModelSelectedItem = (int)m_modelsCombo.GetSelectedKey();

            RecreateControls(false);
        }
Пример #29
0
 private void OnOnlineModeSelect()
 {
     m_maxPlayersSlider.Enabled = m_onlineMode.GetSelectedKey() != (int)MyOnlineModeEnum.OFFLINE;
     m_maxPlayersLabel.Enabled  = m_onlineMode.GetSelectedKey() != (int)MyOnlineModeEnum.OFFLINE;
 }
Пример #30
0
        private void UpdateControls()
        {
            var selectedType = (MyMwcObjectBuilder_SmallShip_TypesEnum)m_shipTypeCombobox.GetSelectedKey();

            FillListBox(selectedType);
        }