Exemplo n.º 1
0
    //发送更换头像请求
    private void SendChangeHeadReq()
    {
        //本地校验

        var isHeadUnlock      = _model.GetHeadInfo(_headId).IsUnlock;
        var isHeadFrameUnlock = _model.GetHeadFrameVo(_headFrameId).IsUnlock;

        if (!isHeadUnlock || !isHeadFrameUnlock)
        {
            if (!isHeadUnlock)
            {
                FlowText.ShowMessage("当前头像未解锁~");
            }

            if (!isHeadFrameUnlock)
            {
                FlowText.ShowMessage("当前头像框未解锁~");
            }

            return;
        }

        //发更换请求
        LoadingOverlay.Instance.Show();
        ReplaceUserAvatarOrBoxReq req = new ReplaceUserAvatarOrBoxReq {
            Avatar = _headId, AvatarBox = _headFrameId,
        };

        byte[] data = NetWorkManager.GetByteData(req);
        NetWorkManager.Instance.Send <ReplaceUserAvatarOrBoxRes>(CMD.USERC_REPLACEUSERAVATARORBOX, data,
                                                                 GetChangeHeadRes);
    }
Exemplo n.º 2
0
    public void SetData(HeadModel model)
    {
        _model       = model;
        _curHeadPath = model.GetCurPlayerHeadPath();
        var userData = GlobalData.PlayerModel.PlayerVo.UserOther;

        _headId      = userData.Avatar;
        _headFrameId = userData.AvatarBox;


        CreateHeadItem(model.GetAllUserHeadData());
        SetFontColor("All");
        CreateHeadFrameItem(model.UserHeadFrameData);

        var curHeadVo      = model.GetHeadInfo(_headId);
        var curHeadFrameVo = model.GetHeadFrameVo(_headFrameId);



        _headImg.texture      = ResourceManager.Load <Texture>(curHeadVo.Path);
        _headFrameImg.texture = ResourceManager.Load <Texture>(curHeadFrameVo.Path);

        _headContent.GetText("Text").text      = "";
        _headFrameContent.GetText("Text").text = "";
        SetHeadFrameRedDot();
    }