public void AddNewsEvent(GuEvents datas) { foreach (var guEvent in datas.events) { foreach (var rec in GetNewsEventList()) { if (rec.newsEvent.event_id == guEvent.event_id) { return; } } LocalNewsEvent news = new LocalNewsEvent { eState = NewsEventState.Fresh, newsEvent = guEvent }; GetNewsEventList().Add(news); foreach (var res in guEvent.res) { switch (res.type) { case "png": case "jpg": { if (string.IsNullOrEmpty(news.spriteUrl.url)) { news.spriteUrl.url = res.url; int index = res.url.LastIndexOf('/'); news.spriteUrl.filename = res.url.Substring(index + 1); news.spriteUrl.crc = res.crc; GuLog.Debug("<><NewsEventManager>AddNewsEvent Sprite:" + news.spriteUrl.filename); } } break; case "mp3": { if (string.IsNullOrEmpty(news.audioUrl.url)) { news.audioUrl.url = res.url; int index = res.url.LastIndexOf('/'); news.audioUrl.filename = res.url.Substring(index + 1); news.audioUrl.crc = res.crc; GuLog.Debug("<><NewsEventManager>AddNewsEvent Audio:" + news.audioUrl.filename); } } break; } } } SaveNewsEvent(); DownloadNewsResource(); }
public void SetOldNews(LocalNewsEvent news) { foreach (var newsEvent in GetNewsEventList()) { if (newsEvent.newsEvent.event_id == news.newsEvent.event_id) { Assert.AreEqual(newsEvent.eState, NewsEventState.InPlaying); newsEvent.eState = NewsEventState.OldNews; GuLog.Debug("<><NewsEventManager>SetOldNews event_id:" + news.newsEvent.event_id); break; } } SaveNewsEvent(); }