Beispiel #1
0
    private void OnGetRoleInfo(byte[] buffer)
    {
        Account_RoleInfoReqProto proto = Account_RoleInfoReqProto.GetProto(buffer);
        int roleId = proto.RoldId;

        GetRoleInfoResp(roleId);
    }
Beispiel #2
0
    public static Account_RoleInfoReqProto GetProto(byte[] buffer)
    {
        Account_RoleInfoReqProto proto = new Account_RoleInfoReqProto();

        using (MemoryStreamUtil ms = new MemoryStreamUtil(buffer))
        {
            proto.RoldId = ms.ReadInt();
        }
        return(proto);
    }
    /// <summary>
    /// 服务器返回进入游戏是否成功消息
    /// </summary>
    /// <param name="buffer"></param>
    private void OnEnterGameServerResp(byte[] buffer)
    {
        Account_EnterGameRespProto proto = Account_EnterGameRespProto.GetProto(buffer);

        if (proto.IsSuccess)
        {
            //TODO:成功就获取角色信息
            Debug.Log("进入游戏成功!,开始获取角色信息");
            Account_RoleInfoReqProto infoProto = new Account_RoleInfoReqProto();
            infoProto.RoldId = mCurrentSelectedRoleId;
            SocketManager.Instance.SendMessageToLocalServer(infoProto.ToArray());
        }
        else
        {
            UIDialogController.Instance.Show("进入游戏失败!" + proto.MsgCode);
        }
    }