internal WaitForAIDialog(Server serverData, SettingStructure settings)
 {
     this.DataContext = serverData;
     base.DataContext = this.DataContext;
     SettingStruct    = settings;
     InitializeComponent();
     serverData.PropertyChanged += __serverDataPropertyChanged;
 }
        internal static bool ShowDialog(out SettingStructure setting)
        {
            GameSettingDialog dialog = new GameSettingDialog();

            dialog.ShowDialog();
            if (dialog.DialogResult == true)
            {
                setting = dialog.DataContext;
                return(true);
            }
            else
            {
                setting = null;
                return(false);
            }
        }
Пример #3
0
 internal WaitForAIDialog(Server serverData, SettingStructure settings)
 {
     this.DataContext = serverData;
     InitializeComponent();
     serverData.PropertyChanged += (ss, ee) =>
     {
         if (ee.PropertyName.StartsWith("IsConnected") && ((serverData.IsConnected1P | settings.IsUser1P) & (serverData.IsConnected2P | settings.IsUser2P)))
         {
             Dispatcher.BeginInvoke((Action)(() => this.Close()));
         }
     };
     if (settings.IsUser1P)
     {
         Text1P.Visibility = (Progress1P.Visibility = Visibility.Hidden);
     }
     if (settings.IsUser2P)
     {
         Text2P.Visibility = (Progress2P.Visibility = Visibility.Hidden);
     }
 }
 public async Task <bool> InitGame(GameSettings.SettingStructure settings)
 {
     this.IsEnabled = false;
     if (!(await gameManager.InitGameData(settings)))
     {
         this.IsEnabled = true;
         return(false);
     }
     CreateCellOnCellGrid(gameManager.Data.BoardWidth, gameManager.Data.BoardHeight);
     if (settings.IsUser1P)
     {
         Player1Window         = new PlayerControlPanel(gameManager, viewModel.Players[0]);
         Player1Window.Closed += (ss, ee) => Player1Window = null;
         Player1Window.Show();
     }
     if (settings.IsUser2P)
     {
         Player2Window         = new PlayerControlPanel(gameManager, viewModel.Players[1]);
         Player2Window.Closed += (ss, ee) => Player2Window = null;
         Player2Window.Show();
     }
     this.IsEnabled = true;
     return(true);
 }
 public GameSettingDialog()
 {
     DataContext      = new SettingStructure();
     base.DataContext = DataContext;
     InitializeComponent();
 }
Пример #6
0
 public void InitGame(GameSettings.SettingStructure settings)
 {
     gameManager.InitGameData(settings);
     CreateCellOnCellGrid(gameManager.Data.BoardWidth, gameManager.Data.BoardHeight);
 }
 public void InitGameData(GameSettings.SettingStructure settings)
 {
     Data.InitGameData(settings);
     Data.IsPause = false;
     Server.StartListening(settings);
 }
Пример #8
0
 public void InitGameData(GameSettings.SettingStructure settings)
 {
     data.InitGameData(settings);
     server.StartListening(settings);
 }