123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class MissionsUI : MonoBehaviour
- {
- [Tooltip("The prefab of the Quest UI.")]
- public GameObject QuestUITemplate;
- Quest queuedquests;
- int queuedquestIndex;
- public static MissionsUI Instance;
- List<QuestUINew> quests;
- void Awake()
- {
- Instance = this;
- quests = new List<QuestUINew>();
- }
- // Use this for initialization
- void Start()
- {
- // ConversationUI.Instance.EndDialog += Instance_EndDialog;
- }
- private void Instance_EndDialog()
- {
- //throw new System.NotImplementedException();
- if (queuedquests != null)
- {
- InitMission(queuedquests, queuedquestIndex);
- queuedquests = null;
- queuedquestIndex = 0;
- }
- }
- // Update is called once per frame
- void Update()
- {
- }
- public void AddMission(Quest quest,int index)
- {
- /*if (!ConversationUI.Instance.InConversation && PhoneUI.Instance.State == PhoneState.Idle)
- {
- InitMission(quest,index);
- }
- else
- {
- queuedquests = quest;
- queuedquestIndex = index;
- }*/
- }
- public void LoadMission(Quest quest, int index)
- {
- InitMission(quest,index);
- for (int i = 0; i < index; i++)
- {
- LoadCheck(i, quest.id);
- }
-
- }
- void InitMission(Quest quest,int index)
- {
- GameObject newQuest = Instantiate(QuestUITemplate, transform);
- newQuest.GetComponent<QuestUINew>().Init(quest, index);
- quests.Add(newQuest.GetComponent<QuestUINew>());
- }
- public void Check(int Index, string missionName)
- {
- foreach (QuestUINew quest in quests)
- {
- if (quest.QuestName == missionName)
- {
- quest.CheckTask(Index);
- }
- }
- }
- public void LoadCheck(int Index, string missionName)
- {
- foreach (QuestUINew quest in quests)
- {
- if (quest.QuestName == missionName)
- {
- quest.CheckTask(Index);
- }
- }
- }
- public void ToggleContent()
- {
- foreach (UIElement element in GetComponentsInChildren<UIElement>(true))
- element.ChangeVisibility(!element.Visible);
- }
- }
|