コード例 #1
0
    void setCurTitle(int titleId)
    {
        TitleItemTableItem item = TitleModule.GetTitleItemById(titleId);

        if (item == null)
        {
            return;
        }

        UIAtlasHelper.SetSpriteImage(mIconSp, item.picName, true);

        mAttrisLb[0].text = item.detail1;
        mAttrisLb[1].text = item.detail2;
        mAttrisLb[2].text = item.detail3;
        mAttrisLb[3].text = item.detail4;

        mGradeLb.text = item.grade.ToString();

        PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>();

        if (pdm == null)
        {
            return;
        }

        bool ishave = pdm.IsHasTitleByID(titleId);

        string detail = "";

        switch (item.contentId)
        {
        case 0:
            FontColor fc  = ishave ? FontColor.Green : FontColor.Red;
            string    tmp = StringHelper.StringWithColor(fc, pdm.GetLevel() + "/" + item.conditionVal);
            detail = string.Format(item.contentDetail, tmp);
            break;

        default:
            detail = item.contentDetail;
            break;
        }

        mConditionLb.text = detail;

        UISprite btnBg = mEquipBtn.GetComponent <UISprite>();

        if (btnBg != null)
        {
            UIAtlasHelper.SetSpriteShaderGrey(btnBg, !ishave);
        }

        mEquipBtnLb.text = pdm.GetCurTitle() == titleId ? "卸下" : "穿戴";
    }