Esempio n. 1
0
        private UIElasticButton AddBtn(List <UIElasticButton> targ, string imgname, ButtonClickDelegate onClick)
        {
            var ui  = Content.Get().CustomUI;
            var btn = new UIElasticButton(ui.Get(imgname).Get(GameFacade.GraphicsDevice));

            btn.OnButtonClick += onClick;
            targ.Add(btn);
            Add(btn);
            return(btn);
        }
        public UIModeSwitcher(TS1GameScreen screen)
        {
            Game = screen;
            var ui = Content.Get().CustomUI;

            var btn = new UILiveButton(screen);

            btn.MotiveLevel    = 0.5f;
            btn.Position       = Vector2.Zero;
            btn.OnButtonClick += (b) => { SwitchMode(UIMainPanelMode.LIVE); };
            Add(btn);
            LiveButton = btn;

            BuildButton                = new UIElasticButton(ui.Get("mode_build.png").Get(GameFacade.GraphicsDevice));
            BuildButton.Position       = btn.Position;
            BuildButton.OnButtonClick += (b) => { SwitchMode(UIMainPanelMode.BUILD); };
            BuildButton.Opacity        = 0;
            Add(BuildButton);

            BuyButton                = new UIElasticButton(ui.Get("mode_buy.png").Get(GameFacade.GraphicsDevice));
            BuyButton.Position       = btn.Position;
            BuyButton.OnButtonClick += (b) => { SwitchMode(UIMainPanelMode.BUY); };
            BuyButton.Opacity        = 0;
            Add(BuyButton);

            OptionButton                = new UIElasticButton(ui.Get("mode_options.png").Get(GameFacade.GraphicsDevice));
            OptionButton.Position       = btn.Position;
            OptionButton.OnButtonClick += (b) => { SwitchMode(UIMainPanelMode.OPTIONS); };
            OptionButton.Opacity        = 0;
            Add(OptionButton);

            ButtonOrder = new UIButton[]
            {
                LiveButton,
                BuyButton,
                BuildButton,
                OptionButton
            };
            UpdateBuildBuy();
        }