public static User GetCurrentUser(bool needLogin = false) { if (needLogin||CurrentUser == null || CurrentUser.Level == 1) { if (MembershipManager.Login().Flag == ResultFlag.Success) { CurrentUser = GetUserInfo(); } } return CurrentUser; }
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; }