Skip to content

Commit 9dc9736

Browse files
committed
Minor changes.
1 parent 0d62f51 commit 9dc9736

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

Runtime/DevConsole.cs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static bool IsEnabled
5050
}
5151

5252
/// <summary>
53-
/// Whether the dev console is open.
53+
/// Whether the dev console window is open.
5454
/// </summary>
5555
public static bool IsOpen
5656
{
@@ -68,7 +68,7 @@ public static bool IsOpen
6868
}
6969

7070
/// <summary>
71-
/// Whether the dev console is open and the input field is focused.
71+
/// Whether the dev console window is open and the input field is focused.
7272
/// </summary>
7373
public static bool IsOpenAndFocused => _console.ConsoleIsShowingAndFocused;
7474

@@ -285,6 +285,11 @@ public static void ClearConsole()
285285
/// <param name="callback"></param>
286286
public static void Register_OnDevConsoleOpened(Action callback)
287287
{
288+
if (callback == null)
289+
{
290+
throw new ArgumentNullException(nameof(callback));
291+
}
292+
288293
_console.OnDevConsoleOpened += callback;
289294
}
290295

@@ -294,6 +299,11 @@ public static void Register_OnDevConsoleOpened(Action callback)
294299
/// <param name="callback"></param>
295300
public static void Deregister_OnDevConsoleOpened(Action callback)
296301
{
302+
if (callback == null)
303+
{
304+
throw new ArgumentNullException(nameof(callback));
305+
}
306+
297307
_console.OnDevConsoleOpened -= callback;
298308
}
299309

@@ -303,6 +313,11 @@ public static void Deregister_OnDevConsoleOpened(Action callback)
303313
/// <param name="callback"></param>
304314
public static void Register_OnDevConsoleClosed(Action callback)
305315
{
316+
if (callback == null)
317+
{
318+
throw new ArgumentNullException(nameof(callback));
319+
}
320+
306321
_console.OnDevConsoleClosed += callback;
307322
}
308323

@@ -312,6 +327,11 @@ public static void Register_OnDevConsoleClosed(Action callback)
312327
/// <param name="callback"></param>
313328
public static void Deregister_OnDevConsoleClosed(Action callback)
314329
{
330+
if (callback == null)
331+
{
332+
throw new ArgumentNullException(nameof(callback));
333+
}
334+
315335
_console.OnDevConsoleClosed -= callback;
316336
}
317337

@@ -320,8 +340,7 @@ public static void Deregister_OnDevConsoleClosed(Action callback)
320340
private static void Init()
321341
#pragma warning restore IDE0051
322342
{
323-
GameObject obj = UnityEngine.Object.Instantiate(Resources.Load<GameObject>("Prefabs/FAB_DevConsole.Instance"));
324-
_console = obj.GetComponent<DevConsoleMono>();
343+
_console = UnityEngine.Object.Instantiate(Resources.Load<GameObject>("Prefabs/FAB_DevConsole.Instance")).GetComponent<DevConsoleMono>();
325344
}
326345

327346
#endregion

Runtime/DevConsoleMono.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ private void Awake()
579579
hideFlags = HideFlags.HideInInspector | HideFlags.HideInHierarchy;
580580
#endif
581581

582-
_versionText.text = "v" + _version.ToString();
582+
_versionText.text = $"v{_version}";
583583
_initPosition = _dynamicTransform.anchoredPosition;
584584
_initSize = _dynamicTransform.sizeDelta;
585585
_initLogFieldWidth = _logFieldPrefab.GetComponent<RectTransform>().sizeDelta.x;
@@ -1778,6 +1778,7 @@ private void ProcessStoredLogs()
17781778

17791779
private int GetVertexCount(string text)
17801780
{
1781+
// Determine the number of vertices required to render the provided rich text
17811782
Text logText = _logFields.Last().textComponent;
17821783
_textGenerator.Populate(text, logText.GetGenerationSettings(logText.rectTransform.rect.size));
17831784
return _textGenerator.vertexCount;
@@ -1842,6 +1843,7 @@ IEnumerator ScrollToBottomCoroutine()
18421843

18431844
private bool GetKeyDown(InputKey key)
18441845
{
1846+
// Check if the specified key was pressed this frame, using the correct input system
18451847
#if USE_NEW_INPUT_SYSTEM
18461848
return Keyboard.current[key].wasPressedThisFrame;
18471849
#else
@@ -1851,6 +1853,7 @@ private bool GetKeyDown(InputKey key)
18511853

18521854
private Vector2 GetMousePosition()
18531855
{
1856+
// Get the current mouse position, using the correct input system
18541857
#if USE_NEW_INPUT_SYSTEM
18551858
return Mouse.current.position.ReadValue();
18561859
#else

0 commit comments

Comments
 (0)