Skip to content

Commit c9ac0b2

Browse files
authored
fix pw turns web ui
fix web ui
2 parents 2d505cd + 6cb1331 commit c9ac0b2

2 files changed

Lines changed: 16 additions & 13 deletions

File tree

Zero-K.info/Views/Planetwars/PwMatchMaker.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
}
1414
else
1515
{
16-
PwMatchCommand.VoteOption opt = pw.Options.First();
17-
text = string.Format("{0} attacks planet {2}, {1} defends", pw.AttackerFaction, string.Join(",", pw.DefenderFactions), opt.PlanetName);
16+
var planetNames = string.Join(", ", pw.Options.Select(o => o.PlanetName));
17+
text = string.Format("{0} attacks {2}, {1} defends", pw.AttackerFaction, string.Join(",", pw.DefenderFactions), planetNames);
1818
}
1919

2020
bool canClick = (pw.Mode == PwMatchCommand.ModeType.Attack && pw.AttackerFaction == Global.Account.Faction.Shortcut) || (pw.Mode == PwMatchCommand.ModeType.Defend && pw.DefenderFactions.Contains(Global.Account.Faction.Shortcut));

ZeroKLobby/Notifications/PwBar.cs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,23 +82,26 @@ void UpdateGui()
8282
}
8383
else if (pw.Mode == PwMatchCommand.ModeType.Defend)
8484
{
85-
PwMatchCommand.VoteOption opt = pw.Options.First();
86-
headerLabel.Text = string.Format("{0} attacks planet {2}, {1} defends",
85+
headerLabel.Text = string.Format("{0} attacks, {1} defends",
8786
pw.AttackerFaction,
88-
string.Join(",", pw.DefenderFactions),
89-
opt.PlanetName);
87+
string.Join(",", pw.DefenderFactions));
9088

9189
foreach (Button c in pnl.Controls.OfType<Button>().ToList()) pnl.Controls.Remove(c);
9290

93-
var but = new Button { Text = string.Format("{0} [{1}/{2}]", opt.PlanetName, opt.Count, opt.Needed), AutoSize = true };
94-
Program.ToolTip.SetMap(but, opt.Map);
95-
96-
if (pw.DefenderFactions.Contains(tas.MyUser.Faction)) // NOTE this is for cases where nightwatch self faction info is delayed
91+
foreach (PwMatchCommand.VoteOption opt in pw.Options)
9792
{
98-
AddButtonClick(opt, but);
93+
Program.Downloader.GetResource(DownloadType.MAP, opt.Map);
94+
95+
var but = new Button { Text = string.Format("{0} [{1}/{2}]", opt.PlanetName, opt.Count, opt.Needed), AutoSize = true };
96+
Program.ToolTip.SetMap(but, opt.Map);
97+
98+
if (pw.DefenderFactions.Contains(tas.MyUser.Faction))
99+
{
100+
AddButtonClick(opt, but);
101+
}
102+
else but.Enabled = false;
103+
pnl.Controls.Add(but);
99104
}
100-
else but.Enabled = false;
101-
pnl.Controls.Add(but);
102105
}
103106

104107
Program.NotifySection.AddBar(this);

0 commit comments

Comments
 (0)