private void tryShowHint() { if (!checkTrayIsClosed()) { DQuestMessage dQuestMessage = new DQuestMessage(); dQuestMessage.MascotName = currentHint.MascotName; dQuestMessage.DismissTime = 4f; dQuestMessage.Text = currentHint.HintText; Service.Get <EventDispatcher>().DispatchEvent(new HudEvents.ShowQuestMessage(dQuestMessage)); Service.Get <QuestService>().SendEvent("QuestHintShown"); if (currentHint.Repeat) { startHintTimer(currentHint); } else { hintTimer = 0f; hintState = QuestHintState.Idle; } } else { hintState = QuestHintState.Delayed; hintTimer = 2.5f; } loadedHintTime = false; }
private void Update() { if (hintState == QuestHintState.Waiting) { hintTimer -= Time.deltaTime; if (hintTimer <= 0f) { tryShowHint(); } } else if (hintState == QuestHintState.Delayed && !checkTrayIsClosed()) { hintState = QuestHintState.Waiting; hintTimer = 2.5f; } }
private void Awake() { eventChannel = new EventChannel(Service.Get <EventDispatcher>()); eventChannel.AddListener <QuestEvents.SetQuestHint>(setHint); eventChannel.AddListener <QuestEvents.CancelQuestHint>(cancelHint); if (PlayerPrefs.HasKey("QUEST_HINT_TIME")) { float @float = PlayerPrefs.GetFloat("QUEST_HINT_TIME"); if (@float != 0f) { hintTimer = Mathf.Max(@float, 2.5f); hintState = QuestHintState.Waiting; loadedHintTime = true; } PlayerPrefs.DeleteKey("QUEST_HINT_TIME"); } }
private void startHintTimer(QuestHint hint) { float num = 0f; switch (hint.WaitType) { case QuestHintWaitType.HintTimeShort: num = 30f; break; case QuestHintWaitType.HintTimeLong: num = 60f; break; case QuestHintWaitType.HintTimeCustom: num = hint.WaitTime; break; } if (num != 0f) { hintTimer = num; hintState = QuestHintState.Waiting; } }
private bool cancelHint(QuestEvents.CancelQuestHint evt) { hintState = QuestHintState.Idle; return(false); }