diff --git a/Assets/Resources/UI/UpdaterView.prefab b/Assets/Resources/UI/UpdaterView.prefab
index 3ce14b4..3688aa5 100644
--- a/Assets/Resources/UI/UpdaterView.prefab
+++ b/Assets/Resources/UI/UpdaterView.prefab
@@ -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}
diff --git a/Assets/RothenburgAR/Scripts/AppInitializerBehaviour.cs b/Assets/RothenburgAR/Scripts/AppInitializerBehaviour.cs
index 51e3d1f..1c119d3 100644
--- a/Assets/RothenburgAR/Scripts/AppInitializerBehaviour.cs
+++ b/Assets/RothenburgAR/Scripts/AppInitializerBehaviour.cs
@@ -63,5 +63,10 @@ namespace RothenburgAR
" Exhibitions of Path " + currentPaths + " of " + maxPaths + " paths.");
});
}
+
+ private void OnDestroy()
+ {
+ VuforiaARController.Instance.UnregisterVuforiaInitializedCallback(InitializeData);
+ }
}
}
\ No newline at end of file
diff --git a/Assets/RothenburgAR/Scripts/Common/Singleton.cs b/Assets/RothenburgAR/Scripts/Common/Singleton.cs
index 04a40a1..b33efd7 100644
--- a/Assets/RothenburgAR/Scripts/Common/Singleton.cs
+++ b/Assets/RothenburgAR/Scripts/Common/Singleton.cs
@@ -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;
+ }
+
///
/// 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.
///
public void OnDestroy()
+ {
+ }
+
+ private void OnApplicationQuit()
{
applicationIsQuitting = true;
}
diff --git a/Assets/RothenburgAR/Scripts/Common/SettingsManager.cs b/Assets/RothenburgAR/Scripts/UI/SettingsManager.cs
similarity index 97%
rename from Assets/RothenburgAR/Scripts/Common/SettingsManager.cs
rename to Assets/RothenburgAR/Scripts/UI/SettingsManager.cs
index e493e36..85a4f97 100644
--- a/Assets/RothenburgAR/Scripts/Common/SettingsManager.cs
+++ b/Assets/RothenburgAR/Scripts/UI/SettingsManager.cs
@@ -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
{
diff --git a/Assets/RothenburgAR/Scripts/Common/SettingsManager.cs.meta b/Assets/RothenburgAR/Scripts/UI/SettingsManager.cs.meta
similarity index 100%
rename from Assets/RothenburgAR/Scripts/Common/SettingsManager.cs.meta
rename to Assets/RothenburgAR/Scripts/UI/SettingsManager.cs.meta
diff --git a/Assets/RothenburgAR/Scripts/UI/UpdaterViewBehaviour.cs b/Assets/RothenburgAR/Scripts/UI/UpdaterViewBehaviour.cs
index 2dc6ffe..ca04b3c 100644
--- a/Assets/RothenburgAR/Scripts/UI/UpdaterViewBehaviour.cs
+++ b/Assets/RothenburgAR/Scripts/UI/UpdaterViewBehaviour.cs
@@ -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");
+ }
}
}
\ No newline at end of file