Example #1
0
 private void Update()
 {
     if (this.newsService != null && this.newsService.FetchTime > this.updatedTime)
     {
         foreach (NewsListItem newsListItem in this.NewsListContent.GetComponentsInChildren <NewsListItem>())
         {
             Object.Destroy(newsListItem.gameObject);
         }
         foreach (NewsArticle newsArticle in this.newsService.NewsArticles)
         {
             NewsListItem newsListItem2 = Object.Instantiate <NewsListItem>(this.NewsListItemPrefab, this.NewsListContent.transform, false);
             newsListItem2.SetNewsArticle(newsArticle);
             newsListItem2.newsPanel = this;
         }
         this.updatedTime = this.newsService.FetchTime;
     }
     if (Input.GetKeyDown(27) && this.ArticleViewPanel.gameObject.activeSelf)
     {
         this.CloseArticleView();
     }
 }
 private void Update()
 {
     if (this.newsService != null && this.newsService.FetchTime > this.updatedTime)
     {
         NewsListItem[] componentsInChildren = this.NewsListContent.GetComponentsInChildren <NewsListItem>();
         for (int i = 0; i < (int)componentsInChildren.Length; i++)
         {
             UnityEngine.Object.Destroy(componentsInChildren[i].gameObject);
         }
         foreach (NewsArticle newsArticle in this.newsService.NewsArticles)
         {
             NewsListItem newsListItem = UnityEngine.Object.Instantiate <NewsListItem>(this.NewsListItemPrefab, this.NewsListContent.transform, false);
             newsListItem.SetNewsArticle(newsArticle);
             newsListItem.newsPanel = this;
         }
         this.updatedTime = this.newsService.FetchTime;
     }
     if (Input.GetKeyDown(KeyCode.Escape) && this.ArticleViewPanel.gameObject.activeSelf)
     {
         this.CloseArticleView();
     }
 }