improve scene loading
This commit is contained in:
@@ -32722,7 +32722,7 @@ MonoBehaviour:
|
|||||||
m_TargetGraphic: {fileID: 1882365343}
|
m_TargetGraphic: {fileID: 1882365343}
|
||||||
m_HandleRect: {fileID: 1882365342}
|
m_HandleRect: {fileID: 1882365342}
|
||||||
m_Direction: 2
|
m_Direction: 2
|
||||||
m_Value: 1
|
m_Value: 0
|
||||||
m_Size: 1
|
m_Size: 1
|
||||||
m_NumberOfSteps: 0
|
m_NumberOfSteps: 0
|
||||||
m_OnValueChanged:
|
m_OnValueChanged:
|
||||||
@@ -33090,7 +33090,7 @@ MonoBehaviour:
|
|||||||
m_Calls:
|
m_Calls:
|
||||||
- m_Target: {fileID: 1564959567}
|
- m_Target: {fileID: 1564959567}
|
||||||
m_TargetAssemblyTypeName: UmaViewerUI, umamusume
|
m_TargetAssemblyTypeName: UmaViewerUI, umamusume
|
||||||
m_MethodName: ChangeMainPath
|
m_MethodName: ChangeDataPath
|
||||||
m_Mode: 1
|
m_Mode: 1
|
||||||
m_Arguments:
|
m_Arguments:
|
||||||
m_ObjectArgument: {fileID: 0}
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||||||
using Mono.Data.Sqlite;
|
using Mono.Data.Sqlite;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using Assets.Scripts;
|
using Assets.Scripts;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
public class UmaDatabaseController
|
public class UmaDatabaseController
|
||||||
{
|
{
|
||||||
@@ -60,11 +61,13 @@ public class UmaDatabaseController
|
|||||||
{
|
{
|
||||||
if(Config.Instance.WorkMode == WorkMode.Standalone)
|
if(Config.Instance.WorkMode == WorkMode.Standalone)
|
||||||
{
|
{
|
||||||
|
if(!File.Exists($@"{Config.Instance.MainPath}\meta_umaviewer")) throw new Exception();
|
||||||
metaDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}\meta_umaviewer;");
|
metaDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}\meta_umaviewer;");
|
||||||
masterDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}\master\master_umaviewer.mdb;");
|
masterDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}\master\master_umaviewer.mdb;");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (!File.Exists($@"{Config.Instance.MainPath}\meta")) throw new Exception();
|
||||||
metaDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}\meta;");
|
metaDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}\meta;");
|
||||||
masterDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}\master\master.mdb;");
|
masterDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}\master\master.mdb;");
|
||||||
}
|
}
|
||||||
@@ -214,10 +217,10 @@ public class UmaDatabaseController
|
|||||||
|
|
||||||
public void CloseAllConnection()
|
public void CloseAllConnection()
|
||||||
{
|
{
|
||||||
masterDb.Close();
|
masterDb?.Close();
|
||||||
metaDb.Close();
|
metaDb?.Close();
|
||||||
masterDb.Dispose();
|
masterDb?.Dispose();
|
||||||
metaDb.Dispose();
|
metaDb?.Dispose();
|
||||||
SqliteConnection.ClearAllPools();
|
SqliteConnection.ClearAllPools();
|
||||||
GC.Collect();
|
GC.Collect();
|
||||||
GC.WaitForPendingFinalizers();
|
GC.WaitForPendingFinalizers();
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class UmaSceneController:MonoBehaviour
|
|||||||
DontDestroyOnLoad(this);
|
DontDestroyOnLoad(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadScene(string name, Action OnSceneloaded, Action OnLastSceneUnloaded)
|
public void LoadScene(string name, Action OnSceneloaded = null, Action OnLastSceneUnloaded = null)
|
||||||
{
|
{
|
||||||
StartCoroutine(LoadLiveSceneAsync(name, OnSceneloaded, OnLastSceneUnloaded));
|
StartCoroutine(LoadLiveSceneAsync(name, OnSceneloaded, OnLastSceneUnloaded));
|
||||||
}
|
}
|
||||||
@@ -45,13 +45,13 @@ public class UmaSceneController:MonoBehaviour
|
|||||||
// Wait until the last operation fully loads to return anything
|
// Wait until the last operation fully loads to return anything
|
||||||
yield return new WaitUntil(()=> asyncLoad.isDone);
|
yield return new WaitUntil(()=> asyncLoad.isDone);
|
||||||
|
|
||||||
OnSceneloaded();
|
OnSceneloaded?.Invoke();
|
||||||
|
|
||||||
// Unload the previous Scene
|
// Unload the previous Scene
|
||||||
AsyncOperation asyncUnLoad = SceneManager.UnloadSceneAsync(currentScene);
|
AsyncOperation asyncUnLoad = SceneManager.UnloadSceneAsync(currentScene);
|
||||||
yield return new WaitUntil(() => asyncUnLoad.isDone);
|
yield return new WaitUntil(() => asyncUnLoad.isDone);
|
||||||
|
|
||||||
OnLastSceneUnloaded();
|
OnLastSceneUnloaded?.Invoke();
|
||||||
|
|
||||||
animation.Play("SceneTransition_e");
|
animation.Play("SceneTransition_e");
|
||||||
yield return new WaitUntil(() => !animation.isPlaying);
|
yield return new WaitUntil(() => !animation.isPlaying);
|
||||||
|
|||||||
@@ -495,11 +495,14 @@ namespace Gallop.Live
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isExit;
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
if (isExit) return;
|
||||||
if (Input.GetKeyDown(KeyCode.Escape))
|
if (Input.GetKeyDown(KeyCode.Escape))
|
||||||
{
|
{
|
||||||
SceneManager.LoadScene("Version2");
|
isExit = true;
|
||||||
|
UmaSceneController.instance.LoadScene("Version2");
|
||||||
AssetBundle.UnloadAllAssetBundles(true);
|
AssetBundle.UnloadAllAssetBundles(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user