adapt to singleton

This commit is contained in:
in0finite 2022-01-26 20:21:50 +01:00
parent a6b8af5cb9
commit 37930ac861
2 changed files with 7 additions and 13 deletions

View file

@ -5,10 +5,10 @@ using SanAndreasUnity.Utilities;
namespace SanAndreasUnity.Behaviours
{
public class UIManager : MonoBehaviour
public class UIManager : StartupSingleton<UIManager>
{
public static UIManager Instance { get; private set; }
public static UIManager Instance => Singleton;
bool m_useTouchInput = false;
public bool UseTouchInput
@ -45,10 +45,8 @@ namespace SanAndreasUnity.Behaviours
void Awake()
protected override void OnSingletonAwake()
{
Instance = this;
// enable touch input by default on mobile platforms
if (Application.isMobilePlatform)

View file

@ -1,13 +1,14 @@
using System;
using System.Collections.Generic;
using SanAndreasUnity.Net;
using SanAndreasUnity.Utilities;
using UnityEngine;
namespace SanAndreasUnity.GameModes
{
public class GameModeManager : MonoBehaviour
public class GameModeManager : StartupSingleton<GameModeManager>
{
public static GameModeManager Instance { get; private set; }
public static GameModeManager Instance => Singleton;
public class GameModeInfo
{
@ -31,12 +32,7 @@ namespace SanAndreasUnity.GameModes
private GameModeInfo m_selectedGameMode;
void Awake()
{
Instance = this;
}
private void Start()
protected override void OnSingletonStart()
{
NetManager.Instance.onServerStatusChanged += OnServerStatusChanged;
}