Xonotic
dialog_firstrun.qc
Go to the documentation of this file.
1 #include "dialog_firstrun.qh"
2 
3 #include "textlabel.qh"
4 #include "inputbox.qh"
5 #include "languagelist.qh"
6 #include "radiobutton.qh"
7 #include "colorpicker.qh"
8 #include "charmap.qh"
9 #include "commandbutton.qh"
10 
12 {
13  return cvar_string("_cl_name") == cvar_defstring("_cl_name");
14 }
15 
17 {
18  if(cvar_string("_cl_name") != cvar_defstring("_cl_name"))
19  return 1;
20 
21  if(cvar_string("_menu_prvm_language") != prvm_language)
22  return 1; // OK will then reopen the dialog in another language
23 
24  if(cvar_string("cl_allow_uid2name") != "-1")
25  return 1;
26 
27  return 0;
28 }
29 
31 {
32  if(prvm_language != cvar_string("_menu_prvm_language"))
33  localcmd("\nprvm_language \"$_menu_prvm_language\"; saveconfig; menu_restart\n");
34 }
35 
37 {
38  entity e;
39  entity label, box;
40 
41  me.TR(me);
42  me.TR(me);
43  me.TDempty(me, 1);
44  me.TD(me, 2, 4, e = makeXonoticTextLabel(0, _("Welcome to Xonotic, please select your language preference and enter your player name to get started. You can change these options later through the menu system.")));
45  e.allowWrap = 1;
46  me.TR(me);
47 
48  me.TR(me);
49  me.TR(me);
50  me.TD(me, 1, 0.5, me.playerNameLabel = makeXonoticTextLabel(0, _("Name:")));
51  me.playerNameLabelAlpha = me.playerNameLabel.alpha;
52  me.TD(me, 1, 3.25, label = makeXonoticTextLabel(0, string_null));
53  label.allowCut = 1;
54  label.allowColors = 1;
55  label.alpha = 1;
56  me.TR(me);
57  me.TD(me, 1, 3.75, box = makeXonoticInputBox_T(1, "_cl_name",
58  _("Name under which you will appear in the game")));
59  box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved
60  box.maxLength = -127; // negative means encoded length in bytes
61  box.saveImmediately = 0; // Sorry, can't do this, it spams "name" commands.
62  box.enableClearButton = 0;
63  label.textEntity = box;
64  me.TR(me);
65  me.TD(me, 5, 1.25, e = makeXonoticColorpicker(box));
66  me.TD(me, 5, 2.5, e = makeXonoticCharmap(box));
67  me.TR(me);
68  me.TR(me);
69  me.TR(me);
70  me.TR(me);
71 
72  me.gotoRC(me, 3, 4); me.setFirstColumn(me, me.currentColumn);
73  me.TR(me);
74  me.TD(me, 1, 2, e = makeXonoticTextLabel(0, _("Text language:")));
75  me.TR(me);
76  me.TD(me, 6, 2, e = makeXonoticLanguageList());
77  e.name = "languageselector_firstrun";
78  e.setLanguage = firstRun_setLanguage;
79  me.TR(me);
80  me.TR(me);
81 
82  me.gotoRC(me, me.rows - 4, 0);
83  me.TD(me, 1, me.columns, e = makeXonoticTextLabel(0.5, _("Allow player statistics to use your nickname at stats.xonotic.org?")));
84 
85  me.gotoRC(me, me.rows - 3, 0);
86  me.TDempty(me, 1.5);
87  me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "cl_allow_uid2name", "1", _("Yes")));
88  me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "cl_allow_uid2name", "0", _("No")));
89  me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "cl_allow_uid2name", "-1", _("Undecided")));
90  me.TR(me);
91  me.TD(me, 1, me.columns, e = makeXonoticTextLabel(0.5, _("Player statistics are enabled by default, you can change this in the Profile menu")));
92 
93  // because of the language selector, this is a menu_restart!
94  me.gotoRC(me, me.rows - 1, 0);
95  me.TD(me, 1, me.columns, e = makeXonoticCommandButton(_("Save settings"), '0 0 0', "prvm_language \"$_menu_prvm_language\"; saveconfig; menu_restart", COMMANDBUTTON_APPLY));
97 }
string string_null
Definition: nil.qh:9
entity makeXonoticRadioButton(float theGroup, string theCvar, string theValue, string theText)
Definition: radiobutton.qc:10
entity() spawn
entity makeXonoticTextLabel(float theAlign, string theText)
Definition: textlabel.qc:3
bool XonoticFirstRunDialog_shouldShow()
void XonoticFirstRunDialog_fill(entity me)
entity makeXonoticCharmap(entity controlledInputBox)
Definition: charmap.qc:32
entity makeXonoticLanguageList()
Definition: languagelist.qc:12
void firstRun_setLanguage(entity me)
entity makeXonoticCommandButton(string theText, vector theColor, string theCommand, int theFlags)
string prvm_language
Definition: i18n.qh:8
entity makeXonoticColorpicker(entity theTextbox)
Definition: colorpicker.qc:5
#define COMMANDBUTTON_APPLY
entity makeXonoticInputBox_T(float doEditColorCodes, string theCvar, string theTooltip)
Definition: inputbox.qc:3
float CheckFirstRunButton(entity me)