Exemplo n.º 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;
        }
Exemplo n.º 2
0
        public LevelPickingLevelItem(LevelRep level, MHUrhoApp game)
            : base(game, "UI/LevelItemStyle.xml", true)
        {
            this.Level = level;


            XmlFile styleFile = game.PackageManager.GetXmlFile("UI/LevelItemStyle.xml", true);

            UIElement fixedElementContents = game.UI.LoadLayout(game.PackageManager.GetXmlFile("UI/LevelItemFixedLayout.xml", true),
                                                                styleFile);

            FixedElement.AddChild(fixedElementContents);


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

            ExpandingElement.AddChild(expandingElementContents);

            var thumbnailElement = (BorderImage)fixedElementContents.GetChild("Thumbnail", true);

            thumbnailElement.Texture   = level.Thumbnail;
            thumbnailElement.ImageRect = new IntRect(0, 0, level.Thumbnail.Width, level.Thumbnail.Height);

            var nameElement = (Text)CheckBox.GetChild("NameText", true);

            nameElement.Value = level.Name;

            ((Text)ExpandingElement.GetChild("DescriptionText", true)).Value = level.Description;
        }