當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。