Skip to content

Conversation

@jefetienne
Copy link
Contributor

@jefetienne jefetienne commented Jul 1, 2021

(Very last minute but in EDT it isn't July yet! Hopefully I make it through the feature lock ;))

Implements #2004

Added a dropdown menu in the pause window that by default will include access to the mod settings menu. I simply took the same logic as the static class ChangeModSettings in DefaultCommands, so hopefully this should suffice. Shortcut to toggle it can can be used with 'D'.

Additional options (button text and button click event) can be easily added to the dropdown via a method from DaggerfallUI called RegisterPauseOptionToDropdown that takes in a string for the button text and an Action to implement the logic once it has been clicked.

I'm making this a draft because I have been having a hard time trying to get the dropdown toggle be moved to the very edge of the screen. When I add it to ParentPanel, the controls become very tiny and I haven't figured out how to properly scale it with AutoSize, Scale = NativePanel.LocalScale, etc. I would appreciate any help to get this working as I want it to. Additionally, if there are any other improvements to what I have down, please feel free to let me know.

By default, it will include the mod settings menu
Options can be added to the dropdown as well
Shortcut can be used with 'D'
@ajrb
Copy link
Collaborator

ajrb commented Jul 1, 2021

How will mods know that their settings have changed though? Most load settings at initialisation so changing them mid game will not change anything. There are some I can think of in my mods where they cause overriding of behaviour that currently has no way to undo it without restarting the game.

TheLacus suggested a flag per setting so mod authors could mark dynamically changeable settings. I think this PR will need synchronising with that work.

Could the standard vanilla arrows work for this, or are the new ones needed for some reason?

@jefetienne
Copy link
Contributor Author

TheLacus suggested a flag per setting so mod authors could mark dynamically changeable settings. I think this PR will need synchronising with that work.

Right, I will try and implement that part. Would the flag essentially be used a visibility flag in the mod settings window?

Could the standard vanilla arrows work for this, or are the new ones needed for some reason?

I actually wasn't aware that they existed - I'd be happy to use them. Which textures would those be?

@ajrb
Copy link
Collaborator

ajrb commented Jul 1, 2021

the ones I used for the item list scroller component were these, though there may be others more applicable for what you're doing. I just thought I'd mention it so you could consider what's most appropriate. :)

const string greenArrowsTextureName = "INVE06I0.IMG"; // Green up/down arrows when more items available const string redArrowsTextureName = "INVE07I0.IMG"; // Red up/down arrows when no more items available

I think the flag would need to indicate that a mod setting was dynamically changeable at runtime and default to false. My thought is that settings would be 'greyed' out and non-interacting during runtime of DFU unless the flag had been set by mod author indicating that it can be changed. That would avoid layout issues.

@jefetienne
Copy link
Contributor Author

Considering that this PR is essentially a front-end to an already existing feature in the console, and that the mod setting changes might be more involved, I will set aside those commits for a separate PR. I am still trying to figure out a solution to positioning the dropdown to the top-left corner of the screen, but this PR is feature-complete otherwise.

- Move dropdown to ParentPanel (top-left corner) and scale it to the NativePanel
- Parts of the ListBox had to be modified to put selection and mouse-clicking at the right scale.
@jefetienne
Copy link
Contributor Author

I finally found a solution to get the dropdown to move it to the ParentPanel and have it scale properly with the NativePanel. I had issues with the ListBox scaling properly to be in sync with what my mouse was hovering over, so I had to do some modifications. I don't believe it caused any regressions after testing the Save and Talk windows.

It is a very messy fix, but I am not aware of a better way to do it. If there is, please let me know.

@jefetienne jefetienne marked this pull request as ready for review July 5, 2021 06:33
@Interkarma
Copy link
Owner

I had issues with the ListBox scaling properly to be in sync with what my mouse was hovering over, so I had to do some modifications. I don't believe it caused any regressions after testing the Save and Talk windows.

Those changes should be OK. I never considering parenting ListBox outside of native panels, so something like this is really necessary in this case. I'll try to find any problems, but I think it will be fine.

@Interkarma Interkarma merged commit 3b646d0 into Interkarma:master Jul 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants