mirror of
https://github.com/RaindropViewer/RaindropViewer.git
synced 2026-07-27 22:11:39 +00:00
refactor: change RD_BS to run on application load
change RD_BS into ScriptableObject
This commit is contained in:
committed by
alexiscatnip
parent
6b9a285312
commit
a11b7ce3f7
@@ -132,7 +132,6 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 278446682}
|
||||
- component: {fileID: 278446681}
|
||||
m_Layer: 0
|
||||
m_Name: RaindropBootstrapper
|
||||
m_TagString: Untagged
|
||||
@@ -140,19 +139,6 @@ GameObject:
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &278446681
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 278446680}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fa61eabca29ec274e822d94f50702a99, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
startUI: 1
|
||||
--- !u!4 &278446682
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using Disk;
|
||||
using OpenMetaverse;
|
||||
using Plugins.CommonDependencies;
|
||||
using Raindrop.Netcom;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityScripts.Disk;
|
||||
@@ -19,23 +21,43 @@ namespace Raindrop.Bootstrap
|
||||
// Then, you can disable/enable UI-scene loading using the boolean
|
||||
|
||||
// Disable UI scene loading for headless tests
|
||||
public class RaindropBootstrapper : MonoBehaviour
|
||||
|
||||
public class RaindropBootstrapper : ScriptableObject
|
||||
{
|
||||
[SerializeField] public bool startUI;
|
||||
|
||||
private void Awake()
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
||||
public static void Start()
|
||||
{
|
||||
RegisterToAppTeardownEvent();
|
||||
Start_Raindrop_CoreDependencies();
|
||||
|
||||
if (startUI)
|
||||
{
|
||||
StartUIScene();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnDestroy()
|
||||
|
||||
private static void RegisterToAppTeardownEvent()
|
||||
{
|
||||
Quit_Application();
|
||||
#if !UNITY_EDITOR
|
||||
Application.quitting += Quit_Application;
|
||||
#endif
|
||||
#if UNITY_EDITOR
|
||||
|
||||
EditorApplication.playModeStateChanged -=
|
||||
InternalPlayModeStateChanged;
|
||||
EditorApplication.playModeStateChanged +=
|
||||
InternalPlayModeStateChanged;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>For in-editor usage only.</summary>
|
||||
public static void InternalPlayModeStateChanged(PlayModeStateChange state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case PlayModeStateChange.ExitingPlayMode:
|
||||
Quit_Application();
|
||||
break;
|
||||
case PlayModeStateChange.ExitingEditMode:
|
||||
case PlayModeStateChange.EnteredPlayMode:
|
||||
case PlayModeStateChange.EnteredEditMode:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#region Bootstrap functions
|
||||
@@ -122,7 +144,7 @@ namespace Raindrop.Bootstrap
|
||||
|
||||
|
||||
// globally-accessible quit method.
|
||||
public void Quit_Application()
|
||||
public static void Quit_Application()
|
||||
{
|
||||
void SaveInventoryToDiskAndLogout(RaindropInstance raindropInstance, RaindropNetcom raindropNetcom)
|
||||
{
|
||||
@@ -175,7 +197,7 @@ namespace Raindrop.Bootstrap
|
||||
|
||||
// wraps up the netcom (synchronisation context) ,
|
||||
// followed by the client instance.
|
||||
void frmMain_Disposed(RaindropInstance instance)
|
||||
static void frmMain_Disposed(RaindropInstance instance)
|
||||
{
|
||||
RaindropNetcom netcom = instance.Netcom;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user