Skip to content

Commit

Permalink
feat: adding "dont show" toggle to welcome window
Browse files Browse the repository at this point in the history
adding option to not show welcome window after updates
  • Loading branch information
James-Frowen committed Aug 31, 2024
1 parent bac7538 commit f3eae96
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
</ui:ScrollView>
</ui:VisualElement>
</ui:Box>
<ui:VisualElement style="align-items: end;">
<ui:Toggle name="DontShowToggle" text="Dont show on update" style="pad-left:6px;" />
</ui:VisualElement>
</ui:VisualElement>
</ui:VisualElement>
</ui:UXML>
11 changes: 9 additions & 2 deletions Assets/Mirage/Editor/WelcomeWindow/WelcomeWindow.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Mirage.Logging;
Expand All @@ -10,7 +9,6 @@
using UnityEditor.PackageManager.Requests;
using UnityEngine;
using UnityEngine.UIElements;
using PackageInfo = UnityEditor.PackageManager.PackageInfo;

/**
* Docs used:
Expand Down Expand Up @@ -105,6 +103,10 @@ private static void ShowWindowOnFirstStart()
EditorApplication.update -= ShowWindowOnFirstStart;
firstStartUpKey = GetVersion();

var dontShow = EditorPrefs.GetBool("DontShowToggle", false);
if (dontShow)
return;

if ((!EditorPrefs.GetBool(firstTimeMirageKey, false) || !EditorPrefs.GetBool(firstStartUpKey, false)) && firstStartUpKey != "MirageUnknown")
{
EditorPrefs.SetString(screenToOpenKey, ShowChangeLog ? "ChangeLog" : "Welcome");
Expand Down Expand Up @@ -156,6 +158,11 @@ private void OnEnable()

DrawChangeLog(ParseChangeLog());

var dontShowToggle = root.Q<Toggle>("DontShowToggle");
dontShowToggle.value = EditorPrefs.GetBool("DontShowToggle", false);
dontShowToggle.tooltip = "Dont show welcome window after there is an update to Mirage";
dontShowToggle.RegisterValueChangedCallback(b => EditorPrefs.SetBool("DontShowToggle", b.newValue));

#region Page buttons

ConfigureTab("WelcomeButton", "Welcome", WelcomePageUrl);
Expand Down

0 comments on commit f3eae96

Please sign in to comment.