CustomQuestLogWindow.cs
Code: Select all
using UnityEngine;
using PixelCrushers;
using PixelCrushers.DialogueSystem;
public class CustomQuestLogWindow : StandardUIQuestLogWindow
{
public StandardUIButtonTemplate trackButtonTemplate;
public KeyCode trackToggleKey = KeyCode.C;
public string trackToggleButton = "";
protected override void Start()
{
base.Start();
Tools.SetGameObjectActive(trackButtonTemplate, false);
}
private void Update()
{
if (isOpen && !string.IsNullOrEmpty(selectedQuest) &&
(InputDeviceManager.IsKeyDown(trackToggleKey) || InputDeviceManager.IsButtonDown(trackToggleButton)))
{
ClickTrackQuest(selectedQuest);
}
}
protected override void RepaintSelectedQuest(QuestInfo quest)
{
base.RepaintSelectedQuest(quest);
if (quest != null)
{
var isTrackable = QuestLog.IsQuestTrackingAvailable(quest.Title);
if (isTrackable)
{
var trackButton = detailsPanelContentManager.Instantiate<StandardUIButtonTemplate>(trackButtonTemplate);
detailsPanelContentManager.Add(trackButton, questDetailsContentContainer);
trackButton.button.onClick.AddListener(() => ClickTrackQuest(selectedQuest));
}
}
}
}