//create a single ui element for one quest private GameObject CreateQuestDisplay(Quests.C_QuestState questState) { GameObject go = null; switch (questState.activeState) { case Quests.E_QuestActiveState.none: if (UI_OpenTemplate == null) { Debug.LogError("The parameter 'UI_OpenTemplate' for the script Quest_UIList was not configured at " + gameObject.name + ". Element will not be displayed."); return(null); } go = (GameObject)Instantiate(UI_OpenTemplate); break; case Quests.E_QuestActiveState.active: if (UI_ActiveTemplate == null) { Debug.LogError("The parameter 'UI_ActiveTemplate' for the script Quest_UIList was not configured at " + gameObject.name + ". Element will not be displayed."); return(null); } go = (GameObject)Instantiate(UI_ActiveTemplate); break; case Quests.E_QuestActiveState.finished: if (UI_CompletedTemplate == null) { Debug.LogError("The parameter 'UI_CompletedTemplate' for the script Quest_UIList was not configured at " + gameObject.name + ". Element will not be displayed."); return(null); } go = (GameObject)Instantiate(UI_CompletedTemplate); break; } if (go == null) { Debug.LogError("The element for displaying a quest couldn't be created."); return(null); } go.transform.SetParent(gameObject.transform, false); Quest_UIItem uiItem = go.GetComponent <Quest_UIItem>(); if (uiItem == null) { Debug.LogWarning("The Prefab for quest UI-items should have a 'Quest_UIItem' script. This script was not found. Skipping display."); return(null); } else { uiItem.SetQuestState(questState); listElements.Add(go); return(go); } }
void createQuestFinishedPopup(C_QuestState questState) { if (questFullfillmentPopup.popupParent != null && questFullfillmentPopup.popupPrefab != null) { GameObject popup = (GameObject)Instantiate(questFullfillmentPopup.popupPrefab); popup.transform.SetParent(questFullfillmentPopup.popupParent.transform, false); Quest_UIItem questUiItem = popup.GetComponent <Quest_UIItem>(); if (questUiItem != null) { questUiItem.SetQuestState(questState); } else { Debug.LogWarning("The popup for the fullfillment of quest '" + questState.questKey + "' couldn't be displayed because the script 'Quest_UIItem' is not attached in the popup prefab."); } } }