public void Open() { gameObject.SetActive(true); foreach (Transform t in missionPlace) { Destroy(t.gameObject); } for (int i = 0; i < 4; ++i)//c { if (PlayerData.instance.missions.Count > i) { MissionEntry entry = Instantiate(missionEntryPrefab); entry.transform.SetParent(missionPlace, false); entry.FillWithMission(PlayerData.instance.missions[i], this); } else { AdsForMission obj = Instantiate(addMissionButtonPrefab); obj.missionUI = this; obj.transform.SetParent(missionPlace, false); } } }
//public AdsForMission addMissionButtonPrefab; public void Open() { gameObject.SetActive(true); if (!PlayerData.instance.koreanCheck) { title.text = "MISSION"; achievementTitle.text = "REWARD"; } else { title.text = "미 션"; achievementTitle.text = "별 획득 !"; } foreach (Transform t in repetitionMissionPlace) { Destroy(t.gameObject); } for (int i = 0; i < 2; ++i) { if (PlayerData.instance.missions.Count > i) { MissionEntry entry = Instantiate(missionEntryPrefab); entry.transform.SetParent(repetitionMissionPlace, false); entry.FillWithMission(PlayerData.instance.missions[i], this); } /* * else * { * AdsForMission obj = Instantiate(addMissionButtonPrefab); * obj.missionUI = this; * obj.transform.SetParent(repetitionMissionPlace, false); * } */ } foreach (Transform t in achievementMissionPlace) { Destroy(t.gameObject); } for (int i = 0; i < PlayerData.instance.achievementMissions.Count; ++i) { AchievementMissionEntry entry = Instantiate(achievementMissionEntryPrefab); entry.transform.SetParent(achievementMissionPlace, false); entry.FillWithMission(PlayerData.instance.achievementMissions[i], this); } }
public IEnumerator Open() { gameObject.SetActive(true); foreach (Transform t in missionPlace) { Addressables.ReleaseInstance(t.gameObject); } for (int i = 0; i < 3; ++i) { if (PlayerData.instance.missions.Count > i) { AsyncOperationHandle op = missionEntryPrefab.InstantiateAsync(); yield return(op); if (op.Result == null || !(op.Result is GameObject)) { Debug.LogWarning(string.Format("Unable to load mission entry {0}.", missionEntryPrefab.Asset.name)); yield break; } MissionEntry entry = (op.Result as GameObject).GetComponent <MissionEntry>(); entry.transform.SetParent(missionPlace, false); entry.FillWithMission(PlayerData.instance.missions[i], this); } else { AsyncOperationHandle op = addMissionButtonPrefab.InstantiateAsync(); yield return(op); if (op.Result == null || !(op.Result is GameObject)) { Debug.LogWarning(string.Format("Unable to load button {0}.", addMissionButtonPrefab.Asset.name)); yield break; } AdsForMission obj = (op.Result as GameObject)?.GetComponent <AdsForMission>(); obj.missionUI = this; obj.transform.SetParent(missionPlace, false); } } }
public void Open() { gameObject.SetActive(true); foreach (Transform t in missionPlace) Destroy(t.gameObject); for(int i = 0; i < 3; ++i) { if (PlayerData.instance.missions.Count > i) { MissionEntry entry = Instantiate(missionEntryPrefab); entry.transform.SetParent(missionPlace, false); entry.FillWithMission(PlayerData.instance.missions[i], this); } else { } } }