Exemple #1
0
        public PackageListItem(GamePackRep pack, MHUrhoApp game)
            : base(game, "UI/AvailablePackItemStyle.xml", true)
        {
            this.Pack = pack;
            UIElement fixedElementContents = game.UI.LoadLayout(game.PackageManager.GetXmlFile("UI/AvailablePackItemFixedLayout.xml", true),
                                                                game.PackageManager.GetXmlFile("UI/AvailablePackItemStyle.xml", true));

            FixedElement.AddChild(fixedElementContents);

            var thumbnail = (BorderImage)FixedElement.GetChild("Thumbnail", true);

            thumbnail.Texture   = pack.Thumbnail;
            thumbnail.ImageRect = new IntRect(0, 0, pack.Thumbnail.Width, pack.Thumbnail.Height);

            var name = (Text)FixedElement.GetChild("NameText", true);

            name.Value = pack.Name;


            UIElement expandingElementContents =
                game.UI.LoadLayout(game.PackageManager.GetXmlFile("UI/AvailablePackItemExpandingLayout.xml", true),
                                   game.PackageManager.GetXmlFile("UI/AvailablePackItemStyle.xml", true));

            ExpandingElement.AddChild(expandingElementContents);

            descriptionText       = (Text)ExpandingElement.GetChild("DescriptionText", true);
            descriptionText.Value = pack.Description;
        }
Exemple #2
0
            void AddItem(GamePackRep gamePack)
            {
                var newItem = new PackageListItem(gamePack, Game);

                newItem.ItemSelected   += ItemSelected;
                newItem.ItemDeselected += ItemDeselected;
                listView.AddItem(newItem);
            }