コード例 #1
0
    private AgentGainWidget mRootView;//父对象

    public void InitUI(SendGetAgentWinList data, Transform root, AgentGainWidget view)
    {
        mRootView = view;
        mData     = data;
        mRoot     = root;
        //头像
        Assets.LoadIcon(data.headUrl, (t) => { mHead.mainTexture = t; });
        //昵称
        mNickNameLabel.text = data.nickname;
        //id
        mUIDLabel.text = "ID:" + data.userId;
        //总桃数
        mPeachNum.text = (data.selfPeach + data.warehousePeach).ToString();
        //下级代理抽成
        mGainLabel.text = data.oneBenefit.ToString();
        //下下级代理
        if (data.two != null)
        {
            mTwoGo.gameObject.SetActive(true);
            //下下级代理人数
            mTwoPeopleNumLabel.text = data.two.agentTotal.ToString();
            //下下级代理抽成
            mTwoAgainCutNum.text = data.two.sum.ToString();
        }
        else
        {
            mTwoGo.gameObject.SetActive(false);
        }
    }
コード例 #2
0
    /// <summary>
    /// 请求获取代理收益
    /// </summary>
    public void SendGetAgentGain()
    {
        CommonSendProto req = new CommonSendProto();

        NetProcess.SendRequest <CommonSendProto>(req, ProtoIdMap.CMD_SendGetAgentGain, (msg) =>
        {
            SendGetAgentWinAck ack = msg.Read <SendGetAgentWinAck>();
            if (ack.code == 1)
            {
                AgentGainWidget widget = Global.Inst.GetController <AgentGainController>().OpenWindow() as AgentGainWidget;
                if (ack.data != null)
                {
                    mView.gameObject.SetActive(false);
                    float allpeach = PlayerModel.Inst.UserInfo.gold + PlayerModel.Inst.UserInfo.wareHouse;
                    widget.InitUI(ack.data.agentList, mView.gameObject, ack.data.agentNum, ClubModel.Inst.AllPlayerPeach, PlayerModel.Inst.UserInfo.wareHouse, ack.data.higherAgent);
                }
            }
            else
            {
                GameUtils.ShowErrorTips(ack.code);
            }
        });
    }