• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# GUI.MyGuiControlList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



MyGuiControlList类属于Sandbox.Graphics.GUI命名空间,在下文中一共展示了MyGuiControlList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Add

            /// <summary>
            /// Add this area into a list
            /// </summary>
            public void Add(MyGuiControlList list, bool showAll)
            {
                m_header.Position = Vector2.Zero;
                if (m_header.Controls.Count == 0)
                {
                    m_header.Controls.Add(m_titleBackground);
                    m_header.Controls.Add(m_title);
                    m_header.Controls.Add(m_lastOccurence);
                    m_header.Controls.Add(m_separator);
                }

                bool headerAdded = false;
                Warnings.Sort(delegate(WarningLine x, WarningLine y)
                {
                    return x.Warning.Time - y.Warning.Time;
                });
                foreach (var warning in Warnings)
                {
                    if (warning.Warning.Time < 120 || showAll)
                    {
                        if (!headerAdded)
                        {
                            list.Controls.Add(m_header);
                            headerAdded = true;
                        }
                        warning.Prepare();
                        list.Controls.Add(warning.Parent);
                    }
                }
                if (headerAdded && m_graphicsButton != null)
                {
                    list.Controls.Add(m_graphicsButton);
                }
            }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:37,代码来源:MyGuiScreenPerformanceWarnings.cs


示例2: CreateSeedButton

        private MyGuiControlTextbox CreateSeedButton(MyGuiControlList list, string seedValue, float usableWidth)
        {
            var label = AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_ProceduralSeed), Color.White.ToVector4(), m_scale);
            Controls.Remove(label);
            list.Controls.Add(label);

           var textBox = new MyGuiControlTextbox(m_currentPosition, seedValue, 20, Color.White.ToVector4(), m_scale, MyGuiControlTextboxType.Normal);
            textBox.TextChanged += (MyGuiControlTextbox t) => { seedValue = t.Text; };
            textBox.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            list.Controls.Add(textBox);

            var button = CreateDebugButton(usableWidth, MySpaceTexts.ScreenDebugSpawnMenu_GenerateSeed, (MyGuiControlButton buttonClicked) => { textBox.Text = MyRandom.Instance.Next().ToString(); });
            Controls.Remove(button);
            list.Controls.Add(button);
            return textBox;
        }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:16,代码来源:MyGuiScreenDebugSpawnMenu.cs


示例3: CreateSlider

        private void CreateSlider(MyGuiControlList list, float usableWidth, float min,float max,ref MyGuiControlSlider slider)
        {
            slider = new MyGuiControlSlider(
               position: m_currentPosition,
               width: 400f / MyGuiConstants.GUI_OPTIMAL_SIZE.X,
               minValue: min,
               maxValue: max,
               labelText: String.Empty,
               labelDecimalPlaces: 4,
               labelScale: 0.75f * m_scale,
               originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
               labelFont: MyFontEnum.Debug);

            slider.DebugScale = m_sliderDebugScale;
            slider.ColorMask = Color.White.ToVector4();
            list.Controls.Add(slider);
        }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:17,代码来源:MyGuiScreenDebugSpawnMenu.cs


示例4: CreateInventoryControlsInList

        private void CreateInventoryControlsInList(List<MyEntity> owners, MyGuiControlList listControl, MyInventoryOwnerTypeEnum? filterType = null)
        {
            if (listControl.Controls.Contains(m_focusedOwnerControl))
                m_focusedOwnerControl = null;

            List<MyGuiControlBase> inventoryControlList = new List<MyGuiControlBase>();

            foreach (var owner in owners)
            {
                if (!(owner != null && owner.HasInventory))
                    continue;

                if (filterType.HasValue && (owner as MyEntity).InventoryOwnerType() != filterType)
                    continue;

                Vector4 labelColor = Color.White.ToVector4();
                if (owner is MyCubeBlock)
                {
                    labelColor = m_colorHelper.GetGridColor((owner as MyCubeBlock).CubeGrid).ToVector4();
                }

                var ownerControl = new MyGuiControlInventoryOwner(owner, labelColor);
                ownerControl.Size = new Vector2(listControl.Size.X - 0.045f, ownerControl.Size.Y);
                ownerControl.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
                foreach (var grid in ownerControl.ContentGrids)
                {
                    grid.ItemSelected += grid_ItemSelected;
                    grid.ItemDragged += grid_ItemDragged;
                    grid.ItemDoubleClicked += grid_ItemDoubleClicked;
                    grid.ItemClicked += grid_ItemClicked;
                }
                ownerControl.SizeChanged += inventoryControl_SizeChanged;
                ownerControl.InventoryContentsChanged += ownerControl_InventoryContentsChanged;

                if (owner is MyCubeBlock)
                    ownerControl.Enabled = (owner as MyCubeBlock).IsFunctional;

                // Put inventory of interacted block or character on first position.
                if (owner == m_interactedAsOwner ||
                    owner == m_userAsOwner)
                {
                    inventoryControlList.Insert(0, ownerControl);
                }
                else
                {
                    //sort by name (Inventory filters ticket)
                    inventoryControlList.Add(ownerControl);
                }
            
            }
            listControl.InitControls(inventoryControlList);
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:52,代码来源:MyTerminalInventoryController.cs


示例5: CreatePlanetMenu

        private void CreatePlanetMenu()
        {
            m_currentVoxel = null;
            MyGuiControlList list = new MyGuiControlList(size: new Vector2(SCREEN_SIZE.X,1.0f));

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

            float textScale = 0.8f;
            float usableWidth = SCREEN_SIZE.X - HIDDEN_PART_RIGHT - controlPadding.X * 2;

            m_currentPosition = Vector2.Zero;/* -m_size.Value / 2.0f;
            m_currentPosition += controlPadding;*/
            m_scale = textScale;

            var label = AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_SelectAsteroidType), Vector4.One, m_scale);
            Controls.Remove(label);
            list.Controls.Add(label);

            var combo = AddCombo();
            combo.AddItem(1, MySpaceTexts.ScreenDebugSpawnMenu_PredefinedAsteroids);
            combo.AddItem(2, MySpaceTexts.ScreenDebugSpawnMenu_ProceduralAsteroids);
            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); };

            Controls.Remove(combo);
            list.Controls.Add(combo);

            CreatePlanetControls(list, usableWidth);

            AddSeparator(list);
  
            var button = CreateDebugButton(usableWidth, MySpaceTexts.ScreenDebugSpawnMenu_SpawnAsteroid, OnSpawnProceduralAsteroid); 
            Controls.Remove(button);
            list.Controls.Add(button);

            Controls.Add(list);
        }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:39,代码来源:MyGuiScreenDebugSpawnMenu.cs


示例6: DisableUnreachableInventoryControls

        private void DisableUnreachableInventoryControls(MyInventory srcInventory, MyPhysicalInventoryItem item, MyGuiControlList list)
        {
            bool fromUser = srcInventory.Owner == m_userAsOwner;
            bool fromInteracted = srcInventory.Owner == m_interactedAsOwner;

            // srcEndpoint will be the endpoint from which we search the graph
            var srcInventoryOwner = srcInventory.Owner;
            IMyConveyorEndpointBlock srcEndpoint = null;
            // Search the interacted's graph if we want to transfer from the user
            if (fromUser)
            {
                if (m_interactedAsEntity != null)
                    srcEndpoint = m_interactedAsEntity as IMyConveyorEndpointBlock;
            }
            else if (srcInventoryOwner != null)
            {
                srcEndpoint = srcInventoryOwner as IMyConveyorEndpointBlock;
            }

            IMyConveyorEndpointBlock interactedEndpoint = null;
            if (m_interactedAsEntity != null)
            {
                interactedEndpoint = m_interactedAsEntity as IMyConveyorEndpointBlock;
            }

            if (srcEndpoint != null)
            {
                long ownerId = MySession.Static.LocalPlayerId;
                m_interactedEndpointBlock = interactedEndpoint;
                MyGridConveyorSystem.AppendReachableEndpoints(srcEndpoint.ConveyorEndpoint, ownerId, m_reachableInventoryOwners, item, m_endpointPredicate);
            }

            foreach (var control in list.Controls.GetVisibleControls())
            {
                if (!control.Enabled)
                    continue;

                var ownerControl = (MyGuiControlInventoryOwner)control;
                var owner = ownerControl.InventoryOwner;

                IMyConveyorEndpoint endpoint = null;
                var ownerBlock = owner as IMyConveyorEndpointBlock;
                if (ownerBlock != null)
                    endpoint = ownerBlock.ConveyorEndpoint;

                // TODO: Make some of these as functions so we don't have to call it even when not used due to lazy evaluation
                bool transferIsLocal = owner == srcInventoryOwner;
                bool transferIsClose = (fromUser && owner == m_interactedAsOwner) || (fromInteracted && owner == m_userAsOwner);
                bool transferIsFar = !transferIsLocal && !transferIsClose;
                bool endpointUnreachable = !m_reachableInventoryOwners.Contains(endpoint);
                bool interactedReachable = interactedEndpoint != null && m_reachableInventoryOwners.Contains(interactedEndpoint.ConveyorEndpoint);
                // If interacted is reachable but does not have inventory, than you cant take anything out from it.
                // WARNING: no need for check of null on m_interactedAsEntity, because interactedEndpoint is checked above already (that will be null also if the other is)
                bool toOwnerThroughInteracted = owner == m_userAsOwner && interactedReachable && m_interactedAsEntity.HasInventory;

                if (transferIsFar && endpointUnreachable && !toOwnerThroughInteracted)
                {
                    for (int i = 0; i < owner.InventoryCount; ++i)
                    {
                        if (!ownerControl.ContentGrids[i].Enabled)
                            continue;

                        ownerControl.ContentGrids[i].Enabled = false;
                        m_controlsDisabledWhileDragged.Add(ownerControl.ContentGrids[i]);
                    }
                }
            }

            m_reachableInventoryOwners.Clear();
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:70,代码来源:MyTerminalInventoryController.cs


示例7: CreatePlanetCanyonControlls

        private void CreatePlanetCanyonControlls(MyGuiControlList list, float usableWidth)
        {          
            var labelHillTreshold = CreateSliderWithDescription(list, usableWidth, -1.345f, -0.5f, "Planet canyon treshold", ref m_planetCanyonTreshold);
            m_planetCanyonTreshold.ValueChanged += (MyGuiControlSlider s) =>
            {
                labelHillTreshold.Text = MyValueFormatter.GetFormatedFloat(s.Value, 3);
            };
            m_planetCanyonTreshold.Value = -0.8f;

            var labelHillBlendTreshold = CreateSliderWithDescription(list, usableWidth, 0f, 1f, "Planet canyon blend size", ref m_planetCanyonBlendTreshold);
            m_planetCanyonBlendTreshold.ValueChanged += (MyGuiControlSlider s) =>
            {
                labelHillBlendTreshold.Text = MyValueFormatter.GetFormatedFloat(s.Value, 2);
            };
            m_planetCanyonBlendTreshold.Value = 0.1f;

            var labelHillSizeRatio = CreateSliderWithDescription(list, usableWidth, 1.0f, 5.0f, "Planet canyon size ratio", ref m_planetCanyonSizeRatio);
            m_planetCanyonSizeRatio.ValueChanged += (MyGuiControlSlider s) =>
            {
                labelHillSizeRatio.Text = MyValueFormatter.GetFormatedFloat(s.Value, 3);
                m_planetCanyonRatioValue = s.Value;
            };
            m_planetCanyonSizeRatio.Value = m_planetCanyonRatioValue;
            m_planetCanyonSizeRatio.ValueChanged += OnPlanetCanyonRatioChanged;

            var labelHillFrequency = CreateSliderWithDescription(list, usableWidth, 0.1f, 3f, "Planet canyon frequency", ref m_planetCanyonFrequency);
            m_planetCanyonFrequency.ValueChanged += (MyGuiControlSlider s) =>
            {
                labelHillFrequency.Text = MyValueFormatter.GetFormatedFloat(s.Value, 2);
            };
            m_planetCanyonFrequency.Value = 0.11f;

            var labelCanoynNumNoises = CreateSliderWithDescription(list, usableWidth, 1f, 2f, "Planet canyon num noises", ref m_planetCanyonNumNoises);
            m_planetCanyonNumNoises.ValueChanged += (MyGuiControlSlider s) =>
            {
                int value = (int)Math.Ceiling(s.Value);
                labelCanoynNumNoises.Text = value.ToString();
            };
            m_planetCanyonNumNoises.Value = 0.9f;
        }
开发者ID:caomw,项目名称:SpaceEngineers,代码行数:40,代码来源:MyGuiScreenDebugSpawnMenu.cs


示例8: CreatePlanetControls

        private void CreatePlanetControls(MyGuiControlList list, float usableWidth)
        {
            var labelDeviation = CreateSliderWithDescription(list, usableWidth, 0f, 1f, "Planet deviation scale", ref m_procAsteroidDeviationScale);
               
            m_procAsteroidDeviationScale.ValueChanged += (MyGuiControlSlider s) =>
            {
                float value = DenormalizeLog(s.Value, MIN_DEVIATION, MAX_DEVIATION);
                labelDeviation.Text = MyValueFormatter.GetFormatedFloat(value * 100.0f, 3) + "%";
                m_planetDeviationScaleValue = value;
            };
            m_procAsteroidDeviationScale.Value = NormalizeLog(0.003f, MIN_DEVIATION, MAX_DEVIATION);
            labelDeviation.Text = MyValueFormatter.GetFormatedFloat(0.003f * 100.0f, 3) + "%";
            m_procAsteroidDeviationScale.ValueChanged += OnPlanetDeviationChanged;

            var asteroidSizeLabel = CreateSliderWithDescription(list, usableWidth, 8000f, 50000f, MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_ProceduralSize), ref m_procAsteroidSize);

            m_procAsteroidSize.ValueChanged += (MyGuiControlSlider s) => { asteroidSizeLabel.Text = MyValueFormatter.GetFormatedFloat(s.Value, 0) + "m"; m_procAsteroidSizeValue = s.Value; };
            m_procAsteroidSize.Value = 8000.1f;
            m_procAsteroidSize.ValueChanged += OnPlanetSizeChanged;

            var labelNoise = CreateSliderWithDescription(list, usableWidth, 0.1f, 5f, "Planet structures ratio", ref m_planetStructureRatio);
            m_planetStructureRatio.ValueChanged += (MyGuiControlSlider s) =>
            {
                labelNoise.Text = MyValueFormatter.GetFormatedFloat(s.Value, 2);
            };
            m_planetStructureRatio.Value = 1f;

            var labelNormalNoise = CreateSliderWithDescription(list, usableWidth, 0.1f, 10f, "Planet normal noise ratio", ref m_normalNoiseFrequency);
            m_normalNoiseFrequency.ValueChanged += (MyGuiControlSlider s) =>
            {
                labelNormalNoise.Text = MyValueFormatter.GetFormatedFloat(s.Value, 2);
            };
            m_normalNoiseFrequency.Value = 1f;

            m_procAsteroidSeed = CreateSeedButton(list, m_procAsteroidSeedValue, usableWidth);
        
            var label = AddLabel("Atmosphere", Color.White.ToVector4(), m_scale);
            Controls.Remove(label);
            list.Controls.Add(label);

            m_planetAtmosphere = new MyGuiControlCheckbox(m_currentPosition);
            m_planetAtmosphere.IsChecked = true;
            list.Controls.Add(m_planetAtmosphere);
        }
开发者ID:caomw,项目名称:SpaceEngineers,代码行数:44,代码来源:MyGuiScreenDebugSpawnMenu.cs


示例9: CreateInventoryControlInList

        private void CreateInventoryControlInList(IMyInventoryOwner owner, MyGuiControlList listControl)
        {
            List<IMyInventoryOwner> inventories = new List<IMyInventoryOwner>();
            if (owner != null)
                inventories.Add(owner);

            CreateInventoryControlsInList(inventories, listControl);
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:8,代码来源:MyTerminalInventoryController.cs


示例10: CreatePlanetHillControlls

        private void CreatePlanetHillControlls(MyGuiControlList list, float usableWidth)
        {
            var labelHillTreshold = CreateSliderWithDescription(list, usableWidth, 0f, 2f, "Planet hill treshold", ref m_planetHillTreshold);
            m_planetHillTreshold.ValueChanged += (MyGuiControlSlider s) =>
            {
                labelHillTreshold.Text = MyValueFormatter.GetFormatedFloat(s.Value, 3);
            };
            m_planetHillTreshold.Value = 0.5f;

            var labelHillBlendTreshold = CreateSliderWithDescription(list, usableWidth, 0f, 1f, "Planet hill blend size", ref m_planetHillBlendTreshold);
            m_planetHillBlendTreshold.ValueChanged += (MyGuiControlSlider s) =>
            {
                labelHillBlendTreshold.Text = MyValueFormatter.GetFormatedFloat(s.Value, 2);
            };
            m_planetHillBlendTreshold.Value = 0.4f;

            var labelHillSizeRatio = CreateSliderWithDescription(list, usableWidth, 1f, 5f, "Planet hill size ratio", ref m_planetHillSizeRatio);
            m_planetHillSizeRatio.ValueChanged += (MyGuiControlSlider s) =>
            {
                labelHillSizeRatio.Text = MyValueFormatter.GetFormatedFloat(s.Value, 3);
                m_planetHillRatioValue = s.Value;
            };
            m_planetHillSizeRatio.Value = m_planetHillRatioValue;
            m_planetHillSizeRatio.ValueChanged += OnPlanetHillRatioChanged;

            var labelHillFrequency = CreateSliderWithDescription(list, usableWidth, 0.1f, 4f, "Planet hill frequency", ref m_planetHillFrequency);
            m_planetHillFrequency.ValueChanged += (MyGuiControlSlider s) =>
            {
                labelHillFrequency.Text = MyValueFormatter.GetFormatedFloat(s.Value, 2);
            };
            m_planetHillFrequency.Value = 2f;

            var labelHillNumNoises = CreateSliderWithDescription(list, usableWidth, 1f, 4f, "Planet hill num noises", ref m_planetHillNumNoises);
            m_planetHillNumNoises.ValueChanged += (MyGuiControlSlider s) =>
            {
                int value = (int)Math.Ceiling(s.Value);
                labelHillNumNoises.Text = value.ToString();
            };
            m_planetHillNumNoises.Value = 2f;
        }
开发者ID:caomw,项目名称:SpaceEngineers,代码行数:40,代码来源:MyGuiScreenDebugSpawnMenu.cs


示例11: RecreateControls

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

            ProfilerShort.Begin("MyGuiScreenCubeBuilder.RecreateControls");

            m_gridBlocks.MouseOverIndexChanged += OnGridMouseOverIndexChanged;
            m_gridBlocks.ItemSelected += OnSelectedItemChanged;

            m_blockInfoStyle = new MyGuiControlBlockInfo.MyControlBlockInfoStyle()
			{
				BlockNameLabelFont = MyFontEnum.White,
				EnableBlockTypeLabel = false,
				ComponentsLabelText = MySpaceTexts.HudBlockInfo_Components,
				ComponentsLabelFont = MyFontEnum.Blue,
				InstalledRequiredLabelText = MySpaceTexts.HudBlockInfo_Installed_Required,
				InstalledRequiredLabelFont = MyFontEnum.Blue,
                RequiredLabelText = MyCommonTexts.HudBlockInfo_Required,
				IntegrityLabelFont = MyFontEnum.White,
				IntegrityBackgroundColor = new Vector4(78 / 255.0f, 116 / 255.0f, 137 / 255.0f, 1.0f),
				IntegrityForegroundColor = new Vector4(0.5f, 0.1f, 0.1f, 1),
				IntegrityForegroundColorOverCritical = new Vector4(118 / 255.0f, 166 / 255.0f, 192 / 255.0f, 1.0f),
				LeftColumnBackgroundColor = new Vector4(46 / 255.0f, 76 / 255.0f, 94 / 255.0f, 1.0f),
				TitleBackgroundColor = new Vector4(72 / 255.0f, 109 / 255.0f, 130 / 255.0f, 1.0f),
				ComponentLineMissingFont = MyFontEnum.Red,
				ComponentLineAllMountedFont = MyFontEnum.White,
				ComponentLineAllInstalledFont = MyFontEnum.Blue,
				ComponentLineDefaultFont = MyFontEnum.White,
				ComponentLineDefaultColor = new Vector4(0.6f, 0.6f, 0.6f, 1f),
				ShowAvailableComponents = false,
                EnableBlockTypePanel = false,
			};

            m_rbGridSizeSmall = (MyGuiControlRadioButton)Controls.GetControlByName("GridSizeSmall");
            if(m_rbGridSizeSmall == null) 
                Debug.Fail("Someone changed CubeBuilder.gsc file in Content folder? Please check");

            m_rbGridSizeSmall.HighlightType = MyGuiControlHighlightType.NEVER;
            m_rbGridSizeSmall.SelectedChanged += OnGridSizeSmallSelected;

            m_rbGridSizeLarge = (MyGuiControlRadioButton)Controls.GetControlByName("GridSizeLarge");
            if (m_rbGridSizeLarge == null)
                Debug.Fail("Someone changed CubeBuilder.gsc file in Content folder? Please check");

            m_rbGridSizeLarge.HighlightType = MyGuiControlHighlightType.NEVER;
            m_rbGridSizeLarge.SelectedChanged += OnGridSizeLargeSelected;

            m_rbGroupGridSize = new MyGuiControlRadioButtonGroup { m_rbGridSizeSmall, m_rbGridSizeLarge };
            if (MyCubeBuilder.Static != null)
            {
                m_rbGroupGridSize.SelectedIndex = MyCubeBuilder.Static.CubeBuilderState.CubeSizeMode == MyCubeSize.Small ? 0 : 1;
            }

            MyGuiControlLabel gridSizeLabel = (MyGuiControlLabel)Controls.GetControlByName("GridSizeHintLabel");
            gridSizeLabel.Text = string.Format(MyTexts.GetString(gridSizeLabel.TextEnum), MyGuiSandbox.GetKeyName(MyControlsSpace.CUBE_BUILDER_CUBESIZE_MODE));

            m_blockInfoList = (MyGuiControlList)Controls.GetControlByName("BlockInfoPanel");
            if (m_blockInfoList == null)
                Debug.Fail("Someone changed CubeBuilder.gsc file in Content folder? Please check");



            //m_blockInfoSmall = new MyGuiControlBlockInfo(style, false, false);
            //m_blockInfoSmall.Visible = false;
            //m_blockInfoSmall.IsActiveControl = false;
            //m_blockInfoSmall.BlockInfo = new MyHudBlockInfo();
            //m_blockInfoSmall.Position = new Vector2(0.28f, -0.04f);
            //m_blockInfoSmall.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            //Controls.Add(m_blockInfoSmall);
            //m_blockInfoLarge = new MyGuiControlBlockInfo(style, false, true);
            //m_blockInfoLarge.Visible = false;
            //m_blockInfoLarge.IsActiveControl = false;
            //m_blockInfoLarge.BlockInfo = new MyHudBlockInfo();
            //m_blockInfoLarge.Position = new Vector2(0.28f, -0.06f);
            //m_blockInfoLarge.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
            //Controls.Add(m_blockInfoLarge);

            ProfilerShort.End();
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:79,代码来源:MyGuiScreenCubeBuilder.cs


示例12: MyGuiControlGenericFunctionalBlock

        internal MyGuiControlGenericFunctionalBlock(MyTerminalBlock[] blocks) :
            base(canHaveFocus: true,
                  allowFocusingElements: true,
                  isActiveControl: false)
        {
            this.m_currentBlocks = blocks;

            m_separatorList = new MyGuiControlSeparatorList();
            Elements.Add(m_separatorList);

            m_terminalControlList = new MyGuiControlList();
            m_terminalControlList.VisualStyle = MyGuiControlListStyleEnum.Simple;
            m_terminalControlList.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP;
            m_terminalControlList.Position = new Vector2(0.1f, 0.1f);
            Elements.Add(m_terminalControlList);

            m_blockPropertiesMultilineText = new MyGuiControlMultilineText(
                position: new Vector2(0.049f, -0.195f),
                size: new Vector2(0.39f, 0.635f),
                font: MyFontEnum.Blue,
                textScale: 0.85f,
                textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP
                );
            m_blockPropertiesMultilineText.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_blockPropertiesMultilineText.Text = new StringBuilder();
            Elements.Add(m_blockPropertiesMultilineText);

            m_transferToCombobox = new MyGuiControlCombobox(
                Vector2.Zero,
                new Vector2(0.15f, 0.1f),
                null, null);
            m_transferToCombobox.ItemSelected += m_transferToCombobox_ItemSelected;
            Elements.Add(m_transferToCombobox);

            m_shareModeCombobox = new MyGuiControlCombobox(
            Vector2.Zero,
            new Vector2(0.25f, 0.1f),
            null, null);
            m_shareModeCombobox.ItemSelected += m_shareModeCombobox_ItemSelected;
            Elements.Add(m_shareModeCombobox);

            m_ownershipLabel = new MyGuiControlLabel(
                Vector2.Zero, null, MyTexts.GetString(MySpaceTexts.BlockOwner_Owner) + ":");
            Elements.Add(m_ownershipLabel);

            m_ownerLabel = new MyGuiControlLabel(
                Vector2.Zero, null, String.Empty);
            Elements.Add(m_ownerLabel);

            m_transferToLabel = new MyGuiControlLabel(
                Vector2.Zero, null, MyTexts.GetString(MySpaceTexts.BlockOwner_TransferTo));
            Elements.Add(m_transferToLabel);

            if (MySession.Static.CreativeMode)
            {
                var topLeftRelative = Vector2.One * -0.5f;
                Vector2 leftColumnSize = new Vector2(0.3f, 0.55f);
                var position = topLeftRelative + new Vector2(leftColumnSize.X + 0.503f, 0.42f);

                m_npcButton = new MyGuiControlButton(
                    position,
                    MyGuiControlButtonStyleEnum.Tiny,
                    new Vector2(0.1f, 0.1f),
                    null, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, MyTexts.GetString(MyCommonTexts.AddNewNPC), new StringBuilder("+"),
                    MyGuiConstants.DEFAULT_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiControlHighlightType.WHEN_ACTIVE, true,
                    OnNewNpcClick, GuiSounds.MouseClick, 0.75f);
                Elements.Add(m_npcButton);
            }


            RecreateBlockControls();
            RecreateOwnershipControls();

            if (m_currentBlocks.Length > 0)
            {
                m_currentBlocks[0].PropertiesChanged += block_PropertiesChanged;
            }

            foreach (var block in m_currentBlocks)
            {
                block.OwnershipChanged += block_OwnershipChanged;
                block.VisibilityChanged += block_VisibilityChanged;
            }

            Sync.Players.IdentitiesChanged += Players_IdentitiesChanged;

            UpdateDetailedInfo();

            Size = new Vector2(0.595f, 0.64f);
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:91,代码来源:MyGuiControlGenericFunctionalBlock.cs


示例13: RecreateControls

        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);
            AddCaption(MyTexts.GetString(MyCommonTexts.PerformanceWarningHelpHeader));

            m_warningsList = new MyGuiControlList(position: new Vector2(0f, -0.05f), size: new Vector2(0.92f, 0.7f));
            var m_showWarningsLabel = new MyGuiControlLabel(
                text: MyTexts.GetString(MyCommonTexts.ScreenOptionsGame_EnablePerformanceWarnings), 
                position: new Vector2(-0.17f, 0.35f),
                originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER
                );
            m_showWarningsCheckBox = new MyGuiControlCheckbox(
                toolTip: MyTexts.GetString(MyCommonTexts.ToolTipGameOptionsEnablePerformanceWarnings), 
                position: new Vector2(-0.15f, 0.35f),
                originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER
                );
            m_showWarningsCheckBox.IsChecked = MySandboxGame.Config.EnablePerformanceWarnings;
            m_showWarningsCheckBox.IsCheckedChanged += ShowWarningsChanged;

            var m_showAllLabel = new MyGuiControlLabel(
                text: MyTexts.GetString(MyCommonTexts.PerformanceWarningShowAll),
                position: new Vector2(0.25f, 0.35f),
                originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER
                );
            m_showAllCheckBox = new MyGuiControlCheckbox(
                toolTip: MyTexts.GetString(MyCommonTexts.ToolTipPerformanceWarningShowAll),
                position: new Vector2(0.27f, 0.35f),
                originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER
                );
            m_showAllCheckBox.IsChecked = m_showAll;
            m_showAllCheckBox.IsCheckedChanged += KeepInListChanged;

            m_okButton = new MyGuiControlButton(position: new Vector2(0, 0.42f), text: MyTexts.Get(MyCommonTexts.Ok));
            m_okButton.ButtonClicked += m_okButton_ButtonClicked;

            Controls.Add(m_warningsList);
            Controls.Add(m_showWarningsLabel);
            Controls.Add(m_showWarningsCheckBox);
            Controls.Add(m_showAllLabel);
            Controls.Add(m_showAllCheckBox);
            Controls.Add(m_okButton);

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


示例14: SearchInList

        private void SearchInList(MyGuiControlTextbox searchText, MyGuiControlList list, bool hideEmpty)
        {
            if (searchText.Text != "")
            {
                String[] tmpSearch = searchText.Text.ToLower().Split(' ');

                foreach (var item in list.Controls)
                {
                    var owner   = (item as MyGuiControlInventoryOwner).InventoryOwner;
                    var tmp     = (owner as MyEntity).DisplayNameText.ToString().ToLower();
                    var add     = true;
                    var isEmpty = true;

                    foreach (var search in tmpSearch)
                    {
                        if (!tmp.Contains(search))
                        {
                            add = false;
                            break;
                        }
                    }

                    if (!add)
                    {
                        for (int i = 0; i < owner.InventoryCount; i++)
                        {
                            System.Diagnostics.Debug.Assert(owner.GetInventory(i) as MyInventory != null, "Null or other inventory type!");

                            foreach (var inventoryItem in (owner.GetInventory(i) as MyInventory).GetItems())
                            {
                                bool matches = true;
                                string inventoryItemName = MyDefinitionManager.Static.GetPhysicalItemDefinition(inventoryItem.Content).DisplayNameText.ToString().ToLower();
                                foreach (var search in tmpSearch)
                                {
                                    if (!inventoryItemName.Contains(search))
                                    {
                                        matches = false;
                                        break;
                                    }
                                }

                                if (matches)
                                {
                                    add = true;
                                    break;
                                }
                            }
                            if (add)
                            {
                                break;
                            }
                        }
                    }

                    if (add)
                    {
                        for (int i = 0; i < owner.InventoryCount; ++i)
                        {
                            if (owner.GetInventory(i).CurrentMass != 0)
                            {
                                isEmpty = false;
                                break;
                            }
                        }
                        item.Visible = (hideEmpty && isEmpty) ? false : true;
                    }
                    else
                        item.Visible = false;
                }
            }
            else
            {
                foreach (var item in list.Controls)
                {
                    bool isEmpty = true;
                    var owner = (item as MyGuiControlInventoryOwner).InventoryOwner;

                    for (int i = 0; i < owner.InventoryCount; ++i)
                    {
                        if (owner.GetInventory(i).CurrentMass != 0)
                        {
                            isEmpty = false;
                            break;
                        }
                    }

                    if (hideEmpty && isEmpty)
                        item.Visible = false;
                    else
                        item.Visible = true;
                }
            }
            list.SetScrollBarPage();
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:94,代码来源:MyTerminalInventoryController.cs


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


示例16: Init

        public void Init(IMyGuiControlsParent controlsParent, MyEntity thisEntity, MyEntity interactedEntity, MyGridColorHelper colorHelper)
        {
            ProfilerShort.Begin("MyGuiScreenTerminal.ControllerInventory.Init");
            m_userAsEntity = thisEntity;
            m_interactedAsEntity = interactedEntity;
            m_colorHelper = colorHelper;

            m_leftOwnersControl = (MyGuiControlList)controlsParent.Controls.GetControlByName("LeftInventory");
            m_rightOwnersControl = (MyGuiControlList)controlsParent.Controls.GetControlByName("RightInventory");

            m_leftSuitButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftSuitButton");
            m_leftGridButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftGridButton");
            m_leftFilterStorageButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftFilterStorageButton");
            m_leftFilterSystemButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftFilterSystemButton");
            m_leftFilterEnergyButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftFilterEnergyButton");
            m_leftFilterAllButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftFilterAllButton");

            m_rightSuitButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightSuitButton");
            m_rightGridButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightGridButton");
            m_rightFilterStorageButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightFilterStorageButton");
            m_rightFilterSystemButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightFilterSystemButton");
            m_rightFilterEnergyButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightFilterEnergyButton");
            m_rightFilterAllButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightFilterAllButton");

            m_throwOutButton = (MyGuiControlButton)controlsParent.Controls.GetControlByName("ThrowOutButton");

            m_hideEmptyLeft         = (MyGuiControlCheckbox)controlsParent.Controls.GetControlByName("CheckboxHideEmptyLeft");
            m_hideEmptyLeftLabel    = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("LabelHideEmptyLeft");
            m 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# GUI.MyGuiControlListbox类代码示例发布时间:2022-05-26
下一篇:
C# GUI.MyGuiControlLabel类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap