예제 #1
0
 private int compareTo(UserRanking x, UserRanking y)
 {
     int result = y.Score - x.Score;
     if (result == 0)
     {
         result = y.UserID - x.UserID;
     }
     return result;
 }
예제 #2
0
 public override bool TakeAction()
 {
     var cache = new ShareCacheStruct<UserRanking>();
     var ranking = cache.Find(m => m.UserName == UserName);
     if (ranking == null)
     {
         ranking = new UserRanking();
         ranking.UserID = (int)cache.GetNextNo();
         ranking.UserName = UserName;
         ranking.Score = Score;
         cache.Add(ranking);
     }
     else
     {
         ranking.UserName = UserName;
         ranking.Score = Score;
     }
     return true;
 }