private void GenerateItemsToUnlock(Slot slot, InteriorPanel interior) { for (int i = 0; i < interior.interiorObjects.Count; i++) { ItemOfListElementsToUnlock item = Instantiate(itemOfListElementsToUnlockPrefab, scrollViewContent); item.Initialize(slot, interior.interiorObjects[i], i); itemsOfListElementsToUnlock.Add(item); } }
public void Show(Slot slot, InteriorPanel interior) { if (PlayerPrefs.GetInt("TutorialUpgradeEachFloor") != 1) { FindObjectOfType <TutorialManager>().PlayTutorialStep(2); PlayerPrefs.SetInt("TutorialUpgradeEachFloor", 1); } this.slot = slot; SetUpButton(); SetUpButtons(slot.bulkLevelUpIndex); SetUpTexts(slot.bulkLevelUpIndex); GenerateItemsToUnlock(slot, interior); anim.SetTrigger("Show"); isVisible = true; }
public void Initialize(Slot slot) { this.slot = slot; upgradeEachFloorPopup = FindObjectOfType <UpgradeEachFloorPopup>(); try { if (interiors.Count <= 0) { throw new Exception("Interiors is equal null"); } if (slot.index <= interiors.Count - 1) { interior = Instantiate(interiors[slot.index], this.transform).GetComponent <InteriorPanel>(); interior.transform.SetSiblingIndex(1); interior.Initialize(slot); } else { interior = Instantiate(interiors[slot.index % 10], this.transform).GetComponent <InteriorPanel>(); interior.transform.SetSiblingIndex(1); interior.Initialize(slot); } } catch (Exception ex) { throw ex; } ManagerData managerData = GameData.instance.GetDataForManager(slot.index); numberOfBuilding = slot.numberOfBuilding; managerIcon.sprite = managerData.imageForSlot; managerIcon.gameObject.SetActive(false); floorImage.color = slot.floorColor; if (PlayerManager.instance.HasBoughtManager(slot.index)) { SetVisibleManagerIcon(); slot.ManagerStartsWorking(); } else { slot.isProducing = false; slot.OnUnitProduced += SlotProducedAUnit; slot.OnUnitProduced += SlotHiredAManager; } iconImage.onClick.AddListener(() => { slot.StartProducingOrSpeedUp(); }); upgreadeButton.onClick.AddListener(() => { UpgradeEachFloorPopup upgradeEachFloorPopup = FindObjectOfType <UpgradeEachFloorPopup>(); if (upgradeEachFloorPopup.typeOfUpgradeSystem == TypeOfUpgradeSystem.ADVANCED) { upgradeEachFloorPopup.Show(slot, interior); } else { upgradeEachFloorPopup.SetSlot(slot); upgradeEachFloorPopup.UpgradeButton_OnPressed(); upgradeEffect.Play(); } }); slotImageBackgroundGO.GetComponent <Image>().sprite = GameManager.instance.slotPanelSprites[numberOfBuilding - 1]; RefreshLanguage(); Refresh(); GameManager.instance.OnUpdateUI(); }