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