Skip to content

Commit c141f54

Browse files
committed
Add a tip about dragging the game window, hide unnecessary tips
1 parent eb4fd75 commit c141f54

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

ConfigurationManager/ConfigurationManager.cs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ public class ConfigurationManager : BaseUnityPlugin
6363

6464
internal Rect SettingWindowRect { get; private set; }
6565
private bool _windowWasMoved;
66+
67+
private bool _tipsPluginHeaderWasClicked, _tipsWindowWasMoved;
68+
6669
private Rect _screenRect;
6770
private Vector2 _settingWindowScrollPos;
6871
private int _tipsHeight;
@@ -281,6 +284,8 @@ private void OnGUI()
281284
{
282285
_windowWasMoved = true;
283286
SettingWindowRect = newRect;
287+
288+
_tipsWindowWasMoved = true;
284289
}
285290

286291
if (!SettingFieldDrawer.SettingKeyboardShortcut && (!_windowWasMoved || SettingWindowRect.Contains(UnityInput.Current.mousePosition)))
@@ -392,11 +397,17 @@ private void SettingsWindow(int id)
392397

393398
private void DrawTips()
394399
{
395-
GUILayout.BeginHorizontal();
400+
var tip = !_tipsPluginHeaderWasClicked ? "Tip: Click plugin names to expand. Click setting and group names to see their descriptions." :
401+
!_tipsWindowWasMoved ? "Tip: You can drag this window to move it. It will stay open while you interact with the game." : null;
402+
403+
if (tip != null)
396404
{
397-
GUILayout.Label("Tip: Click plugin names to expand. Click setting and group names to see their descriptions.");
405+
GUILayout.BeginHorizontal();
406+
{
407+
GUILayout.Label(tip);
408+
}
409+
GUILayout.EndHorizontal();
398410
}
399-
GUILayout.EndHorizontal();
400411
}
401412

402413
private void DrawWindowHeader()
@@ -480,6 +491,8 @@ private void DrawWindowHeader()
480491
_pluginConfigCollapsedDefault.Value = newValue;
481492
foreach (var plugin in _filteredSetings)
482493
plugin.Collapsed = newValue;
494+
495+
_tipsPluginHeaderWasClicked = true;
483496
}
484497
}
485498
GUILayout.EndHorizontal();
@@ -524,7 +537,10 @@ private void DrawSinglePlugin(PluginSettingsData plugin)
524537
}
525538

526539
if (SettingFieldDrawer.DrawPluginHeader(categoryHeader, plugin.Collapsed && !isSearching) && !isSearching)
540+
{
541+
_tipsPluginHeaderWasClicked = true;
527542
plugin.Collapsed = !plugin.Collapsed;
543+
}
528544

529545
if (hasWebsite)
530546
{

0 commit comments

Comments
 (0)