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


C# MyGuiControlListbox.Add方法代码示例

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


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

示例1: RecreateControls

        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);
            float hiddenPartTop = (SCREEN_SIZE.Y - 1.0f) / 2.0f;
            Vector2 controlPadding = new Vector2(0.02f, 0);

            // Position the Caption
            var caption = AddCaption("Scripting Tools", Color.White.ToVector4(), controlPadding + new Vector2(-HIDDEN_PART_RIGHT, hiddenPartTop));
            m_currentPosition.Y = caption.PositionY + caption.Size.Y + ITEM_VERTICAL_PADDING;

            // Position all the controls under the caption
            // Debug draw checkbox
            PositionControls(new MyGuiControlBase[]
            {
                CreateLabel("Debug Draw"), 
                CreateCheckbox(DebugDrawCheckedChanged, MyDebugDrawSettings.ENABLE_DEBUG_DRAW)
            });
            // Selected entity controls
            m_selectedEntityNameBox = CreateTextbox("");
            PositionControls(new MyGuiControlBase[]
            {
                CreateLabel("Selected Entity: "), 
                m_selectedEntityNameBox, 
                CreateButton("Rename", RenameSelectedEntityOnClick)
            });
            m_selectedFunctionalBlockNameBox = CreateTextbox("");
            PositionControls(new MyGuiControlBase[]
            {
                CreateLabel("Selected Block: "), 
                m_selectedFunctionalBlockNameBox, 
                CreateButton("Rename", RenameFunctionalBlockOnClick)
            });
            // Spawn entity button
            PositionControls(new MyGuiControlBase[]
            {
                CreateButton("Spawn Entity", SpawnEntityClicked), 
                CreateButton("Delete Entity", DeleteEntityOnClicked)
            });

            // Trigger section
            PositionControl(CreateLabel("Triggers"));

            // Attach new trigger
            PositionControl(CreateButton("Attach to selected entity", AttachTriggerOnClick));

            m_enlargeTriggerButton = CreateButton("+", EnlargeTriggerOnClick);
            m_shrinkTriggerButton = CreateButton("-", ShrinkTriggerOnClick);
            m_setTriggerSizeButton = CreateButton("Size", SetSizeOnClick);

            // Enlarge, Set size, Shrink
            PositionControls(new MyGuiControlBase[]
            {
                m_enlargeTriggerButton, 
                m_setTriggerSizeButton, 
                m_shrinkTriggerButton
            });

            // Snap, Select, Delete
            PositionControls(new MyGuiControlBase[]
                {
                    CreateButton("Snap", SnapTriggerToCameraOrEntityOnClick),
                    CreateButton("Select", SelectTriggerOnClick),
                    CreateButton("Delete", DeleteTriggerOnClick)
                }
            );

            // Selected trigger section
            m_selectedTriggerNameBox = CreateTextbox("Trigger not selected");
            PositionControls(new MyGuiControlBase[] {CreateLabel("Selected Trigger:"), m_selectedTriggerNameBox});

            // Listbox for queried triggers
            m_triggersListBox = CreateListBox();
            m_triggersListBox.Size = new Vector2(0f, 0.06f);
            m_triggersListBox.ItemDoubleClicked += TriggersListBoxOnItemDoubleClicked;
            PositionControl(m_triggersListBox);
            // Because something is reseting the value
            m_triggersListBox.ItemSize = new Vector2(SCREEN_SIZE.X, ITEM_SIZE.Y);

            // Running Level Scripts
            PositionControl(CreateLabel("Running Level Scripts"));
            m_levelScriptListBox = CreateListBox();
            m_levelScriptListBox.Size = new Vector2(0f, 0.06f);
            PositionControl(m_levelScriptListBox);
            // Because something is reseting the value
            m_triggersListBox.ItemSize = new Vector2(SCREEN_SIZE.X, ITEM_SIZE.Y);

            // Fill with levelscripts -- they wont change during the process
            if (m_scriptManager.RunningLevelScriptNames != null)
            {
                foreach (var runningLevelScriptName in m_scriptManager.RunningLevelScriptNames)
                {
                    // user data are there to tell if the script already failed or not
                    m_levelScriptListBox.Add(new MyGuiControlListbox.Item(new StringBuilder(runningLevelScriptName),
                        userData: false));
                }
            }

            // Running State machines
            PositionControl(CreateLabel("Running state machines"));
            m_smListBox = CreateListBox();
//.........这里部分代码省略.........
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:101,代码来源:MyGuiScreenScriptingTools.cs


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