当前位置: 首页>>代码示例>>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;未经允许,请勿转载。