ShotgunNinja / Kerbalism

Hundreds of Kerbals were killed in the making of this mod.
The Unlicense
43 stars 19 forks source link

Window position not persistent #106

Closed KSAMissionCtrl closed 7 years ago

KSAMissionCtrl commented 7 years ago

I know this seems like a small thing, but for people with a lot of mods that have their own data windows, arranging them can be a bit of a hassle initially, but eventually you find a layout that works for you. It would be nice if Kerbalism windows could work within this layout instead of having to be moved into their place every time since they keep popping up atop other data readouts when they are shown

PiezPiedPy commented 7 years ago

It defo gets tedious. I'll look into it in a couple weeks see what I can do. no promises tho I'm a Unity noob

KSAMissionCtrl commented 7 years ago

remember all mods are open source so check and see what they are doing. FAR, Kerbal Engineer Redux, Vessel Orbiter Information Display, Haystack Continued are some off the top of my head that have persistent window locations/visibility

ShotgunNinja commented 7 years ago

Let me describe the UI system used here a bit.

All UI is 'structured data', than is then 'committed' to 'panel containers' like: monitor, planner and window. Note the singular in the latter: there is only one single global window.

This window get a functor that specify how it should 'refresh'. To open the window you just set a refresh functor that generate the content you want to display dynamically. To close it, set the refresh functor to null. When you open a new window, you are just replacing the refresh functor of the existing one.

So, there is only one window globally. And its position is already 'persistent' during the course of a game sessions.

PiezPiedPy commented 7 years ago

So I've had a nose around the UI system and come up with a half way solution, in at least the single popout window's position in now persistent between different saves and close/start of KSP. Now it's no longer restricted to only having persistence during a game session. Another benefit is the body info window only shows once (brand new game start and first time in map view).

See PR #113 UI persistence, load and save UI data to .sfs file.