private void CreateControlsSound(Vector2 controlsOrigin)
        {
            AddSeparator(controlsOrigin);

            Controls.Add(new MyGuiControlLabel(this, controlsOrigin + m_controlsAdded * CONTROLS_DELTA + new Vector2(0.05f, 0), null, MyTextsWrapperEnum.SoundInfluenceSphereType, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));

            m_controlsAdded++;

            m_selectDialogueCombobox = new MyGuiControlCombobox(this,
                                                                controlsOrigin + m_controlsAdded++ *CONTROLS_DELTA +
                                                                new Vector2(MyGuiConstants.COMBOBOX_LONGMEDIUM_SIZE.X / 2.0f, 0),
                                                                MyGuiControlPreDefinedSize.LONGMEDIUM,
                                                                MyGuiConstants.COMBOBOX_BACKGROUND_COLOR,
                                                                MyGuiConstants.COMBOBOX_TEXT_SCALE, 6, false, false, false);

            System.Collections.Generic.SortedDictionary <string, int> dialogues = new System.Collections.Generic.SortedDictionary <string, int>();

            foreach (MyDialogueEnum dialogue in Enum.GetValues(typeof(MyDialogueEnum)))
            {
                dialogues.Add(dialogue.ToString(), (int)dialogue);
            }

            foreach (var dialogue in dialogues)
            {
                m_selectDialogueCombobox.AddItem(dialogue.Value, null, new StringBuilder(dialogue.Key));
            }

            m_selectDialogueCombobox.SelectItemByIndex(0);

            Controls.Add(m_selectDialogueCombobox);
        }
        private void CreatePlanetsSpawnMenu(float separatorSize, float usableWidth)
        {
            float min = MyFakes.ENABLE_EXTENDED_PLANET_OPTIONS ? 100 : 19000;
            float max = /*MyFakes.ENABLE_EXTENDED_PLANET_OPTIONS ? (6378.1f * 1000 * 2) :*/ 120000f;
            MyGuiControlSlider slider = null;

            slider = new MyGuiControlSlider(
                position: m_currentPosition,
                width: 400f / MyGuiConstants.GUI_OPTIMAL_SIZE.X,
                minValue: min,
                maxValue: max,
                labelText: String.Empty,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                labelFont: MyFontEnum.Debug,
                intValue: true);
            slider.DebugScale = m_sliderDebugScale;
            slider.ColorMask  = Color.White.ToVector4();
            Controls.Add(slider);

            var label = new MyGuiControlLabel(
                position: m_currentPosition + new Vector2(slider.Size.X + 0.005f, slider.Size.Y / 2),
                text: String.Empty,
                colorMask: Color.White.ToVector4(),
                textScale: MyGuiConstants.DEFAULT_TEXT_SCALE * 0.8f * m_scale,
                font: MyFontEnum.Debug);

            label.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
            Controls.Add(label);

            m_currentPosition.Y += slider.Size.Y;
            m_currentPosition.Y += separatorSize;

            slider.ValueChanged += (MyGuiControlSlider s) =>
            {
                StringBuilder sb = new StringBuilder();
                MyValueFormatter.AppendDistanceInBestUnit(s.Value, sb);
                label.Text = sb.ToString();
                m_procAsteroidSizeValue = s.Value;
            };
            slider.Value = 8000;

            m_procAsteroidSeed = CreateSeedButton(m_procAsteroidSeedValue, usableWidth);
            m_planetCombobox   = AddCombo();
            {
                foreach (var definition in MyDefinitionManager.Static.GetPlanetsGeneratorsDefinitions())
                {
                    m_planetCombobox.AddItem((int)definition.Id.SubtypeId, definition.Id.SubtypeId.ToString());
                }
                m_planetCombobox.ItemSelected += OnPlanetCombobox_ItemSelected;
                m_planetCombobox.SortItemsByValueText();
                m_planetCombobox.SelectItemByIndex(0);
            }

            CreateDebugButton(usableWidth, MySpaceTexts.ScreenDebugSpawnMenu_SpawnAsteroid, x =>
            {
                int seed = GetProceduralAsteroidSeed(m_procAsteroidSeed);
                CreatePlanet(seed, slider.Value);
                CloseScreenNow();
            });
        }
Beispiel #3
0
        protected override void CreateButtons()
        {
            Vector2 buttonPosition = new Vector2(0.215f, -0.173f) + m_offset;
            Vector2 buttonOffset   = new Vector2(0.13f, 0.045f);

            float width = 0.26f;

            var openInWorkshopButton = CreateButton(width, new StringBuilder("Open In Workshop"), OnOpenInWorkshop, textScale: m_textScale);

            openInWorkshopButton.Position = buttonPosition;

            width = 0.14f;

            var closeButton = CreateButton(width, new StringBuilder("Close"), OnCloseButton, textScale: m_textScale);

            closeButton.Position = buttonPosition + new Vector2(0.5f, 2f) * buttonOffset + new Vector2(-0.005f, 0.005f);

            var sendLabel = MakeLabel("Send to Player", buttonPosition + new Vector2(-1f, 1f) * buttonOffset, m_textScale);

            Controls.Add(sendLabel);

            m_sendToCombo          = AddCombo(size: new Vector2(0.14f, 0.1f));
            m_sendToCombo.Position = buttonPosition + new Vector2(-0.075f, 1f) * buttonOffset;

            foreach (var player in Sync.Clients.GetClients())
            {
                m_sendToCombo.AddItem(Convert.ToInt64(player.SteamUserId), new StringBuilder(player.DisplayName));
                if (player.SteamUserId != Sync.MyId)
                {
                    m_sendToCombo.AddItem(Convert.ToInt64(player.SteamUserId), new StringBuilder(player.DisplayName));
                }
            }
            m_sendToCombo.ItemSelected += OnSendToPlayer;
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
 public override void Draw()
 {
     base.Draw();
     foreach (MyGuiControlBase control in Controls.GetList())
     {
         if (control is MyGuiControlListboxDragAndDrop)
         {
             MyGuiControlListboxDragAndDrop tempDragAndDrop = (MyGuiControlListboxDragAndDrop)control;
             if (tempDragAndDrop.IsActive())
             {
                 continue;
             }
         }
         if (control is MyGuiControlCombobox)
         {
             MyGuiControlCombobox tempCombobox = (MyGuiControlCombobox)control;
             if (tempCombobox.IsHandlingInputNow() == true)
             {
                 continue;
             }
         }
         if (control.Visible)
         {
             control.Draw();
         }
     }
 }
        /// <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);
        }
        protected override void BuildControls()
        {
            base.BuildControls();

            // Training level
            {
                var trainingLabel = MakeLabel(MySpaceTexts.TrainingLevel);
                trainingLabel.Position    = new Vector2(-0.25f, -0.47f + MARGIN_TOP);
                trainingLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;

                m_trainingLevel = new MyGuiControlCombobox(
                    position: new Vector2(-0.04f, -0.47f + MARGIN_TOP),
                    size: new Vector2(0.2f, trainingLabel.Size.Y),
                    originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER
                    );
                m_trainingLevel.AddItem((int)TrainingLevel.BASIC, MySpaceTexts.TrainingLevel_Basic);
                m_trainingLevel.AddItem((int)TrainingLevel.INTERMEDIATE, MySpaceTexts.TrainingLevel_Intermediate);
                m_trainingLevel.AddItem((int)TrainingLevel.ADVANCED, MySpaceTexts.TrainingLevel_Advanced);
                m_trainingLevel.SelectItemByIndex(0);
                m_trainingLevel.ItemSelected += OnTrainingLevelSelected;

                Controls.Add(trainingLabel);
                Controls.Add(m_trainingLevel);
            }
        }
Beispiel #8
0
 void CueVolumeCurveChanged(MyGuiControlCombobox combobox)
 {
     if (m_canUpdateValues)
     {
         m_currentCue.VolumeCurve = (MyCurveType)combobox.GetSelectedKey();
     }
 }
        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);
        }
Beispiel #10
0
        MyGuiControlCombobox GetComboboxHandlingInputNow()
        {
            for (int i = 0; i < m_controlsVisible.Count; i++)
            {
                MyGuiControlBase control = m_controlsVisible[i];

                if (control is MyGuiControlCombobox)
                {
                    MyGuiControlCombobox tempCombobox = (MyGuiControlCombobox)control;
                    if (tempCombobox.IsHandlingInputNow() == true)
                    {
                        foreach (MyGuiControlBase c in m_controlsAll)
                        {
                            if (c is MyGuiControlCombobox && c != control)
                            {
                                ((MyGuiControlCombobox)c).SetKeyboardActiveControl(false);
                            }
                        }
                        return(tempCombobox);
                    }
                }
            }

            //  Not found
            return(null);
        }
Beispiel #11
0
        public override void RecreateControls(bool contructor)
        {
            base.RecreateControls(contructor);

            this.Controls.Add(new MyGuiControlLabel(new Vector2(0.0f, -0.10f), text: "Select gps you want to reach. (Dont use for grids with subgrids.)", originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER));
            m_prefabs       = new MyGuiControlCombobox(new Vector2(0.2f, 0.0f), new Vector2(0.3f, 0.05f), null, null, 10, null);
            m_confirmButton = new MyGuiControlButton(new Vector2(0.21f, 0.10f), MyGuiControlButtonStyleEnum.Default, new Vector2(0.2f, 0.05f), null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, new System.Text.StringBuilder("Confirm"));
            m_cancelButton  = new MyGuiControlButton(new Vector2(-0.21f, 0.10f), MyGuiControlButtonStyleEnum.Default, new Vector2(0.2f, 0.05f), null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, new System.Text.StringBuilder("Cancel"));

            List <IMyGps> outlist = new List <IMyGps>();

            MySession.Static.Gpss.GetGpsList(MySession.Static.LocalPlayerId, outlist);
            foreach (var prefab in outlist)
            {
                int key = m_prefabDefinitions.Count;
                m_prefabDefinitions.Add(prefab);
                m_prefabs.AddItem(key, prefab.Name);
            }

            this.Controls.Add(m_prefabs);
            this.Controls.Add(m_confirmButton);
            this.Controls.Add(m_cancelButton);

            m_confirmButton.ButtonClicked += confirmButton_OnButtonClick;
            m_cancelButton.ButtonClicked  += cancelButton_OnButtonClick;
        }
        public override void RecreateControls(bool contructor)
        {
            base.RecreateControls(contructor);

            this.Controls.Add(new MyGuiControlLabel(new Vector2(0.0f, -0.10f), text: "Select the amount and type of items to spawn in your inventory", originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER));
            m_amountTextbox = new MyGuiControlTextbox(new Vector2(-0.2f, 0.0f), null, 9, null, MyGuiConstants.DEFAULT_TEXT_SCALE, MyGuiControlTextboxType.DigitsOnly);
            m_items         = new MyGuiControlCombobox(new Vector2(0.2f, 0.0f), new Vector2(0.3f, 0.05f), null, null, 10, null);
            m_confirmButton = new MyGuiControlButton(new Vector2(0.21f, 0.10f), Common.ObjectBuilders.Gui.MyGuiControlButtonStyleEnum.Default, new Vector2(0.2f, 0.05f), null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, new System.Text.StringBuilder("Confirm"));
            m_cancelButton  = new MyGuiControlButton(new Vector2(-0.21f, 0.10f), Common.ObjectBuilders.Gui.MyGuiControlButtonStyleEnum.Default, new Vector2(0.2f, 0.05f), null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, new System.Text.StringBuilder("Cancel"));

            foreach (var definition in MyDefinitionManager.Static.GetAllDefinitions())
            {
                var physicalItemDef = definition as MyPhysicalItemDefinition;
                if (physicalItemDef == null || physicalItemDef.CanSpawnFromScreen == false)
                {
                    continue;
                }

                int key = m_physicalItemDefinitions.Count;
                m_physicalItemDefinitions.Add(physicalItemDef);
                m_items.AddItem(key, definition.DisplayNameText);
            }

            this.Controls.Add(m_amountTextbox);
            this.Controls.Add(m_items);
            this.Controls.Add(m_confirmButton);
            this.Controls.Add(m_cancelButton);

            m_confirmButton.ButtonClicked += confirmButton_OnButtonClick;
            m_cancelButton.ButtonClicked  += cancelButton_OnButtonClick;
        }
Beispiel #13
0
        public void Init(MyGuiControlParent menuParent, MyGuiControlParent panelParent, MyEntity interactedEntity, MyEntity openInventoryInteractedEntity)
        {
            m_interactedEntityRepresentative = GetInteractedEntityRepresentative(interactedEntity);
            m_openInventoryInteractedEntityRepresentative = GetInteractedEntityRepresentative(openInventoryInteractedEntity);

            if (menuParent == null)
            {
                MySandboxGame.Log.WriteLine("menuParent is null");
            }
            if (panelParent == null)
            {
                MySandboxGame.Log.WriteLine("panelParent is null");
            }
            if (menuParent == null || panelParent == null)
            {
                return;
            }
            m_shipsInRange = (MyGuiControlCombobox)menuParent.Controls.GetControlByName("ShipsInRange");
            m_button       = (MyGuiControlButton)menuParent.Controls.GetControlByName("SelectShip");
            m_shipsData    = (MyGuiControlTable)panelParent.Controls.GetControlByName("ShipsData");

            //sort by status by default
            m_columnToSort = 2;

            m_button.ButtonClicked      += Menu_ButtonClicked;
            m_shipsData.ColumnClicked   += shipsData_ColumnClicked;
            m_shipsInRange.ItemSelected += shipsInRange_ItemSelected;

            Refresh();
        }
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            m_currentPosition    = -m_size.Value / 2.0f + new Vector2(0.02f, 0.10f);
            m_currentPosition.Y += 0.01f;
            m_scale              = 0.7f;

            AddCaption("Character kinematics debug draw", Color.Yellow.ToVector4());
            AddShareFocusHint();

            AddCheckBox("Enable permanent IK/Ragdoll simulation ", null, MemberHelper.GetMember(() => MyFakes.ENABLE_PERMANENT_SIMULATIONS_COMPUTATION));

            AddCheckBox("Draw IK Settings ", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_CHARACTER_IK_SETTINGS));
            AddCheckBox("Draw ankle final position", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_CHARACTER_IK_ANKLE_FINALPOS));
            AddCheckBox("Draw raycast lines and foot lines", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_CHARACTER_IK_RAYCASTLINE));
            AddCheckBox("Draw bones", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_CHARACTER_IK_BONES));
            AddCheckBox("Draw raycast hits", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_CHARACTER_IK_RAYCASTHITS));
            AddCheckBox("Draw ankle desired positions", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_CHARACTER_IK_ANKLE_DESIREDPOSITION));
            AddCheckBox("Draw closest support position", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_CHARACTER_IK_CLOSESTSUPPORTPOSITION));
            AddCheckBox("Draw IK solvers debug", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_CHARACTER_IK_IKSOLVERS));

            AddCheckBox("Draw Ragdoll Rig Pose", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_CHARACTER_RAGDOLL_ORIGINAL_RIG));
            AddCheckBox("Draw Bones Rig Pose", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_CHARACTER_RAGDOLL_BONES_ORIGINAL_RIG));
            AddCheckBox("Draw Ragdoll Pose", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_CHARACTER_RAGDOLL_POSE));
            AddCheckBox("Draw Bones", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_CHARACTER_RAGDOLL_COMPUTED_BONES));
            AddCheckBox("Draw bones intended transforms", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_CHARACTER_RAGDOLL_BONES_DESIRED));
            AddCheckBox("Draw Hip Ragdoll and Char. Position", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_CHARACTER_RAGDOLL_HIPPOSITIONS));

            AddCheckBox("Enable Ragdoll", null, MemberHelper.GetMember(() => MyPerGameSettings.EnableRagdollModels));
            AddCheckBox("Enable Ragdoll Animation", null, MemberHelper.GetMember(() => MyFakes.ENABLE_RAGDOLL_ANIMATION));
            AddCheckBox("Enable Bones Translation", null, MemberHelper.GetMember(() => MyFakes.ENABLE_RAGDOLL_BONES_TRANSLATION));

            AddSlider("Ragdoll simulation time", 10f, 20 * 60f, () => MyPerGameSettings.CharacterDefaultLootingCounter, (x) => MyPerGameSettings.CharacterDefaultLootingCounter = x);


            StringBuilder caption = new StringBuilder("Kill Ragdoll");

            AddButton(caption, killRagdollAction);

            StringBuilder captionActivate = new StringBuilder("Activate Ragdoll");

            AddButton(captionActivate, activateRagdollAction);

            StringBuilder captionRagdollDynamic = new StringBuilder("Switch to Dynamic / Keyframed");

            AddButton(captionRagdollDynamic, switchRagdoll);

            characterMovementStateCombo = AddCombo <Sandbox.Common.ObjectBuilders.MyCharacterMovementEnum>(null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_CHARACTER_IK_MOVEMENT_STATE));
            enabledIKState         = AddCheckBox("Enable IK for this state", null, MemberHelper.GetMember(() => MyGuiScreenDebugCharacterKinematics.ikSettingsEnabled));
            belowReachableDistance = AddSlider("Reachable distance below character", 0f, 0f, 2f, null);
            aboveReachableDistance = AddSlider("Reachable distance above character", 0f, 0f, 2f, null);
            verticalChangeUpGain   = AddSlider("Shift Up Gain", 0.1f, 0f, 1f, null);
            verticalChangeDownGain = AddSlider("Sift Down Gain", 0.1f, 0f, 1f, null);
            ankleHeight            = AddSlider("Ankle height", 0.1f, 0.001f, 0.3f, null);
            footWidth  = AddSlider("Foot width", 0.1f, 0.001f, 0.3f, null);
            footLength = AddSlider("Foot length", 0.3f, 0.001f, 0.2f, null);
            RegisterEvents();
        }
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);
            BackgroundColor = new Vector4(1f, 1f, 1f, 0.5f);

            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.13f);

            AddCaption("Voxels", Color.Yellow.ToVector4());
            AddShareFocusHint();

            AddSlider("Max precalc time", 0f, 20f, null, MemberHelper.GetMember(() => MyFakes.MAX_PRECALC_TIME_IN_MILLIS));
            //AddSlider("Terrain Tau Parameter", 0f, 1f, () => MyPlanetShapeProvider.GetTau(), x => MyPlanetShapeProvider.SetTau(x));
            AddCheckBox("Enable yielding", null, MemberHelper.GetMember(() => MyFakes.ENABLE_YIELDING_IN_PRECALC_TASK));

            m_filesCombo = MakeComboFromFiles(Path.Combine(MyFileSystem.ContentPath, "VoxelMaps"));
            m_filesCombo.ItemSelected += filesCombo_OnSelect;

            m_materialsCombo = AddCombo();
            foreach (var material in MyDefinitionManager.Static.GetVoxelMaterialDefinitions())
            {
                m_materialsCombo.AddItem(material.Index, new StringBuilder(material.Id.SubtypeName));
            }
            m_materialsCombo.ItemSelected += materialsCombo_OnSelect;
            m_materialsCombo.SelectItemByIndex(0);

            AddCombo <MyVoxelDebugDrawMode>(null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_VOXELS_MODE));

            AddLabel("Voxel ranges", Color.Yellow.ToVector4(), 0.7f);
            AddCombo <MyRenderQualityEnum>(null, MemberHelper.GetMember(() => VoxelRangesQuality));



            AddButton(new StringBuilder("Remove all"), onClick: RemoveAllAsteroids);
            AddButton(new StringBuilder("Generate render"), onClick: GenerateRender);
            AddButton(new StringBuilder("Generate physics"), onClick: GeneratePhysics);
            //AddButton(new StringBuilder("Voxelize all"), onClick: ForceVoxelizeAllVoxelMaps);
            //AddButton(new StringBuilder("Resave prefabs"), onClick: ResavePrefabs);
            AddButton(new StringBuilder("Reset all"), onClick: ResetAll);
            //AddButton(new StringBuilder("Reset part"), onClick: ResetPart);
            m_currentPosition.Y += 0.01f;

            //AddCheckBox("Geometry cell debug draw", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_VOXEL_GEOMETRY_CELL));
            AddCheckBox("Freeze terrain queries", MyRenderProxy.Settings, MemberHelper.GetMember(() => MyRenderProxy.Settings.FreezeTerrainQueries));
            AddCheckBox("Debug render clipmap cells", MyRenderProxy.Settings, MemberHelper.GetMember(() => MyRenderProxy.Settings.DebugRenderClipmapCells));
            AddCheckBox("Debug render merged cells", MyRenderProxy.Settings, MemberHelper.GetMember(() => MyRenderProxy.Settings.DebugRenderMergedCells));
            AddCheckBox("Debug clipmap lod colors", () => MyRenderSettings.DebugClipmapLodColor, (value) => MyRenderSettings.DebugClipmapLodColor = value);
            AddCheckBox("Enable physics shape discard", null, MemberHelper.GetMember(() => MyFakes.ENABLE_VOXEL_PHYSICS_SHAPE_DISCARDING));
            AddCheckBox("Wireframe", MyRenderProxy.Settings, MemberHelper.GetMember(() => MyRenderProxy.Settings.Wireframe));
            //AddCheckBox("Green background", MyRenderProxy.Settings, MemberHelper.GetMember(() => MyRenderProxy.Settings.ShowGreenBackground));
            AddCheckBox("Use triangle cache", this, MemberHelper.GetMember(() => UseTriangleCache));
            AddCheckBox("Use lod cutting", null, MemberHelper.GetMember(() => MyClipmap.UseLodCut));
            AddCheckBox("Use storage cache", null, MemberHelper.GetMember(() => MyStorageBase.UseStorageCache));
            AddCheckBox("Use dithering", null, MemberHelper.GetMember(() => MyClipmap.UseDithering));
            AddCheckBox("Use voxel merging", () => MyRenderProxy.Settings.EnableVoxelMerging, (x) => { VoxelMergeChanged(x); });
            AddCheckBox("Use queries", null, MemberHelper.GetMember(() => MyClipmap.UseQueries));
            AddCheckBox("Voxel AO", null, MemberHelper.GetMember(() => MyFakes.ENABLE_VOXEL_COMPUTED_OCCLUSION));

            m_currentPosition.Y += 0.01f;
        }
Beispiel #16
0
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            m_scale = 0.7f;

            AddCaption("Cutscenes", Color.Yellow.ToVector4());
            AddShareFocusHint();

            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.10f);


            m_comboCutscenes       = AddCombo();
            m_playButton           = AddButton(new StringBuilder("Play"), onClick_PlayButton);
            m_addCutsceneButton    = AddButton(new StringBuilder("Add cutscene"), onClick_AddCutsceneButton);
            m_deleteCutsceneButton = AddButton(new StringBuilder("Delete cutscene"), onClick_DeleteCutsceneButton);


            m_currentPosition.Y += 0.01f;

            AddLabel("Nodes", Color.Yellow.ToVector4(), 1);
            m_comboNodes = AddCombo();
            m_comboNodes.ItemSelected += m_comboNodes_ItemSelected;


            m_addNodeButton    = AddButton(new StringBuilder("Add node"), onClick_AddNodeButton);
            m_deleteNodeButton = AddButton(new StringBuilder("Delete node"), onClick_DeleteNodeButton);

            m_nodeTimeSlider = AddSlider("Node time", 0, 0, 100, OnNodeTimeChanged);

            var cutscenes = MySession.Static.GetComponent <MySessionComponentCutscenes>();

            m_comboCutscenes.ClearItems();
            foreach (var key in cutscenes.GetCutscenes().Keys)
            {
                m_comboCutscenes.AddItem(key.GetHashCode(), key);
            }

            m_comboCutscenes.SortItemsByValueText();
            m_comboCutscenes.ItemSelected += m_comboCutscenes_ItemSelected;

            AddLabel("Waypoints", Color.Yellow.ToVector4(), 1);
            m_comboWaypoints = AddCombo();
            m_comboWaypoints.ItemSelected += m_comboWaypoints_ItemSelected;



            m_currentPosition.Y += 0.01f;

            m_spawnButton     = AddButton(new StringBuilder("Spawn entity"), onSpawnButton);
            m_removeAllButton = AddButton(new StringBuilder("Remove all"), onRemoveAllButton);


            if (m_comboCutscenes.GetItemsCount() > 0)
            {
                m_comboCutscenes.SelectItemByIndex(0);
            }
        }
        /// <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");
        }
Beispiel #18
0
        /// <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);
            }
        }
        public static List <MyGuiControlCombobox.Item> ItemsAsList(this MyGuiControlCombobox combo)
        {
            var list = new List <MyGuiControlCombobox.Item>();

            for (var i = 0; i < combo.GetItemsCount(); i++)
            {
                list.Add(combo.GetItemByIndex(i));
            }

            return(list);
        }
Beispiel #20
0
        protected override MyGuiControlBase CreateGui()
        {
            m_comboBox               = new MyGuiControlCombobox(toolTip: MyTexts.GetString(Tooltip), size: new VRageMath.Vector2(0.23f, 0.04f));
            m_comboBox.VisualStyle   = MyGuiControlComboboxStyleEnum.Terminal;
            m_comboBox.ItemSelected += OnItemSelected;

            return(new MyGuiControlBlockProperty(
                       MyTexts.GetString(Title),
                       MyTexts.GetString(Tooltip),
                       m_comboBox,
                       MyGuiControlBlockPropertyLayoutEnum.Vertical));
        }
Beispiel #21
0
        private void UpdateControls()
        {
            //  Update screen controls
            for (int i = 0; i < m_controlsAll.Count; i++)
            {
                MyGuiControlBase control = m_controlsAll[i];
                control.Update();
            }

            m_comboboxHandlingNow           = GetComboboxHandlingInputNow();
            m_listboxDragAndDropHandlingNow = GetDragAndDropHandlingNow();
        }
Beispiel #22
0
        protected MyGuiControlCombobox AddCombo(List <MyGuiControlBase> controlGroup = null, MyGuiControlButtonTextAlignment textAlign = MyGuiControlButtonTextAlignment.CENTERED, Vector4?textColor = null, Vector2?size = null)
        {
            MyGuiControlCombobox combo = new MyGuiControlCombobox(this, new Vector2(m_buttonXOffset, m_currentPosition.Y), MyGuiControlPreDefinedSize.MEDIUM, Vector4.One, 0.7f);

            Controls.Add(combo);

            m_currentPosition.Y += 0.04f * m_scale;

            if (controlGroup != null)
            {
                controlGroup.Add(combo);
            }

            return(combo);
        }
Beispiel #23
0
        protected void RecreateHandItemsCombo()
        {
            m_handItemsCombo = AddCombo();

            m_handItemDefinitions.Clear();
            foreach (var handItemDef in MyDefinitionManager.Static.GetHandItemDefinitions())
            {
                var def         = MyDefinitionManager.Static.GetDefinition(handItemDef.PhysicalItemId);
                int handItemKey = m_handItemDefinitions.Count;
                m_handItemDefinitions.Add(handItemDef);
                m_handItemsCombo.AddItem(handItemKey, def.DisplayNameText);
            }

            m_handItemsCombo.SortItemsByValueText();
            m_handItemsCombo.ItemSelected += handItemsCombo_ItemSelected;
        }
Beispiel #24
0
        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();
        }
Beispiel #25
0
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);
            BackgroundColor = new Vector4(1f, 1f, 1f, 0.5f);

            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.13f);

            AddCaption("Voxels", Color.Yellow.ToVector4());
            AddShareFocusHint();

            AddSlider("Max precalc time", 0f, 20f, null, MemberHelper.GetMember(() => MyFakes.MAX_PRECALC_TIME_IN_MILLIS));
            AddCheckBox("Enable yielding", null, MemberHelper.GetMember(() => MyFakes.ENABLE_YIELDING_IN_PRECALC_TASK));

            m_filesCombo = MakeComboFromFiles(Path.Combine(MyFileSystem.ContentPath, "VoxelMaps"));
            m_filesCombo.ItemSelected += filesCombo_OnSelect;

            m_materialsCombo = AddCombo();
            foreach (var material in MyDefinitionManager.Static.GetVoxelMaterialDefinitions())
            {
                m_materialsCombo.AddItem(material.Index, new StringBuilder(material.Id.SubtypeName));
            }
            m_materialsCombo.ItemSelected += materialsCombo_OnSelect;
            m_materialsCombo.SelectItemByIndex(0);
            AddCombo <MyVoxelDebugDrawMode>(null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_VOXELS_MODE));

            AddButton(new StringBuilder("Remove all"), onClick: RemoveAllAsteroids);
            AddButton(new StringBuilder("Generate render"), onClick: GenerateRender);
            AddButton(new StringBuilder("Generate physics"), onClick: GeneratePhysics);
            AddButton(new StringBuilder("Voxelize all"), onClick: ForceVoxelizeAllVoxelMaps);
            AddButton(new StringBuilder("Resave prefabs"), onClick: ResavePrefabs);
            AddButton(new StringBuilder("Reset all"), onClick: ResetAll);
            AddButton(new StringBuilder("Reset part"), onClick: ResetPart);
            m_currentPosition.Y += 0.01f;

            AddCheckBox("Geometry cell debug draw", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_VOXEL_GEOMETRY_CELL));
            AddCheckBox("Freeze terrain queries", MyRenderProxy.Settings, MemberHelper.GetMember(() => MyRenderProxy.Settings.FreezeTerrainQueries));
            AddCheckBox("Debug render clipmap cells", MyRenderProxy.Settings, MemberHelper.GetMember(() => MyRenderProxy.Settings.DebugRenderClipmapCells));
            AddCheckBox("Debug clipmap lod colors", () => MyRenderSettings.DebugClipmapLodColor, (value) => MyRenderSettings.DebugClipmapLodColor = value);
            AddCheckBox("Enable physics shape discard", null, MemberHelper.GetMember(() => MyFakes.ENABLE_VOXEL_PHYSICS_SHAPE_DISCARDING));
            AddCheckBox("Wireframe", MyRenderProxy.Settings, MemberHelper.GetMember(() => MyRenderProxy.Settings.Wireframe));
            AddCheckBox("Green background", MyRenderProxy.Settings, MemberHelper.GetMember(() => MyRenderProxy.Settings.ShowGreenBackground));
            m_currentPosition.Y += 0.01f;

            AddSlider("Clipmap highest lod", MyClipmap.DebugClipmapMostDetailedLod, 0f, 15.9f, (slider) => MyClipmap.DebugClipmapMostDetailedLod = slider.Value);
            m_currentPosition.Y += 0.01f;
        }
Beispiel #26
0
        internal void Close()
        {
            UnregisterEvents();
            UnregisterAssemblerEvents(m_selectedAssembler);

            m_assemblersByKey.Clear();
            m_blueprintButtonGroup.Clear();
            m_modeButtonGroup.Clear();

            m_selectedAssembler  = null;
            m_controlsParent     = null;
            m_terminalSystem     = null;
            m_comboboxAssemblers = null;

            m_dragAndDrop     = null;
            m_dragAndDropInfo = null;
        }
        public MyGuiScreenOptionsGame()
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null)
        {
            m_enableBackgroundFade = true;
            m_size = new Vector2(0.51f, 0.525f);
            //m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\GameOptionsBackground", flags: TextureFlags.IgnoreQuality);

            AddCaption(MyTextsWrapperEnum.GameOptions, new Vector2(0, 0.005f));

            Vector2 controlsOriginLeft  = new Vector2(-m_size.Value.X / 2.0f + 0.05f, -m_size.Value.Y / 2.0f + 0.125f);
            Vector2 controlsOriginRight = new Vector2(-m_size.Value.X / 2.0f + 0.175f, -m_size.Value.Y / 2.0f + 0.125f);
            Vector2 controlsDelta       = new Vector2(0, 0.0525f);

            //  Language
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 0 * controlsDelta, null, MyTextsWrapperEnum.Language, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_languageCombobox = new MyGuiControlCombobox(this, controlsOriginRight + 0 * controlsDelta + new Vector2(MyGuiConstants.COMBOBOX_MEDIUM_SIZE.Y / 2.0f + 0.1f, 0), MyGuiControlPreDefinedSize.MEDIUM, MyGuiConstants.COMBOBOX_BACKGROUND_COLOR, MyGuiConstants.COMBOBOX_TEXT_SCALE);
            m_languageCombobox.AddItem((int)MyLanguagesEnum.English, MyTextsWrapperEnum.LanguageEnglish);
            m_languageCombobox.AddItem((int)MyLanguagesEnum.Cesky, MyTextsWrapperEnum.LanguageCesky);
            Controls.Add(m_languageCombobox);

            //  Subtitles
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 1 * controlsDelta, null, MyTextsWrapperEnum.Subtitles, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_subtitlesCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight + 1 * controlsDelta + new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f + 0.1f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_subtitlesCheckbox);

            //  Notifications
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 2 * controlsDelta, null, MyTextsWrapperEnum.Notifications, MyGuiConstants.LABEL_TEXT_COLOR,
                                               MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_notificationsCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight + 2 * controlsDelta + new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f + 0.1f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_notificationsCheckbox);

            //  Buttons OK and CANCEL
            Vector2 buttonDelta = new Vector2(0.1f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f - 0.03f);

            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));


            //  Update controls with values from config file
            UpdateControls();
        }
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);
            BackgroundColor = new Vector4(1f, 1f, 1f, 0.5f);

            m_currentPosition = -m_size.Value / 2.0f + new Vector2(0.02f, 0.13f);

            AddCaption("Voxel materials", Color.Yellow.ToVector4());
            AddShareFocusHint();

            m_materialsCombo = AddCombo();

            var defList = MyDefinitionManager.Static.GetVoxelMaterialDefinitions().OrderBy(x => x.Id.SubtypeName).ToList();

            foreach (var material in defList)
            {
                m_materialsCombo.AddItem(material.Index, new StringBuilder(material.Id.SubtypeName));
            }
            m_materialsCombo.ItemSelected += materialsCombo_OnSelect;
            m_currentPosition.Y           += 0.01f;

            m_sliderInitialScale       = AddSlider("Initial scale", 0, 1f, 100f, null);
            m_sliderScaleMultiplier    = AddSlider("Scale multiplier", 0, 1f, 100f, null);
            m_sliderInitialDistance    = AddSlider("Initial distance", 0, 1f, 100f, null);
            m_sliderDistanceMultiplier = AddSlider("Distance multiplier", 0, 1f, 100f, null);

            m_sliderFar1Distance = AddSlider("Far1 distance", 0, 0f, 20000f, null);
            m_sliderFar1Scale    = AddSlider("Far1 scale", 0, 1f, 50000f, null);
            m_sliderFar2Distance = AddSlider("Far2 distance", 0, 0f, 20000f, null);
            m_sliderFar2Scale    = AddSlider("Far2 scale", 0, 1f, 50000f, null);
            m_sliderFar3Distance = AddSlider("Far3 distance", 0, 0f, 40000f, null);
            m_sliderFar3Scale    = AddSlider("Far3 scale", 0, 1f, 50000f, null);

            m_sliderExtScale = AddSlider("Detail scale (/1000)", 0, 0.01f, 1f, null);

            m_materialsCombo.SelectItemByIndex(0);

            m_colorFar3 = AddColor(new StringBuilder("Far3 color"), m_selectedVoxelMaterial, MemberHelper.GetMember(() => m_selectedVoxelMaterial.Far3Color));
            m_colorFar3.SetColor(m_selectedVoxelMaterial.Far3Color);

            m_currentPosition.Y += 0.01f;

            AddButton(new StringBuilder("Reload definition"), OnReloadDefinition);
        }
        private void CreateObjectsSpawnMenu(float separatorSize, float usableWidth)
        {
            AddSubcaption(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_Items), Color.White.ToVector4(), new Vector2(-HIDDEN_PART_RIGHT, 0.0f));

            AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_ItemType), Vector4.One, m_scale);
            m_physicalObjectCombobox = AddCombo();
            {
                foreach (var definition in MyDefinitionManager.Static.GetAllDefinitions())
                {
                    if (!definition.Public)
                    {
                        continue;
                    }
                    var physicalItemDef = definition as MyPhysicalItemDefinition;
                    if (physicalItemDef == null || physicalItemDef.CanSpawnFromScreen == false)
                    {
                        continue;
                    }

                    int key = m_physicalItemDefinitions.Count;
                    m_physicalItemDefinitions.Add(physicalItemDef);
                    m_physicalObjectCombobox.AddItem(key, definition.DisplayNameText);
                }
                m_physicalObjectCombobox.SortItemsByValueText();
                m_physicalObjectCombobox.SelectItemByIndex(m_lastSelectedFloatingObjectIndex);
                m_physicalObjectCombobox.ItemSelected += OnPhysicalObjectCombobox_ItemSelected;
            }

            m_currentPosition.Y += separatorSize;

            AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_ItemAmount), Vector4.One, m_scale);
            m_amountTextbox              = new MyGuiControlTextbox(m_currentPosition, m_amount.ToString(), 6, null, m_scale, MyGuiControlTextboxType.DigitsOnly);
            m_amountTextbox.OriginAlign  = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_amountTextbox.TextChanged += OnAmountTextChanged;
            Controls.Add(m_amountTextbox);

            m_currentPosition.Y += separatorSize + m_amountTextbox.Size.Y;
            m_errorLabel         = AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_InvalidAmount), Color.Red.ToVector4(), m_scale);
            m_errorLabel.Visible = false;
            CreateDebugButton(usableWidth, MySpaceTexts.ScreenDebugSpawnMenu_SpawnObject, OnSpawnPhysicalObject);

            m_currentPosition.Y += separatorSize;
        }
Beispiel #30
0
        void UdpateCuesCombo(MyGuiControlCombobox box)
        {
            box.ClearItems();
            long key = 0;

            foreach (var cue in MyAudio.Static.CueDefinitions)
            {
                if ((m_currentCategorySelectedItem == ALL_CATEGORIES) || (m_currentCategorySelectedItem == cue.Category.ToString()))
                {
                    box.AddItem(key, new StringBuilder(cue.SubtypeId.ToString()));
                    key++;
                }
            }

            box.SortItemsByValueText();
            if (box.GetItemsCount() > 0)
            {
                box.SelectItemByIndex(0);
            }
        }