Implemented ApplyUpdates method to reload the scene after updates were downloaded
This commit is contained in:
@@ -2430,7 +2430,7 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 114612701476717838}
|
||||
m_MethodName: ExitView
|
||||
m_MethodName: ApplyUpdates
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
|
||||
@@ -63,5 +63,10 @@ namespace RothenburgAR
|
||||
" Exhibitions of Path " + currentPaths + " of " + maxPaths + " paths.</color>");
|
||||
});
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
VuforiaARController.Instance.UnregisterVuforiaInitializedCallback(InitializeData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using UnityEngine;
|
||||
using RothenburgAR.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RothenburgAR.Common
|
||||
{
|
||||
@@ -32,7 +33,7 @@ namespace RothenburgAR.Common
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = (T) FindObjectOfType(typeof(T));
|
||||
_instance = (T)FindObjectOfType(typeof(T));
|
||||
|
||||
if (FindObjectsOfType(typeof(T)).Length > 1)
|
||||
{
|
||||
@@ -68,6 +69,12 @@ namespace RothenburgAR.Common
|
||||
|
||||
private static bool applicationIsQuitting = false;
|
||||
|
||||
public virtual void ResetInstance()
|
||||
{
|
||||
Destroy(_instance.gameObject);
|
||||
_instance = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When Unity quits, it destroys objects in a random order.
|
||||
/// In principle, a Singleton is only destroyed when application quits.
|
||||
@@ -77,6 +84,10 @@ namespace RothenburgAR.Common
|
||||
/// So, this was made to be sure we're not creating that buggy ghost object.
|
||||
/// </summary>
|
||||
public void OnDestroy()
|
||||
{
|
||||
}
|
||||
|
||||
private void OnApplicationQuit()
|
||||
{
|
||||
applicationIsQuitting = true;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using RothenburgAR.UI;
|
||||
using RothenburgAR.Common;
|
||||
|
||||
namespace RothenburgAR.Common
|
||||
namespace RothenburgAR.UI
|
||||
{
|
||||
class SettingsManager : Singleton<SettingsManager>
|
||||
{
|
||||
@@ -1,5 +1,9 @@
|
||||
using RothenburgAR.Updater;
|
||||
using RothenburgAR.Exhibition;
|
||||
using RothenburgAR.PointOfInterest;
|
||||
using RothenburgAR.Updater;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace RothenburgAR.UI
|
||||
{
|
||||
@@ -11,18 +15,26 @@ namespace RothenburgAR.UI
|
||||
public GameObject UpdateCompletedDialog;
|
||||
public GameObject UpdateFailedDialog;
|
||||
|
||||
private bool allowAbort = true;
|
||||
|
||||
private UpdateState lastUpdateState = UpdateState.UpdatesFound;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
UIManager.Instance.StartingUp = false;
|
||||
|
||||
UpdateDialog.SetActive(true);
|
||||
UpdateConfirmationDialog.SetActive(false);
|
||||
UpdateCompletedDialog.SetActive(false);
|
||||
UpdateFailedDialog.SetActive(false);
|
||||
ProgressBar.value = 0;
|
||||
ProgressBar.maxValue = 1;
|
||||
|
||||
if (UIManager.Instance.StartingUp)
|
||||
{
|
||||
allowAbort = false;
|
||||
//TODO disable all ExitView() calls in UI and ensure they are not enabled otherwise
|
||||
}
|
||||
|
||||
UIManager.Instance.StartingUp = false;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@@ -53,7 +65,7 @@ namespace RothenburgAR.UI
|
||||
|
||||
case UpdateState.Completed:
|
||||
UpdateCompletedDialog.SetActive(true);
|
||||
//TODO add "apply upgrades" button or sth that Destroys all DontDestroyOnLoads and reloads the scene, use AppInitializerBehaviour for that
|
||||
//TODO add "apply upgrades" button which Destroys all DontDestroyOnLoads and reloads the scene
|
||||
break;
|
||||
|
||||
case UpdateState.Failed:
|
||||
@@ -72,5 +84,24 @@ namespace RothenburgAR.UI
|
||||
UIManager.Instance.SwitchToView(ViewName.ARView);
|
||||
}
|
||||
|
||||
public void ApplyUpdates()
|
||||
{
|
||||
//DisplayManager.ResetInstance();
|
||||
|
||||
LanguageManager.Instance.ResetInstance();
|
||||
InputManager.Instance.ResetInstance();
|
||||
|
||||
UIManager.Instance.ResetInstance();
|
||||
UpdateManager.Instance.ResetInstance();
|
||||
SettingsManager.Instance.ResetInstance();
|
||||
|
||||
PoiDataManager.Instance.ResetInstance();
|
||||
ExhibitionManager.Instance.ResetInstance();
|
||||
|
||||
UIColorSchemeManager.Instance.ResetInstance();
|
||||
FontsizeManager.Instance.ResetInstance();
|
||||
|
||||
SceneManager.LoadScene("mainScene");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user