1 #ifndef DIALOG_TEAMSELECT_H
2 #define DIALOG_TEAMSELECT_H
3 #include "rootdialog.qc"
4 CLASS(XonoticTeamSelectDialog, XonoticRootDialog)
5 METHOD(XonoticTeamSelectDialog, fill, void(entity)); // to be overridden by user to fill the dialog with controls
6 METHOD(XonoticTeamSelectDialog, showNotify, void(entity));
7 ATTRIB(XonoticTeamSelectDialog, title, string, _("Team Selection")) // ;)
8 ATTRIB(XonoticTeamSelectDialog, tooltip, string, _("Join \"best\" team (auto-select) / Autoselect team (recommended)"))
9 ATTRIB(XonoticTeamSelectDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
10 ATTRIB(XonoticTeamSelectDialog, intendedWidth, float, 0.4)
11 ATTRIB(XonoticTeamSelectDialog, rows, float, 5)
12 ATTRIB(XonoticTeamSelectDialog, columns, float, 4)
13 ATTRIB(XonoticTeamSelectDialog, name, string, "TeamSelect")
14 ATTRIB(XonoticTeamSelectDialog, team1, entity, NULL)
15 ATTRIB(XonoticTeamSelectDialog, team2, entity, NULL)
16 ATTRIB(XonoticTeamSelectDialog, team3, entity, NULL)
17 ATTRIB(XonoticTeamSelectDialog, team4, entity, NULL)
18 ATTRIB(XonoticTeamSelectDialog, requiresConnection, float, true)
19 ENDCLASS(XonoticTeamSelectDialog)
23 entity makeTeamButton_T(string theName, vector theColor, string commandtheName, string theTooltip)
26 b = makeXonoticBigCommandButton(theName, theColor, commandtheName, 1);
29 entity makeTeamButton(string theName, vector theColor, string commandtheName)
31 return makeTeamButton_T(theName, theColor, commandtheName, string_null);
34 void XonoticTeamSelectDialog_showNotify(entity me)
37 teams = cvar("_teams_available");
39 me.team1.disabled = !(teams & 1); nTeams += !!(teams & 1);
40 me.team2.disabled = !(teams & 2); nTeams += !!(teams & 2);
41 me.team3.disabled = !(teams & 4); nTeams += !!(teams & 4);
42 me.team4.disabled = !(teams & 8); nTeams += !!(teams & 8);
45 void XonoticTeamSelectDialog_fill(entity me)
49 me.TD(me, 2, 4, e = makeTeamButton_T(_("join 'best' team (auto-select)"), '0 0 0', "cmd selectteam auto; cmd join",
50 _("Join 'best' team (auto-select) / Autoselect team (recommended)")));
51 e.preferredFocusPriority = 1;
54 me.TD(me, 2, 1, e = me.team1 = makeTeamButton_T(_("red"), '1 0.5 0.5', "cmd selectteam red; cmd join",
55 _("Join the red team")));
56 me.TD(me, 2, 1, e = me.team2 = makeTeamButton_T(_("blue"), '0.5 0.5 1', "cmd selectteam blue; cmd join",
57 _("Join the blue team")));
58 me.TD(me, 2, 1, e = me.team3 = makeTeamButton_T(_("yellow"), '1 1 0.5', "cmd selectteam yellow; cmd join",
59 _("Join the yellow team")));
60 me.TD(me, 2, 1, e = me.team4 = makeTeamButton_T(_("pink"), '1 0.5 1', "cmd selectteam pink; cmd join",
61 _("Join the pink team")));
64 me.TD(me, 1, 4, makeXonoticCommandButton(_("spectate"), '0 0 0', "cmd spectate", 1));
68 /* Click. The c-word is here so you can grep for it :-) */