Rewrite of studio toolbar API with new features; and added GlobalTooltips #85
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
IllusionMods/IllusionModdingAPI!85
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "wip-toolbar"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull Request Overview
This PR implements a comprehensive rewrite of the studio toolbar API with enhanced features and introduces a new GlobalTooltips system for displaying tooltips throughout the game and studio. The rewrite provides better positioning control, drag-and-drop functionality, and persistence of toolbar layouts.
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 5 comments.
Show a summary per file
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
@ -0,0 +104,4 @@if (_iconTex == null)throw new InvalidOperationException($"Icon texture getter for {ButtonID} returned null");if (_iconTex.width != 32 || _iconTex.height != 32)KoikatuAPI.Logger.LogWarning($"Icon texture passed to {ButtonID} has wrong size, it should be 32x32 but is {_iconTex.width}x{_iconTex.height}");[nitpick] The warning message should specify that this is just a recommendation rather than a requirement, since the code continues to work with non-32x32 textures. Consider clarifying this in the warning message.
@ -0,0 +151,4 @@var button = ButtonObject;if (button) Object.Destroy(button.gameObject);Object.Destroy(_iconTex);Calling Object.Destroy on _iconTex may destroy textures that were provided by external code and shouldn't be destroyed by this class. Consider only destroying textures that were created internally, or document that provided textures will be destroyed.
@ -0,0 +1,107 @@using System;Using Contains() on a List for duplicate detection has O(n) complexity. Consider using a HashSet to track seen entries for better performance when dealing with many toolbar buttons.
@ -0,0 +1,197 @@using System;Modifying a list while iterating with RemoveAt() and manual index adjustment can be inefficient for large lists. Consider using a reverse loop or collecting items to remove and processing them separately.
@ -0,0 +59,4 @@{_tooltipBackground = new Texture2D(1, 1, TextureFormat.ARGB32, false);_tooltipBackground.SetPixel(0, 0, new Color(0, 0, 0, 0.65f));_tooltipBackground.Apply();The tooltip background texture is created every frame in Update() instead of being initialized once. Consider moving this initialization to a static constructor or separate initialization method called once at startup.