protected override void StartShowWindow(object[] data) { this.data = data[0] as AnnouncementData; pool.resetAllTarget(); if (!string.IsNullOrEmpty(this.data.img_url)) { topImage.enabled = true; AssetLoadManager.Instance.LoadAsset <Texture2D>(this.data.img_url, (tex) => { topImage.texture = tex; }); } else { topImage.enabled = false; } if (this.data.sections != null) { for (int i = 0; i < this.data.sections.Length; i++) { AnnouncementContentData content = this.data.sections[i]; UINoticeItem item = pool.getIdleTarget <UINoticeItem>(); item.SetData(content); } } }
public void SetData(AnnouncementContentData data) { titleLabel.text = data.sub_title; string str = ""; for (int i = 0; i < data.content.Length; i++) { str += string.Format("<{0}>{1}</color>", data.content[i].color < colors.Length?colors[data.content[i].color]:colors[1], data.content[i].text); } contentLabel.text = str; }