Ejemplo n.º 1
0
    public void UpdateUserInfo()
    {
        if (null == inputNickNameObj)
        {
            return;
        }

        LionUserInfo ui = m_userInfo;

        // 区分自己和他人
        bool isSelf = m_userInfo.UserId == Lobby.getInstance().UId;

        // NickName
        if (isSelf)
        {
            valNickNameObj.SetActive(false);
            inputNickNameObj.SetActive(true);
            InputField field = inputNickNameObj.GetComponent <InputField>();
            field.text = ui.Name;
        }
        else
        {
            inputNickNameObj.SetActive(false);
            valNickNameObj.SetActive(true);
            valNickNameObj.GetComponent <Text>().text = ui.Name;
        }

        // Level
        GameObject.Find("valLevel").GetComponent <Text>().text = ui.Level.ToString();

        // Coins
        GameObject.Find("valCoins").GetComponent <Text>().text = Tools.CoinToString(ui.Gold);

        // Location
        GameObject.Find("valLocation").GetComponent <Text>().text = ui.Location;

        // Like
        GameObject.Find("valLike").GetComponent <Text>().text = ui.Praise.ToString();

        // UUID
        GameObject.Find("valUId").GetComponent <Text>().text = ui.UserId.ToString();

        // 头像
        //if (ui.HeadImgUrl != "")
        {
            GameObject goSrc = DialogSelectAvatar.GetHeadObject(ui.HeadImgUrl);;

            if (goSrc != null)
            {
                GameObject goDest =
                    DialogPersonalInfo.GetInstance().transform.Find("main").
                    transform.Find("BtnUpAvatar").gameObject;
                goDest.GetComponent <Image>().sprite = goSrc.GetComponent <Image>().sprite;
            }
            else
            {
                GameObject goHeadDefault = GameObject.Find("BtnAvatar").transform.Find("BtnHeadDefault").gameObject;
                GameObject goDest        =
                    DialogPersonalInfo.GetInstance().transform.Find("main").
                    transform.Find("BtnUpAvatar").gameObject;
                goDest.GetComponent <Image>().sprite = goHeadDefault.GetComponent <Image>().sprite;
            }
        }

        Reception recp = GameObject.Find("Reception").GetComponent <Reception>();

        recp.GetTigerStatInfo(m_userInfo.UserId, UpdateTigerStatUI);
    }