예제 #1
0
 public static User GetCurrentUser(bool needLogin = false)
 {
     if (needLogin||CurrentUser == null || CurrentUser.Level == 1)
     {
         if (MembershipManager.Login().Flag == ResultFlag.Success)
         {
             CurrentUser = GetUserInfo();
         }
     }
     return CurrentUser;
 }
예제 #2
0
        public static User ParseUserFromJson(JsonUser jsonUser)
        {
            if (jsonUser == null) return null;

            User user = new User
            {
                Id = jsonUser.UserId,
                Level = jsonUser.UserLevel,
                Gold = jsonUser.Gold,
                Energy = jsonUser.Energy
            };
            return user;
        }