Open IL0co opened 2 years ago
Each addition into Shop_SetCallbacks
is a pain. Need to think about another registration callbacks.
enum SHOP_CB_TYPE {
ItemRegistration = 1,
ItemToggle = 2,
OtherThing = 3
}
Like `Shop_SetCallbackHandler(type: SHOP_CB_TYPE, handler: FuncPrototype);` and each row extend it like subscribing for individual events instead of having them at this complex function
Each addition into
Shop_SetCallbacks
is a pain. Need to think about another registration callbacks.enum SHOP_CB_TYPE { ItemRegistration = 1, ItemToggle = 2, OtherThing = 3 } Like `Shop_SetCallbackHandler(type: SHOP_CB_TYPE, handler: FuncPrototype);` and each row extend it like subscribing for individual events instead of having them at this complex function
Yes, I think it will be very useful to use a system like sdkhooks. But how to do this in the current situation, when we already register everything in one native in a row?
This is what I do with my plugin, one native for registration and enum with a list of all types, as well as typeset MCS_ItemCallBack
- where all function references are indicated.
enum MCS_ItemCallBackType {
ItemCB_OnDisplay, // Callback to the display name of an item
ItemCB_OnPreview, // Callback for the preview display request
ItemCB_OnSwitching, // Callback when switching an item.
ItemCB_OnUsing, // Callback when the item is used.
ItemCB_Length, // The number of elements in the enum.
};
native void MCS_RegItemCallBack(MCS_ItemCallBackType type, MCS_ItemCallBack callback, any data = 0);
Added forwards:
Shop_OnItemPanelExitButton
Shop_OnItemPanelBackButton
As well as callbacks that are registered when registering an item (
Shop_SetCallbacks
)