2 CLASS(XonoticDemoBrowserTab) EXTENDS(XonoticTab)
3 METHOD(XonoticDemoBrowserTab, fill, void(entity))
4 ATTRIB(XonoticDemoBrowserTab, title, string, _("Demo"))
5 ATTRIB(XonoticDemoBrowserTab, intendedWidth, float, 0.9)
6 ATTRIB(XonoticDemoBrowserTab, rows, float, 21)
7 ATTRIB(XonoticDemoBrowserTab, columns, float, 6.5)
8 ATTRIB(XonoticDemoBrowserTab, name, string, "DemoBrowser")
9 ATTRIB(XonoticDemoBrowserTab, democlicktype, float, 0)
10 ENDCLASS(XonoticDemoBrowserTab)
11 entity makeXonoticDemoBrowserTab();
12 const float DMO_PLAY = 1;
13 const float DMO_TIME = 2;
17 void DemoConfirm_Check_Gamestatus(entity btn, entity me)
19 if(!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER))) // we're not in a match, lets watch the demo
21 if(btn.democlicktype == DMO_PLAY)
22 { demolist.startDemo(demolist); }
23 else if(btn.democlicktype == DMO_TIME)
24 { demolist.timeDemo(demolist); }
26 else // already in a match, player has to confirm
28 if(btn.democlicktype == DMO_PLAY)
29 { DialogOpenButton_Click(btn, main.demostartconfirmDialog); }
30 else if(btn.democlicktype == DMO_TIME)
31 { DialogOpenButton_Click(btn, main.demotimeconfirmDialog); }
35 entity makeXonoticDemoBrowserTab()
38 me = spawnXonoticDemoBrowserTab();
39 me.configureDialog(me);
42 void XonoticDemoBrowserTab_fill(entity me)
45 demolist = makeXonoticDemoList();
48 me.TD(me, 1, 0.6, e = makeXonoticTextLabel(1, _("Filter:")));
49 me.TD(me, 1, 2.9, e = makeXonoticInputBox(0, string_null));
50 e.onChange = DemoList_Filter_Change;
51 e.onChangeEntity = demolist;
52 demolist.controlledTextbox = e;
54 me.gotoRC(me, 0, 3.7);
55 me.TD(me, 1, 1.5, e = makeXonoticCheckBox(0, "cl_autodemo", _("Auto record demos")));
56 me.TD(me, 1, 1, e = makeXonoticButton(_("Refresh"), '0 0 0'));
57 e.onClick = DemoList_Refresh_Click;
58 e.onClickEntity = demolist;
60 me.gotoRC(me, 1.5, 0);
61 me.TD(me, me.rows - 2.5, me.columns, demolist);
63 me.gotoRC(me, me.rows - 1, 0);
64 me.TD(me, 1, me.columns / 2, e = makeXonoticButton(_("Timedemo"), '0 0 0'));
65 e.democlicktype = DMO_TIME;
66 e.onClick = DemoConfirm_Check_Gamestatus;
67 e.onClickEntity = me; // demolist is global anyway
68 me.TD(me, 1, me.columns / 2, e = makeXonoticButton(ZCTX(_("DEMO^Play")), '0 0 0'));
69 e.democlicktype = DMO_PLAY;
70 e.onClick = DemoConfirm_Check_Gamestatus;
71 e.onClickEntity = me; // demolist is global anyway