Disable lobby entry buttons with mismatching versions
This commit is contained in:
parent
fdaf425e84
commit
73ffdf6e98
|
@ -10,8 +10,9 @@
|
||||||
|
|
||||||
struct FirstPersonCamera {
|
struct FirstPersonCamera {
|
||||||
bool enabled;
|
bool enabled;
|
||||||
bool forceRoll;
|
|
||||||
bool forcePitch;
|
bool forcePitch;
|
||||||
|
bool forceYaw;
|
||||||
|
bool forceRoll;
|
||||||
bool centerL;
|
bool centerL;
|
||||||
s16 pitch;
|
s16 pitch;
|
||||||
s16 yaw;
|
s16 yaw;
|
||||||
|
|
|
@ -46,7 +46,7 @@ static void djui_lobby_entry_destroy(struct DjuiBase* base) {
|
||||||
free(lobbyEntry);
|
free(lobbyEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DjuiLobbyEntry* djui_lobby_entry_create(struct DjuiBase* parent, char* host, char* mode, char* players, char* description, void (*on_click)(struct DjuiBase*), void (*on_hover)(struct DjuiBase*), void (*on_hover_end)(struct DjuiBase*)) {
|
struct DjuiLobbyEntry* djui_lobby_entry_create(struct DjuiBase* parent, char* host, char* mode, char* players, char* description, bool disabled, void (*on_click)(struct DjuiBase*), void (*on_hover)(struct DjuiBase*), void (*on_hover_end)(struct DjuiBase*)) {
|
||||||
struct DjuiLobbyEntry* lobbyEntry = calloc(1, sizeof(struct DjuiLobbyEntry));
|
struct DjuiLobbyEntry* lobbyEntry = calloc(1, sizeof(struct DjuiLobbyEntry));
|
||||||
struct DjuiBase* base = &lobbyEntry->base;
|
struct DjuiBase* base = &lobbyEntry->base;
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ struct DjuiLobbyEntry* djui_lobby_entry_create(struct DjuiBase* parent, char* ho
|
||||||
djui_base_set_border_color(&lobbyEntry->base, 128, 128, 128, 255);
|
djui_base_set_border_color(&lobbyEntry->base, 128, 128, 128, 255);
|
||||||
djui_base_set_border_width(&lobbyEntry->base, 2);
|
djui_base_set_border_width(&lobbyEntry->base, 2);
|
||||||
djui_base_set_border_width_type(&lobbyEntry->base, DJUI_SVT_ABSOLUTE);
|
djui_base_set_border_width_type(&lobbyEntry->base, DJUI_SVT_ABSOLUTE);
|
||||||
|
djui_base_set_enabled(&lobbyEntry->base, !disabled);
|
||||||
djui_interactable_create(base, djui_lobby_entry_update_style);
|
djui_interactable_create(base, djui_lobby_entry_update_style);
|
||||||
djui_interactable_hook_click(base, on_click);
|
djui_interactable_hook_click(base, on_click);
|
||||||
djui_interactable_hook_hover(base, on_hover, on_hover_end);
|
djui_interactable_hook_hover(base, on_hover, on_hover_end);
|
||||||
|
|
|
@ -6,4 +6,4 @@ struct DjuiLobbyEntry {
|
||||||
const char* description;
|
const char* description;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DjuiLobbyEntry* djui_lobby_entry_create(struct DjuiBase* parent, char* host, char* mode, char* players, char* description, void (*on_click)(struct DjuiBase*), void (*on_hover)(struct DjuiBase*), void (*on_hover_end)(struct DjuiBase*));
|
struct DjuiLobbyEntry* djui_lobby_entry_create(struct DjuiBase* parent, char* host, char* mode, char* players, char* description, bool disabled, void (*on_click)(struct DjuiBase*), void (*on_hover)(struct DjuiBase*), void (*on_hover_end)(struct DjuiBase*));
|
||||||
|
|
|
@ -89,12 +89,13 @@ void djui_panel_join_query(uint64_t aLobbyId, UNUSED uint64_t aOwnerId, uint16_t
|
||||||
|
|
||||||
char version[MAX_VERSION_LENGTH] = { 0 };
|
char version[MAX_VERSION_LENGTH] = { 0 };
|
||||||
snprintf(version, MAX_VERSION_LENGTH, "%s", get_version_online());
|
snprintf(version, MAX_VERSION_LENGTH, "%s", get_version_online());
|
||||||
if (strcmp(version, aVersion) != 0) {
|
bool disabled = strcmp(version, aVersion) != 0;
|
||||||
|
if (disabled) {
|
||||||
snprintf(mode, 64, "\\#ff0000\\[%s]", aVersion);
|
snprintf(mode, 64, "\\#ff0000\\[%s]", aVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DjuiBase* layoutBase = &sLobbyLayout->base;
|
struct DjuiBase* layoutBase = &sLobbyLayout->base;
|
||||||
struct DjuiLobbyEntry* entry = djui_lobby_entry_create(layoutBase, (char*)aHostName, (char*)mode, playerText, (char*)aDescription, djui_panel_join_lobby, djui_lobby_on_hover, djui_lobby_on_hover_end);
|
struct DjuiLobbyEntry* entry = djui_lobby_entry_create(layoutBase, (char*)aHostName, (char*)mode, playerText, (char*)aDescription, disabled, djui_panel_join_lobby, djui_lobby_on_hover, djui_lobby_on_hover_end);
|
||||||
entry->base.tag = (s64)aLobbyId;
|
entry->base.tag = (s64)aLobbyId;
|
||||||
djui_paginated_update_page_buttons(sLobbyPaginated);
|
djui_paginated_update_page_buttons(sLobbyPaginated);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue