List <UnitNews> ContentToData(string content) { content = content.Replace("\n", ""); content = content.Replace("\r", ""); content = content.Replace("<br /><br />", "<br />"); content = content.Replace("<p><br /><img", "<p><img"); List <UnitNews> _list = new List <UnitNews>(); MatchCollection matchColl = Regex.Matches(content, regex); foreach (Match match in matchColl) { //Debug.Log(" ---------------- " + "\nValue: " + match.Value + "\nIndex: " + match.Index + "\nLength: " + match.Length); GroupCollection group = match.Groups; if (string.IsNullOrEmpty(group[srcImageTag].ToString()) == false) { ImageNews _item = new ImageNews(); _item.type = TypeNews.image; _item.urlImage = group[srcImageTag].ToString(); _item.text = group[altImageTag].ToString(); if (string.IsNullOrEmpty(_item.urlImage) == false) { _list.Add(_item); } } else if ((string.IsNullOrEmpty(group[heading1].ToString()) == false)) { UnitNews _item = new UnitNews(); _item.type = TypeNews.title; _item.text = group[heading1].ToString(); if (string.IsNullOrEmpty(_item.text) == false) { _list.Add(_item); } } else if ((string.IsNullOrEmpty(group[heading2].ToString()) == false)) { UnitNews _item = new UnitNews(); _item.type = TypeNews.title; _item.text = group[heading2].ToString(); if (string.IsNullOrEmpty(_item.text) == false) { _list.Add(_item); } } else if (string.IsNullOrEmpty(group[paragraphTag].ToString()) == false) { UnitNews _item = new UnitNews(); _item.type = TypeNews.text; _item.text = group[paragraphTag].ToString(); if (string.IsNullOrEmpty(_item.text) == false) { _list.Add(_item); } } else { } } return(_list); }
public override void Init(UnitNews _data) { txt.text = HtmlTextToUnityText.Convert(_data.text); }
public virtual void Init(UnitNews _data) { }
public override void Init(UnitNews _data) { imgData = _data as ImageNews; StartCoroutine(LoadImage()); }