Layering Button Activation Rectangle Over Existing One, Both Trigger On Mouse Click

Discuss modding questions and implementation details.
Post Reply
User avatar
Magicono43
Posts: 279
Joined: Tue Nov 06, 2018 7:06 am

Layering Button Activation Rectangle Over Existing One, Both Trigger On Mouse Click

Post by Magicono43 » Sat May 09, 2020 2:07 pm

So what i'm trying to accomplish right now, is to have the "Sell" button in the Trade Window interface do something more than it currently does, that being do something that ties in with my current mod. The problem is that I can't seem to do this in a "proper" way since the method that handles this button is in a private class. So the only thing I could think of was to try and put my own button over the same area of the screen and have a hack-job "override" that way.

The problem that I expected when first trying this, is that both buttons would just activate and there not being any "priority" or layering to it. As Burt informed me that web-pages sometimes have a Z-axis property to their buttons, so this sort of thing is possible, that being one button being above another. With the Buttons in DFU they only seem to have an X and a Y property, so that clearly shows why what I thought would not work, lol.

Here is an image just for the sake of it:
TestFailed1.png
TestFailed1.png (473.33 KiB) Viewed 86 times
As can be seen, when I click an area where the "Sell" button and my "Testing" button area are both occupying, it brings up both windows at essentially the same time.

So my question is that if anyone knows if there is a better way to get around this problem i'm having? I'd love to just put the code I want in the method that handles the sell button, but that would obviously not be the "proper" way to mod it, especially not for a public mod release. There any trick or tool in the code-base that I can jury rig a way around this? Thanks for your time!

User avatar
TheLacus
Posts: 1150
Joined: Wed Sep 14, 2016 6:22 pm
Contact:

Re: Layering Button Activation Rectangle Over Existing One, Both Trigger On Mouse Click

Post by TheLacus » Sat May 09, 2020 5:15 pm

Do you want to change the behaviour of the Sell button or do something else in addition to classic behaviour? In the second case you can register to OnTrade event. Otherwise you can inherit from DaggerfallTradeWindow and request required methods to be made virtual.
Mod System documentation - Learn how to create mods for Daggerfall Unity.
Modder Discussion - General help and discussion for the mod system.
Github Issues - Submit a bug report for the game, including the mod system.

User avatar
Magicono43
Posts: 279
Joined: Tue Nov 06, 2018 7:06 am

Re: Layering Button Activation Rectangle Over Existing One, Both Trigger On Mouse Click

Post by Magicono43 » Sat May 09, 2020 6:32 pm

TheLacus wrote:
Sat May 09, 2020 5:15 pm
Do you want to change the behaviour of the Sell button or do something else in addition to classic behaviour? In the second case you can register to OnTrade event. Otherwise you can inherit from DaggerfallTradeWindow and request required methods to be made virtual.
Yeah, I would want the behavior changed because I would want a check before the "default" yes/no prompt appears. That check basically seeing if the merchant has enough gold to afford what you want to sell. Just a branching if-statement pretty much, so yeah changing its default behavior.

So from what you and Burt suggested I will likely want/need to get this method made virtual in order to do what I need in this case. I'll have to look into how I would file a request for that though, lol. Once again, thanks for your time, Lacus.

Post Reply