50 lines
1.3 KiB
C#
Raw Normal View History

using QSB.Localization;
using QSB.Utility;
2022-02-01 08:58:52 +00:00
using QSB.WorldSync;
2021-12-23 11:37:37 +00:00
using UnityEngine;
2022-03-02 19:46:33 -08:00
namespace QSB.EyeOfTheUniverse.GalaxyMap;
2023-07-28 19:30:57 +01:00
public class GalaxyMapManager : MonoBehaviour, IAddComponentOnStart
2021-12-23 11:37:37 +00:00
{
2022-03-02 19:46:33 -08:00
public static GalaxyMapManager Instance { get; private set; }
2021-12-23 11:37:37 +00:00
2022-05-13 22:38:06 +01:00
public CustomDialogueTree Tree { get; private set; }
2022-03-02 19:46:33 -08:00
private void Awake()
{
Instance = this;
QSBSceneManager.OnSceneLoaded += OnSceneLoaded;
}
2021-12-23 11:37:37 +00:00
2022-03-02 19:46:33 -08:00
private void OnSceneLoaded(OWScene oldScene, OWScene newScene, bool inUniverse)
{
if (newScene != OWScene.EyeOfTheUniverse)
{
2022-03-02 19:46:33 -08:00
return;
}
2022-05-03 08:48:24 +01:00
var mapController = QSBWorldSync.GetUnityObject<GalaxyMapController>();
2022-03-02 19:46:33 -08:00
var map = mapController._interactVolume.gameObject;
2021-12-23 11:37:37 +00:00
2022-03-02 19:46:33 -08:00
map.SetActive(false);
2022-05-13 22:38:06 +01:00
Tree = map.AddComponent<CustomDialogueTree>();
Tree._xmlCharacterDialogueAsset = new TextAsset(
$@"<DialogueTree>
<NameField>SIGN</NameField>
<DialogueNode>
<EntryCondition>DEFAULT</EntryCondition>
<Dialogue>
<Page>{QSBLocalization.Current.GalaxyMapEveryoneNotPresent}</Page>
</Dialogue>
</DialogueNode>
</DialogueTree>"
);
2022-03-02 19:46:33 -08:00
Tree._attentionPoint = map.transform;
Tree._attentionPointOffset = new Vector3(0, 1, 0);
Tree._turnOffFlashlight = true;
Tree._turnOnFlashlight = true;
map.SetActive(true);
2021-12-23 11:37:37 +00:00
}
}