partsquirrel7 Posted April 20, 2023 Share Posted April 20, 2023 I've followed Cairath's guide to modding (which is a super helpful resource) and was able to modify the game's behavior in simple ways. Now I want to write a mod that requires changing GUI elements (an additional button in an existing screen, a whole new screen with more GUI elements). I've poked around the de-compiled source code a bit and see some classes they use to create GUI elements (KButton, etc), but I don't see how these things are given any layout (size, position, etc.). Are there any good resources (existing mods, a guide, etc.) that could help me modify the GUI? Specifically to create a new screen with its own layout? Is this even possible? Any help is appreciated. Link to comment Share on other sites More sharing options...
pether Posted April 21, 2023 Share Posted April 21, 2023 SGT_Imalas have done some small GUI things recently, check his mods (github?) Peter Han made PLib that is commonly used to generate GUI for mod settings. Also his Resculpt (now happily deprecated) added some buttons I know Aki had some experience with GUI and custom screens. Overall modding GUI seems painful and you must be very determined if you want to go this path... Good Luck! Link to comment Share on other sites More sharing options...
Neviiiir Posted April 21, 2023 Share Posted April 21, 2023 +1 to PLib as a starting point. And check out the rest of Peter Han's mod monorepo for example usages of it. Link to comment Share on other sites More sharing options...
partsquirrel7 Posted April 21, 2023 Author Share Posted April 21, 2023 @Neviiiir@pether These resources look great. Sgt_Imalas has a ClusterTraitGenerationManager trait that seems to build some complex screens and PLib looks really accessible. Thank you. Link to comment Share on other sites More sharing options...
SGT_Imalas Posted April 21, 2023 Share Posted April 21, 2023 Hi, in a lot of my older mods, I use a process that I'd call "UI-Necromancy": I start off by planning what I want the UI to look like, then I start looking for "Components". I find these on existing UI-elements and their prefabs. Now, I start the "necromancy"-process-> I take(copies of) the existing UIs, rip them apart and patch them together like frankensteins monster. This process involves a lot of trial and error for adjusting specific values and is somewhat limited by what the existing UI-prefabs provide, but I managed to do it quite a while now. The process for an element is usually: find element in original prefab find position in the hierarchy of the new custom screen where you want that new element KInstatiateUI a copy of the original at the new position Trial&Error until it looks right some example Mods where I used the process (+ what screen I took as base) - Balloon Dispenser: balloon selection screen (art resculp sidescreen) - Satellites: Satellite type screen (art resculpt sidescreen) - rocketry expanded: Space Station type screen[unreleased] (art resculpt sidescreen), also the world selector & the rocket module menu are extended via the same method - Mod Profile Manager: ALL UIs/menus in here are based on either the mod screen or the language selection screen, the additional main menu button is added the same way (find existing button in main menu, instantiate copy, replace strings+onClick bindings), this one has the most custom built UI - Daily Routine: (timer sensor sidescreen) - Duplicant (count &) Stat Selector: allthough Im currently reworking that one, the current stat selection screen is entirely built by using 2 different button prefabs and the skin selector is created by adding my own buttons to one of the supply closet screens+activating/deactivating existing things on that screen Cluster Generation Manager was the point where I shifted my approach, it still has some elements done via necromancy, but a lot of the screens in there are made in unity and then imported into the game by some unholy methods (if you have any textMeshPro-components, you need to have 2 converters, one in the unity project that converts it into a normal text component and one in your mod that converts the text component to LocText) . I don't know if I would recommend the method described above, as it involves a LOT of trial and error. As an alternative, PLib allows you to built entire custom UIs via code, this makes it independent from existing game assets. Link to comment Share on other sites More sharing options...
partsquirrel7 Posted April 21, 2023 Author Share Posted April 21, 2023 @SGT_Imalas Great explanation, thank you. I'll take your advice and give PLib a try. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.