当前位置: 首页>>代码示例>>C#>>正文


C# MyGuiControlCombobox.SortItemsByValueText方法代码示例

本文整理汇总了C#中Sandbox.Graphics.GUI.MyGuiControlCombobox.SortItemsByValueText方法的典型用法代码示例。如果您正苦于以下问题:C# MyGuiControlCombobox.SortItemsByValueText方法的具体用法?C# MyGuiControlCombobox.SortItemsByValueText怎么用?C# MyGuiControlCombobox.SortItemsByValueText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sandbox.Graphics.GUI.MyGuiControlCombobox的用法示例。


在下文中一共展示了MyGuiControlCombobox.SortItemsByValueText方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RecreateHandItemsCombo

        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;

        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:17,代码来源:MyGuiScreenDebugHandItemBase.cs

示例2: CreatePlanetsSpawnMenu

        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();
            });
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:58,代码来源:MyGuiScreenDebugSpawnMenu.cs

示例3: CreateObjectsSpawnMenu

        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;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:39,代码来源:MyGuiScreenDebugSpawnMenu.cs

示例4: CreateAsteroidsSpawnMenu

        private void CreateAsteroidsSpawnMenu(float separatorSize, float usableWidth)
        {

            AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_Asteroid), Vector4.One, m_scale);
            m_asteroidCombobox = AddCombo();
            {
                foreach (var definition in MyDefinitionManager.Static.GetVoxelMapStorageDefinitions())
                {
                    m_asteroidCombobox.AddItem((int)definition.Id.SubtypeId, definition.Id.SubtypeId.ToString());
                }
                m_asteroidCombobox.ItemSelected += OnAsteroidCombobox_ItemSelected;
                m_asteroidCombobox.SortItemsByValueText();
                m_asteroidCombobox.SelectItemByIndex(m_lastSelectedAsteroidIndex);
            }

            m_currentPosition.Y += separatorSize;

            AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_AsteroidGenerationCanTakeLong), Color.Red.ToVector4(), m_scale);
            CreateDebugButton(usableWidth, MySpaceTexts.ScreenDebugSpawnMenu_SpawnAsteroid, OnLoadAsteroid);

            m_currentPosition.Y += separatorSize;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:22,代码来源:MyGuiScreenDebugSpawnMenu.cs

示例5: RecreateControls

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

            if (m_asteroid_showPlanet)
            {
                CreatePlanetMenu();
                return;
            }

            Vector2 cbOffset = new Vector2(-0.05f, 0.0f);
            Vector2 controlPadding = new Vector2(0.02f, 0.02f); // X: Left & Right, Y: Bottom & Top

            float textScale = 0.8f;
            float separatorSize = 0.01f;
            float usableWidth = SCREEN_SIZE.X - HIDDEN_PART_RIGHT - controlPadding.X * 2;
            float hiddenPartTop = (SCREEN_SIZE.Y - 1.0f) / 2.0f;

            m_currentPosition = -m_size.Value / 2.0f;
            m_currentPosition += controlPadding;
            m_currentPosition.Y += hiddenPartTop;
            m_scale = textScale;

            var caption = AddCaption(MySpaceTexts.ScreenDebugSpawnMenu_Caption, Color.White.ToVector4(), controlPadding + new Vector2(-HIDDEN_PART_RIGHT, hiddenPartTop));
            m_currentPosition.Y += MyGuiConstants.SCREEN_CAPTION_DELTA_Y + separatorSize;

            if (MyFakes.ENABLE_SPAWN_MENU_ASTEROIDS || MyFakes.ENABLE_SPAWN_MENU_PROCEDURAL_ASTEROIDS)
            {
                AddSubcaption(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_Asteroids), Color.White.ToVector4(), new Vector2(-HIDDEN_PART_RIGHT, 0.0f));
            }

            if (MyFakes.ENABLE_SPAWN_MENU_ASTEROIDS && MyFakes.ENABLE_SPAWN_MENU_PROCEDURAL_ASTEROIDS)
            {
                AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_SelectAsteroidType), Vector4.One, m_scale);
                var combo = AddCombo();
                combo.AddItem(1, MySpaceTexts.ScreenDebugSpawnMenu_PredefinedAsteroids);
                combo.AddItem(2, MySpaceTexts.ScreenDebugSpawnMenu_ProceduralAsteroids);
                // DA: Remove from MySpaceTexts and just hardcode until release. Leave a todo so you don't forget about it before release of planets.
                combo.AddItem(3, MySpaceTexts.ScreenDebugSpawnMenu_Planets);

                combo.SelectItemByKey(m_asteroid_showPlanet ? 3 : m_asteroid_showPredefinedOrProcedural ? 1 : 2);
                combo.ItemSelected += () => { m_asteroid_showPredefinedOrProcedural = combo.GetSelectedKey() == 1; m_asteroid_showPlanet = combo.GetSelectedKey() == 3; RecreateControls(false); };
            }

            if (MyFakes.ENABLE_SPAWN_MENU_ASTEROIDS && m_asteroid_showPredefinedOrProcedural)
            {
                AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_Asteroid), Vector4.One, m_scale);
                m_asteroidCombobox = AddCombo();
                {
                    foreach (var definition in MyDefinitionManager.Static.GetVoxelMapStorageDefinitions())
                    {
                        m_asteroidCombobox.AddItem((int)definition.Id.SubtypeId, definition.Id.SubtypeId.ToString());
                    }
                    m_asteroidCombobox.ItemSelected += OnAsteroidCombobox_ItemSelected;
                    m_asteroidCombobox.SortItemsByValueText();
                    m_asteroidCombobox.SelectItemByIndex(m_lastSelectedAsteroidIndex);
                }

                m_currentPosition.Y += separatorSize;

                AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_AsteroidGenerationCanTakeLong), Color.Red.ToVector4(), m_scale);
                CreateDebugButton(usableWidth, MySpaceTexts.ScreenDebugSpawnMenu_SpawnAsteroid, OnLoadAsteroid);

                m_currentPosition.Y += separatorSize;
            }

            if (MyFakes.ENABLE_SPAWN_MENU_PROCEDURAL_ASTEROIDS && !m_asteroid_showPredefinedOrProcedural)
            {
                AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_ProceduralSize), Vector4.One, m_scale);


                m_procAsteroidSize = new MyGuiControlSlider(
                    position: m_currentPosition,
                    width: 400f / MyGuiConstants.GUI_OPTIMAL_SIZE.X,
                    minValue: 5.0f,
                    maxValue: 500f,
                    labelText: String.Empty,
                    labelDecimalPlaces: 2,
                    labelScale: 0.75f * m_scale,
                    originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                    labelFont: MyFontEnum.Debug);
                m_procAsteroidSize.DebugScale = m_sliderDebugScale;
                m_procAsteroidSize.ColorMask = Color.White.ToVector4();
                Controls.Add(m_procAsteroidSize);

                MyGuiControlLabel label = new MyGuiControlLabel(
                    position: m_currentPosition + new Vector2(m_procAsteroidSize.Size.X + 0.005f, m_procAsteroidSize.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_procAsteroidSize.ValueChanged += (MyGuiControlSlider s) => { label.Text = MyValueFormatter.GetFormatedFloat(s.Value, 2) + "m"; m_procAsteroidSizeValue = s.Value; };

                m_procAsteroidSize.Value = m_procAsteroidSizeValue;

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

//.........这里部分代码省略.........
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:101,代码来源:MyGuiScreenDebugSpawnMenu.cs

示例6: RecreateControls

        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("Audio FX", Color.Yellow.ToVector4());
            AddShareFocusHint();

            if (MyAudio.Static is MyNullAudio)
                return;

            m_categoriesCombo = AddCombo();
            List<MyStringId> categories = MyAudio.Static.GetCategories(); 
            m_categoriesCombo.AddItem(0, new StringBuilder(ALL_CATEGORIES));
            int catCount = 1;
            foreach (var category in categories)
            {
                m_categoriesCombo.AddItem(catCount++, new StringBuilder(category.ToString()));//jn:TODO get rid of ToString
            }

            m_categoriesCombo.SortItemsByValueText();
            m_categoriesCombo.ItemSelected += new MyGuiControlCombobox.ItemSelectedDelegate(categoriesCombo_OnSelect);

            m_cuesCombo = AddCombo();

            m_cuesCombo.ItemSelected += new MyGuiControlCombobox.ItemSelectedDelegate(cuesCombo_OnSelect);

            m_cueVolumeSlider = AddSlider("Volume", 1f, 0f, 1f, null);
            m_cueVolumeSlider.ValueChanged = CueVolumeChanged;

            m_applyVolumeToCategory = AddButton(new StringBuilder("Apply to category"), OnApplyVolumeToCategorySelected);
            m_applyVolumeToCategory.Enabled = false;

            m_cueVolumeCurveCombo = AddCombo();
            foreach (var curveType in Enum.GetValues(typeof(MyCurveType)))
            {
                m_cueVolumeCurveCombo.AddItem((int)curveType, new StringBuilder(curveType.ToString()));
            }

            m_effects = AddCombo();
            m_effects.AddItem(0,new StringBuilder(""));
            catCount =1;
            foreach(var effect in MyDefinitionManager.Static.GetAudioEffectDefinitions())
            {
                m_effects.AddItem(catCount++, new StringBuilder(effect.Id.SubtypeName));
            }
            m_effects.SelectItemByIndex(0);
            m_effects.ItemSelected += effects_ItemSelected;

            m_cueMaxDistanceSlider = AddSlider("Max distance", 0, 0, 2000, null);
            m_cueMaxDistanceSlider.ValueChanged = MaxDistanceChanged;

            m_applyMaxDistanceToCategory = AddButton(new StringBuilder("Apply to category"), OnApplyMaxDistanceToCategorySelected);
            m_applyMaxDistanceToCategory.Enabled = false;

            m_cueVolumeVariationSlider = AddSlider("Volume variation", 0, 0, 10, null);
            m_cueVolumeVariationSlider.ValueChanged = VolumeVariationChanged;
            m_cuePitchVariationSlider = AddSlider("Pitch variation", 0, 0, 500, null);
            m_cuePitchVariationSlider.ValueChanged = PitchVariationChanged;

            m_soloCheckbox = AddCheckBox("Solo", false, null);
            m_soloCheckbox.IsCheckedChanged = SoloChanged;

            MyGuiControlButton btn = AddButton(new StringBuilder("Play selected"), OnPlaySelected);
            btn.CueEnum = GuiSounds.None;

            AddButton(new StringBuilder("Stop selected"), OnStopSelected);
            AddButton(new StringBuilder("Save"), OnSave);
            AddButton(new StringBuilder("Reload"), OnReload);

            if (m_categoriesCombo.GetItemsCount() > 0)
                m_categoriesCombo.SelectItemByIndex(0);
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:79,代码来源:MyGuiScreenDebugAudio.cs

示例7: UdpateCuesCombo

        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);
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:18,代码来源:MyGuiScreenDebugAudio.cs

示例8: RecreateControls

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

            m_scale = 0.7f;

            AddCaption("Render Character", Color.Yellow.ToVector4());
            AddShareFocusHint();

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


            m_currentPosition.Y += 0.01f;


            if (MySession.ControlledEntity == null || !(MySession.ControlledEntity is MyCharacter))
            {
                AddLabel("None active character", Color.Yellow.ToVector4(), 1.2f);
                return;
            }

            MyCharacter playerCharacter = MySession.LocalCharacter;
            
            if (!constructor)
                playerCharacter.DebugMode = true;

            AddSlider("Max slope", playerCharacter.Definition.MaxSlope, 0f, 89f, (slider) => { playerCharacter.Definition.MaxSlope = slider.Value; });

            AddLabel(playerCharacter.Model.AssetName, Color.Yellow.ToVector4(), 1.2f);
              
            AddLabel("Animation A:", Color.Yellow.ToVector4(), 1.2f);

            m_animationComboA = AddCombo();
            int i = 0;
            foreach (var animation in playerCharacter.Definition.AnimationNameToSubtypeName)
            {
                m_animationComboA.AddItem(i++, new StringBuilder(animation.Key));
            }
            m_animationComboA.SelectItemByIndex(0);

            AddLabel("Animation B:", Color.Yellow.ToVector4(), 1.2f);

            m_animationComboB = AddCombo();
            i = 0;
            foreach (var animation in playerCharacter.Definition.AnimationNameToSubtypeName)
            {
                m_animationComboB.AddItem(i++, new StringBuilder(animation.Key));
            }
            m_animationComboB.SelectItemByIndex(0);

            m_blendSlider = AddSlider("Blend time", 0.5f, 0, 3, null);

            AddButton(new StringBuilder("Play A->B"), OnPlayBlendButtonClick);

            m_currentPosition.Y += 0.01f;


            m_animationCombo = AddCombo();
            i = 0;
            foreach (var animation in playerCharacter.Definition.AnimationNameToSubtypeName)
            {
                m_animationCombo.AddItem(i++, new StringBuilder(animation.Key));
            }
            m_animationCombo.SortItemsByValueText();
            m_animationCombo.SelectItemByIndex(0);

            m_loopCheckbox = AddCheckBox("Loop", false, null);

            m_currentPosition.Y += 0.02f;

            foreach (var val in System.Enum.GetValues(typeof(MyBonesArea)))
            {
                string name = System.Enum.GetName(typeof(MyBonesArea), val);
                var checkBox = AddCheckBox(name, false, null);
                checkBox.UserData = val;
                if (name == "Body")
                    checkBox.IsChecked = true;
            }

            AddButton(new StringBuilder("Play animation"), OnPlayButtonClick);

            m_currentPosition.Y += 0.01f;
        }
开发者ID:austusross,项目名称:SpaceEngineers,代码行数:83,代码来源:MyGuiScreenDebugCharacter.cs

示例9: CreateLayersControls

        private void CreateLayersControls(MyGuiControlList list, float usableWidth)
        {
            var button = CreateDebugButton(usableWidth, MySpaceTexts.ScreenDebugSpawnMenu_CreateLayer, OnCreateLayer);
            Controls.Remove(button);
            list.Controls.Add(button);

            button = CreateDebugButton(usableWidth, MySpaceTexts.ScreenDebugSpawnMenu_RemoveLayer, OnRemoveLayer);
            Controls.Remove(button);
            list.Controls.Add(button);

            m_materialLayerDeviationSeed = CreateSeedButton(list, m_materialLayerDeviationSeedValue, usableWidth);

            var layerNoiseLabel = CreateSliderWithDescription(list, usableWidth, 10f, 200.0f, "Layer deviation noise frequency", ref m_materialLayerDeviationNoise);
            m_materialLayerDeviationNoise.ValueChanged += (MyGuiControlSlider s) =>
            {
                layerNoiseLabel.Text = MyValueFormatter.GetFormatedFloat(s.Value, 2);
            };

            m_layerCombobox = AddCombo();
            m_layerCombobox.ItemSelected += OnLayerCombobox_ItemSelected;
            Controls.Remove(m_layerCombobox);
            list.Controls.Add(m_layerCombobox);

            m_oreComboboxLabel = AddLabel("Layer ore", Vector4.One, m_scale);
            Controls.Remove(m_oreComboboxLabel);
            list.Controls.Add(m_oreComboboxLabel);
            m_oreComboboxLabel.Visible = false;

            m_oreCombobox = AddCombo();
            {
                foreach (var definition in MyDefinitionManager.Static.GetVoxelMaterialDefinitions())
                {
                    m_oreCombobox.AddItem((int)definition.Id.SubtypeId, definition.Id.SubtypeId);
                }
                m_oreCombobox.ItemSelected += OnOreCombobox_ItemSelected;
                m_oreCombobox.SortItemsByValueText();
            }
            m_oreCombobox.Visible = false;
            list.Controls.Add(m_oreCombobox);


            var layerStartLabel = CreateSliderWithDescription(list, usableWidth, -m_procAsteroidSizeValue * m_planetDeviationScaleValue, m_procAsteroidSizeValue * m_planetDeviationScaleValue, "Layer start", ref m_materialLayerStart);
            m_materialLayerStart.ValueChanged += (MyGuiControlSlider s) =>
            {
                layerStartLabel.Text = MyValueFormatter.GetFormatedFloat(s.Value, 0) + "m";
                int currentLayer = m_layerCombobox.GetSelectedIndex();
                if (currentLayer >= 0 && currentLayer < m_materialLayers.Count)
                {
                    m_materialLayers[currentLayer].StartHeight = s.Value;
                }

                if (s.Value > m_materialLayerEnd.Value)
                {
                    m_materialLayerEnd.Value = s.Value;
                }
            };

            var layerStartHeigthDeviationLabel = CreateSliderWithDescription(list, usableWidth, 0, 100.0f, "Layer start height deviation", ref m_materialLayerStartHeigthDeviation);
            m_materialLayerStartHeigthDeviation.ValueChanged += (MyGuiControlSlider s) =>
            {
                layerStartHeigthDeviationLabel.Text = MyValueFormatter.GetFormatedFloat(s.Value, 0) + "m";
                int currentLayer = m_layerCombobox.GetSelectedIndex();
                if (currentLayer >= 0 && currentLayer < m_materialLayers.Count)
                {
                    m_materialLayers[currentLayer].HeightStartDeviation = s.Value;
                }
            };

            var layerEndLabel = CreateSliderWithDescription(list, usableWidth, -m_procAsteroidSizeValue * m_planetDeviationScaleValue, m_procAsteroidSizeValue * m_planetDeviationScaleValue, "Layer end", ref m_materialLayerEnd);   
            m_materialLayerEnd.ValueChanged += (MyGuiControlSlider s) =>
            {
                layerEndLabel.Text = MyValueFormatter.GetFormatedFloat(s.Value, 0) + "m";
                int currentLayer = m_layerCombobox.GetSelectedIndex();
                if (currentLayer >= 0 && currentLayer < m_materialLayers.Count)
                {
                    m_materialLayers[currentLayer].EndHeight = s.Value;
                }
                if (s.Value < m_materialLayerStart.Value)
                {
                    m_materialLayerStart.Value = s.Value;
                }
            };

            var layerHeigthDeviationLabel = CreateSliderWithDescription(list, usableWidth,0, 100.0f, "Layer end height deviation", ref m_materialLayerEndHeigthDeviation);
            m_materialLayerEndHeigthDeviation.ValueChanged += (MyGuiControlSlider s) =>
            {
                layerHeigthDeviationLabel.Text = MyValueFormatter.GetFormatedFloat(s.Value, 0) + "m";
                int currentLayer = m_layerCombobox.GetSelectedIndex();
                if (currentLayer >= 0 && currentLayer < m_materialLayers.Count)
                {
                    m_materialLayers[currentLayer].HeightEndDeviation = s.Value;
                }
            };

            var layerAngleStartLabel = CreateSliderWithDescription(list, usableWidth, -1, 1, "Layer angle start", ref m_materialLayerAngleStart);
            m_materialLayerAngleStart.ValueChanged += (MyGuiControlSlider s) =>
            {
                layerAngleStartLabel.Text = MyValueFormatter.GetFormatedFloat(s.Value, 3);
                int currentLayer = m_layerCombobox.GetSelectedIndex();
                if (currentLayer >= 0 && currentLayer < m_materialLayers.Count)
//.........这里部分代码省略.........
开发者ID:caomw,项目名称:SpaceEngineers,代码行数:101,代码来源:MyGuiScreenDebugSpawnMenu.cs

示例10: RecreateControls

        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);
            AddCaption("Cube blocks", Color.Yellow.ToVector4());
            m_combo = AddCombo();
            m_combo.Position = new Vector2(-0.15f, -0.35f);
            Dictionary<long, int> dict = new Dictionary<long, int>();
            Dictionary<long, StringBuilder> names = new Dictionary<long, StringBuilder>();
            foreach (var entity in MyEntities.GetEntities())
            {
                if (entity is MyCubeGrid)
                {
                    var grid = entity as MyCubeGrid;
                    foreach (var block in grid.GetBlocks())
                    {
                        long defId = block.BlockDefinition.Id.GetHashCode();
                        if (!dict.ContainsKey(defId))
                            dict.Add(defId, 0);

                        dict[defId]++;

                        string cubesize = "";
                        switch(block.BlockDefinition.CubeSize)
                        {
                            case MyCubeSize.Large: cubesize = "Large"; break;
                            case MyCubeSize.Small: cubesize = "Small"; break;
                        }

                        StringBuilder blockName = new StringBuilder().Append("[").Append(cubesize).Append("] ").Append(block.BlockDefinition.DisplayNameText);

                        if (!names.ContainsKey(defId))
                            names.Add(defId, blockName);
                    }
                }
            }

            int qt;
            StringBuilder name;
            foreach (var key in names.Keys) //could be dict.Keys too
            {
                if (names.TryGetValue(key, out name) && dict.TryGetValue(key, out qt))
                    m_combo.AddItem(key, name.Append(": ").Append(qt));
            }

            m_combo.SortItemsByValueText();
            if(m_combo.GetItemsCount() > 0)
                m_combo.SelectItemByIndex(0);
            m_button = AddButton(new StringBuilder("Remove All"), onClick_RemoveAllBlocks);
            m_button.VisualStyle = MyGuiControlButtonStyleEnum.Default;
            m_button.Position = new Vector2(0.0f, -0.25f);

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

            AddCheckBox("Enable use object highlight", null, MemberHelper.GetMember(() => MyFakes.ENABLE_USE_OBJECT_HIGHLIGHT));
            AddCheckBox("Show grids decay", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_GRIDS_DECAY));

            m_currentPosition += new Vector2(0.00f, 0.21f);

            AddCheckBox("Debug draw all mount points", MyDebugDrawSettings.DEBUG_DRAW_MOUNT_POINTS_ALL, onClick_DebugDrawMountPointsAll);
            AddCheckBox("Debug draw mount points", MyDebugDrawSettings.DEBUG_DRAW_MOUNT_POINTS, onClick_DebugDrawMountPoints);
            AddCheckBox("Forward", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_MOUNT_POINTS_AXIS0));
            AddCheckBox("Backward", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_MOUNT_POINTS_AXIS1));
            AddCheckBox("Left", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_MOUNT_POINTS_AXIS2));
            AddCheckBox("Right", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_MOUNT_POINTS_AXIS3));
            AddCheckBox("Up", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_MOUNT_POINTS_AXIS4));
            AddCheckBox("Down", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_MOUNT_POINTS_AXIS5));
            AddCheckBox("Draw autogenerated", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_MOUNT_POINTS_AUTOGENERATE));
            AddCheckBox("CubeBlock Integrity", null, MemberHelper.GetMember(() => MyDebugDrawSettings.DEBUG_DRAW_BLOCK_INTEGRITY));

            m_button = AddButton(new StringBuilder("Resave mountpoints"), onClick_Save);
            m_button.VisualStyle = MyGuiControlButtonStyleEnum.Default;

        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:73,代码来源:MyGuiScreenDebugCubeBlocks.cs

示例11: RecreateControls

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

         
         
      
            
      
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:64,代码来源:MyGuiScreenDebugCutscenes.cs


注:本文中的Sandbox.Graphics.GUI.MyGuiControlCombobox.SortItemsByValueText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。