X2CommunityCore / X2CommunityHighlander

MIT License
7 stars 3 forks source link

Mod- and controller-friendly UI enhancements #1

Open robojumper opened 7 years ago

robojumper commented 7 years ago

One of the biggest issues in the game is moddable UI. It is quite easy to add random buttons to click somewhere on the screen, but that

My idea is to add an ActorComponent to UIScreen (due to not being able to change the data layout) that gets populated with control data during the UIScreenListener::OnInit() step, and then added to the screen in a fashion that the screen deems appropriate.

Control data would look like this

struct EnhancementPanelData
{
    name ID;
    string displayString;
    string tooltipText;
    string iconPath;
    bool bDisabled;
    eUIState State;
    delegate<OnItemClicked> OnClickedDelegate; // attn: garbage collection
    string consolecommand; // ConsoleCommand
    name eventName; // TriggerEvent
};

If the screen handles it gracefully, nothing else is required. Examples for this would be:

If a screen doesn't handle it, UIScreenStack handles it via a hotkey (suggestion for Controller: Stick_R3) and just pushes a rudimentary Screen with a vertical icon+tooltip list to the screen. Ideally, every screen could be expanded rudimentarily, with certain screens being able to do it better.

Considerations: There needs to be a way to modify data, i.e. change the icon / text upon click later. This would probably be possible using the delegate method, and have a callback in UIScreen that returns self when it's a normal screen and the base screen if the screen is a pushed extension screen.

robojumper commented 7 years ago

Problem: Stick_R3 is integrated into Armory NavHelp. Considering using FXS_BUTTON_SELECT instead, which is advertised as unused. Only use is on UIStrategyMap for "Resistance Network".