當前位置: 首頁>>代碼示例>>C#>>正文


C# MyGuiControlListbox.Item類代碼示例

本文整理匯總了C#中Sandbox.Graphics.GUI.MyGuiControlListbox.Item的典型用法代碼示例。如果您正苦於以下問題:C# MyGuiControlListbox.Item類的具體用法?C# MyGuiControlListbox.Item怎麽用?C# MyGuiControlListbox.Item使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MyGuiControlListbox.Item類屬於Sandbox.Graphics.GUI命名空間,在下文中一共展示了MyGuiControlListbox.Item類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

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

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

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

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

示例5: ExtractWorkShopItems

        void ExtractWorkShopItems()
        {
            ProfilerShort.Begin("Blueprint screen - Extracting bluepritns");

            if (!Directory.Exists(m_workshopBlueprintFolder))
            {
                Directory.CreateDirectory(m_workshopBlueprintFolder);
            }
            var downloadedMods = Directory.GetFiles(m_workshopBlueprintFolder);

            foreach (var mod in downloadedMods)
            {
                var fileName = Path.GetFileNameWithoutExtension(mod);
                var id = ulong.Parse(fileName);
                if(!m_subscribedItemsList.Any(item => item.PublishedFileId == id))
                {
                    File.Delete(mod); 
                }
            }

            var tempPath = Path.Combine(m_workshopBlueprintFolder, "temp");
            if (Directory.Exists(tempPath))
            {
                Directory.Delete(tempPath, true);
            }
            var tempDir = Directory.CreateDirectory(tempPath);

            foreach (var subItem in m_subscribedItemsList)
            {
                if (downloadedMods.Any(item => item.Contains(subItem.PublishedFileId.ToString())))
                {
                    string archive = Array.Find(downloadedMods, item => item.Contains(subItem.PublishedFileId.ToString()));

                    var extractPath = Path.Combine(tempDir.FullName, subItem.PublishedFileId.ToString());

                    if (!File.Exists(extractPath))
                    {
                        Directory.CreateDirectory(extractPath);
                        var extracted = MyZipArchive.OpenOnFile(archive);

                        var modInfo = new MyObjectBuilder_ModInfo();
                        modInfo.SubtypeName = subItem.Title;
                        modInfo.WorkshopId = subItem.PublishedFileId;
                        modInfo.SteamIDOwner = subItem.SteamIDOwner;


                        var infoFile = Path.Combine(m_workshopBlueprintFolder, "temp", subItem.PublishedFileId.ToString(), "info.temp");
                        if (File.Exists(infoFile))
                        {
                            File.Delete(infoFile);
                        }
                        var infoSuccess = MyObjectBuilderSerializer.SerializeXML(infoFile, false, modInfo);
  
                        if (extracted.FileExists("thumb.png"))
                        {
                            var stream = extracted.GetFile("thumb.png").GetStream();
                            if (stream != null)
                            {
                                using (var file = File.Create(Path.Combine(extractPath, "thumb.png")))
                                {
                                    stream.CopyTo(file);
                                }
                            }
                            stream.Close();
                        }
                        
                        extracted.Dispose();

                        var info = new MyBlueprintItemInfo(MyBlueprintTypeEnum.STEAM, subItem.PublishedFileId);
                        var listItem = new MyGuiControlListbox.Item(text: new StringBuilder(subItem.Title), toolTip: subItem.Title, icon: MyGuiConstants.TEXTURE_ICON_MODS_WORKSHOP.Normal, userData: info);

                        var itemIndex = m_blueprintList.Items.FindIndex(item => ((item.UserData as MyBlueprintItemInfo).PublishedItemId == (listItem.UserData as MyBlueprintItemInfo).PublishedItemId) && (item.UserData as MyBlueprintItemInfo).Type == MyBlueprintTypeEnum.STEAM);
                        if (itemIndex == -1)
                        {
                            m_blueprintList.Add(listItem);
                        }
                    }
                }
            }
            ProfilerShort.End();
        }
開發者ID:fluxit,項目名稱:SpaceEngineers,代碼行數:81,代碼來源:MyGuiBlueprintScreen.cs

示例6: FillListContent

        private void FillListContent(ICollection<MyGuiControlListbox.Item> listBoxContent, ICollection<MyGuiControlListbox.Item> listBoxSelectedItems)
        {
            foreach (var soundCategory in MyDefinitionManager.Static.GetSoundCategoryDefinitions())
            {
                foreach (var sound in soundCategory.Sounds)
                {
                    m_helperSB.Clear().Append(sound.SoundText);
                    var stringId = MySoundPair.GetCueId(sound.SoundId);
                    
                    var item = new MyGuiControlListbox.Item(text: m_helperSB, userData: stringId);

                    listBoxContent.Add(item);
                    if (stringId == CueId)
                        listBoxSelectedItems.Add(item);
                }
            }
        }
開發者ID:Krulac,項目名稱:SpaceEngineers,代碼行數:17,代碼來源:MySoundBlock.cs

示例7: AddBlockToList

        private MyGuiControlListbox.Item AddBlockToList(MyTerminalBlock block)
        {
            var item = new MyGuiControlListbox.Item(userData: block);
            UpdateItemAppearance(block, item);
            block.CustomNameChanged += block_CustomNameChanged;
            block.PropertiesChanged += block_CustomNameChanged;
            block.ShowInTerminalChanged += block_ShowInTerminalChanged;

            m_blockListbox.Add(item);
            return item;
        }
開發者ID:ChristianHeinz71,項目名稱:SpaceEngineers,代碼行數:11,代碼來源:MyTerminalControlPanel.cs

示例8: OnReload

        void OnReload(MyGuiControlButton button)
        {
            m_selectedItem = null;
            m_detailsButton.Enabled = false;
            m_screenshotButton.Enabled = false;

            RefreshAndReloadBlueprintList();
        }
開發者ID:fluxit,項目名稱:SpaceEngineers,代碼行數:8,代碼來源:MyGuiBlueprintScreen.cs

示例9: OnReload

        void OnReload(MyGuiControlButton button)
        {
            m_selectedItem = null;
            m_renameButton.Enabled = false;
            m_detailsButton.Enabled = false;

            RefreshAndReloadScriptsList(true);
        }
開發者ID:fluxit,項目名稱:SpaceEngineers,代碼行數:8,代碼來源:MyGuiIngameScriptsPage.cs

示例10: ExtractWorkshopItem

        void ExtractWorkshopItem(MySteamWorkshop.SubscribedItem subItem)
        {
            string archive = Path.Combine(m_workshopBlueprintFolder, subItem.PublishedFileId.ToString() + m_workshopBlueprintSuffix);
            var extractPath = Path.Combine(TEMP_PATH, subItem.PublishedFileId.ToString());

            if (Directory.Exists(extractPath))
            {
                Directory.Delete(extractPath);
            }

            Directory.CreateDirectory(extractPath);
            var extracted = MyZipArchive.OpenOnFile(archive);

            var modInfo = new MyObjectBuilder_ModInfo();
            modInfo.SubtypeName = subItem.Title;
            modInfo.WorkshopId = subItem.PublishedFileId;
            modInfo.SteamIDOwner = subItem.SteamIDOwner;

            var infoFile = Path.Combine(TEMP_PATH,subItem.PublishedFileId.ToString(), "info.temp");
            if (File.Exists(infoFile))
            {
                File.Delete(infoFile);
            }

            var infoSuccess = MyObjectBuilderSerializer.SerializeXML(infoFile, false, modInfo);

            if (extracted.FileExists("thumb.png"))
            {
                var stream = extracted.GetFile("thumb.png").GetStream();
                if (stream != null)
                {
                    using (var file = File.Create(Path.Combine(extractPath, "thumb.png")))
                    {
                        stream.CopyTo(file);
                    }
                }
                stream.Close();
            }

            extracted.Dispose();

            var info = new MyBlueprintItemInfo(MyBlueprintTypeEnum.STEAM, subItem.PublishedFileId);
            var listItem = new MyGuiControlListbox.Item(text: new StringBuilder(subItem.Title), toolTip: subItem.Title, icon: MyGuiConstants.TEXTURE_ICON_MODS_WORKSHOP.Normal, userData: info);

            var itemIndex = m_blueprintList.Items.FindIndex(item => ((item.UserData as MyBlueprintItemInfo).PublishedItemId == (listItem.UserData as MyBlueprintItemInfo).PublishedItemId) && (item.UserData as MyBlueprintItemInfo).Type == MyBlueprintTypeEnum.STEAM);
            if (itemIndex == -1)
            {
                m_blueprintList.Add(listItem);
            }
        }
開發者ID:stanhebben,項目名稱:SpaceEngineers,代碼行數:50,代碼來源:MyGuiBlueprintScreen.cs

示例11: OnItemDoubleClick

 void OnItemDoubleClick(MyGuiControlListbox list)
 {
     m_selectedItem = list.SelectedItems[0];
     Ok();        
 }
開發者ID:stanhebben,項目名稱:SpaceEngineers,代碼行數:5,代碼來源:MyGuiBlueprintScreen.cs

示例12: ShareBlueprintRequestClient

        static void ShareBlueprintRequestClient(ulong workshopId, string name, ulong sendToId, string senderName)
        {
            var itemId = workshopId;
            var info = new MyBlueprintItemInfo(MyBlueprintTypeEnum.SHARED, id: itemId);
            var item = new MyGuiControlListbox.Item(new StringBuilder(name.ToString()), userData: info, icon: MyGuiConstants.TEXTURE_BLUEPRINTS_ARROW.Normal);
            item.ColorMask = new Vector4(0.7f);
            if (!m_recievedBlueprints.Any(item2 => (item2.UserData as MyBlueprintItemInfo).PublishedItemId == (item.UserData as MyBlueprintItemInfo).PublishedItemId))
            {
                m_recievedBlueprints.Add(item);
                m_blueprintList.Add(item);

                var notification = new MyHudNotificationDebug(senderName + " just shared a blueprint with you.", 2500);
                MyHud.Notifications.Add(notification);
            }
        }
開發者ID:stanhebben,項目名稱:SpaceEngineers,代碼行數:15,代碼來源:MyGuiBlueprintScreen.cs

示例13: GetWorkshopItemsSteam

        void GetWorkshopItemsSteam()
        {
            for (int i = 0; i < m_subscribedItemsList.Count; i++)
            {
                MySteamWorkshop.SubscribedItem suscribedItem = m_subscribedItemsList[i];
                MyAnalyticsHelper.ReportActivityStart(null, "show_blueprints", string.Empty, "gui", string.Empty);

                String name = suscribedItem.Title;
                var info = new MyBlueprintItemInfo(MyBlueprintTypeEnum.STEAM, suscribedItem.PublishedFileId) {Item = suscribedItem };
                var item = new MyGuiControlListbox.Item(text: new StringBuilder(name), toolTip: name, userData: info, icon: MyGuiConstants.TEXTURE_ICON_MODS_WORKSHOP.Normal);
                m_blueprintList.Add(item);
            }
        }
開發者ID:stanhebben,項目名稱:SpaceEngineers,代碼行數:13,代碼來源:MyGuiBlueprintScreen.cs

示例14: OnBlueprintDownloadedDetails

 void OnBlueprintDownloadedDetails(MySteamWorkshop.SubscribedItem workshopDetails)
 {
     var path2 = Path.Combine(m_workshopBlueprintFolder, workshopDetails.PublishedFileId.ToString() + m_workshopBlueprintSuffix);
     if (File.Exists(path2))
     {
         m_thumbnailImage.Visible = false;
         m_detailScreen = new MyGuiDetailScreenSteam(
             callBack: delegate(MyGuiControlListbox.Item item)
             {
                 m_selectedItem = item;
                 m_activeDetail = false;
                 m_detailScreen = null;
                 if (Task.IsComplete)
                 {
                     RefreshBlueprintList();
                 }
             },
             selectedItem: m_selectedItem,
             parent: this,
             thumbnailTexture: m_selectedImage.BackgroundTexture,
             textScale: m_textScale
             );
         m_activeDetail = true;
         MyScreenManager.InputToNonFocusedScreens = true;
         MyScreenManager.AddScreen(m_detailScreen);
     }
     else
     {
         MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                     buttonType: MyMessageBoxButtonsType.OK,
                     styleEnum: MyMessageBoxStyleEnum.Error,
                     messageCaption: new StringBuilder("Error"),
                     messageText: new StringBuilder("Cannot find the blueprint file.")
                     ));
     }
 }
開發者ID:stanhebben,項目名稱:SpaceEngineers,代碼行數:36,代碼來源:MyGuiBlueprintScreen.cs

示例15: FillSelectedListContent

 public void FillSelectedListContent(ICollection<MyGuiControlListbox.Item> listBoxContent, ICollection<MyGuiControlListbox.Item> listBoxSelectedItems)
 {
     foreach (var texture in m_selectedTexturesToDraw)
     {
         m_helperSB.Clear().Append(texture.Id.SubtypeName);
         var item = new MyGuiControlListbox.Item(text: m_helperSB, userData: texture.TexturePath);
         listBoxContent.Add(item);
     }
 }
開發者ID:ChristianHeinz71,項目名稱:SpaceEngineers,代碼行數:9,代碼來源:MyTextPanel.cs


注:本文中的Sandbox.Graphics.GUI.MyGuiControlListbox.Item類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。