Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tooltips for join-queue and leave-queue and use them in non-singleplayer rooms #355

Merged
merged 3 commits into from
Apr 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions LuaMenu/widgets/chobby/i18n/chililobby.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,16 @@ return {
rejoin = "Rejoin",
abandon = "Abandon",

tooltip_is_spectator = "You will spectate this game.",
tooltip_become_spectator = "Press to watch the game as a spectator.",
spectate = "Spectate",
spectating = "Spectating",

tooltip_is_player = "You will play in this game.",
tooltip_is_spectator = "You will spectate this game when it starts.",
tooltip_become_spectator = "Press to watch the game as a spectator.",
tooltip_is_player = "You will play in this game when it starts.",
tooltip_become_player = "Press to play in this game.",
tooltip_join_queue = "Enter the join-queue to play in this game.",
tooltip_leave_queue = "Spectate this game and remove yourself from the join-queue.",

play = "Play",
playing = "Playing",

Expand Down
15 changes: 10 additions & 5 deletions LuaMenu/widgets/gui_battle_room_window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -839,8 +839,13 @@ local function SetupInfoButtonsPanel(leftInfo, rightInfo, battle, battleID, myUs
btnSpectate.suppressButtonReaction = true
btnPlay.suppressButtonReaction = false

btnSpectate.tooltip = i18n("tooltip_is_spectator")
btnPlay.tooltip = i18n("tooltip_become_player")
if battleLobby.name ~= "singleplayer" then
btnSpectate.tooltip = i18n("tooltip_leave_queue")
btnPlay.tooltip = i18n("tooltip_join_queue")
else
btnSpectate.tooltip = i18n("tooltip_is_spectator")
btnPlay.tooltip = i18n("tooltip_become_player")
end

ButtonUtilities.SetCaption(btnSpectate, i18n("spectating"))
end
Expand All @@ -856,9 +861,9 @@ local function SetupInfoButtonsPanel(leftInfo, rightInfo, battle, battleID, myUs
OnClick = {
function(obj)
local battleStatus = battleLobby:GetUserBattleStatus(myUserName) or {}
if battleStatus.isSpectator then
if battleStatus.isSpectator and battleLobby.name ~= "singleplayer" then
battleLobby:SayBattle('$leaveq')
battleLobby:_OnUpdateUserBattleStatus(battleLobby:GetMyUserName(), {queuePos = 0}) -- we proactive change our queuePos; because we dont reliable receicve s.battle.queue_status on fast clicking play/spectate
battleLobby:_OnUpdateUserBattleStatus(battleLobby:GetMyUserName(), {queuePos = 0}) -- we proactive change our queuePos; because we don't reliable receicve s.battle.queue_status on fast clicking play/spectate
end
battleLobby:SetBattleStatus({
isSpectator = true,
Expand Down Expand Up @@ -1936,7 +1941,7 @@ local function SetupPlayerPanel(playerParent, spectatorParent, battle, battleID)
end
local playerData = GetPlayerData(userName)
if playerData.team == teamNew then
return -- team didnt change, so dont update
return -- team didn't change, so don't update
end
if playerData.team ~= false then
RemovePlayerFromTeam(userName)
Expand Down