示例#1
0
    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
    }
    /// <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("提示", "创建角色失败");
        }
    }
    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 = "用户名已存在",
            });
        }
    }