ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Contextual Actions On Item Slots (https://www.esoui.com/forums/showthread.php?t=5259)

Randactyl 11/04/15 11:37 PM

Contextual Actions On Item Slots
 
1 Attachment(s)
Now that game pad support is out, I want to see if we can find a better way of adding actions to context menus.

Currently, we prehook ZO_InventorySlot_ShowContextMenu and shove our code in right before the menu is shown.

The game manages contextual actions in itemslot.lua, but there is no global object to work with and both the table of action handlers and the table of actions available to each slot type are local.

I've built up a preliminary library to manage the manipulation of these tables, but it unfortunately requires a pretty ham-fisted copy/paste of much of the code in itemslot.lua since there are so many local functions used to support the handlers in the actions table.

The benefit of going about managing contextual actions with this library would be:
  • common way to manage actions for kb/m and game pad UIs
  • easily get and manipulate handlers for existing actions

The drawback is obviously the rather large size (89 KB) due to the file containing the ported itemslot.lua code, but I may be able to slim that down further. (When I was originally building it, I broke mouse interactions with item slots like double click and dragging)

So, what do you all think? Am I over-engineering here? Can anyone think of any other potential benefits to build in that would offset the cost? Do you anticipate any problems with the current implementation?

Baertram 11/05/15 03:42 AM

I'm not pretty sure what the difference in context menus, between mouse/keyboard and gamepad controllers, is at the moment?
I know the m/k way but what does the controller support? Is there any "keybind" to activate the context menu (like rpessing the right mouse button)? Or aren't there any context menus, just keybinds to start the action with an item?

Randactyl 11/05/15 01:37 PM

Quote:

Originally Posted by Baertram (Post 24117)
I'm not pretty sure what the difference in context menus, between mouse/keyboard and gamepad controllers, is at the moment?
I know the m/k way but what does the controller support? Is there any "keybind" to activate the context menu (like rpessing the right mouse button)? Or aren't there any context menus, just keybinds to start the action with an item?

Yes, there is an "Actions" menu attached to the Y/triangle button which has all of the actions like destroy, repair, split, etc.

circonian 11/05/15 01:58 PM

Quote:

Originally Posted by Randactyl (Post 24106)
Do you anticipate any problems with the current implementation?

I tried something like this once before & ran into problems with Private functions like:

Lua Code:
  1. UseItem(bag, index)



Lua Code:
  1. local MAJOR, MINOR = "LibActionMenu", 1.0.0.0

Randactyl 11/06/15 05:08 AM

Quote:

Originally Posted by circonian (Post 24137)
I tried something like this once before & ran into problems with Private functions like:

Lua Code:
  1. UseItem(bag, index)

I think that can be solved by wrapping up those protected function calls in CallSecureProtected.


Lua Code:
  1. local MAJOR, MINOR = "LibActionMenu", 1.0.0.0

Oh duh, that should have been a string. LibStub accepts strings for that, doesn't it?

I'll look at this stuff on Monday. I'm out for the weekend.

merlight 11/06/15 06:38 AM

Quote:

Originally Posted by Randactyl (Post 24155)
Oh duh, that should have been a string. LibStub accepts strings for that, doesn't it?

Yes it does, but it will only take the "1.0" part. Better to use plain number.

Randactyl 11/06/15 11:43 AM

Quote:

Originally Posted by merlight (Post 24157)
Yes it does, but it will only take the "1.0" part. Better to use plain number.

gotcha, thanks


All times are GMT -6. The time now is 09:59 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI