Ejemplo n.º 1
0
    private void OnReq_CreateRole(MessageRecv obj)
    {
        System.IO.MemoryStream ms  = new System.IO.MemoryStream(obj.Data);
        RoleCreateReq          req = Serializer.Deserialize <RoleCreateReq>(ms);

        RoleCreateAck ack = new RoleCreateAck();

        ack.RoleID    = GTGUID.NewGUID();
        ack.Name      = req.Name;
        ack.RoleType  = req.RoleType;
        ack.AccountID = req.AccountID;
        NetworkManager.Instance.Send(MessageID.MSG_ROLE_CREATE_ACK, ack, 0, 0);
    }
Ejemplo n.º 2
0
    //创建角色
    public void TryCreateRole(string name, int roleID, ulong accountID)
    {
        if (string.IsNullOrEmpty(name))
        {
            GTItemHelper.ShowTip("名字不能为空");
            return;
        }
        RoleCreateReq req = new RoleCreateReq();

        req.Name      = name;
        req.AccountID = accountID;
        req.RoleType  = (uint)roleID;
        NetworkManager.Instance.Send(MessageID.MSG_ROLE_CREATE_REQ, req);
    }