示例#1
0
        public OutOfGameMenu(GameConnectionManager connectionManager, ConnectScreen connectScreen)
        {
            _connectionManager = connectionManager;
            _connectScreen = connectScreen;

            _startGameButton = new Button
            {
                Top = Property.Get(20f),
                Left = Property.Get(20f),
                Text = Property.Get("Start Game"),
            };
            _startGameButton.Click += OnStartGameButtonClick;

            _connectButton = new Button
            {
                Top = Property.Get(20f),
                Left = Property.Get(2 * 20f + Button.Width),
                Text = Property.Get("Connect"),
            };
            _connectButton.Click += () => _activeScreen = connectScreen;
        }
示例#2
0
        public PauseMenu(GameConnectionManager connectionManager)
        {
            _connectionManager = connectionManager;

            _backgroundOpacity = new AnimatedProperty
            {
                TargetValue = DelegateProperty.Get(() => IsVisible ? 0.75f : 0f),
                AnimationSpeed = Property.Get(8f),
            };

            var buttonLeft = new AnimatedProperty(-Button.Width - 1)
            {
                TargetValue = DelegateProperty.Get(() => IsVisible ? 25f : -Button.Width - 1),
                AnimationSpeed = Property.Get(16 * Button.Width),
            };

            _continueButton = new Button
            {
                Text = Property.Get("Continue"),
                Left = buttonLeft,
                Top = Property.Get(60f),
            };

            _disconnectButton = new Button
            {
                Text = Property.Get("Disconnect"),
                Left = buttonLeft,
                Top = Property.Get(100f),
            };

            _continueButton.Click += () =>
            {
                IsVisible = false;
            };

            _disconnectButton.Click += () =>
            {
                _connectionManager.Disconnect();
            };
        }