/// <summary>
    /// 删除角色协议回调
    /// </summary>
    /// <param name="p"></param>
    private void OnDeleteRoleReturnProto(byte[] p)
    {
        RoleOperation_DeleteRoleReturnProto proto = RoleOperation_DeleteRoleReturnProto.ToProto(p);

        if (proto.IsSucess)
        {
            RoleOperation_LogOnGameServerReturnProto.RoleItem roleItem = m_RoleItemList.Find((item) => item.RoleId == CurrentRoleID);
            if (roleItem != null)
            {
                m_RoleItemList.Remove(roleItem);
                if (m_RoleItemList.Count > 0)
                {
                    CurrentRoleID = m_RoleItemList[0].RoleId;
                }
                else
                {
                    ShowCreateRoleView();
                    return;
                }
            }
            else
            {
                Debug.Log("Error");
            }

            ShowSelectRoleView();
        }
        else
        {
            Debug.Log("Error:0000");
        }
    }
    public static RoleOperation_DeleteRoleReturnProto GetProto(byte[] buffer, bool isChild = false)
    {
        RoleOperation_DeleteRoleReturnProto proto = new RoleOperation_DeleteRoleReturnProto();

        MMO_MemoryStream ms = null;

        if (!isChild)
        {
            ms = GameEntry.Socket.SocketSendMS;
        }
        else
        {
            ms = GameEntry.Pool.DequeueClassObject <MMO_MemoryStream>();
        }
        ms.SetLength(0);
        ms.Write(buffer, 0, buffer.Length);
        ms.Position = 0;

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

        if (isChild)
        {
            GameEntry.Pool.EnqueueClassObject(ms);
        }
        return(proto);
    }
    public static void OnRoleOperation_DeleteRoleReturn(byte[] buffer)
    {
        RoleOperation_DeleteRoleReturnProto proto = RoleOperation_DeleteRoleReturnProto.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)
        {
            GameEntry.UI.OpenDialog(new DialogParams()
            {
                Mode    = 1,
                Title   = "提示",
                Message = "删除角色成功",
            });
            //删除角色成功
            GameEntry.Event.CommonEvent.Dispatch(GameEntry.Socket.MainSocket, GameEntry.Pool.SpawnClassObject <DeleateRoleSuccessGameEvent>());
        }
        else
        {
            GameEntry.UI.OpenDialog(new DialogParams()
            {
                Mode    = 1,
                Title   = "提示",
                Message = "删除角色失败",
            });
        }
    }
 public static RoleOperation_DeleteRoleReturnProto ToProto(byte[] buffer)
 {
     using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer))
     {
         RoleOperation_DeleteRoleReturnProto proto = new RoleOperation_DeleteRoleReturnProto();
         proto.IsSucess = ms.ReadBool();
         return(proto);
     }
 }
示例#5
0
    public static void OnRoleOperation_DeleteRoleReturn(byte[] buffer)
    {
        RoleOperation_DeleteRoleReturnProto proto = RoleOperation_DeleteRoleReturnProto.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_DeleteRoleReturnProto GetProto(byte[] buffer)
    {
        RoleOperation_DeleteRoleReturnProto proto = new RoleOperation_DeleteRoleReturnProto();

        using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer))
        {
            proto.IsSuccess = ms.ReadBool();
            if (!proto.IsSuccess)
            {
                proto.MessageId = ms.ReadShort();
            }
        }
        return(proto);
    }
示例#7
0
        private void DeleteRoleReturn(Role role, MFReturnValue <object> ret)
        {
            RoleOperation_DeleteRoleReturnProto proto = new RoleOperation_DeleteRoleReturnProto();

            if (ret.HasError)
            {
                proto.IsSucess = false;
            }
            else
            {
                proto.IsSucess = true;
            }
            role.Client_Socket.SendMsg(proto.ToArray());
        }
    /// <summary>
    /// 服务器返回删除角色的消息
    /// </summary>
    /// <param name="p"></param>
    private void OnDeleteRoleReturn(byte[] p)
    {
        RoleOperation_DeleteRoleReturnProto proto = RoleOperation_DeleteRoleReturnProto.GetProto(p);

        if (proto.IsSuccess)
        {
            //删除角色成功
            DeleteRole(m_currentRoleId);
            Debug.Log("删除角色成功");
        }
        else
        {
            UIMessageCtr.Instance.Show("提示", "删除角色失败");
        }
    }
    public static RoleOperation_DeleteRoleReturnProto GetProto(MMO_MemoryStream ms, byte[] buffer)
    {
        RoleOperation_DeleteRoleReturnProto proto = new RoleOperation_DeleteRoleReturnProto();

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