2022-02-01 08:58:52 +00:00
|
|
|
|
using QSB.Utility;
|
|
|
|
|
using QSB.WorldSync;
|
2021-12-23 11:37:37 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
namespace QSB.EyeOfTheUniverse.GalaxyMap;
|
|
|
|
|
|
|
|
|
|
internal class GalaxyMapManager : MonoBehaviour, IAddComponentOnStart
|
2021-12-23 11:37:37 +00:00
|
|
|
|
{
|
2022-03-03 03:46:33 +00:00
|
|
|
|
public static GalaxyMapManager Instance { get; private set; }
|
2021-12-23 11:37:37 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
public QSBCharacterDialogueTree Tree { get; private set; }
|
2022-02-27 12:40:44 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
private void Awake()
|
|
|
|
|
{
|
|
|
|
|
Instance = this;
|
|
|
|
|
QSBSceneManager.OnSceneLoaded += OnSceneLoaded;
|
|
|
|
|
}
|
2021-12-23 11:37:37 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
private void OnSceneLoaded(OWScene oldScene, OWScene newScene, bool inUniverse)
|
|
|
|
|
{
|
|
|
|
|
if (newScene != OWScene.EyeOfTheUniverse)
|
2022-02-27 12:40:44 +00:00
|
|
|
|
{
|
2022-03-03 03:46:33 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2022-02-27 12:40:44 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
var mapController = QSBWorldSync.GetUnityObjects<GalaxyMapController>().First();
|
|
|
|
|
var map = mapController._interactVolume.gameObject;
|
2021-12-23 11:37:37 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
map.SetActive(false);
|
|
|
|
|
Tree = map.AddComponent<QSBCharacterDialogueTree>();
|
|
|
|
|
Tree._xmlCharacterDialogueAsset = QSBCore.TextAssetsBundle.LoadAsset<TextAsset>("Assets/TextAssets/GalaxyMap.txt");
|
|
|
|
|
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
|
|
|
|
}
|
2022-02-25 06:04:54 +00:00
|
|
|
|
}
|