@@ -25,7 +25,7 @@ local IMG_LINK = LUA_DIRNAME .. "images/link.png"
2525
2626local panelInterface
2727local PLANET_NAME_LENGTH = 210
28- local FACTION_SPACING = 156
28+ local FACTION_SPACING = 134
2929
3030local phaseTimer
3131local requiredGame = false
@@ -94,7 +94,7 @@ local function TryToJoinPlanet(planetData)
9494 WG .Analytics .SendOnetimeEvent (" lobby:multiplayer:planetwars:join_site" )
9595end
9696
97- local function GetAttackingOrDefending (lobby , attackerFaction , defenderFactions )
97+ local function GetAttackingOrDefending (lobby , attackerFaction , defenderFactions , currentMode )
9898 local myFaction = lobby :GetMyFaction ()
9999 local attacking = (myFaction == attackerFaction )
100100 local defending = false
@@ -669,7 +669,7 @@ local function MakePlanetControl(planetData, DeselectOtherFunc)
669669 else
670670 btnJoin :SetCaption (" ???" )
671671 end
672- else then
672+ else
673673 if downloading then
674674 btnJoin :SetCaption (i18n (" downloading" ))
675675 else
@@ -853,7 +853,7 @@ local function MakeFactionSelector(parent, x, y, SelectionFunc, CancelFunc, righ
853853
854854 local HolderType = (right and bottom and ScrollPanel ) or Control
855855
856- local offset = 0
856+ local offset = 15
857857 local holder = HolderType :New {
858858 x = x ,
859859 y = y ,
@@ -876,6 +876,7 @@ local function MakeFactionSelector(parent, x, y, SelectionFunc, CancelFunc, righ
876876 local name = factionList [i ].Name
877877 local factionData = factionText [shortname ] or {}
878878
879+ local buttonPos = 140
879880 if factionData .imageLarge then
880881 Image :New {
881882 x = 2 ,
@@ -886,10 +887,21 @@ local function MakeFactionSelector(parent, x, y, SelectionFunc, CancelFunc, righ
886887 file = factionData .imageLarge ,
887888 parent = holder ,
888889 }
890+ elseif factionData .image then
891+ buttonPos = 86
892+ Image :New {
893+ x = 8 ,
894+ y = offset ,
895+ width = 64 ,
896+ height = 64 ,
897+ keepAspect = true ,
898+ file = factionData .image ,
899+ parent = holder ,
900+ }
889901 end
890902
891903 Button :New {
892- x = 140 ,
904+ x = buttonPos ,
893905 y = offset ,
894906 width = 260 ,
895907 height = WG .BUTTON_HEIGHT ,
@@ -907,14 +919,26 @@ local function MakeFactionSelector(parent, x, y, SelectionFunc, CancelFunc, righ
907919 parent = holder ,
908920 }
909921
910- if factionData .motto and factionData .desc then
922+ if factionData .motto then
923+ TextBox :New {
924+ x = buttonPos ,
925+ y = offset + 56 ,
926+ width = 360 ,
927+ height = 45 ,
928+ objectOverrideFont = Configuration :GetFont (2 ),
929+ text = [[ "]] .. factionData .motto .. [[ "]] ,
930+ parent = holder ,
931+ }
932+ offset = offset + 30
933+ end
934+ if factionData .motto then
911935 TextBox :New {
912- x = 140 ,
936+ x = buttonPos ,
913937 y = offset + 56 ,
914- width = 240 ,
938+ width = 360 ,
915939 height = 45 ,
916940 objectOverrideFont = Configuration :GetFont (2 ),
917- text = [[ " ]] .. factionData . motto .. [[ " ]] .. " \n " .. factionData .desc ,
941+ text = factionData .desc ,
918942 parent = holder ,
919943 }
920944 end
@@ -1248,7 +1272,7 @@ local function InitializeControls(window)
12481272 end
12491273 end
12501274
1251- local attacking , defending = GetAttackingOrDefending (lobby , attackerFaction , defenderFactions )
1275+ local attacking , defending = GetAttackingOrDefending (lobby , attackerFaction , defenderFactions , currentMode )
12521276 UpdateStatusText (attacking , defending , currentMode )
12531277
12541278 planetList .SetPlanetList (planets , modeSwitched )
@@ -1257,14 +1281,14 @@ local function InitializeControls(window)
12571281 lobby :AddListener (" OnPwMatchCommand" , OnPwMatchCommand )
12581282
12591283 local function OnPwAttackingPlanet ()
1260- local attacking , defending = GetAttackingOrDefending (lobby , oldAttackerFaction , oldDefenderFactions )
1284+ local attacking , defending = GetAttackingOrDefending (lobby , oldAttackerFaction , oldDefenderFactions , oldMode )
12611285 UpdateStatusText (attacking , defending , oldMode )
12621286 end
12631287 lobby :AddListener (" OnPwAttackingPlanet" , OnPwAttackingPlanet )
12641288
12651289 local function OnUpdateUserStatus (listener , userName , status )
12661290 if lobby :GetMyUserName () == userName then
1267- local attacking , defending = GetAttackingOrDefending (lobby , oldAttackerFaction , oldDefenderFactions )
1291+ local attacking , defending = GetAttackingOrDefending (lobby , oldAttackerFaction , oldDefenderFactions , oldMode )
12681292 UpdateStatusText (attacking , defending , oldMode )
12691293 end
12701294 end
@@ -1395,6 +1419,7 @@ function DelayedInitialize()
13951419 end
13961420
13971421 local function OnPwStatus (_ , enabledStatus , requiredLevel )
1422+ Spring .Echo (" OnPwStatus" , enabledStatus , requiredLevel , lobby .PW_PREGAME , lobby .PW_ENABLED )
13981423 local myInfo = lobby :GetMyInfo ()
13991424 myLevel = myInfo .level
14001425 planetwarsLevelRequired = requiredLevel
0 commit comments