Onboarding now skips already made Settings
added UpdaterView to Onboarding
This commit is contained in:
@@ -8,14 +8,14 @@ namespace RothenburgAR.Common
|
|||||||
{
|
{
|
||||||
public bool? IsInitialized { get; private set; }
|
public bool? IsInitialized { get; private set; }
|
||||||
|
|
||||||
internal class Settings
|
public class AppSettings
|
||||||
{
|
{
|
||||||
public string Language { get; set; }
|
public string Language { get; set; }
|
||||||
public FontsizeSetting Fontsize { get; set; }
|
public FontsizeSetting? Fontsize { get; set; }
|
||||||
public int ColorschemeID { get; set; }
|
public int? ColorschemeID { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private Settings settings;
|
public AppSettings Settings { get; private set; }
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
@@ -23,28 +23,32 @@ namespace RothenburgAR.Common
|
|||||||
{
|
{
|
||||||
//load settings file into settings object if existent
|
//load settings file into settings object if existent
|
||||||
var json = File.ReadAllText(PathHelper.SettingsFilePath);
|
var json = File.ReadAllText(PathHelper.SettingsFilePath);
|
||||||
settings = JsonConvert.DeserializeObject<Settings>(json);
|
Settings = JsonConvert.DeserializeObject<AppSettings>(json);
|
||||||
|
|
||||||
LanguageManager.Instance.CurrentLanguageKey = settings.Language;
|
|
||||||
UIColorSchemeManager.Instance.SetUiColorScheme(settings.ColorschemeID);
|
|
||||||
FontsizeManager.Instance.CurrentFontsizeSetting = settings.Fontsize;
|
|
||||||
|
|
||||||
IsInitialized = true;
|
IsInitialized = true;
|
||||||
|
|
||||||
|
if (Settings.Language != null)
|
||||||
|
LanguageManager.Instance.CurrentLanguageKey = Settings.Language;
|
||||||
|
|
||||||
|
if (Settings.ColorschemeID.HasValue)
|
||||||
|
UIColorSchemeManager.Instance.SetUiColorScheme(Settings.ColorschemeID.Value);
|
||||||
|
|
||||||
|
if (Settings.Fontsize.HasValue)
|
||||||
|
FontsizeManager.Instance.CurrentFontsizeSetting = Settings.Fontsize.Value;
|
||||||
|
|
||||||
|
if (Settings.Language == null || !Settings.ColorschemeID.HasValue || !Settings.Fontsize.HasValue)
|
||||||
|
IsInitialized = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
settings = new Settings();
|
Settings = new AppSettings();
|
||||||
IsInitialized = false;
|
IsInitialized = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PersistSettings()
|
public void PersistSettings()
|
||||||
{
|
{
|
||||||
settings.Language = LanguageManager.Instance.CurrentLanguageKey;
|
var json = JsonConvert.SerializeObject(Settings);
|
||||||
settings.ColorschemeID = UIColorSchemeManager.Instance.CurrentColorSchemeID;
|
|
||||||
settings.Fontsize = FontsizeManager.Instance.CurrentFontsizeSetting;
|
|
||||||
|
|
||||||
var json = JsonConvert.SerializeObject(settings);
|
|
||||||
File.WriteAllText(PathHelper.SettingsFilePath, json);
|
File.WriteAllText(PathHelper.SettingsFilePath, json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ namespace RothenburgAR.UI
|
|||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
if (SettingsManager.Instance.Settings.ColorschemeID.HasValue && UIManager.Instance.StartingUp)
|
||||||
|
SwitchToFontsizeSelectView();
|
||||||
|
|
||||||
CreateColorSelectionCircles();
|
CreateColorSelectionCircles();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,7 +30,9 @@ namespace RothenburgAR.UI
|
|||||||
selectionCircle.GetComponentInChildren<Button>().onClick.AddListener(() =>
|
selectionCircle.GetComponentInChildren<Button>().onClick.AddListener(() =>
|
||||||
{
|
{
|
||||||
UIColorSchemeManager.Instance.SetUiColorScheme(id);
|
UIColorSchemeManager.Instance.SetUiColorScheme(id);
|
||||||
if (!UIManager.Instance.StartingUp) SettingsManager.Instance.PersistSettings();
|
|
||||||
|
SettingsManager.Instance.Settings.ColorschemeID = UIColorSchemeManager.Instance.CurrentColorSchemeID;
|
||||||
|
SettingsManager.Instance.PersistSettings();
|
||||||
|
|
||||||
if (UIManager.Instance.StartingUp) SwitchToFontsizeSelectView();
|
if (UIManager.Instance.StartingUp) SwitchToFontsizeSelectView();
|
||||||
else SwitchToARView();
|
else SwitchToARView();
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ namespace RothenburgAR.UI
|
|||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
|
if (SettingsManager.Instance.Settings.Fontsize.HasValue && UIManager.Instance.StartingUp)
|
||||||
|
SwitchToTutorialView();
|
||||||
|
|
||||||
CreateLanguageSelectionFlags();
|
CreateLanguageSelectionFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +51,9 @@ namespace RothenburgAR.UI
|
|||||||
{
|
{
|
||||||
Debug.Log("Switching Font size to '" + Enum.GetName(typeof(FontsizeSetting), setting) + "'");
|
Debug.Log("Switching Font size to '" + Enum.GetName(typeof(FontsizeSetting), setting) + "'");
|
||||||
FontsizeManager.Instance.CurrentFontsizeSetting = setting;
|
FontsizeManager.Instance.CurrentFontsizeSetting = setting;
|
||||||
if (!UIManager.Instance.StartingUp) SettingsManager.Instance.PersistSettings();
|
|
||||||
|
SettingsManager.Instance.Settings.Fontsize = FontsizeManager.Instance.CurrentFontsizeSetting;
|
||||||
|
SettingsManager.Instance.PersistSettings();
|
||||||
|
|
||||||
StateManager sm = TrackerManager.Instance.GetStateManager();
|
StateManager sm = TrackerManager.Instance.GetStateManager();
|
||||||
foreach (var item in sm.GetActiveTrackableBehaviours())
|
foreach (var item in sm.GetActiveTrackableBehaviours())
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ namespace RothenburgAR.UI
|
|||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
|
if (SettingsManager.Instance.Settings.Language != null && UIManager.Instance.StartingUp)
|
||||||
|
SwitchToColorSelectView();
|
||||||
|
|
||||||
CreateLanguageSelectionFlags();
|
CreateLanguageSelectionFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +54,9 @@ namespace RothenburgAR.UI
|
|||||||
{
|
{
|
||||||
Debug.Log("Switching Language to '" + languageCode + "'");
|
Debug.Log("Switching Language to '" + languageCode + "'");
|
||||||
LanguageManager.Instance.CurrentLanguageKey = languageCode;
|
LanguageManager.Instance.CurrentLanguageKey = languageCode;
|
||||||
if (!UIManager.Instance.StartingUp) SettingsManager.Instance.PersistSettings();
|
|
||||||
|
SettingsManager.Instance.Settings.Language = LanguageManager.Instance.CurrentLanguageKey;
|
||||||
|
SettingsManager.Instance.PersistSettings();
|
||||||
|
|
||||||
StateManager sm = TrackerManager.Instance.GetStateManager();
|
StateManager sm = TrackerManager.Instance.GetStateManager();
|
||||||
foreach (var item in sm.GetActiveTrackableBehaviours())
|
foreach (var item in sm.GetActiveTrackableBehaviours())
|
||||||
|
|||||||
@@ -18,11 +18,10 @@ namespace RothenburgAR.UI
|
|||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
if (Input.GetMouseButtonDown(0) == true ||
|
if (Input.GetMouseButtonDown(0) == true || (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended))
|
||||||
(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended))
|
|
||||||
{
|
{
|
||||||
if (UIManager.Instance.StartingUp) SettingsManager.Instance.PersistSettings();
|
if (UIManager.Instance.StartingUp) SwitchToUpdaterView();
|
||||||
UIManager.Instance.SwitchToView(ViewName.ARView);
|
else UIManager.Instance.SwitchToView(ViewName.ARView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using RothenburgAR.Common;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using RothenburgAR.UI;
|
||||||
|
|
||||||
namespace RothenburgAR.Updater
|
namespace RothenburgAR.Updater
|
||||||
{
|
{
|
||||||
@@ -447,8 +448,11 @@ namespace RothenburgAR.Updater
|
|||||||
|
|
||||||
public void UpdatesCompleted()
|
public void UpdatesCompleted()
|
||||||
{
|
{
|
||||||
//TODO force switch to UpdaterView when update needs to be applied
|
|
||||||
UpdateState = UpdateState.Completed;
|
UpdateState = UpdateState.Completed;
|
||||||
|
|
||||||
|
//TODO force switch to UpdaterView when update needs to be applied
|
||||||
|
if (!UIManager.Instance.StartingUp)
|
||||||
|
UIManager.Instance.SwitchToView(ViewName.UpdaterView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user