private void Prepare(bool prepareQuestIfNone) { current = this; openedQuest = -1; int totalCount = (int)QuestSection.TotalCount; activeQuests = new Quest[totalCount]; questCreateQueue = new Queue <byte>(); GameMaster.realMaster.everydayUpdate += this.EverydayUpdate; for (int i = 0; i < activeQuests.Length; i++) { activeQuests[i] = Quest.NoQuest; } questAccessMap = new bool[totalCount]; CheckQuestsAccessibility(prepareQuestIfNone); questUpdateTimer = QUEST_UPDATE_TIME; for (int i = 0; i < questButtons.Length; i++) { Button b = questButtons[i].GetComponent <Button>(); sbyte index = (sbyte)i; b.onClick.AddListener(() => { this.QuestButton_OpenQuest(index); }); } LocalizeTitles(); prepared = true; }
// Načte scénu s generátorem mapy (scéna s postavou je načtena) a odnačte scénu s výběrem úrovní IEnumerator LoadMazeAsync(string locationSceneName, MazeSettingsSO mazeSettings) { _loading = true; _loadingScreen.ShowLoadingScreen(); Player.SetActive(false); CurrentHubManager = null; CurrentMazeManager = null; AsyncOperation locationSceneLoadingTask = SceneManager.LoadSceneAsync(locationSceneName, LoadSceneMode.Additive); while (!locationSceneLoadingTask.isDone) { yield return(null); } SceneManager.SetActiveScene(SceneManager.GetSceneByName(locationSceneName)); while (CurrentMazeManager == null) { yield return(null); } string message = CurrentMazeManager.CreateMaze(mazeSettings); QuestUI.QueueMessage(message); CurrentHubManager = null; UnloadScene(HUB_SCENE_NAME); Player.SetActive(true); _loading = false; _loadingScreen.HideLoadingScreen(); }
/// <summary> /// Check whether the itemName belongs to any /// of the quest. If it is, update the quest progress. /// </summary> /// <param name="itemName"> /// Name of an Item Prefab. /// </param> /// <returns> /// Whether the quest item is removed from the /// scene. /// </returns> public bool CheckQuestItem(string itemName) { QuestUI finishedQuest = null; foreach (QuestUI quest in activeQuests) { if (quest.CheckObject(itemName)) { bool finished = quest.UpdateProgress(); if (finished) { finishedQuest = quest; // can't delete while looping break; } } } if (finishedQuest != null) { activeQuests.Remove(finishedQuest); string nextQuest = finishedQuest.detail.nextQuestName; if (nextQuest != "" && nextQuest != null) { AddQuest(finishedQuest.detail.nextQuestName); } DisplayQuests(); var args = new QuestEndedEventArgs(); args.questName = finishedQuest.detail.questName; OnQuestEnded?.Invoke(this, args); return(true); } return(false); }
public FoundationRouteScenario() : base(FOUNDATION_ROUTE_ID) { localizer = new Localizer(); colony = GameMaster.realMaster.colonyController; questUI = UIController.GetCurrent().GetMainCanvasController().questUI; Knowledge.GetCurrent()?.SetExecutingScenarioIndex((int)Knowledge.ResearchRoute.Foundation); }
public void Init(Quest _data, QuestUI _controler) { data = _data; controler = _controler; button.GetComponentInChildren <Text>().text = data.data.questName; SetSelected(false); }
public void QuestRequest(QuestObject questGiver) { QuestUI questUI = UIManager.Instance.GetQuestUI(); if (questGiver.availableQuests.Count > 0) { foreach (QuestData questGiverQuest in questGiver.availableQuests) { int questId = questGiverQuest.id; if (masterQuestDictionary.ContainsKey(questId) && masterQuestDictionary[questId].progress == Quest.QuestProgress.Available) { questUI.questAvailable = true; questUI.availableQuests.Add(masterQuestDictionary[questId]); } } } foreach (QuestData questGiverQuest in questGiver.receivableQuests) { int questId = questGiverQuest.id; if (masterQuestDictionary.ContainsKey(questId) && masterQuestDictionary[questId].progress == Quest.QuestProgress.Accepted || masterQuestDictionary[questId].progress == Quest.QuestProgress.Complete) { questUI.questRunning = true; questUI.runningQuests.Add(masterQuestDictionary[questId]); } } }
// Use this for initialization void Start() { instance = this; currentQuestNumber = 0; isOpenCraftMenu = false; theItemEffectDatabase = FindObjectOfType <ItemEffectDatabase>(); }
private void Awake() { current = this; openedQuest = -1; int totalCount = (int)QuestSection.TotalCount; activeQuests = new Quest[totalCount]; for (int i = 0; i < activeQuests.Length; i++) { activeQuests[i] = Quest.NoQuest; } questAccessMap = new bool[totalCount]; CheckQuestsAccessibility(); questUpdateTimer = QUEST_UPDATE_TIME; for (int i = 0; i < questButtons.Length; i++) { Button b = questButtons[i].GetComponent <Button>(); sbyte index = (sbyte)i; b.onClick.AddListener(() => { this.QuestButton_OpenQuest(index); }); } LocalizeTitles(); }
private void Instance_OnNewQuest(Quest quest) { if (!questUIElementPrefab) { Debug.LogError("Prefab for QuestUI has not been set in the inspector."); return; } if (!questUIScrollViewContent) { Debug.LogError("Parent for QuestUI Elements has not been set in the inspector."); return; } GameObject questUIElement = Instantiate(questUIElementPrefab, questUIScrollViewContent.transform); QuestUI questUI = questUIElement.GetComponent <QuestUI>(); if (!questUI) { Debug.LogError("Quest UI Element prefab does not have the QuestUI component attached."); return; } questUIElements_.Add(quest, questUI); questUI.InitQuestUI(quest); }
public void CreateQuestDialog(string giver, string title, string dialog, Sprite npc) { if (!QuestDialog) { QuestDialog = MonoBehaviour.Instantiate(Resources.Load <QuestUI>("Prefabs/QuestDialogCanvas"), Vector3.zero, Quaternion.identity); QuestDialog.Initialize(giver, title, dialog, npc); } }
public QuestUI getQuestUI() { if (_questUI == null) { _questUI = new QuestUI(); } return(_questUI); }
public virtual void QuestCompliteAction() { StopCoroutine(QuestUpdate()); QuestUI questUI = QuestPanel.GetComponent <QuestUI>(); questUI.CompliteQuest(); isComplited = true; }
public void SubscribeToUpdate(QuestUI qui) { //для квестов, выполняющихся вне QuestUI.activeQuests if (!subscribedToQuestUpdate) { qui.questUpdateEvent += this.CheckQuestConditions; subscribedToQuestUpdate = true; } }
// Start is called before the first frame update void Start() { instance = this; questSet.SetActive(false); rewordPanel.SetActive(false); buttonState = QuestState.Startable; questInformationPanel.SetActive(false); }
public void AddNewQuestUI(Quest quest) { QuestUI currentQuestUI = Instantiate(questEntryPrefab, questLog.transform).GetComponent <QuestUI>(); currentQuestUI.name.text = quest.name; currentQuestUI.description.text = quest.description; questsUI.Add(currentQuestUI); }
private void QuestTurnedIn(QuestTracker quest) { QuestUI questUI = inProgressQuestUIList.Find(q => q.questTracker == quest); questUI.transform.SetParent(turnedInQuestContainer); questUI.transform.SetSiblingIndex(0); inProgressQuestUIList.Remove(questUI); turnedInQuestUIList.Add(questUI); turnedInQuestContainer.gameObject.SetActive(true); }
public GameObject CreateQuestPanel(string name, string description) { GameObject quest = Instantiate(questPrefab); quest.transform.SetParent(questPanel); QuestUI questUI = quest.GetComponent <QuestUI>(); questUI.Name.text = description; return(quest); }
// Přesvědčí se, zda se už něco nenačítá a poté zavolá Coroutine, která načte úvodní obrazovku public void ReturnToMenu() { if (_loading) { return; } QuestUI.ClearQueueAndHideCanvas(); StartCoroutine(LoadMenu(MENU_SCENE_NAME)); }
public void Load() { if (current != null) { return; } current = this; buildEmitter = Instantiate(Resources.Load <ParticleSystem>("buildEmitter")); lightPassengerShip_pref = Resources.Load <GameObject>("Prefs/lightPassengerShip"); lightCargoShip_pref = Resources.Load <GameObject>("Prefs/lightCargoShip"); lightWarship_pref = Resources.Load <GameObject>("Prefs/lightWarship"); privateShip_pref = Resources.Load <GameObject>("Prefs/privateShip"); lightPassengerShips = new List <GameObject>(); lightCargoShips = new List <GameObject>(); lightWarships = new List <GameObject>(); privateShips = new List <GameObject>(); plane_excavated_025 = Resources.Load <Mesh>("Meshes/Plane_excavated_025"); plane_excavated_05 = Resources.Load <Mesh>("Meshes/Plane_excavated_05"); plane_excavated_075 = Resources.Load <Mesh>("Meshes/Plane_excavated_075"); lr_red_material = Resources.Load <Material>("Materials/GUI_Red"); lr_green_material = Resources.Load <Material>("Materials/GUI_Green"); zoneCube = Instantiate(Resources.Load <Transform>("Prefs/zoneCube"), transform); zoneCube.gameObject.SetActive(false); cavePref = Resources.Load <GameObject>("Prefs/CaveBlock_pref"); quadsPool = new List <GameObject>(); quad_pref = Instantiate(Resources.Load <GameObject>("Prefs/quadPref"), transform); // ууу, костыль! а если текстура не 4 на 4 ? //quad_pref.GetComponent<MeshFilter>().sharedMesh.uv = new Vector2[] { new Vector2(0.02f, 0.02f), new Vector2(0.98f, 0.98f), new Vector2(0.98f, 0.02f), new Vector2(0.02f, 0.98f) }; quad_pref.GetComponent <MeshFilter>().sharedMesh.uv = new Vector2[] { Vector2.zero, Vector2.one, Vector2.right, Vector2.up }; quad_pref.transform.parent = transform; quad_pref.SetActive(false); quadsPool.Add(quad_pref); default_material = Resources.Load <Material>("Materials/Default"); darkness_material = Resources.Load <Material>("Materials/Darkness"); energy_material = Resources.Load <Material>("Materials/ChargedMaterial"); energy_offline_material = Resources.Load <Material>("Materials/UnchargedMaterial"); basic_material = Resources.Load <Material>("Materials/Basic"); glass_material = Resources.Load <Material>("Materials/Glass"); glass_offline_material = Resources.Load <Material>("Materials/GlassOffline"); metal_material = Resources.Load <Material>("Materials/Metal"); green_material = Resources.Load <Material>("Materials/Green"); billboardMaterial = Resources.Load <Material>("Materials/BillboardMaterial"); basic_illuminated = new Material[MAX_MATERIAL_LIGHT_DIVISIONS]; green_illuminated = new Material[MAX_MATERIAL_LIGHT_DIVISIONS]; metal_illuminated = new Material[MAX_MATERIAL_LIGHT_DIVISIONS]; mineElevator_pref = Resources.Load <GameObject>("Structures/MineElevator"); QuestUI.LoadTextures(); gui_overridingSprite = Resources.Load <Sprite>("Textures/gui_overridingSprite"); }
public void Awake() { if (_instance != null) { Destroy(gameObject); } else { _instance = this; } }
private void Start() { SetupEventListeners(); inProgressQuestContainer.gameObject.SetActive(false); turnedInQuestContainer.gameObject.SetActive(false); questUIprefab = Resources.Load <QuestUI>("UI/QuestUI"); goalTextUIprefab = Resources.Load <GoalTextUI>("UI/GoalText"); inProgressQuestUIList = new List <QuestUI>(); turnedInQuestUIList = new List <QuestUI>(); this.transform.GetChild(0).gameObject.SetActive(isOpen); questDetailContainer.gameObject.SetActive(false); }
private void QuestAccepted(QuestTracker quest) { QuestUI questUI = Instantiate(questUIprefab, inProgressQuestContainer); questUI.SetQuest(quest); if (inProgressQuestUIList.Count == 0) { inProgressQuestContainer.gameObject.SetActive(true); QuestUISelected(questUI); } inProgressQuestUIList.Add(questUI); }
private void RemoveQuestUI(Quest quest) { foreach (Transform child in questPanelContent.transform) { QuestUI questTransformUI = child.GetComponent <QuestUI>(); if (questTransformUI.quest.ID == quest.ID) { Destroy(child.gameObject); } } }
private void QuestUISelected(QuestUI questUI) { if (selectedQuest != null) { selectedQuest.SetDeslected(); } questUI.SetSelected(); selectedQuest = questUI; questTitle.text = questUI.questTracker.quest.name; questDescription.text = questUI.questTracker.quest.description; updateGoalText();; questDetailContainer.gameObject.SetActive(true); }
private void OpenCompletedQuestWindow() { questUI = FindObjectOfType <UI_Manager>().GetQuestUI().GetComponent <QuestUI>(); questUI.HideAcptDecButtons(); questUI.ShowRewardButton(); questUI.ShowCheckBox(); questUI.ShowUICloseButton(); questUI.transform.Find("CollectRewardButton").GetComponentInChildren <Button>().onClick.AddListener(CollectReward); FindObjectOfType <UI_QuestManager>().SetQuest(questObject.quest, portrait); FindObjectOfType <UI_Manager>().OpenQuestUI(); }
void Awake() { if (uiManager == null) { uiManager = this; } else if (uiManager != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); panelHide(); }
private void OpenQuestWindow() { questUI = FindObjectOfType <UI_Manager>().GetQuestUI().GetComponent <QuestUI>(); questUI.ShowAcptDecButtons(); questUI.HideRewardButton(); questUI.HideCheckBox(); questUI.HideUICloseButton(); questUI.transform.Find("AD_Buttons").Find("AcceptButton").GetComponent <Button>().onClick.AddListener(AcceptQuest); questUI.transform.Find("AD_Buttons").Find("DeclineButton").GetComponent <Button>().onClick.AddListener(DeclineQuest); FindObjectOfType <UI_QuestManager>().SetQuest(questObject.quest, portrait); FindObjectOfType <UI_Manager>().OpenQuestUI(); }
/// <summary> /// Tries to find a questList /// </summary> private void GetQuestList() { questUI = GetComponentInParent <QuestUI>(); if (questUI == null) { GetComponent <QuestUI>(); if (questUI == null) { GetComponentInChildren <QuestUI>(); if (questUI == null) { Debug.LogWarning("OnScreenMsgHandler cannot find a QuestUI. Therefor it is unable to funktion. Make sure this component is the child or parent of a questList"); } } } }
// public method // link element component public void LinkComponentElement() { // link structure manager = GameObject.FindWithTag("GameLogic").GetComponent <GameManager>(); // link element component storeUI = transform.Find("StoreUI").gameObject; storeUILogic = storeUI.GetComponent <StoreUI>(); storeUILogic.LinkComponentElement(); storageUI = transform.Find("StorageUI").gameObject; storageUILogic = storageUI.GetComponent <StorageUI>(); storeCustomizingSet = transform.Find("CustomizeUI").gameObject; storeCustomizingSetLogic = storeCustomizingSet.GetComponent <CustomizeUI>(); storeCustomizingSetLogic.LinkComponentElement(); createUI = transform.Find("CreateUI").gameObject; createUILogic = createUI.GetComponent <CreateUI>(); sellItemSettingUI = transform.Find("SellItemSettingUI").gameObject; sellItemSettingUILogic = sellItemSettingUI.GetComponent <SellItemSettingUI>(); furnitureMarketUI = transform.Find("FurnitureMarketUI").gameObject; furnitureMarketUILogic = furnitureMarketUI.GetComponent <FurnitureMarketUI>(); stageUI = transform.Find("StageUI").gameObject; stageUILogic = stageUI.GetComponent <StageUI>(); resultRewardUI = transform.Find("ResultRewardUI").gameObject; resultRewardUILogic = resultRewardUI.GetComponent <ResultRewardUI>(); resultUI = transform.Find("ResultUI").gameObject; resultUILogic = resultUI.GetComponent <ResultUI>(); chatSceneUI = transform.Find("ChatScene").gameObject; chatSceneUILogic = chatSceneUI.GetComponent <ChatSceneUI>(); characterCreateUI = transform.Find("CharacterCreateUI").gameObject; characterCreateUILogic = characterCreateUI.GetComponent <CharacterCreateUI>(); questUI = transform.Find("QuestUI").gameObject; questUILogic = questUI.GetComponent <QuestUI>(); questUILogic.LinkComponentElement(); loadingScene = transform.Find("LoadingScene").gameObject; }
protected override void Start() { base.Start(); questManager = QuestManager.Instance; questMarker = GetComponentInChildren <QuestMarker>(); questUI = UIManager.Instance.GetQuestUI(); try { questManager.SubscribeToQuests(this); SetQuestMarker(); } catch { StartCoroutine(LateStart()); } }