示例#1
0
        public static void SetScore(string gamename, Mobile player, int score)
        {
            BoardGamePlayerScore scoredata = GetScoreData(gamename, player);

            if (scoredata != null)
            {
                scoredata.Score = score;
            }
        }
示例#2
0
        public static int GetScore(string gamename, Mobile player)
        {
            BoardGamePlayerScore scoredata = GetScoreData(gamename, player);

            if (scoredata != null)
            {
                return(scoredata.Score);
            }
            return(0);
        }
示例#3
0
        public int CompareTo(object obj)
        {
            if (!(obj is BoardGamePlayerScore))
            {
                return(0);
            }

            BoardGamePlayerScore comparescore = (BoardGamePlayerScore)obj;

            return(-Score.CompareTo(comparescore.Score));
        }
示例#4
0
        protected virtual void Deserialize(GenericReader reader)
        {
            int version = reader.ReadInt();

            _GameName = reader.ReadString();

            int count = reader.ReadInt();

            for (int i = 0; i < count; i++)
            {
                var playerscore = new BoardGamePlayerScore(reader);

                if (playerscore.Player != null && !playerscore.Player.Deleted)
                {
                    Scores.Add(playerscore);
                }
            }
        }
示例#5
0
        protected virtual void Deserialize(GenericReader reader)
        {
            int version = reader.ReadInt();

            _GameName = reader.ReadString();

            int count = reader.ReadInt();

            for (int i = 0; i < count; i++)
            {
                BoardGamePlayerScore playerscore = new BoardGamePlayerScore(reader);

                if (playerscore.Player != null && !playerscore.Player.Deleted)
                {
                    Scores.Add(playerscore);
                }
            }
        }
示例#6
0
        protected static BoardGamePlayerScore GetScoreData(string gamename, Mobile player)
        {
            List <BoardGamePlayerScore> scores = GetScores(gamename);

            if (scores == null)
            {
                var gamedata = new BoardGameData(gamename);
                GameData.Add(gamedata);
                scores = gamedata.Scores;
            }

            int index = BoardGamePlayerScore.IndexOf(scores, player);

            if (index == -1)
            {
                var newscore = new BoardGamePlayerScore(player);
                scores.Add(newscore);
                return(newscore);
            }
            return(scores[index]);
        }
        protected static BoardGamePlayerScore GetScoreData( string gamename, Mobile player )
        {
            List<BoardGamePlayerScore> scores = GetScores( gamename );

            if( scores == null )
            {
                BoardGameData gamedata = new BoardGameData( gamename );
                GameData.Add( gamedata );
                scores = gamedata.Scores;
            }

            int index = BoardGamePlayerScore.IndexOf( scores, player );

            if( index == -1 )
            {
                BoardGamePlayerScore newscore = new BoardGamePlayerScore( player );
                scores.Add( newscore );
                return newscore;
            }
            else
            {
                return scores[ index ];
            }
        }
示例#8
0
        public static void AddLose(string gamename, Mobile player)
        {
            BoardGamePlayerScore playerscore = GetScoreData(gamename, player);

            playerscore.Losses += 1;
        }
示例#9
0
        public static int getLosses(string gamename, Mobile player)
        {
            BoardGamePlayerScore playerscore = GetScoreData(gamename, player);

            return(playerscore.Losses);
        }