Example #1
0
        public PartyControl(string player, string host, LeavePartyHandler leavePartyDelegate, SendMessageHandler sendMessageDelegate, StartGameHandler startGameDelegate)
        {
            OnLeaveParty  = leavePartyDelegate;
            OnSendMessage = sendMessageDelegate;
            OnStartGame   = startGameDelegate;

            this.Host   = host;
            this.player = player;
            InitializeComponent();
            AddPlayer(host);

            // Only host can see the start game button
            if (player == host)
            {
                buttonStartGame.Visibility = Visibility.Visible;
            }
            else
            {
                AddPlayer(player);
            }
        }
Example #2
0
        public void Start()
        {
            try
            {
                StartRoundEventArgs args = new StartRoundEventArgs();
                args.TaskPool          = TaskPool;
                args.Token             = Token;
                args.CancelTokenSource = CancelTokenSource;
                args.WinLength         = WinLength;

                StartGameHandler?.Invoke(this, args);

                Task.WaitAll(TaskPool.ToArray(), Token);
            }
            catch (OperationCanceledException ex)
            {
                //throw new Exception("Stop game");
            }
            catch (Exception ex)
            {
                throw new Exception("Start game exception", ex.InnerException);
            }
            finally
            {
                if (FinishGameHandler != null)
                {
                    FinishGameHandler.Invoke(this, new System.EventArgs());
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine("{0} : {1} ---- {2} : {3}", Team1.Name, Team1.Count, Team2.Name, Team2.Count);
                    Console.WriteLine("End GAME!!!");
                }
            }
        }
Example #3
0
 public StartGame(string installPath)
 {
     ni.DoubleClick  += new EventHandler(ni_DoubleClick);
     StartGameFinish += new StartGameHandler(StartGame_StartGameFinish);
     this.installPath = installPath;
 }
Example #4
0
 private void Start()
 {
     cells            = FindObjectsOfType <FieldController>();
     startGameHandler = FindObjectOfType <StartGameHandler>();
     Cursor.visible   = true;
 }