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

C# GUI.MyGuiControlListbox类代码示例

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

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



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

示例1: MyGuiControlContextMenu

        public MyGuiControlContextMenu()
        {
            m_itemsList = new MyGuiControlListbox();
            m_itemsList.Name = "ContextMenuListbox";
            m_itemsList.VisibleRowsCount = NUM_VISIBLE_ITEMS;
            Enabled = false;

            m_keys = new MyContextMenuKeyTimerController[3];
            m_keys[(int)MyContextMenuKeys.UP] = new MyContextMenuKeyTimerController(MyKeys.Up);
            m_keys[(int)MyContextMenuKeys.DOWN] = new MyContextMenuKeyTimerController(MyKeys.Down);
            m_keys[(int)MyContextMenuKeys.ENTER] = new MyContextMenuKeyTimerController(MyKeys.Enter);

            Name = "ContextMenu";
            Elements.Add(m_itemsList);
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:15,代码来源:MyGuiControlContextMenu.cs


示例2: MyGuiDetailScreenBase

 public MyGuiDetailScreenBase(bool isTopMostScreen, MyGuiBlueprintScreenBase parent, string thumbnailTexture, MyGuiControlListbox.Item selectedItem, float textScale)
     : base(new Vector2(0.37f, 0.325f), new Vector2(0.725f, 0.4f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, isTopMostScreen)
 {
     m_thumbnailImage = new MyGuiControlImage()
     {
         BackgroundTexture = MyGuiConstants.TEXTURE_RECTANGLE_DARK,
     };
     m_thumbnailImage.SetPadding(new MyGuiBorderThickness(3f, 2f, 3f, 2f));
     m_thumbnailImage.SetTexture(thumbnailTexture);
     
     m_selectedItem = selectedItem;
     m_blueprintName = selectedItem.Text.ToString();
     m_textScale = textScale;
     m_parent = parent;
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:15,代码来源:MyGuiDetailScreen.cs


示例3: MyGuiDetailScreenBase

 public MyGuiDetailScreenBase(bool isTopMostScreen, MyGuiBlueprintScreenBase parent, MyGuiCompositeTexture thumbnailTexture, MyGuiControlListbox.Item selectedItem, float textScale)
     : base(new Vector2(0.37f, 0.325f), new Vector2(0.725f, 0.4f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, isTopMostScreen)
 {
     m_thumbnailImage = new MyGuiControlImageButton(true);
     if (thumbnailTexture == null)
     {
         m_thumbnailImage.Visible = false;
     }
     else
     {
         m_thumbnailImage.BackgroundTexture = thumbnailTexture;
     }
     m_selectedItem = selectedItem;
     m_blueprintName = selectedItem.Text.ToString();
     m_textScale = textScale;
     m_parent = parent;
 }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:17,代码来源:MyGuiDetailScreen.cs


示例4: Init

        public void Init(IMyGuiControlsParent controlsParent)
        {
            m_playerList = (MyGuiControlListbox)controlsParent.Controls.GetControlByName("PlayerListbox");
            m_factionList = (MyGuiControlListbox)controlsParent.Controls.GetControlByName("FactionListbox");

            m_chatHistory = (MyGuiControlMultilineText)controlsParent.Controls.GetControlByName("ChatHistory");
            m_chatbox = (MyGuiControlTextbox)controlsParent.Controls.GetControlByName("Chatbox");

            m_playerList.ItemsSelected += m_playerList_ItemsSelected;
            m_playerList.MultiSelect = false;

            m_factionList.ItemsSelected += m_factionList_ItemsSelected;
            m_factionList.MultiSelect = false;

            m_sendButton = (MyGuiControlButton)controlsParent.Controls.GetControlByName("SendButton");
            m_sendButton.ButtonClicked += m_sendButton_ButtonClicked;

            m_chatbox.TextChanged += m_chatbox_TextChanged;
            m_chatbox.EnterPressed += m_chatbox_EnterPressed;

            if (MySession.Static.LocalCharacter != null)
            {
                MySession.Static.ChatSystem.PlayerMessageReceived += MyChatSystem_PlayerMessageReceived;
                MySession.Static.ChatSystem.FactionMessageReceived += MyChatSystem_FactionMessageReceived;
                MySession.Static.ChatSystem.GlobalMessageReceived += MyChatSystem_GlobalMessageReceived;

                MySession.Static.ChatSystem.FactionHistoryDeleted += ChatSystem_FactionHistoryDeleted;
                MySession.Static.ChatSystem.PlayerHistoryDeleted += ChatSystem_PlayerHistoryDeleted;
            }

            MySession.Static.Players.PlayersChanged += Players_PlayersChanged;
            
            RefreshLists();

            m_chatbox.SetText(m_emptyText);
            m_sendButton.Enabled = false;

            if (MyMultiplayer.Static != null)
            {
                MyMultiplayer.Static.ChatMessageReceived += Multiplayer_ChatMessageReceived;
            }


            m_closed = false;
        }
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:45,代码来源:MyTerminalChatController.cs


示例5: OnSelectItem

        void OnSelectItem(MyGuiControlListbox list)
        {
            if (list.SelectedItems.Count == 0)
            {
                return;
            }
            
            m_selectedItem = list.SelectedItems[0];
            m_detailsButton.Enabled = true;
            m_screenshotButton.Enabled = true;
            m_replaceButton.Enabled = m_clipboard.HasCopiedGrids();

            var type = (m_selectedItem.UserData as MyBlueprintItemInfo).Type;
            var id = (m_selectedItem.UserData as MyBlueprintItemInfo).PublishedItemId;
            var path = "";

            if (type == MyBlueprintTypeEnum.LOCAL)
            {
                path = Path.Combine(m_localBlueprintFolder, m_selectedItem.Text.ToString(), "thumb.png");
                m_deleteButton.Enabled = true;
            }
            else if (type == MyBlueprintTypeEnum.STEAM)
            {
                path = Path.Combine(m_workshopBlueprintFolder, "temp", id.ToString(), "thumb.png");
                m_screenshotButton.Enabled = false;
                m_replaceButton.Enabled = false;
                m_deleteButton.Enabled = false;
            }
            else if (type == MyBlueprintTypeEnum.SHARED)
            {
                m_replaceButton.Enabled = false;
                m_screenshotButton.Enabled = false;
                m_detailsButton.Enabled = false;
                m_deleteButton.Enabled = false;
            }
            else if (type == MyBlueprintTypeEnum.DEFAULT)
            {
                path = Path.Combine(m_defaultBlueprintFolder, m_selectedItem.Text.ToString(), "thumb.png");
                m_replaceButton.Enabled = false;
                m_screenshotButton.Enabled = false;
                m_deleteButton.Enabled = false;
            }

            if (File.Exists(path))
            {
                m_selectedImage.SetTexture(path);
            }

            else
            {
                m_selectedImage.BackgroundTexture = null;
            }
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:53,代码来源:MyGuiBlueprintScreen.cs


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


示例7: OnMouseOverItem

        void OnMouseOverItem(MyGuiControlListbox listBox)
        {
            var item = listBox.MouseOverItem;
            var path = "";
            if (item != null)
            {
                if ((item.UserData as MyBlueprintItemInfo).Type == MyBlueprintTypeEnum.LOCAL)
                {
                    path = Path.Combine(m_localBlueprintFolder, item.Text.ToString(), "thumb.png");
                    
                }
                else if ((item.UserData as MyBlueprintItemInfo).Type == MyBlueprintTypeEnum.STEAM)
                {
                    var id = (item.UserData as MyBlueprintItemInfo).PublishedItemId;
                    if (id != null)
                    {
                        path = Path.Combine(m_workshopBlueprintFolder, "temp", id.ToString(), "thumb.png");
                    }
                }
                else if ((item.UserData as MyBlueprintItemInfo).Type == MyBlueprintTypeEnum.DEFAULT)
                {
                    path = Path.Combine(m_defaultBlueprintFolder, item.Text.ToString(), "thumb.png");
                }

                if (File.Exists(path))
                {
                    m_thumbnailImage.SetTexture(path);
                    if (!m_activeDetail)
                    {
                        if (m_thumbnailImage.BackgroundTexture != null)
                        {
                            m_thumbnailImage.Visible = true;
                        }
                    }
                }
                else
                {
                    m_thumbnailImage.Visible = false;
                    m_thumbnailImage.BackgroundTexture = null;
                }
            }
            else
            {
                m_thumbnailImage.Visible = false;
            }
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:46,代码来源:MyGuiBlueprintScreen.cs


示例8: list_ItemClicked

        void list_ItemClicked(MyGuiControlListbox sender)
        {
            if (!Visible)
                return;

            int selectedIndex = -1;
            object userData = null;
            foreach (var item in sender.SelectedItems)
            {
                selectedIndex = sender.Items.IndexOf(item);
                userData = item.UserData;
                break;
            }

            if (ItemClicked != null)
                ItemClicked(this, new EventArgs { ItemIndex = selectedIndex, UserData = userData });

            //GK: If the item list have scrollbar and we are over the caret then let scrollbar hanlde input. In any other case disappear when clicked
            if(!m_itemsList.IsOverScrollBar())
                Deactivate();
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:21,代码来源:MyGuiControlContextMenu.cs


示例9: MyGuiDetailScreenLocal

        public MyGuiDetailScreenLocal(Action<MyGuiControlListbox.Item> callBack, MyGuiControlListbox.Item selectedItem, MyGuiBlueprintScreenBase parent , MyGuiCompositeTexture thumbnailTexture, float textScale) :
            base(false, parent, thumbnailTexture, selectedItem, textScale)
        {
            var prefabPath = Path.Combine(m_localBlueprintFolder, m_blueprintName, "bp.sbc");
            this.callBack = callBack;

            if (File.Exists(prefabPath))
            {
                m_loadedPrefab = LoadPrefab(prefabPath);

                if (m_loadedPrefab == null)
                {
                    MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                        buttonType: MyMessageBoxButtonsType.OK,
                        styleEnum: MyMessageBoxStyleEnum.Error,
                        messageCaption: new StringBuilder("Error"),
                        messageText: new StringBuilder("Failed to load the blueprint file.")
                        ));
                    m_killScreen = true;
                }
                else
                {
                    RecreateControls(true);
                }
            }
            else 
            {
                m_killScreen = true;
            }
        }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:30,代码来源:MyGuiDetailScreen.cs


示例10: m_factionList_ItemsSelected

        void m_factionList_ItemsSelected(MyGuiControlListbox obj)
        {
            if (m_factionList.SelectedItems.Count > 0)
            {
                var selectedItem = m_factionList.SelectedItems[0];
                var faction = (MyFaction)selectedItem.UserData;
                RefreshFactionChatHistory(faction);

                var factions = MySession.Static.Factions;
                var localFaction = factions.TryGetPlayerFaction(MySession.Static.LocalPlayerId);
                if (localFaction != null)
                {
                    MyFactionChatHistory factionChat = MyChatSystem.FindFactionChatHistory(faction.FactionId, localFaction.FactionId);
                    if (factionChat != null)
                    {
                        factionChat.UnreadMessageCount = 0;
                        UpdateFactionList(true);
                    }
                }

                m_chatbox.SetText(m_emptyText);
            }
        }
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:23,代码来源:MyTerminalChatController.cs


示例11: list_ItemClicked

        void list_ItemClicked(MyGuiControlListbox sender)
        {
            if (!Visible)
                return;

            int selectedIndex = -1;
            object userData = null;
            foreach (var item in sender.SelectedItems)
            {
                selectedIndex = sender.Items.IndexOf(item);
                userData = item.UserData;
                break;
            }

            if (ItemClicked != null)
                ItemClicked(this, new EventArgs { ItemIndex = selectedIndex, UserData = userData });

            //A context menu always disappears when clicked
            Deactivate();
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:20,代码来源:MyGuiControlContextMenu.cs


示例12: OnItemDoubleClick

 void OnItemDoubleClick(MyGuiControlListbox list)
 {
     m_selectedItem = list.SelectedItems[0];
     Ok();        
 }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:5,代码来源:MyGuiBlueprintScreen.cs


示例13: CreateTerminalControls

        protected override void CreateTerminalControls()
        {
            if (MyTerminalControlFactory.AreControlsCreated<MyRemoteControl>())
                return;
            base.CreateTerminalControls();
            var controlBtn = new MyTerminalControlButton<MyRemoteControl>("Control", MySpaceTexts.ControlRemote, MySpaceTexts.Blank, (b) => b.RequestControl());
            controlBtn.Enabled = r => r.CanControl();
            controlBtn.SupportsMultipleBlocks = false;
            var action = controlBtn.EnableAction(MyTerminalActionIcons.TOGGLE);
            if (action != null)
            {
                action.InvalidToolbarTypes = new List<MyToolbarType> { MyToolbarType.ButtonPanel };
                action.ValidForGroups = false;
            }
            MyTerminalControlFactory.AddControl(controlBtn);

            
            var autoPilotSeparator = new MyTerminalControlSeparator<MyRemoteControl>();
            MyTerminalControlFactory.AddControl(autoPilotSeparator);

            var autoPilot = new MyTerminalControlOnOffSwitch<MyRemoteControl>("AutoPilot", MySpaceTexts.BlockPropertyTitle_AutoPilot, MySpaceTexts.Blank);
            autoPilot.Getter = (x) => x.m_autoPilotEnabled;
            autoPilot.Setter = (x, v) => x.SetAutoPilotEnabled(v);
            autoPilot.Enabled = r => r.CanEnableAutoPilot();
            autoPilot.EnableToggleAction();
            autoPilot.EnableOnOffActions();
            MyTerminalControlFactory.AddControl(autoPilot);

            var collisionAv = new MyTerminalControlOnOffSwitch<MyRemoteControl>("CollisionAvoidance", MySpaceTexts.BlockPropertyTitle_CollisionAvoidance, MySpaceTexts.Blank);
            collisionAv.Getter = (x) => x.m_useCollisionAvoidance;
            collisionAv.Setter = (x, v) => x.SetCollisionAvoidance(v);
            collisionAv.Enabled = r => true;
            collisionAv.EnableToggleAction();
            collisionAv.EnableOnOffActions();
            MyTerminalControlFactory.AddControl(collisionAv);

            var dockignMode = new MyTerminalControlOnOffSwitch<MyRemoteControl>("DockingMode", MySpaceTexts.BlockPropertyTitle_EnableDockingMode, MySpaceTexts.Blank);
            dockignMode.Getter = (x) => x.m_dockingModeEnabled;
            dockignMode.Setter = (x, v) => x.SetDockingMode(v);
            dockignMode.Enabled = r => r.IsWorking;
            dockignMode.EnableToggleAction();
            dockignMode.EnableOnOffActions();
            MyTerminalControlFactory.AddControl(dockignMode);

            var cameraList = new MyTerminalControlCombobox<MyRemoteControl>("CameraList", MySpaceTexts.BlockPropertyTitle_AssignedCamera, MySpaceTexts.Blank);
            cameraList.ComboBoxContentWithBlock = (x, list) => x.FillCameraComboBoxContent(list);
            cameraList.Getter = (x) => (long)x.m_bindedCamera;
            cameraList.Setter = (x, y) => x.m_bindedCamera.Value = y;
            MyTerminalControlFactory.AddControl(cameraList);
            m_cameraList = cameraList;

            var flightMode = new MyTerminalControlCombobox<MyRemoteControl>("FlightMode", MySpaceTexts.BlockPropertyTitle_FlightMode, MySpaceTexts.Blank);
            flightMode.ComboBoxContent = (x) => FillFlightModeCombo(x);
            flightMode.Getter = (x) => (long)x.m_currentFlightMode.Value;
            flightMode.Setter = (x, v) => x.ChangeFlightMode((FlightMode)v);
            flightMode.SetSerializerRange((int)MyEnum<FlightMode>.Range.Min, (int)MyEnum<FlightMode>.Range.Max);
            MyTerminalControlFactory.AddControl(flightMode);

            var directionCombo = new MyTerminalControlCombobox<MyRemoteControl>("Direction", MySpaceTexts.BlockPropertyTitle_ForwardDirection, MySpaceTexts.Blank);
            directionCombo.ComboBoxContent = (x) => FillDirectionCombo(x);
            directionCombo.Getter = (x) => (long)x.m_currentDirection.Value;
            directionCombo.Setter = (x, v) => x.ChangeDirection((Base6Directions.Direction)v);
            MyTerminalControlFactory.AddControl(directionCombo);

            if (MyFakes.ENABLE_VR_REMOTE_BLOCK_AUTOPILOT_SPEED_LIMIT)
            {
                var sliderSpeedLimit = new MyTerminalControlSlider<MyRemoteControl>("SpeedLimit", MySpaceTexts.BlockPropertyTitle_RemoteBlockSpeedLimit,
                    MySpaceTexts.BlockPropertyTitle_RemoteBlockSpeedLimit);
                sliderSpeedLimit.SetLimits(1, 200);
                sliderSpeedLimit.DefaultValue = MyObjectBuilder_RemoteControl.DEFAULT_AUTOPILOT_SPEED_LIMIT;
                sliderSpeedLimit.Getter = (x) => x.m_autopilotSpeedLimit;
                sliderSpeedLimit.Setter = (x, v) => x.m_autopilotSpeedLimit.Value = v;
                sliderSpeedLimit.Writer = (x, sb) => sb.Append(MyValueFormatter.GetFormatedFloat(x.m_autopilotSpeedLimit, 0));
                sliderSpeedLimit.EnableActions();
                MyTerminalControlFactory.AddControl(sliderSpeedLimit);
            }

            var waypointList = new MyTerminalControlListbox<MyRemoteControl>("WaypointList", MySpaceTexts.BlockPropertyTitle_Waypoints, MySpaceTexts.Blank, true);
            waypointList.ListContent = (x, list1, list2) => x.FillWaypointList(list1, list2);
            waypointList.ItemSelected = (x, y) => x.SelectWaypoint(y);
            if (!MySandboxGame.IsDedicated)
            {
                m_waypointGuiControl = (MyGuiControlListbox)((MyGuiControlBlockProperty)waypointList.GetGuiControl()).PropertyControl;
            }
            MyTerminalControlFactory.AddControl(waypointList);


            var toolbarButton = new MyTerminalControlButton<MyRemoteControl>("Open Toolbar", MySpaceTexts.BlockPropertyTitle_AutoPilotToolbarOpen, MySpaceTexts.BlockPropertyPopup_AutoPilotToolbarOpen,
                delegate(MyRemoteControl self)
                {
                    var actions = self.m_selectedWaypoints[0].Actions;
                    if (actions != null)
                    {
                        for (int i = 0; i < actions.Length; i++)
                        {
                            if (actions[i] != null)
                            {
                                self.m_actionToolbar.SetItemAtIndex(i, actions[i]);
                            }
                        }
//.........这里部分代码省略.........
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:101,代码来源:MyRemoteControl.cs


示例14: OnItemDoubleClick

 void OnItemDoubleClick(MyGuiControlListbox list)
 {
     m_selectedItem = list.SelectedItems[0];
     var itemInfo = m_selectedItem.UserData as MyBlueprintItemInfo;
     OpenSelectedSript();
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:6,代码来源:MyGuiIngameScriptsPage.cs


示例15: OnMouseOverItem

        void OnMouseOverItem(MyGuiControlListbox listBox)
        {
            var item = listBox.MouseOverItem;
            var path = "";
            if (item != null)
            {
                MyBlueprintItemInfo blueprintInfo = (item.UserData as MyBlueprintItemInfo);
                if (blueprintInfo.Type == MyBlueprintTypeEnum.LOCAL)
                {
                    path = Path.Combine(m_localBlueprintFolder, item.Text.ToString(), "thumb.png");               
                }
                else if (blueprintInfo.Type == MyBlueprintTypeEnum.STEAM)
                {
                    var id = blueprintInfo.PublishedItemId;
                    if (id != null)
                    {
                        path = Path.Combine(TEMP_PATH, id.ToString(), "thumb.png");
                        if (blueprintInfo.Item != null)
                        {
                            bool isQueued = m_downloadQueued.Contains(blueprintInfo.Item.PublishedFileId);
                            bool isDownloaded = m_downloadFinished.Contains(blueprintInfo.Item.PublishedFileId);
                            MySteamWorkshop.SubscribedItem worshopData = blueprintInfo.Item;
                            if (isDownloaded && IsExtracted(worshopData) == false)
                            {
                                m_blueprintList.Enabled = false;
                                m_okButton.Enabled = false;
                                ExtractWorkshopItem(worshopData);
                                m_blueprintList.Enabled = true;
                                m_okButton.Enabled = true;
                            }
                            if (isQueued == false && isDownloaded == false)
                            {
                                m_blueprintList.Enabled = false;
                                m_okButton.Enabled = false;
                                m_downloadQueued.Add(blueprintInfo.Item.PublishedFileId);

                                Task = Parallel.Start(() =>
                                {
                                    DownloadBlueprintFromSteam(worshopData);
                                }, () => { OnBlueprintDownloadedThumbnail(worshopData); });
                            }
                        }
                    }
                }
                else if (blueprintInfo.Type == MyBlueprintTypeEnum.DEFAULT)
                {
                    path = Path.Combine(m_defaultBlueprintFolder, item.Text.ToString(), "thumb.png");
                }

                if (File.Exists(path))
                {
                    m_thumbnailImage.SetTexture(path);
                    if (!m_activeDetail)
                    {
                        if (m_thumbnailImage.BackgroundTexture != null)
                        {
                            m_thumbnailImage.Visible = true;
                        }
                    }
                }
                else
                {
                    m_thumbnailImage.Visible = false;
                    m_thumbnailImage.BackgroundTexture = null;
                }
            }
            else
            {
                m_thumbnailImage.Visible = false;
            }
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:71,代码来源:MyGuiBlueprintScreen.cs


示例16: OnSelectItem

        void OnSelectItem(MyGuiControlListbox list)
        {
            if (list.SelectedItems.Count == 0)
            {
                return;
            }

            m_selectedItem = list.SelectedItems[0];
            m_detailsButton.Enabled = true;
            m_renameButton.Enabled = false;

            var type = (m_selectedItem.UserData as MyBlueprintItemInfo).Type;
            var id = (m_selectedItem.UserData as MyBlueprintItemInfo).PublishedItemId;

            if (type == MyBlueprintTypeEnum.LOCAL)
            {
                m_deleteButton.Enabled = true;
                m_replaceButton.Enabled = true;
                m_renameButton.Enabled = true;
            }
            else if (type == MyBlueprintTypeEnum.STEAM)
            {
                m_deleteButton.Enabled = false;
                m_replaceButton.Enabled = false;
            }
            else if (type == MyBlueprintTypeEnum.SHARED)
            {
                m_renameButton.Enabled = false;
                m_detailsButton.Enabled = false;
                m_deleteButton.Enabled = false;
            }
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:32,代码来源:MyGuiIngameScriptsPage.cs


示例17: CreateContextMenu

        private void CreateContextMenu()
        {
            m_itemsList = new MyGuiControlListbox(visualStyle: MyGuiControlListboxStyleEnum.ContextMenu);

            //Todo: automatically decide how to draw it given the position
            m_itemsList.HighlightType = MyGuiControlHighlightType.WHEN_CURSOR_OVER;
            m_itemsList.Enabled = true;
            m_itemsList.ItemClicked += list_ItemClicked;
            m_itemsList.MultiSelect = false;

        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:11,代码来源:MyGuiControlContextMenu.cs


示例18: TriggersListBoxOnItemDoubleClicked

        private void TriggersListBoxOnItemDoubleClicked(MyGuiControlListbox listBox)
        {
            if (listBox.SelectedItems.Count == 0) return;

            // Set the selected trigger to the selected one
            var item = listBox.SelectedItems[0];
            var trigger = (MyAreaTriggerComponent) item.UserData;

            m_triggerManipulator.SelectedTrigger = trigger;
            // Reset the GUI data
            if (m_triggerManipulator.SelectedTrigger != null)
            {
                var areaTrigger = (MyAreaTriggerComponent) m_triggerManipulator.SelectedTrigger;

                // Set textbox Text ... not the easy way....
                m_helperStringBuilder.Clear();
                m_helperStringBuilder.Append(areaTrigger.Name);
                m_selectedTriggerNameBox.SetText(m_helperStringBuilder);
            }
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:20,代码来源:MyGuiScreenScriptingTools.cs


示例19: OnItemDoubleClick

        void OnItemDoubleClick(MyGuiControlListbox list)
        {
            m_selectedItem = list.SelectedItems[0];
            var itemInfo = m_selectedItem.UserData as MyBlueprintItemInfo;

            if (itemInfo.Type == MyBlueprintTypeEnum.SHARED)
            {
                OpenSharedBlueprint(itemInfo);
            }
            else
            {
                if (MySession.Static.SurvivalMode && m_clipboard == Sandbox.Game.Entities.MyCubeBuilder.Static.Clipboard)
                {
                    CloseScreen();
                }
                else
                {
                    var close = CopySelectedItemToClipboard();
                    if (close)
                    {
                        CloseScreen();
                    }
                }
            }
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:25,代码来源:MyGuiBlueprintScreen.cs


示例20: UpdateItemAppearance

 private void UpdateItemAppearance(MyTerminalBlock block, MyGuiControlListbox.Item item)
 {
     item.Text.Clear().Append(block.CustomName);
     if (!block.IsFunctional)
     {
         item.ColorMask = Vector4.One;
         item.Text.AppendStringBuilder(MyTexts.Get(MySpaceTexts.Terminal_BlockIncomplete));
         item.FontOverride = MyFontEnum.Red;
     }
     else if (!block.HasPlayerAccess(m_controller.Identity.IdentityId))
     {
         item.ColorMask = Vector4.One;
         item.Text.AppendStringBuilder(MyTexts.Get(MySpaceTexts.Terminal_BlockAccessDenied));
         item.FontOverride = MyFontEnum.Red;
     }
     else if (block.ShowInTerminal == false)
     {
         item.ColorMask = 0.6f * m_colorHelper.GetGridColor(block.CubeGrid).ToVector4();
         item.FontOverride = null;
     }
     else
     {
         item.ColorMask = m_colorHelper.GetGridColor(block.CubeGrid).ToVector4();
         item.FontOverride = null;
     }
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:26,代码来源:MyTerminalControlPanel.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# MyGuiControlListbox.Item类代码示例发布时间:2022-05-26
下一篇:
C# GUI.MyGuiControlList类代码示例发布时间: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