void OnDestroy() { try { if (currentSkin != null) { currentSkin.Rollback(); } currentSkin = null; config = null; if (sapphirePanel != null) { Destroy(sapphirePanel); } if (sapphireButton != null) { Destroy(sapphireButton); } SetCameraRectHelper.Deinitialize(); bootstrapped = false; } catch (Exception ex) { Debug.LogException(ex); } }
public void Rollback() { if (!isValid) { Debug.LogWarning("Trying to roll-back an invalid skin"); return; } applicator.Rollback(); SetCameraRectHelper.ResetCameraRect(); }
void Start() { SetCameraRectHelper.Initialize(); LoadConfig(); if (!Directory.Exists(overrideDirectory)) { try { Directory.CreateDirectory(overrideDirectory); } catch (Exception ex) { Debug.LogException(ex); } } InitializeInGamePanels(); availableSkins = SkinLoader.FindAllSkins(); if (!string.IsNullOrEmpty(config.selectedSkinPath) && config.applySkinOnStartup) { foreach (var metadata in availableSkins) { if (metadata.sapphirePath == config.selectedSkinPath) { currentSkin = Skin.FromXmlFile(Path.Combine(metadata.sapphirePath, "skin.xml"), false); needToApplyCurrentSkin = true; break; } } } CreateUI(); debugRenderer = gameObject.AddComponent <DebugRenderer>(); }