Skip to content

Commit

Permalink
Merge pull request #355 from AntlerForce/antlertest
Browse files Browse the repository at this point in the history
Add tooltips for join-queue and leave-queue and use them in non-singleplayer rooms
  • Loading branch information
FIr3baL authored Apr 16, 2023
2 parents f55b796 + 3ff9b65 commit 0e7ad96
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
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 don´t 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 didn´t change, so don´t update
return -- team didn't change, so don't update
end
if playerData.team ~= false then
RemovePlayerFromTeam(userName)
Expand Down

0 comments on commit 0e7ad96

Please sign in to comment.