Ejemplo n.º 1
0
    public CommandCallbackType NewReceiveLoginRes(byte[] dataBuffer, int socketId)
    {
        NewSSUserLoginRes sSUserLoginRes = NewSSUserLoginRes.ParsePackage(dataBuffer);

        LoginManager.Instance.NewSSUserLoginRes = sSUserLoginRes;
        //LoginPlatformManager.Instance.NewSSUserLoginRes = sSUserLoginRes;

        if (m_isAutoLogin)
        {
            if (sSUserLoginRes.SSActorInfos.Count() > 0)
            {
                LoginManager.Instance.LoginSSActorInfo = sSUserLoginRes.SSActorInfos[0];
                //LoginPlatformManager.Instance.LoginSSActorInfo = sSUserLoginRes.SSActorInfos[0];

                NewJumpToGamtway();
            }
            else
            {
                UI.MessageBox.Instance.Show(3, "", "没有角色信息", "确定", null);
            }
        }
        else
        {
            RaiseEvent(EventTypeEnum.S_CUserLoginRes.ToString(), sSUserLoginRes);
        }

        return(CommandCallbackType.Continue);
    }
Ejemplo n.º 2
0
    public static NewSSUserLoginRes ParsePackage(byte[] dataBuffer)
    {
        Package package = PackageHelper.ParseReceiveData(dataBuffer);

        NewSSUserLoginRes sSUserLoginRes = new NewSSUserLoginRes();
        int offset = 0;

        offset += PackageHelper.ReadData(package.Data.Skip(offset).ToArray(), out sSUserLoginRes.lUserID);
        offset += PackageHelper.ReadData(package.Data.Skip(offset).ToArray(), out sSUserLoginRes.lActorNum);
        offset += PackageHelper.ReadData(package.Data.Skip(offset).ToArray(), out sSUserLoginRes.lPromptFlag);
        offset += PackageHelper.ReadData(package.Data.Skip(offset).ToArray(), out sSUserLoginRes.lPromptMsg, 256);

        sSUserLoginRes.SSActorInfos = new SSActorInfo[sSUserLoginRes.lActorNum];
        for (int i = 0; i < sSUserLoginRes.lActorNum; i++)
        {
            sSUserLoginRes.SSActorInfos[i] = SSActorInfo.ParsePackage(package.Data, ref offset);
        }
        return(sSUserLoginRes);
    }