private void CreateViews() { ObjectContainer objectContainer = (!SafeLayout.IsTablet) ? this.phonePool : this.tabletPool; int num = Mathf.RoundToInt(((RectTransform)base.transform).rect.height / (float)this.height) + this.topPreloadRows + this.bottomPreloadRows; this._views = new ScrollRowItem[num]; for (int i = 0; i < num; i++) { ScrollRowItem entity = objectContainer.GetEntity <ScrollRowItem>(this._content); entity.name = i + string.Empty; entity.Row = -1; entity.transform.localScale = Vector3.one; entity.transform.localPosition = Vector3.zero; RectTransform component = entity.GetComponent <RectTransform>(); component.pivot = new Vector2(0.5f, 1f); component.anchorMin = new Vector2(0f, 1f); component.anchorMax = new Vector2(1f, 1f); component.offsetMax = new Vector2(0f, 0f); component.offsetMin = new Vector2(0f, (float)(-(float)this.height)); this._views[i] = entity; } this._rects = new RectTransform[this._views.Length]; for (int j = 0; j < this._views.Length; j++) { this._rects[j] = this._views[j].gameObject.GetComponent <RectTransform>(); } }
public void RemoveSave(int packId, int id) { ScrollRowItem rowWithId = this.scroll.GetRowWithId(id); if (rowWithId != null) { PicItem pictureItem = rowWithId.GetPictureItem(id); if (pictureItem != null) { pictureItem.RemoveSave(); } } }
private void OnPicDeleted(PictureData delPicData, PictureData replacePicData) { if (replacePicData == null) { return; } for (int i = 0; i < this.data.Count; i++) { if (this.data[i].Id == replacePicData.Id) { this.data[i] = replacePicData; } } if (this.scroll != null && this.scroll.Count > 0) { ScrollRowItem rowWithId = this.scroll.GetRowWithId(replacePicData.Id); if (rowWithId != null) { rowWithId.ReinitPicItem(replacePicData); } } }
public void RemoveItemFromFeed(int id) { ScrollRowItem rowWithId = this.scroll.GetRowWithId(id); List <ScrollRowItem> list = new List <ScrollRowItem>(this.scroll.Views); if (rowWithId != null) { List <PicItem> pics = new List <PicItem>(); list.Sort((ScrollRowItem x, ScrollRowItem y) => x.Row.CompareTo(y.Row)); int num = list.IndexOf(rowWithId); if (MenuScreen.RowItems == 2) { if (rowWithId.pics[0].Id == id) { rowWithId.pics[0].Reset(); if (rowWithId.pics[1].gameObject.activeSelf) { pics.AddRange(rowWithId.pics); } else { pics.Add(rowWithId.pics[0]); } } else { rowWithId.pics[1].Reset(); pics.Add(rowWithId.pics[1]); } } else if (MenuScreen.RowItems == 3) { if (rowWithId.pics[0].Id == id) { rowWithId.pics[0].Reset(); pics.Add(rowWithId.pics[0]); if (rowWithId.pics[1].gameObject.activeSelf) { pics.Add(rowWithId.pics[1]); } if (rowWithId.pics[2].gameObject.activeSelf) { pics.Add(rowWithId.pics[2]); } } else if (rowWithId.pics[1].gameObject.activeSelf && rowWithId.pics[1].Id == id) { rowWithId.pics[1].Reset(); pics.Add(rowWithId.pics[1]); if (rowWithId.pics[2].gameObject.activeSelf) { pics.Add(rowWithId.pics[2]); } } else { rowWithId.pics[2].Reset(); pics.Add(rowWithId.pics[2]); } } for (int i = num + 1; i < list.Count; i++) { for (int j = 0; j < list[i].pics.Count; j++) { if (list[i].pics[j].gameObject.activeSelf) { pics.Add(list[i].pics[j]); } } } for (int k = 0; k < pics.Count - 1; k++) { pics[k].InitFromItem(pics[k + 1]); } if (pics.Count == 1) { pics[pics.Count - 1].Reset(); pics[pics.Count - 1].gameObject.SetActive(false); } else { PictureData pictureData = this.data.Find((PictureData pd) => pd.Id == pics[pics.Count - 2].Id); if (pictureData != null) { int num2 = this.data.IndexOf(pictureData); if (num2 == this.data.Count - 1) { pics[pics.Count - 1].gameObject.SetActive(false); } else if (num2 != -1 && num2 < this.data.Count - 1) { pics[pics.Count - 1].Init(this.data[num2 + 1], false, true, false); for (int l = 0; l < this.saves.Count; l++) { if (this.saves[l].Id == pics[pics.Count - 1].Id) { pics[pics.Count - 1].AddSave(this.saves[l]); break; } } } } } } for (int m = 0; m < this.data.Count; m++) { PictureData pictureData2 = this.data[m]; if (pictureData2.Id == id) { this.data.RemoveAt(m); break; } } for (int n = 0; n < this.saves.Count; n++) { PictureSaveData pictureSaveData = this.saves[n]; if (pictureSaveData.Id == id) { this.saves.RemoveAt(n); break; } } }