public void Initialize(bool re_init) { if (initedBefore == false || re_init == true) { this.questlogdatabase = QuestLogDatabase.Instance; //temporary solution List <string> gamelevelnamelist = ApplicationLevelBoard.Instance.gameLevelNameList; for (int i = 0; i < gamelevelnamelist.Count; ++i) { if (gamelevelnamelist[i] == Application.loadedLevelName) { currentGameLevel = i; break; } } Debug.Log("current game level in quest manager:" + currentGameLevel); this.questLogListDatabase = questlogdatabase[currentGameLevel]; questDisplayRect = new Rect(0.0f, Screen.height * 0.001f, Screen.width * 0.25f, Screen.height * 0.1f); questLogHeight = questDisplayRect.height / (maxQuestLog + 1); for (int i = 0; i < maxQuestLog; ++i) //reserve some rect { //questLogs.Add(new my_QuestLog()); questLogRects.Add(new Rect(questDisplayRect.xMin, questDisplayRect.yMin + (i + 1) * questLogHeight, questDisplayRect.width, questLogHeight)); questlogStyles.Add(new GUIStyle()); questlogStyles[i].normal.textColor = Color.white; questlogStyles[i].normal.background = Texture2D.blackTexture; questlogStyles[i].alignment = TextAnchor.MiddleCenter; } notificationDisplayRect = new Rect(questDisplayRect.xMin, questDisplayRect.yMin + (maxQuestLog + 1) * questLogHeight, questDisplayRect.width, questLogHeight); currentQuestIndex = 0; questLogs.Clear(); FetchCurrentQuest(); notificationlabelStyle = new GUIStyle(); notificationlabelStyle.normal.textColor = Color.white; notificationlabelStyle.normal.background = (Texture2D)Resources.Load("green"); notificationlabelStyle.alignment = TextAnchor.MiddleCenter; skin = (GUISkin)Resources.Load("Skins/UI"); initedBefore = true; } }
public void DestroyInstance() { instance = null; }