예제 #1
0
 public MinesweeperEvent(string callBackKey, MinesweeperEventArgs e)
 {
     CallbackKey = callBackKey;
     Args = new List<int> { e.X, e.Y, e.UserId };
     Id = e.EventId;
     Timestamp = DateTimeOffset.Now;
 }
 void RecordUnflag(object sender, MinesweeperEventArgs e)
 {
     lock (_journal)
     {
         _journal.Enqueue(new MinesweeperEvent("unflag", e));
     }
 }
 void RecordSpecialUncover(object sender, MinesweeperEventArgs e)
 {
     lock (_journal)
     {
         _journal.Enqueue(new MinesweeperEvent("specialUncover", e));
     }
 }
예제 #4
0
 public MinesweeperEvent(string callBackKey, MinesweeperEventArgs e)
 {
     CallbackKey = callBackKey;
     Args        = new List <int> {
         e.X, e.Y, e.UserId
     };
     Id        = e.EventId;
     Timestamp = DateTimeOffset.Now;
 }
 public virtual void OnUnflag(MinesweeperEventArgs e)
 {
     var x = e.X;
     var y = e.Y;
     if (Board[x, y].FlagOwnerId == e.UserId)
     {
         Board.Unflag(e.X, e.Y, e.UserId);
         Unflag(this, e);
     }
 }
예제 #6
0
        public virtual void OnUnflag(MinesweeperEventArgs e)
        {
            var x = e.X;
            var y = e.Y;

            if (Board[x, y].FlagOwnerId == e.UserId)
            {
                Board.Unflag(e.X, e.Y, e.UserId);
                Unflag(this, e);
            }
        }
 public virtual void OnFlag(MinesweeperEventArgs e)
 {
     var x = e.X;
     var y = e.Y;
     var userId = e.UserId;
     var cell = Board[x, y];
     if(cell.FlagOwnerId != null && cell.FlagOwnerId != userId)
     {
         //By default do not allow
         //different players to flag the same cell
         return;
     }
     Board.Flag(x, y, userId);
     Flag(this, e);
 }
예제 #8
0
        public virtual void OnFlag(MinesweeperEventArgs e)
        {
            var x      = e.X;
            var y      = e.Y;
            var userId = e.UserId;
            var cell   = Board[x, y];

            if (cell.FlagOwnerId != null && cell.FlagOwnerId != userId)
            {
                //By default do not allow
                //different players to flag the same cell
                return;
            }
            Board.Flag(x, y, userId);
            Flag(this, e);
        }
 public virtual void OnUncover(MinesweeperEventArgs e)
 {
     Board.Uncover(e.X, e.Y, e.UserId);
     Uncover(this, e);
 }
예제 #10
0
 protected virtual void HandleSpecialUncover(object sender, MinesweeperEventArgs e)
 {
 }
예제 #11
0
        protected virtual void HandleUnflag(object sender, MinesweeperEventArgs e)
        {
            var userId = e.UserId;

            Scores[userId] = Controller.Board.GetNumFlags(userId);
        }
예제 #12
0
 public virtual void OnSpecialUncover(MinesweeperEventArgs e)
 {
     Board.SpecialUncover(e.X, e.Y, e.UserId);
     SpecialUncover(this, e);
 }
예제 #13
0
 protected virtual void HandleUnflag(object sender, MinesweeperEventArgs e)
 {
     var userId = e.UserId;
     Scores[userId] = Controller.Board.GetNumFlags(userId);
 }
예제 #14
0
 protected virtual void HandleUncover(object sender, MinesweeperEventArgs e)
 {
 }