public static void OnRoleOperation_CreateRoleReturn(byte[] buffer)
    {
        RoleOperation_CreateRoleReturnProto proto = RoleOperation_CreateRoleReturnProto.GetProto(buffer);

#if DEBUG_LOG_PROTO
        Debug.Log("<color=#00eaff>接收消息:</color><color=#00ff9c>" + proto.ProtoEnName + " " + proto.ProtoCode + "</color>");
        Debug.Log("<color=#c5e1dc>==>>" + JsonUtility.ToJson(proto) + "</color>");
#endif
    }
 public static RoleOperation_CreateRoleReturnProto ToProto(byte[] buffer)
 {
     using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer))
     {
         RoleOperation_CreateRoleReturnProto proto = new RoleOperation_CreateRoleReturnProto();
         proto.IsSucess = ms.ReadBool();
         if (!proto.IsSucess)
         {
             proto.MessageID = ms.ReadInt();
         }
         return(proto);
     }
 }
    public static RoleOperation_CreateRoleReturnProto GetProto(byte[] buffer)
    {
        RoleOperation_CreateRoleReturnProto proto = new RoleOperation_CreateRoleReturnProto();

        using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer))
        {
            proto.IsSuccess = ms.ReadBool();
            if (!proto.IsSuccess)
            {
                proto.MsgCode = ms.ReadInt();
            }
        }
        return(proto);
    }
    /// <summary>
    /// 服务器对客户端创建角色的事件响应
    /// </summary>
    /// <param name="p"></param>
    private void OnCreateRoleReturnEventHandler(byte[] p)
    {
        RoleOperation_CreateRoleReturnProto proto = RoleOperation_CreateRoleReturnProto.GetProto(p);

        Debug.Log(proto.IsSuccess);
        if (proto.IsSuccess)
        {
            AppDebug.Log("创建成功");
        }
        else
        {
            UIMessageCtr.Instance.Show("提示", "创建角色失败");
        }
    }
示例#5
0
        private void CreateRoleProtoReturn(MFReturnValue <object> ret, Role role)
        {
            RoleOperation_CreateRoleReturnProto proto = new RoleOperation_CreateRoleReturnProto();

            if (ret.HasError)
            {
                proto.IsSucess  = false;
                proto.MessageID = 100;
            }
            else
            {
                proto.IsSucess = true;
            }
            role.Client_Socket.SendMsg(proto.ToArray());
        }
    public static RoleOperation_CreateRoleReturnProto GetProto(MMO_MemoryStream ms, byte[] buffer)
    {
        RoleOperation_CreateRoleReturnProto proto = new RoleOperation_CreateRoleReturnProto();

        ms.SetLength(0);
        ms.Write(buffer, 0, buffer.Length);
        ms.Position = 0;

        proto.IsSuccess = ms.ReadBool();
        if (!proto.IsSuccess)
        {
            proto.MsgCode = ms.ReadInt();
        }

        return(proto);
    }
    public static void OnRoleOperation_CreateRoleReturn(byte[] buffer)
    {
        RoleOperation_CreateRoleReturnProto proto = RoleOperation_CreateRoleReturnProto.GetProto(buffer);

#if DEBUG_LOG_PROTO
        Debug.Log("<color=#00eaff>接收消息:</color><color=#00ff9c>" + proto.ProtoEnName + " " + proto.ProtoCode + "</color>");
        Debug.Log("<color=#c5e1dc>==>>" + JsonUtility.ToJson(proto) + "</color>");
#endif
        if (proto.IsSuccess)
        {
            Log.Info("创建角色成功");
            GameEntry.Procedure.SetData <VarInt>(Constant.ProcedureData.NextSceneId, 1);
        }
        else
        {
            GameEntry.UI.OpenDialog(new DialogParams()
            {
                Mode    = 1,
                Title   = "提示",
                Message = "用户名已存在",
            });
        }
    }
    /// <summary>
    /// 创建角色 结果 协议回调
    /// </summary>
    /// <param name="p"></param>
    private void OnCreateRoleReturnProto(byte[] p)
    {
        RoleOperation_CreateRoleReturnProto proto = RoleOperation_CreateRoleReturnProto.ToProto(p);

        m_CreateRoleOK = proto.IsSucess;
    }