public void SetStarEarned(List <StarData> starDatas, LobbyUIView lobbyUIView, int levelIndex) { this.starDatas = starDatas; if (lobbyStarControllerList.Count <= 0) { for (int i = 0; i < starDatas.Count; i++) { GameObject star = Instantiate(starPrefab); star.transform.SetParent(this.transform); star.transform.localScale = Vector3.one; star.GetComponent <LobbyStarController>().SetStarColor(startNotAchievedColor); if (lobbyUIView.ReturnSaveService().ReadStarTypeForLevel(levelIndex, starDatas[i].type)) { star.GetComponent <LobbyStarController>().SetStarColor(starAchievedColor); } lobbyStarControllerList.Add(star.GetComponent <LobbyStarController>()); } } else { for (int i = 0; i < lobbyStarControllerList.Count; i++) { lobbyStarControllerList[i].SetStarColor(startNotAchievedColor); if (lobbyUIView.ReturnSaveService().ReadStarTypeForLevel(levelIndex, starDatas[i].type)) { lobbyStarControllerList[i].SetStarColor(starAchievedColor); } } } }
public UIService(SignalBus signalBus) { this.signalBus = signalBus; signalBus.Subscribe <StateChangeSignal>(OnGameStateChanged); playView = GameObject.FindObjectOfType <PlayUIView>(); overView = GameObject.FindObjectOfType <GameOverUIView>(); finishedUIView = GameObject.FindObjectOfType <LevelFinishedUIView>(); lobbyUIView = GameObject.FindObjectOfType <LobbyUIView>(); playView.gameObject.SetActive(false); overView.gameObject.SetActive(false); finishedUIView.gameObject.SetActive(false); }
public void DefaultSettings(bool unlocked, int levelIndex, LobbyUIView lobbyUIView) { this.lobbyUIView = lobbyUIView; this.levelIndex = levelIndex; SetLevelText(); if (unlocked == true) { GetComponent <Button>().interactable = true; levelText.gameObject.SetActive(true); lobbyStarHolder.gameObject.SetActive(true); lockObject.SetActive(false); lobbyStarHolder.SetStarEarned(lobbyUIView.ReturnGameService().GetStarsForLevel(levelIndex), lobbyUIView, levelIndex); } else { GetComponent <Button>().interactable = false; lobbyStarHolder.gameObject.SetActive(false); levelText.gameObject.SetActive(false); lockObject.SetActive(true); } }