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 ? "卸下" : "穿戴"; }
void onEquipBtnClick() { PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>(); if (pdm == null) { return; } if (!pdm.IsHasTitleByID(CurTitleId)) { PopTipManager.Instance.AddNewTip(StringHelper.GetString("title_no_have", FontColor.Red)); return; } TitlePutAction param = new TitlePutAction(); param.OpType = pdm.GetCurTitle() == CurTitleId ? (int)Message.TITLE_OP_TYPE.TITLE_PICK_OFF : (int)Message.TITLE_OP_TYPE.TITLE_PICK_UP; param.ResId = CurTitleId; Net.Instance.DoAction((int)Message.MESSAGE_ID.ID_MSG_TITLE, param); }
public string GetTitleImg() { return(TitleModule.GetTitleImgById(mModule.GetCurTitle())); }