コード例 #1
0
ファイル: User.cs プロジェクト: shoferb/OYAOB
        public bool SetPoints(int amount)
        {
            if (amount > 0)
            {
                points += amount;
                userDataProxy.EditUserPoints(id, points);
                return(true);
            }

            return(false);
        }
コード例 #2
0
        //for test only
        //use-case: user can edit is points
        public bool EditUserPoints(int userId, int newPoints)
        {
            bool  toReturn = false;
            IUser user     = _sc.GetUserWithId(userId);

            if (user == null)
            {
                return(toReturn);
            }
            toReturn = user.EditUserPoints(newPoints);
            if (toReturn)
            {
                _userDataProxy.EditUserPoints(userId, newPoints);
            }
            return(toReturn);
        }
コード例 #3
0
ファイル: Player.cs プロジェクト: shoferb/OYAOB
        //get amout won, inc winCounter + update point + check if the user is now the highest player
        public bool Win(int amount)
        {
            bool toReturn;

            try
            {
                user.IncWinNum();
                user.UpdateHighestCashInGame(amount);
                user.UpdateTotalProfit(amount);
                TotalChip += amount;
                int newPoint = GetNewPoint();
                user.EditUserPoints(newPoint);
                UserDataProxy p = new UserDataProxy();
                this.user.EditUserPoints(newPoint);
                p.EditUserPoints(user.Id(), newPoint);
                toReturn = true;
            }
            catch (Exception e)
            {
                toReturn = false;
            }
            return(toReturn);
        }