private void InitControlItem(DownLoadAPKNewsItem info, int index) { GameObject gameObject = NGUITools.AddChild(this.grid_controls.gameObject, this.template_toggle.gameObject); gameObject.name = index.ToString(); gameObject.SetActive(true); this.toggles.Add(gameObject.GetComponent <UIToggle>()); UIEventListener.Get(gameObject).onClick = new UIEventListener.VoidDelegate(this.OnClick_toggle); }
private void RefreshUI_InitItems() { for (int i = 0; i < this.listItems.Count; i++) { DownLoadAPKNewsItem downLoadAPKNewsItem = this.listItems[i]; if (downLoadAPKNewsItem != null) { if (this.curNewsKey < 0) { this.curNewsKey = i; } this.InitNewsItem(downLoadAPKNewsItem, i); this.InitControlItem(downLoadAPKNewsItem, i); } } this.grid_news.Reposition(); this.grid_controls.Reposition(); }
private void InitNewsItem(DownLoadAPKNewsItem info, int index) { GameObject gameObject; ILoginNewsItem component; if (info.type == 1) { gameObject = NGUITools.AddChild(this.grid_news.gameObject, this.template_pic.gameObject); component = gameObject.GetComponent <LoginNewsItem_texture>(); } else { gameObject = NGUITools.AddChild(this.grid_news.gameObject, this.template_txt.gameObject); component = gameObject.GetComponent <LoginNewsItem_notice>(); } gameObject.name = index.ToString(); component.Info = info; component.CheckResource(); component.OnHandle = new Action <GameObject, bool>(this.OnPress_item); this.coms.Add(component); gameObject.SetActive(true); }
public static int Compare(DownLoadAPKNewsItem x, DownLoadAPKNewsItem y) { if (x == null && y == null) { return(0); } if (x == null && y != null) { return(-1); } if (x != null && y == null) { return(1); } if (x.sequence < y.sequence) { return(-1); } if (x.sequence > y.sequence) { return(1); } return(0); }