-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Checklist
- I have not removed the 🧹 emoji from the title.
- I have confirmed that this task is not already tracked under another tech debt or refactor issue.
- This does not represent a user-facing feature request or bug report, but an internal improvement.
- For maintainers: I have updated the projects and milestones if needed.
Description
When editing any UI in the Client project we have to first open up the room, click on the UI object and finally open up its instance creation code to modify the logic. This should likely be adjusted and dedicated objects should be created in their place or an alternative is to use the Model-View-Presenter pattern to extract the logic from the instance entirely.
Impact
The impact this will have will be substantial given that when we have to modify UI logic, we must first open up the GM IDE - instead of just using Stitch for VS Code - or, we have to look through all of the InstanceCreationCode_xxx files within the room's subfolder. Using the MVP pattern will simplify this process to just drag and drop in the GM IDE to setup the style and feel, to finally linking up a presenter to each instance with the room editor.
Proposed Approach
Take for instance the user login button logic (as well as register, etc) can be extracted into a single Struct.LoginPresenter.
// Inside inst_gui_frame_login instance creation code.
_view = {
login: inst_gui_button_login,
register: inst_gui_button_register,
close: inst_gui_button_close,
};
_presenter = new LoginPresenter(_view);And the presenter:
function LoginPresenter(view) constructor
{
_view = view;
_login = function() { // Do login flow here }
_register = function() { // Do register flow here }
_close = function() { room_goto(rm_menu); }
_view.login.register_event(gui_event_type.mouse_left_release, _login);
_view.register.register_event(gui_event_type.mouse_left_release, _register);
_view.close.register_event(gui_event_type.mouse_left_release, _close);
}Metadata
Metadata
Assignees
Labels
Projects
Status