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


C# MyGuiControlCombobox.GetSelectedIndex方法代码示例

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


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

示例1: 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


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