Esempio n. 1
0
        public override void Construct()
        {
            Font = "font10";

            ContentsPanel = AddChild(new ContentsPanel
            {
                AutoLayout = AutoLayout.DockFill,
            }) as ContentsPanel;

            base.Construct();
        }
        //void TopPanel_Paint(object sender, PaintEventArgs e)
        //{
        //   Rectangle rect = new Rectangle ( new Point ( 0, 0 ), new Size ( Math.Max ( this.Width, 1 ), Math.Max ( this.Height, 1 ) ) ) ;

        //   using ( Brush myBrush = new LinearGradientBrush ( rect , Color.LightBlue, Color.DarkBlue, GradientMode ) )
        //   {
        //      e.Graphics.FillRectangle ( myBrush, rect ) ;
        //   }
        //}

        #endregion

        #region Properties

        #endregion

        #region Data Types Definition

        #endregion

        #endregion

        #region Private

        #region Methods

        private void AddPage(PageData pageData)
        {
            pageData.Page.Paint += new PaintEventHandler(TabPage_Paint);

            pageData.Page.Location = PagesLocation;
            pageData.Page.Dock     = DockStyle.Fill;
            pageData.Page.Visible  = false;

            if (!ContentsPanel.Contains(pageData.Page))
            {
                ContentsPanel.Controls.Add(pageData.Page);
            }

            AddTabButton(pageData);
        }
Esempio n. 3
0
        public override void Construct()
        {
            Font = "font8";

            var currentEquipPanel = AddChild(new Widget
            {
                Transparent = true,
                AutoLayout  = AutoLayout.DockLeft,
                MinimumSize = new Point(128, 0)
            });

            ContentsPanel = AddChild(new ContentsPanel
            {
                AutoLayout        = AutoLayout.DockFill,
                MinimumSize       = new Point(128, 0),
                Border            = "border-one",
                EnableDragAndDrop = false,
                Resources         = new ResourceSet(),
                OnIconClicked     = (sender, args) =>
                {
                    SelectedEquipIcon.Resource = (sender as ResourceIcon).Resource;
                    EquipButton.Hidden         = false;
                    EquipButton.Invalidate();
                }
            }) as ContentsPanel;

            var equipmentSlotPanel = currentEquipPanel.AddChild(new Widget
            {
                MinimumSize = new Point(104, 104),
                MaximumSize = new Point(104, 104),
                AutoLayout  = AutoLayout.DockTopCentered
            });

            equipmentSlotPanel.AddChild(new Widget
            {
                Background  = new TileReference("equipment_sheet", 0),
                MinimumSize = new Point(32, 32),
                MaximumSize = new Point(32, 32),
                AutoLayout  = AutoLayout.FloatCenter
            });

            var comparisonPanel = currentEquipPanel.AddChild(new Widget
            {
                AutoLayout = AutoLayout.DockFill,
                Border     = "border-one"
            });

            var bottomBar = comparisonPanel.AddChild(new Widget
            {
                AutoLayout  = AutoLayout.DockBottom,
                MinimumSize = new Point(0, 32)
            });

            RemoveButton = bottomBar.AddChild(new Widget
            {
                Text = "REMOVE",
                TextVerticalAlign  = VerticalAlign.Center,
                MinimumSize        = new Point(64, 32),
                MaximumSize        = new Point(64, 32),
                AutoLayout         = AutoLayout.DockLeft,
                ChangeColorOnHover = true,
                OnClick            = (_sender, args) =>
                {
                    if (SelectedSlotIcon.Resource != null)
                    {
                        Employee.AssignTask(new UnequipTask(SelectedSlotIcon.Resource));
                    }
                },
                Hidden = true
            });

            EquipButton = bottomBar.AddChild(new Widget
            {
                Text = "EQUIP",
                TextVerticalAlign  = VerticalAlign.Center,
                MinimumSize        = new Point(64, 32),
                MaximumSize        = new Point(64, 32),
                AutoLayout         = AutoLayout.DockRight,
                ChangeColorOnHover = true,
                OnClick            = (_sender, args) =>
                {
                    if (SelectedEquipIcon.Resource != null)
                    {
                        Employee.AssignTask(new FindAndEquipTask(SelectedEquipIcon.Resource.DisplayName)); // Todo: Since we had to enumerate to build the list - couldn't we save the location?
                    }
                },
                Hidden = true
            });

            foreach (var slot in Library.EnumerateEquipmentSlotTypes())
            {
                var slotIcon = AddChild(new ResourceIcon
                {
                    OnLayout          = (_) => _.Rect = new Rectangle(equipmentSlotPanel.Rect.X + slot.GuiOffset.X, equipmentSlotPanel.Rect.Y + slot.GuiOffset.Y, 32, 32),
                    EnableDragAndDrop = false,
                    Tag     = slot,
                    OnClick = (sender, args) =>
                    {
                        SelectedSlot = sender.Tag as EquipmentSlotType;
                        SelectedEquipIcon.Resource = null;
                        EquipButton.Hidden         = true;
                    },
                    OverrideTooltip = true
                }) as ResourceIcon;

                ResourceIcons.Add(slot.Name, slotIcon);
            }

            SelectedSlotIcon = comparisonPanel.AddChild(new ResourceIcon
            {
                AutoLayout = AutoLayout.FloatTopLeft
            }) as ResourceIcon;

            SelectedEquipIcon = comparisonPanel.AddChild(new ResourceIcon
            {
                AutoLayout  = AutoLayout.FloatTopRight,
                MinimumSize = new Point(32, 32)
            }) as ResourceIcon;


            base.Construct();
        }