quantum-space-buddies/QSB/TranslationSync/SpiralManager.cs
Mister_Nebula 53974485c9
Spiral sync (#242)
* add stuff

* extract patches

* extract worldobjects (#241)

* add spiral sync

* cleanup

* cleanup

* fix

* rename

* add computers

* remove qnet flagshelper

* Update README.md

* cleanup
2020-12-31 12:10:55 +00:00

36 lines
1.1 KiB
C#

using QSB.TranslationSync.WorldObjects;
using QSB.WorldSync;
using System.Collections.Generic;
using UnityEngine;
namespace QSB.TranslationSync
{
internal class SpiralManager : MonoBehaviour
{
public static SpiralManager Instance { get; private set; }
private List<NomaiWallText> _nomaiWallTexts;
private List<NomaiComputer> _nomaiComputers;
private List<NomaiVesselComputer> _nomaiVesselComputers;
public void Awake()
{
Instance = this;
QSBSceneManager.OnUniverseSceneLoaded += OnSceneLoaded;
}
public void OnDestroy() => QSBSceneManager.OnUniverseSceneLoaded -= OnSceneLoaded;
private void OnSceneLoaded(OWScene scene)
{
_nomaiWallTexts = QSBWorldSync.Init<QSBWallText, NomaiWallText>();
_nomaiComputers = QSBWorldSync.Init<QSBComputer, NomaiComputer>();
_nomaiVesselComputers = QSBWorldSync.Init<QSBVesselComputer, NomaiVesselComputer>();
}
public int GetId(NomaiWallText obj) => _nomaiWallTexts.IndexOf(obj);
public int GetId(NomaiComputer obj) => _nomaiComputers.IndexOf(obj);
public int GetId(NomaiVesselComputer obj) => _nomaiVesselComputers.IndexOf(obj);
}
}