Skip to content
ScutGame edited this page Mar 25, 2015 · 17 revisions

此章节介绍旧版本升级到新版本API更新或变动说明

6.7.9.7 版本变动

(1) 实体自定属性EntityTable(IsStoreInDb = false)调整

[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
{
}

(2) BaseUser角色实体类不再继承IUser接口,提供SessionUser类继承承IUser

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);
}

(3) IDataSender.Send方法参数调整

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());

(4) ActionFactory.SendAsyncAction方法参数调整

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);
    }
}

(5) 登录中间件去掉GameEnvironment.Setting.ProductDesEnKey密钥的加解密

//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]
};
Clone this wiki locally