]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Implement the uid2name dialog in the menu, but keep the existing one implemented...
authorterencehill <piuntn@gmail.com>
Sat, 2 Jul 2016 14:06:21 +0000 (16:06 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 2 Jul 2016 14:06:21 +0000 (16:06 +0200)
qcsrc/client/hud/panel/vote.qc
qcsrc/menu/xonotic/_mod.inc
qcsrc/menu/xonotic/_mod.qh
qcsrc/menu/xonotic/dialog_uid2name.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_uid2name.qh [new file with mode: 0644]
qcsrc/menu/xonotic/mainwindow.qc

index 89c784a1083be4e0ece863ca00419549520c05de..f85d304c5b815757fe4e0168e656b32196b3ef68 100644 (file)
@@ -7,6 +7,13 @@ void HUD_Vote()
 {
        if(autocvar_cl_allow_uid2name == -1 && (gametype == MAPINFO_TYPE_CTS || gametype == MAPINFO_TYPE_RACE || (serverflags & SERVERFLAG_PLAYERSTATS)))
        {
+               // this dialog gets overriden by the uid2name menu dialog, if it exists
+               // TODO remove this client side uid2name dialog in the next release
+               if (!uid2name_dialog)
+                       localcmd("menu_cmd directmenu Uid2Name\n");
+               if(autocvar__menu_alpha)
+                       hud_fade_alpha = 0;
+
                vote_active = 1;
                if (autocvar__hud_configure)
                {
index 867f77b8402b797db0297b0e34c7343aff1a8b20..577c8225803461225c818ce07f6cf396d1806f10 100644 (file)
@@ -79,6 +79,7 @@
 #include <menu/xonotic/dialog_singleplayer.qc>
 #include <menu/xonotic/dialog_singleplayer_winner.qc>
 #include <menu/xonotic/dialog_teamselect.qc>
+#include <menu/xonotic/dialog_uid2name.qc>
 #include <menu/xonotic/gametypelist.qc>
 #include <menu/xonotic/hudskinlist.qc>
 #include <menu/xonotic/image.qc>
index adfefc05d7d5210ff1edd713b751a79afca1bf05..b6e34eff247606d774eb1d321fe9f7539071d3ff 100644 (file)
@@ -79,6 +79,7 @@
 #include <menu/xonotic/dialog_singleplayer.qh>
 #include <menu/xonotic/dialog_singleplayer_winner.qh>
 #include <menu/xonotic/dialog_teamselect.qh>
+#include <menu/xonotic/dialog_uid2name.qh>
 #include <menu/xonotic/gametypelist.qh>
 #include <menu/xonotic/hudskinlist.qh>
 #include <menu/xonotic/image.qh>
diff --git a/qcsrc/menu/xonotic/dialog_uid2name.qc b/qcsrc/menu/xonotic/dialog_uid2name.qc
new file mode 100644 (file)
index 0000000..1cd77b0
--- /dev/null
@@ -0,0 +1,18 @@
+#include "dialog_uid2name.qh"
+
+#include "textlabel.qh"
+#include "commandbutton.qh"
+
+void XonoticUid2NameDialog_fill(entity me)
+{
+       entity e;
+       me.TR(me);
+               me.TD(me, 1, 2, makeXonoticTextLabel(0.5, _("Allow player statistics to use your nickname?")));
+       me.TR(me);
+               me.TD(me, 1, 2, makeXonoticTextLabel(0.5, _("Answering \"No\" you will appear as \"Anonymous player\"")));
+       me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 1, e = makeXonoticCommandButton(_("Yes"), '0 0 0', "vyes; setreport cl_allow_uid2name 1", COMMANDBUTTON_CLOSE));
+                       e.preferredFocusPriority = 1;
+               me.TD(me, 1, 1, e = makeXonoticCommandButton(_("No"), '0 0 0', "vno; setreport cl_allow_uid2name 0", COMMANDBUTTON_CLOSE));
+}
diff --git a/qcsrc/menu/xonotic/dialog_uid2name.qh b/qcsrc/menu/xonotic/dialog_uid2name.qh
new file mode 100644 (file)
index 0000000..7072682
--- /dev/null
@@ -0,0 +1,13 @@
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticUid2NameDialog, XonoticRootDialog)
+       METHOD(XonoticUid2NameDialog, fill, void(entity));
+       ATTRIB(XonoticUid2NameDialog, title, string, _("Name in stats"))
+       ATTRIB(XonoticUid2NameDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+       ATTRIB(XonoticUid2NameDialog, intendedWidth, float, 0.5)
+       ATTRIB(XonoticUid2NameDialog, rows, float, 4)
+       ATTRIB(XonoticUid2NameDialog, columns, float, 2)
+       ATTRIB(XonoticUid2NameDialog, name, string, "Uid2Name")
+       ATTRIB(XonoticUid2NameDialog, closable, float, 0)
+ENDCLASS(XonoticUid2NameDialog)
index fb25eebdef39bc2d4bc92cb5b1fd78d0f33c767e..0e071c2e71efc20321722e13b4246f46ec81cfda 100644 (file)
@@ -39,6 +39,7 @@
 #include "dialog_sandboxtools.qh"
 #include "dialog_monstertools.qh"
 #include "dialog_teamselect.qh"
+#include "dialog_uid2name.qh"
 #include "dialog_singleplayer.qh"
 #include "dialog_multiplayer.qh"
 #include "dialog_settings.qh"
@@ -224,6 +225,10 @@ void MainWindow_configureMainWindow(entity me)
        i.configureDialog(i);
        me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
+       i = NEW(XonoticUid2NameDialog);
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
        i = NEW(XonoticMonsterToolsDialog);
        i.configureDialog(i);
        me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z * SKINALPHA_DIALOG_SANDBOXTOOLS);