diff options
Diffstat (limited to 'Assembly_CSharp/SteamManager.cs')
-rw-r--r-- | Assembly_CSharp/SteamManager.cs | 123 |
1 files changed, 0 insertions, 123 deletions
diff --git a/Assembly_CSharp/SteamManager.cs b/Assembly_CSharp/SteamManager.cs deleted file mode 100644 index 642003a..0000000 --- a/Assembly_CSharp/SteamManager.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System; -using System.Text; -using AOT; -using Steamworks; -using UnityEngine; - -[DisallowMultipleComponent] -public class SteamManager : MonoBehaviour -{ - protected static bool s_EverInitialized; - - protected static SteamManager s_instance; - - protected bool m_bInitialized; - - protected SteamAPIWarningMessageHook_t m_SteamAPIWarningMessageHook; - - protected static SteamManager Instance - { - get - { - if (s_instance == null) - { - return new GameObject("SteamManager").AddComponent<SteamManager>(); - } - return s_instance; - } - } - - public static bool Initialized => Instance.m_bInitialized; - - [MonoPInvokeCallback(typeof(SteamAPIWarningMessageHook_t))] - protected static void SteamAPIDebugTextHook(int nSeverity, StringBuilder pchDebugText) - { - Debug.LogWarning(pchDebugText); - } - - [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] - private static void InitOnPlayMode() - { - s_EverInitialized = false; - s_instance = null; - } - - protected virtual void Awake() - { - if (s_instance != null) - { - UnityEngine.Object.Destroy(base.gameObject); - return; - } - s_instance = this; - if (s_EverInitialized) - { - throw new Exception("Tried to Initialize the SteamAPI twice in one session!"); - } - UnityEngine.Object.DontDestroyOnLoad(base.gameObject); - if (!Packsize.Test()) - { - Debug.LogError("[Steamworks.NET] Packsize Test returned false, the wrong version of Steamworks.NET is being run in this platform.", this); - } - if (!DllCheck.Test()) - { - Debug.LogError("[Steamworks.NET] DllCheck Test returned false, One or more of the Steamworks binaries seems to be the wrong version.", this); - } - try - { - if (SteamAPI.RestartAppIfNecessary((AppId_t)1843760u)) - { - Application.Quit(); - return; - } - } - catch (DllNotFoundException ex) - { - Debug.LogError("[Steamworks.NET] Could not load [lib]steam_api.dll/so/dylib. It's likely not in the correct location. Refer to the README for more details.\n" + ex, this); - Application.Quit(); - return; - } - m_bInitialized = SteamAPI.Init(); - if (!m_bInitialized) - { - Debug.LogError("[Steamworks.NET] SteamAPI_Init() failed. Refer to Valve's documentation or the comment above this line for more information.", this); - } - else - { - s_EverInitialized = true; - } - } - - protected virtual void OnEnable() - { - if (s_instance == null) - { - s_instance = this; - } - if (m_bInitialized && m_SteamAPIWarningMessageHook == null) - { - m_SteamAPIWarningMessageHook = SteamAPIDebugTextHook; - SteamClient.SetWarningMessageHook(m_SteamAPIWarningMessageHook); - } - } - - protected virtual void OnDestroy() - { - if (!(s_instance != this)) - { - s_instance = null; - if (m_bInitialized) - { - SteamAPI.Shutdown(); - } - } - } - - protected virtual void Update() - { - if (m_bInitialized) - { - SteamAPI.RunCallbacks(); - } - } -} |