2 CLASS(XonoticTeamSelectDialog) EXTENDS(XonoticRootDialog)
3 METHOD(XonoticTeamSelectDialog, fill, void(entity)) // to be overridden by user to fill the dialog with controls
4 METHOD(XonoticTeamSelectDialog, showNotify, void(entity))
5 ATTRIB(XonoticTeamSelectDialog, title, string, "Team Selection") // ;)
6 ATTRIB(XonoticTeamSelectDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
7 ATTRIB(XonoticTeamSelectDialog, intendedWidth, float, 0.4)
8 ATTRIB(XonoticTeamSelectDialog, rows, float, 5)
9 ATTRIB(XonoticTeamSelectDialog, columns, float, 4)
10 ATTRIB(XonoticTeamSelectDialog, name, string, "TeamSelect")
11 ATTRIB(XonoticTeamSelectDialog, team1, entity, NULL)
12 ATTRIB(XonoticTeamSelectDialog, team2, entity, NULL)
13 ATTRIB(XonoticTeamSelectDialog, team3, entity, NULL)
14 ATTRIB(XonoticTeamSelectDialog, team4, entity, NULL)
15 ENDCLASS(XonoticTeamSelectDialog)
19 entity makeTeamButton(string theName, vector theColor, string commandtheName)
22 b = makeXonoticBigCommandButton(theName, theColor, commandtheName, 1);
26 void XonoticTeamSelectDialog_showNotify(entity me)
29 teams = cvar("_teams_available");
31 me.team1.disabled = !(teams & 1); nTeams += !!(teams & 1);
32 me.team2.disabled = !(teams & 2); nTeams += !!(teams & 2);
33 me.team3.disabled = !(teams & 4); nTeams += !!(teams & 4);
34 me.team4.disabled = !(teams & 8); nTeams += !!(teams & 8);
37 void XonoticTeamSelectDialog_fill(entity me)
41 me.TD(me, 2, 4, e = makeTeamButton("join 'best' team (auto-select)", '0 0 0', "cmd selectteam auto; cmd join"));
42 e.preferredFocusPriority = 1;
45 me.TD(me, 2, 1, me.team1 = makeTeamButton("red", '1 0.5 0.5', "cmd selectteam red; cmd join"));
46 me.TD(me, 2, 1, me.team2 = makeTeamButton("blue", '0.5 0.5 1', "cmd selectteam blue; cmd join"));
47 me.TD(me, 2, 1, me.team3 = makeTeamButton("yellow", '1 1 0.5', "cmd selectteam yellow; cmd join"));
48 me.TD(me, 2, 1, me.team4 = makeTeamButton("pink", '1 0.5 1', "cmd selectteam pink; cmd join"));
51 me.TD(me, 1, 4, makeXonoticCommandButton("spectate", '0 0 0', "cmd spectate", 1));
55 /* Click. The c-word is here so you can grep for it :-) */