@@ -699,10 +699,11 @@ local function SetupInfoButtonsPanel(leftInfo, rightInfo, battle, battleID, myUs
699699 bottom = 0 ,
700700 height = 48 ,
701701 classname = " ready_button" ,
702- font = config :GetFont (4 ),
703- disabledFont = config :GetFont (4 ),
702+ font = config :GetFont (3 ),
703+ disabledFont = config :GetFont (3 ),
704704 hasDisabledFont = true ,
705- tooltip = " " , -- Set in OnUpdateUserBattleStatus
705+ caption = i18n (" unready" ),
706+ tooltip = i18n (" unready_tooltip" ), -- Set in OnUpdateUserBattleStatus
706707 OnClick = {
707708 function (readyButton )
708709 if not readyButton .state .enabled then return end
@@ -713,6 +714,7 @@ local function SetupInfoButtonsPanel(leftInfo, rightInfo, battle, battleID, myUs
713714 parent = rightInfo ,
714715 }
715716 readyButton :SetEnabled (false )
717+ readyButton :StyleUnready ()
716718 end
717719
718720 btnStartBattle = Button :New {
@@ -722,7 +724,7 @@ local function SetupInfoButtonsPanel(leftInfo, rightInfo, battle, battleID, myUs
722724 height = 48 ,
723725 caption = i18n (" start" ),
724726 classname = " action_button" ,
725- font = config :GetFont (4 ),
727+ font = config :GetFont (3 ),
726728 tooltip = " Start the game, or call a vote to start multiplayer, or join a running game" ,
727729 OnClick = {
728730 function ()
@@ -758,41 +760,67 @@ local function SetupInfoButtonsPanel(leftInfo, rightInfo, battle, battleID, myUs
758760 }
759761
760762 local btnPlay
761- local btnSpectate = Button :New {
763+ local btnSpectate
764+
765+ local function SetButtonStatePlaying ()
766+ ButtonUtilities .SetButtonDeselected (btnSpectate )
767+ ButtonUtilities .SetCaption (btnSpectate , i18n (" spectate" ))
768+ ButtonUtilities .SetButtonSelected (btnPlay )
769+ ButtonUtilities .SetCaption (btnPlay , i18n (" playing" ))
770+
771+ btnPlay .suppressButtonReaction = true
772+ btnSpectate .suppressButtonReaction = false
773+
774+ btnPlay .tooltip = i18n (" tooltip_is_player" )
775+ btnSpectate .tooltip = i18n (" tooltip_become_spectator" )
776+
777+ end
778+ local function SetButtonStateSpectating ()
779+ ButtonUtilities .SetButtonDeselected (btnPlay )
780+ ButtonUtilities .SetCaption (btnPlay , i18n (" play" ))
781+ ButtonUtilities .SetButtonSelected (btnSpectate )
782+
783+ btnSpectate .suppressButtonReaction = true
784+ btnPlay .suppressButtonReaction = false
785+
786+ btnSpectate .tooltip = i18n (" tooltip_is_spectator" )
787+ btnPlay .tooltip = i18n (" tooltip_become_player" )
788+
789+ ButtonUtilities .SetCaption (btnSpectate , i18n (" spectating" ))
790+ end
791+
792+ btnSpectate = Button :New { -- Some properties set by SetButtonStatePlaying() after both buttons are initialised.
762793 x = " 50.5%" ,
763794 right = 0 ,
764795 bottom = 51 ,
765- height = 48 ,
796+ height = 32 ,
766797 classname = " button_highlight" ,
767- caption = " \255\66\138\201 " .. i18n (" spectator" ) .. " \b " ,
768- font = config :GetFont (3 ),
769- tooltip = " Watch the game as a spectator" ,
798+ caption = " " ,
799+ font = config :GetFont (2 ),
770800 OnClick = {
771801 function (obj )
772802 battleLobby :SetBattleStatus ({
773803 isSpectator = true ,
774804 isReady = false
775805 })
776- ButtonUtilities .SetButtonDeselected (btnPlay )
777- ButtonUtilities .SetCaption (btnPlay , i18n (" play" ))
778- ButtonUtilities .SetButtonSelected (obj )
779- ButtonUtilities .SetCaption (obj , i18n (" spectating" ))
806+
807+ SetButtonStateSpectating ()
808+
780809 WG .Analytics .SendOnetimeEvent (" lobby:multiplayer:custom:spectate" )
781810 WG .Chobby .Configuration :SetConfigValue (" lastGameSpectatorState" , true )
782811 end
783812 },
784813 parent = rightInfo ,
785814 }
786815
787- btnPlay = Button :New {
816+ btnPlay = Button :New { -- Some properties set by SetButtonStatePlaying() after both buttons are initialised.
788817 x = 0 ,
789818 right = " 50.5%" ,
790819 bottom = 51 ,
791- height = 48 ,
820+ height = 32 ,
792821 classname = " button_highlight" ,
793- caption = " \255\66\138\201 " .. i18n (" player" ) .. " \b " ,
794- font = config :GetFont (3 ),
795- tooltip = " Become a player in this game" ,
822+ caption = " " ,
823+ font = config :GetFont (2 ),
796824 OnClick = {
797825 function (obj )
798826 local unusedTeamID = battleLobby :GetUnusedTeamID ()
@@ -802,17 +830,18 @@ local function SetupInfoButtonsPanel(leftInfo, rightInfo, battle, battleID, myUs
802830 isReady = false ,
803831 side = (WG .Chobby .Configuration .lastFactionChoice or 0 ),
804832 teamNumber = unusedTeamID })
805- ButtonUtilities .SetButtonDeselected (btnSpectate )
806- ButtonUtilities .SetCaption (btnSpectate , i18n (" spectate" ))
807- ButtonUtilities .SetButtonSelected (obj )
808- ButtonUtilities .SetCaption (obj , i18n (" playing" ))
833+
834+ SetButtonStatePlaying ()
835+
809836 WG .Analytics .SendOnetimeEvent (" lobby:multiplayer:custom:play" )
810837 WG .Chobby .Configuration :SetConfigValue (" lastGameSpectatorState" , false )
811838 end
812839 },
813840 parent = rightInfo ,
814841 }
815842
843+ SetButtonStatePlaying ()
844+
816845 rightInfo .OnResize = {
817846 function (obj , xSize , ySize )
818847 if xSize + minimapBottomClearance < ySize then
@@ -1063,17 +1092,11 @@ local function SetupInfoButtonsPanel(leftInfo, rightInfo, battle, battleID, myUs
10631092 function externalFunctions .UpdateUserTeamStatus (userName , allyNumber , isSpectator )
10641093 if userName == myUserName then
10651094 if isSpectator then
1066- ButtonUtilities .SetButtonDeselected (btnPlay )
1067- ButtonUtilities .SetCaption (btnPlay , i18n (" play" ))
1068- ButtonUtilities .SetButtonSelected (btnSpectate )
1069- ButtonUtilities .SetCaption (btnSpectate , i18n (" spectating" ))
1095+ SetButtonStateSpectating ()
10701096 startBoxPanel :Hide ()
10711097 minimapPanel .disableChildrenHitTest = true -- omg this is amazing
10721098 else
1073- ButtonUtilities .SetButtonDeselected (btnSpectate )
1074- ButtonUtilities .SetCaption (btnSpectate , i18n (" spectate" ))
1075- ButtonUtilities .SetButtonSelected (btnPlay )
1076- ButtonUtilities .SetCaption (btnPlay , i18n (" playing" ))
1099+ SetButtonStatePlaying ()
10771100 startBoxPanel :Show ()
10781101 minimapPanel .disableChildrenHitTest = false
10791102 end
0 commit comments