private static void ToggleSimulation() { var settings = Settings.Instance; settings.EnableSimulation = !settings.EnableSimulation; settings.Save(); NotchSimulator.UpdateAllMockups(); NotchSimulator.UpdateSimulatorTargets(); NotchSimulator.Redraw(); }
internal static void SwitchConfiguration() { Settings.Instance.NextConfiguration(); NotchSimulator.Redraw(); NotchSimulator.UpdateAllMockups(); NotchSimulator.UpdateSimulatorTargets(); // Using shortcut to change aspect ratio actually will not proc the [ExecuteAlways] Update() of adaptation components, unlike using the drop down. // But it mostly do so because we always have some uGUI components which indirectly cause those updates on ratio change. // While the scene with no uGUI at all maybe rare, it never hurts to proc them manually.. just in case. EditorApplication.QueuePlayerLoopUpdate(); }
public override void OnActivate(string searchContext, VisualElement root) { var padRect = new VisualElement(); int padding = 10; padRect.style.paddingBottom = padding; padRect.style.paddingLeft = padding; padRect.style.paddingRight = padding; padRect.style.paddingTop = padding - 5; root.Add(padRect); var title = new Label("Notch Solution"); title.style.fontSize = 15; title.style.unityFontStyleAndWeight = FontStyle.Bold; padRect.Add(title); var repo = new Label("https://github.com/5argon/NotchSolution"); repo.style.paddingBottom = 15; repo.style.unityFontStyleAndWeight = FontStyle.Bold; repo.RegisterCallback((MouseDownEvent ev) => { System.Diagnostics.Process.Start("https://github.com/5argon/NotchSolution"); }); padRect.Add(repo); var devicesPath = new TextField("Device Directory"); devicesPath.SetEnabled(false); devicesPath.value = NotchSimulatorUtility.DevicesFolder; padRect.Add(devicesPath); var colorField = new ColorField("Prefab mode overlay color"); colorField.value = Settings.Instance.PrefabModeOverlayColor; colorField.RegisterValueChangedCallback(ev => { var settings = Settings.Instance; settings.PrefabModeOverlayColor = ev.newValue; settings.Save(); NotchSimulator.UpdateAllMockups(); NotchSimulator.UpdateSimulatorTargets(); }); padRect.Add(colorField); }