Exemplo n.º 1
0
        public HudToolbar(Game game, Renderer r, int basePriority)
        {
            _game = game;
            _basePriority = basePriority;

            _toolbarPanel = new Panel(_basePriority-2);
            _toolbarPanel.X = 0;
            _toolbarPanel.Y = r.Height-Height;
            _toolbarPanel.Width = r.Width;
            _toolbarPanel.Height = Height;
            _toolbarPanel.Color = PanelColor;
            _toolbarPanel.Corners = 0;

            _baseIcon = new Sprite(_game.Config.GetWidgetTemplate("baseicon"), Drawable.Flags.NoScroll|Drawable.Flags.Colorize, _basePriority+1);
            _baseIcon.Resize((int)ToolbarEntries.Count);

            _cashText = new TextLine(r,0,0,basePriority+1);
            _cashText.Font = TextLine.CashFont;
            _cashText.Color = Color4.LightGoldenrodYellow;

            Icons = new ToolbarEntry[(int)ToolbarEntries.Count];
            Icons[(int)ToolbarEntries.None] = new ToolbarEntry(_game, null, _basePriority+2)
            {
                CursorFrame = 0,
                PulloutOptions = BuildablePulloutOptions.ShowCaption|BuildablePulloutOptions.ShowIconTab
            };
            Icons[(int)ToolbarEntries.Wall] = new ToolbarEntry(_game, "wall", _basePriority+2)
            {
                CursorFrame = 2,
                PulloutOptions = BuildablePulloutOptions.ShowCaption|BuildablePulloutOptions.ShowPrice|BuildablePulloutOptions.ShowIconTab
            };
            Icons[(int)ToolbarEntries.Machinegun] = new ToolbarEntry(_game, "machinegun", _basePriority+2)
            {
                CursorFrame = 1,
                PulloutOptions = BuildablePulloutOptions.ShowAllRows|BuildablePulloutOptions.ShowIconTab,
            };
            Icons[(int)ToolbarEntries.Cannon] = new ToolbarEntry(_game, "cannon", _basePriority+2)
            {
                CursorFrame = 1,
                PulloutOptions = BuildablePulloutOptions.ShowAllRows|BuildablePulloutOptions.ShowIconTab,
            };
            Icons[(int)ToolbarEntries.Flamethrower] = new ToolbarEntry(_game, "flamethrower", _basePriority+2)
            {
                CursorFrame = 1,
                PulloutOptions = BuildablePulloutOptions.ShowAllRows|BuildablePulloutOptions.ShowIconTab,
            };
        }
Exemplo n.º 2
0
        public HudBuildablePullout(Game game, Renderer r, int basePriority)
        {
            _game = game;
            _basePriority = basePriority;

            _stayUpTimer = new Timer(TimerMode.CountDown, 60*3);
            _stayUpTimer.Elapsed += HandleStayUpTimerElapsed;
            _foldingTimer = new Timer(TimerMode.CountDown, 100);
            _foldingTimer.Ticked += HandleFoldingTimerTicked;

            _panel = new Panel(_basePriority-1);
            _panel.Width = 96;
            _panel.Corners = Corners.Top|Corners.BottomRight;
            _panel.Color = Color;

            _iconPanel = new Panel(_basePriority-1);
            _iconPanel.Y = r.Height-HudToolbar.Height;
            _iconPanel.Width = 56;
            _iconPanel.Height = HudToolbar.Height;
            _iconPanel.Corners = Corners.Bottom;
            _iconPanel.Color = Color;

            //_captionIcon = new Sprite(_captionIcons, Drawable.Flags.NoScroll, _basePriority+2);

            _icons = new Sprite(_game.Config.GetWidgetTemplate("bpinfoicons"), Drawable.Flags.NoScroll, _basePriority+2);
            _icons.Resize(4);
            _icons[0].Frame = 3;
            _icons[1].Frame = 0;
            _icons[2].Frame = 2;
            _icons[3].Frame = 1;

            _text[0] = new TextLine(r,0,0,_basePriority+2);
            _text[1] = new TextLine(r,0,0,_basePriority+2);
            _text[2] = new TextLine(r,0,0,_basePriority+2);
            _text[3] = new TextLine(r,0,0,_basePriority+2);
            _text[4] = new TextLine(r,0,0,_basePriority+2);
        }