Esempio n. 1
0
        /// <summary>
        /// Player position changed property.
        /// </summary>
        /// <param name="d"></param>
        /// <param name="e"></param>
        private static void OnPlayerPosChanged(DependencyObject d,
                                               DependencyPropertyChangedEventArgs e)
        {
            try
            {
                MazeGrid grid = d as MazeGrid;

                string nextPos = e.NewValue as string;

                grid.MovePlayerRectangle(nextPos);

                // Check if player reached destination.
                if (nextPos == grid.GoalPos &&
                    (grid.Name == "LeftMaze" || grid.Name == "MazeBoard"))
                {
                    MessageBox.Show("You won.", "Victory", MessageBoxButton.OK,
                                    MessageBoxImage.Information);
                }

                // Check if opponent reached destination.
                if (nextPos == grid.GoalPos && grid.Name == "RightMaze")
                {
                    MessageBox.Show("You lost.", "Defeat", MessageBoxButton.OK,
                                    MessageBoxImage.Information);
                }
            }
            catch (NullReferenceException)
            {
            }
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 8 "..\..\..\Views\SinglePlayerGameMaze.xaml"
                ((GameClient.Views.SinglePlayerGameMaze)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.restartButton = ((System.Windows.Controls.Button)(target));

            #line 11 "..\..\..\Views\SinglePlayerGameMaze.xaml"
                this.restartButton.Click += new System.Windows.RoutedEventHandler(this.restartButton_Click);

            #line default
            #line hidden
                return;

            case 3:
                this.solveButton = ((System.Windows.Controls.Button)(target));

            #line 13 "..\..\..\Views\SinglePlayerGameMaze.xaml"
                this.solveButton.Click += new System.Windows.RoutedEventHandler(this.solveButton_Click);

            #line default
            #line hidden
                return;

            case 4:
                this.menuButton = ((System.Windows.Controls.Button)(target));

            #line 15 "..\..\..\Views\SinglePlayerGameMaze.xaml"
                this.menuButton.Click += new System.Windows.RoutedEventHandler(this.menuButton_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.MazeBoard = ((GameClient.Views.MazeGrid)(target));
                return;
            }
            this._contentLoaded = true;
        }
Esempio n. 3
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 8 "..\..\..\Views\MultiplePlayerGameMaze.xaml"
                ((GameClient.Views.MultiplePlayerGameMaze)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden

            #line 8 "..\..\..\Views\MultiplePlayerGameMaze.xaml"
                ((GameClient.Views.MultiplePlayerGameMaze)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.MultiplePlayerGameMaze_OnClosing);

            #line default
            #line hidden
                return;

            case 2:
                this.BackMainMenuButton = ((System.Windows.Controls.Button)(target));

            #line 12 "..\..\..\Views\MultiplePlayerGameMaze.xaml"
                this.BackMainMenuButton.Click += new System.Windows.RoutedEventHandler(this.BackMainMenuButton_Click);

            #line default
            #line hidden
                return;

            case 3:
                this.LeftMaze = ((GameClient.Views.MazeGrid)(target));
                return;

            case 4:
                this.RightMaze = ((GameClient.Views.MazeGrid)(target));
                return;

            case 5:
                this.textBlock = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 6:
                this.textBlock1 = ((System.Windows.Controls.TextBlock)(target));
                return;
            }
            this._contentLoaded = true;
        }