Пример #1
0
        public MapPanel(World world, AssetsManager assetsManager, PanelTemplate template)
            : base(template)
        {
            ViewOffset = new Point(0, 0);
            _assets    = assetsManager;

            World = world;

            _entities = world.EntityManager.Get(typeof(GameObject), typeof(Sprite), typeof(VisibleComponent));
            _player   = world.Player;
        }
Пример #2
0
        protected override void OnSettingUp()
        {
            base.OnSettingUp();

            var mapTemplate =
                new PanelTemplate
            {
                Size       = new Size(Size.Width - 15, Size.Height - 10),
                HasFrame   = false,
                TopLeftPos = new Point(0, 0),
            };

            MapPanel = new MapPanel(World, AssetsManager, mapTemplate);

            AddControl(MapPanel);

            var statusTemplate =
                new PanelTemplate
            {
                Size     = new Size(Size.Width - mapTemplate.Size.Width, mapTemplate.Size.Height),
                HasFrame = true,
            };

            statusTemplate.AlignTo(LayoutDirection.East, mapTemplate);

            StatusPanel = new StatusPanel(World, statusTemplate);

            AddControl(StatusPanel);

            var logTemplate = new LogPanelTemplate
            {
                HasFrame   = true,
                Log        = World.Log,
                Size       = new Size(Size.Width, Size.Height - mapTemplate.Size.Height),
                TopLeftPos = mapTemplate.CalculateRect().BottomLeft
            };

            LogPanel = new LogPanel(logTemplate);
            AddControl(LogPanel);

            PromptTemplate =
                new PromptWindowTemplate
            {
                HasFrame   = false,
                IsPopup    = true,
                TopLeftPos = logTemplate.TopLeftPos.Shift(1, 1),
                Log        = World.Log,
                Size       = new Size(Size.Width - 2, Size.Height - mapTemplate.Size.Height - 2)
            };

            this.KeyPressed += GameplayWindow_KeyPressed;
        }
Пример #3
0
        protected override void OnSettingUp()
        {
            base.OnSettingUp();

            // Create and add interior panel that will "hold" all of the example controls
            Size panelSize = new Size(this.Size.Width - 2, this.Size.Height - 24);

            PanelTemplate panelTemplate = new PanelTemplate()
            {
                HasFrame     = true,
                UpperLeftPos = this.LocalRect.UpperLeft.Shift(1, 3),
                Size         = panelSize
            };

            //panelTemplate.SetLowerRight(this.ScreenRect.LowerRight.Shift(-1, -17));
            AddControl(new Panel(panelTemplate));

            ViewRect = Rect.Inflate(panelTemplate.CalculateRect(), -1, -1);


            // Create the page info TextBox control.  Each page will have one.
            Rect textBoxRect = new Rect(panelTemplate.CalculateRect().LowerLeft.Shift(0, 1),
                                        this.LocalRect.LowerRight.Shift(-1, -1));

            TextBoxTemplate tbt = new TextBoxTemplate()
            {
                Size         = textBoxRect.Size,
                UpperLeftPos = textBoxRect.UpperLeft,
                TextSpeed    = 5,
                Pigments     = new PigmentAlternatives()
                {
                    { PigmentType.Window, new Pigment(0xaaaaaa, 0x111511) }
                }
            };

            PageInfo = new TextBox(tbt);
            AddControl(PageInfo);

            // Create the next, previous and quit buttons.  Each page will have these
            // buttons
            ButtonTemplate nextButtonTemplate = new ButtonTemplate()
            {
                Label   = "Next->",
                Tooltip = "Click to go to the next page",
                HilightWhenMouseOver = true,
                LabelAlignment       = HorizontalAlignment.Center,
                MinimumWidth         = 12
            };

            nextButtonTemplate.SetUpperRight(Application.ScreenRect.UpperRight);

            ButtonTemplate previousButtonTemplate = new ButtonTemplate()
            {
                Label   = "<-Previous",
                Tooltip = "Click to go to the previous page",
                HilightWhenMouseOver = true,
                UpperLeftPos         = new Point(0, 0),
                LabelAlignment       = HorizontalAlignment.Center,
                MinimumWidth         = 12
            };


            ButtonTemplate quitButtonTemplate = new ButtonTemplate()
            {
                Label   = "QUIT",
                Tooltip = "Quit the demo",
                HilightWhenMouseOver = true,
                LabelAlignment       = HorizontalAlignment.Center,
                MinimumWidth         = 38
            };

            quitButtonTemplate.SetTopCenter(Application.ScreenRect.TopCenter);

            Button quitButton = new Button(quitButtonTemplate);

            nextButton = new Button(nextButtonTemplate);
            prevButton = new Button(previousButtonTemplate);

            AddControls(nextButton, prevButton, quitButton);

            quitButton.ButtonPushed += new EventHandler(quitButton_ButtonClicked);
            prevButton.ButtonPushed += new EventHandler(prevButton_ButtonClicked);
            nextButton.ButtonPushed += new EventHandler(nextButton_ButtonClicked);

            prevButton.IsActive = hasPrev;
            nextButton.IsActive = hasNext;
        }
Пример #4
0
 public StatusPanel(World world, PanelTemplate template)
     : base(template)
 {
     this._player   = world.Player;
     this._calendar = world.Calendar;
 }
Пример #5
0
 /// Again we force that a Player object be passed to our constructor, and we save it in
 /// a field for later use.
 public MapView(PanelTemplate template, Player player)
     : base(template)
 {
     this.player = player;
 }