public override void Setup(ViewData data) { base.Setup(data); var historyList = data.UserData as List <HistoryEntry>; if (historyList == null || historyList.Count == 0) { fallbackView.Activate(); } else { fallbackView.Deactivate(); } itemList.Setup(viewPrefab, layout, (itemdata, view) => { view.Setup(itemdata); }, (data1, data2) => { return(data1.PlanetId == data2.PlanetId && data1.Interval == data2.Interval); }); itemList.Fill(data.UserData as List <HistoryEntry>); closeButton.SetListener(() => { Services.SoundService.PlayOneShot(SoundName.click); Services.ViewService.Remove(ViewType.HistoryView, BosUISettings.Instance.ViewCloseDelay); closeButton.interactable = false; }); }
private void Setup() { var products = Services.ResourceService.PersonalProducts.GetProducts(productType); if (itemList.Count != products.Count) { itemList.Setup(productViewPrefab, layout, (prod, view) => view.Setup(prod), (prod1, prod2) => prod1.id == prod2.id, (prod1, prod2) => prod1.id.CompareTo(prod2.id), Services); itemList.Fill(products, 0.2f); } }
public void Setup(ProductListViewData viewData) { this.viewData = viewData; foreach (Transform trs in layout) { if (trs && trs.gameObject) { Destroy(trs.gameObject); } } viewList.Clear(); viewList.Setup(productViewPrefab, layout, (prod, view) => view.Setup(prod), (p1, p2) => p1.id == p2.id, CompareProducts, Services); viewList.UpdateViews(viewData.Products); Debug.Log($"load products => {viewData.ProductType}, count => {viewData.Products.Count}"); }
public void Setup(CoinListData coinListData) { var orderedItems = coinListData.Items.Where(data => IsNotTeleportWhenEarthOrMoon(data)).OrderBy(val => val.Order).ThenBy(val => val.Id).ToList(); if (!isInitialized) { itemList.IsCorrectScale = true; itemList.CorrectedScaleValue = Vector3.one; itemList.Setup(itemPrefab, layout, (data, view) => view.Setup(data, itemList), (d1, d2) => d1.Id == d2.Id, (d1, d2) => d1.Id.CompareTo(d2.Id), Services); itemList.Fill(orderedItems, 0.05f); isInitialized = true; } if (coinListData.CoinUpgradeId != 0) { StartCoroutine(SetupImpl(coinListData.CoinUpgradeId)); } }
private void Setup() { itemList.Setup(itemPrefab, layout, (data, view) => view.Setup(data), (data1, data2) => data1.Id == data2.Id, (data1, data2) => { IUpgradeService serv = Services.UpgradeService; bool isAllowBuyFirst = serv.IsAllowBuy(data1); bool isAllowBuySecond = serv.IsAllowBuy(data2); if (isAllowBuyFirst && !isAllowBuySecond) { return(-1); } if (!isAllowBuyFirst && isAllowBuySecond) { return(1); } return(data1.Price(() => { return BosUtils.GetUpgradePriceMult(Planets.CurrentPlanet.Data, data1); }).CompareTo(data2.Price(() => { return BosUtils.GetUpgradePriceMult(Planets.CurrentPlanet.Data, data2); }))); }); itemList.UpdateViews(DataSource); }