-
Notifications
You must be signed in to change notification settings - Fork 577
ScutGame edited this page Mar 26, 2015
·
17 revisions
此章节介绍旧版本升级到新版本API更新或变动说明
[EntityTable(CacheType.Entity, DbConfig.Data, IsStoreInDb = false, IsExpired = false)]
public class UserNickName : ShareEntity
{
}
修改为:
[EntityTable(CacheType.Entity, DbConfig.Data, StorageType = StorageType.ReadWriteRedis, IsExpired = false)]
public class UserNickName : ShareEntity
{
}
Action1004类的DoSuccess方法
protected override bool DoSuccess(int userId, out IUser user)
{
if (gameUser == null ||
string.IsNullOrEmpty(gameUser.SessionID) ||
gameUser.IsOnlining)
{
gameUser = cacheSet.FindKey(Uid);
}
//...
GameUser gameUser = cacheSet.FindKey(Uid);
user = gameUser;
}
修改为:
protected override bool DoSuccess(int userId, out IUser user)
{
if (gameUser == null ||
string.IsNullOrEmpty(gameUser.SessionID) ||
(Current.User != null && !Current.User.IsOnlining))
{
gameUser = cacheSet.FindKey(Uid);
}
//...
GameUser gameUser = cacheSet.FindKey(Uid);
user = new SessionUser(gameUser);
}
//GameUser.cs 修改
public class GameUser : BaseUser
{
#region extend method
protected override int GetIdentityId()
{
return UserId;
}
public override int GetUserId()
{
return UserId;
}
public override string GetPassportId()
{
return Pid;
}
public override string GetRetailId()
{
return RetailId;
}
public override bool IsLock
{
get { return Status == UserStatus.Locked; }
}
public override string GetNickName()
{
return NickName;
}
#endregion
}
UserLoginLog userLoginLog = new UserLoginLog();
DataSyncManager.GetDataSender().Send(userLoginLog);
修改为:
UserLoginLog userLoginLog = new UserLoginLog();
DataSyncManager.GetDataSender().Send(userLoginLog);
//或多条
var logList = new List<UserLoginLog>();
for(int i=0; i< 10; i++)
{
UserLoginLog userLoginLog = new UserLoginLog();
logList.Add(userLoginLog);
}
DataSyncManager.GetDataSender().Send(logList.ToArray());
private static void DoNotifyAction(int actionId, List<GameUser> userList, Parameters parameters, Action<int> callback)
{
ActionFactory.SendAsyncAction(userList, actionId, parameters, result => { });
if (callback != null)
{
callback(actionId);
}
}
或早期的API代码:
public static void SendAsyncAction<T>(List<T> userList, int actionId, Parameters parameters, Action<HttpGet> successHandle)
修改为:
private static void DoNotifyAction(int actionId, List<GameUser> userList, Parameters parameters, Action<int> callback)
{
List<SessionUser> sessionUsers = userList.ConvertAll(user => new SessionUser(user));
ActionFactory.SendAsyncAction(sessionUsers, actionId, parameters, result => { });
if (callback != null)
{
callback(actionId);
}
}
//Action1002
string[] userList = SnsManager.GetRegPassport(_data.DeviceID);
_result = new PassportResult()
{
PassportID = userList[0],
Password = CryptoHelper.DES_Decrypt(userList[1], GameEnvironment.Setting.ProductDesEnKey)
};
修改为:
string[] userList = SnsManager.GetRegPassport(_data.DeviceID);
_result = new PassportResult()
{
PassportID = userList[0],
Password = userList[1]
};
public override bool TakeAction()
{
_password = DecodePassword(_password);
if (SnsManager.ChangePass(Uid, _password) <= 0)
{
Tips(Language.Instance.ChangedPasswordError);
return false;
}
return true;
}
修改为:
public override bool TakeAction()
{
_password = DecodePassword(_password);
if (SnsManager.ChangePass(UserId.ToString(), _password) <= 0)
{
Tips(Language.Instance.ChangedPasswordError);
return false;
}
return true;
}