DlkGames / SkylineToolkit

Toolkit for easier Cities: Skylines mod creation. This becomes a custom modding API.
Other
8 stars 3 forks source link

UI Framework #4

Open DarkLiKally opened 9 years ago

DarkLiKally commented 9 years ago

There are a few ways implementing a gui framework.

  1. Wrapper around the Colossal UI framework. It could look like the current implementations in UI namespace. This way we could do the reflection and hacking stuff for the modders. They get a simple, lightweight but powerful UI framework with the default Cities:Skylines look and feel. On the other side it needs a lot of testing for compatibility with original UI and code for SkylineToolkit. Maybe designing custom controls becomes easier on top of wrappers which are designed to allow the user to create custom controls but using the internal structure and functionality from Colossal UI. But maybe it requires a lot of research and analyzing the Colossal code to inject new functionality. Also we could have to rewrite some controls from scratch to include new functinality. SkylineToolkit could have a proper documentation about the wrapper.
  2. Using default Unity GUI. Maybe the simplest, good reference and documentation from Unity. But very bad in some cases, i.e. clicking / dragging UI elements, the clicks would pass through the GUI onto the game scene and UI behind. There are a few workarounds but it's everything dirty, I think. I haven't looked at the new UI system of unity in detail, but I think it's not that easy to create such an interface from code. The UI designer in Unity editor does a good job, but creating such things from coud could be very unhandy I think. Maybe someone has more information about it? Also no look and feel from the original UI.
  3. Wrapper around Unity GUI which fixes things like the mentioned click problem.
  4. Using default Colossal UI framework, so integrating no UI framework in SkylineToolkit. Simplest solution, but modders would have to play around with reflection sometimes. Also integrating custom assets could become complicated. Modders also have to depend on ColossalManaged DLL and have to decompile it to look at internal functionality. Also there's no proper documentation for the Colossal code.
  5. Including a free third party GUI framework for Unity. Requires to include a third party DLL. Maybe hard to find a good third party UI which is easy to use and customizable. Maybe a lot of work to make it look like the original game UI.
  6. Writing a new UI framework.

Things that should be considered anyway:

Mesoptier commented 9 years ago

First of all, I think it is best to use the Colossal UI framework. This way we can make mods fit in with the rest of the game. I think it would also be wise to have modders use a single wrapper around the Colossal UI framework, so any problems with UI (think updates) only need to be fixed once. We could also expose the existing UI framework through our wrapper, so developers who want some more advanced features can still access them. Using a wrapper, it is also easier to hook in to some existing components (MainMenu, OptionsPanel, etc.) which would be incredibly useful.

What do you need reflection for in 4? So far I have only used it to list the UI templates. And if it is only things like that for which you could need reflection, we might just provide the tools for the modders.

DarkLiKally commented 9 years ago

So, let's write a wrapper. Yes, the full existing UI framework should be accessible trough the SkylineToolkit API. But it also should allow modders to stay independent from ColossalManaged.

Mesoptier commented 9 years ago

If you start working on that, I will work on a way to allow developers to add buttons to existing panels and button strips. So different mods don't place buttons in the same position as each other.

DarkLiKally commented 9 years ago

Sounds good. I've finished the basic wrapper for UIComponent already. It should be able to handle the basic interaction of every element which is derived from UIComponent. Next up on my list is, cleaning up the code a bit and creating a wrapper for UIPanel and derive a custom Window panel.