From 4699a2142be64867bb10999f68994a75ab7d7df4 Mon Sep 17 00:00:00 2001 From: John3 Date: Tue, 21 Jun 2016 22:06:09 -0500 Subject: [PATCH 1/4] Enable to play recorded gameplay demo from main menu. --- Templates/Empty/game/art/gui/mainMenuGui.gui | 26 ++++++++++++++++--- .../Empty/game/core/scripts/client/core.cs | 1 + Templates/Full/game/art/gui/mainMenuGui.gui | 26 ++++++++++++++++--- .../Full/game/core/scripts/client/core.cs | 1 + 4 files changed, 48 insertions(+), 6 deletions(-) diff --git a/Templates/Empty/game/art/gui/mainMenuGui.gui b/Templates/Empty/game/art/gui/mainMenuGui.gui index bed700a83..e9d575093 100644 --- a/Templates/Empty/game/art/gui/mainMenuGui.gui +++ b/Templates/Empty/game/art/gui/mainMenuGui.gui @@ -16,7 +16,7 @@ isContainer = "1"; canSave = "1"; canSaveDynamicFields = "1"; - enabled = "1"; + Enabled = "1"; isDecoy = "0"; new GuiBitmapCtrl(MainMenuAppLogo) { @@ -35,7 +35,7 @@ isContainer = "0"; canSave = "1"; canSaveDynamicFields = "1"; - enabled = "1"; + Enabled = "1"; isDecoy = "0"; }; new GuiControl() { @@ -59,7 +59,7 @@ buttonType = "PushButton"; useMouseEvents = "1"; position = "9 26"; - extent = "289 75"; + extent = "219 75"; minExtent = "8 8"; horizSizing = "relative"; vertSizing = "bottom"; @@ -158,6 +158,26 @@ canSave = "1"; canSaveDynamicFields = "0"; }; + new GuiButtonCtrl() { + text = "Replay"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "215 26"; + extent = "83 75"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.pushDialog(RecordingsDlg);"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; }; }; //--- OBJECT WRITE END --- diff --git a/Templates/Empty/game/core/scripts/client/core.cs b/Templates/Empty/game/core/scripts/client/core.cs index da26beeff..ecf1626f8 100644 --- a/Templates/Empty/game/core/scripts/client/core.cs +++ b/Templates/Empty/game/core/scripts/client/core.cs @@ -73,6 +73,7 @@ function initializeCore() exec("~/art/gui/console.gui"); exec("~/art/gui/consoleVarDlg.gui"); exec("~/art/gui/netGraphGui.gui"); + exec("~/art/gui/RecordingsDlg.gui"); // Gui Helper Scripts. exec("~/scripts/gui/help.cs"); diff --git a/Templates/Full/game/art/gui/mainMenuGui.gui b/Templates/Full/game/art/gui/mainMenuGui.gui index ac38976d3..bde78491f 100644 --- a/Templates/Full/game/art/gui/mainMenuGui.gui +++ b/Templates/Full/game/art/gui/mainMenuGui.gui @@ -16,7 +16,7 @@ isContainer = "1"; canSave = "1"; canSaveDynamicFields = "1"; - enabled = "1"; + Enabled = "1"; isDecoy = "0"; new GuiBitmapCtrl(MainMenuAppLogo) { @@ -35,7 +35,7 @@ isContainer = "0"; canSave = "1"; canSaveDynamicFields = "1"; - enabled = "1"; + Enabled = "1"; isDecoy = "0"; }; new GuiControl() { @@ -59,7 +59,7 @@ buttonType = "PushButton"; useMouseEvents = "1"; position = "9 18"; - extent = "289 75"; + extent = "219 75"; minExtent = "8 8"; horizSizing = "relative"; vertSizing = "bottom"; @@ -178,6 +178,26 @@ canSave = "1"; canSaveDynamicFields = "0"; }; + new GuiButtonCtrl() { + text = "Replay"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "215 18"; + extent = "83 75"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.pushDialog(RecordingsDlg);"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; }; }; //--- OBJECT WRITE END --- diff --git a/Templates/Full/game/core/scripts/client/core.cs b/Templates/Full/game/core/scripts/client/core.cs index da26beeff..ecf1626f8 100644 --- a/Templates/Full/game/core/scripts/client/core.cs +++ b/Templates/Full/game/core/scripts/client/core.cs @@ -73,6 +73,7 @@ function initializeCore() exec("~/art/gui/console.gui"); exec("~/art/gui/consoleVarDlg.gui"); exec("~/art/gui/netGraphGui.gui"); + exec("~/art/gui/RecordingsDlg.gui"); // Gui Helper Scripts. exec("~/scripts/gui/help.cs"); From 9b8f0eee44ff806fcdb7870dac84af322f2d8746 Mon Sep 17 00:00:00 2001 From: John3 Date: Tue, 21 Jun 2016 22:09:06 -0500 Subject: [PATCH 2/4] added "how to use". Added delete button (Disabled right now) --- .../Empty/game/core/art/gui/RecordingsDlg.gui | 240 ++++++++++++++---- .../Full/game/core/art/gui/RecordingsDlg.gui | 240 ++++++++++++++---- 2 files changed, 370 insertions(+), 110 deletions(-) diff --git a/Templates/Empty/game/core/art/gui/RecordingsDlg.gui b/Templates/Empty/game/core/art/gui/RecordingsDlg.gui index 44df55ca1..28db1ae30 100644 --- a/Templates/Empty/game/core/art/gui/RecordingsDlg.gui +++ b/Templates/Empty/game/core/art/gui/RecordingsDlg.gui @@ -1,97 +1,227 @@ //--- OBJECT WRITE BEGIN --- %guiContent = new GuiControl(recordingsDlg) { - profile = "GuiDefaultProfile"; + position = "0 0"; + extent = "1024 768"; + minExtent = "8 8"; horizSizing = "right"; vertSizing = "bottom"; - position = "0 0"; - extent = "640 480"; - minExtent = "8 8"; + profile = "GuiDefaultProfile"; visible = "1"; - helpTag = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + helpTag = "0"; new GuiWindowCtrl() { - profile = "GuiWindowProfile"; - horizSizing = "center"; - vertSizing = "center"; - position = "55 65"; - extent = "530 338"; - minExtent = "48 92"; - visible = "1"; - helpTag = "0"; text = "Demo Recordings"; - maxLength = "255"; resizeWidth = "0"; resizeHeight = "0"; canMove = "1"; canClose = "1"; canMinimize = "0"; canMaximize = "0"; - minSize = "50 50"; + canCollapse = "0"; closeCommand = "Canvas.popDialog(recordingsDlg);"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "247 215"; + extent = "530 338"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "GuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; new GuiScrollCtrl() { - profile = "GuiScrollProfile"; - horizSizing = "right"; - vertSizing = "bottom"; - position = "23 37"; - extent = "484 260"; - minExtent = "32 32"; - visible = "1"; - helpTag = "0"; willFirstRespond = "1"; hScrollBar = "dynamic"; vScrollBar = "alwaysOn"; - lockHorizScroll = "false"; - lockVertScroll = "false"; + lockHorizScroll = "0"; + lockVertScroll = "0"; constantThumbHeight = "0"; childMargin = "0 0"; - defaultLineHeight = "15"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "23 60"; + extent = "484 237"; + minExtent = "32 32"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; new GuiTextListCtrl(RecordingsDlgList) { - profile = "GuiTextArrayProfile"; - horizSizing = "right"; - vertSizing = "bottom"; - position = "2 2"; - extent = "462 20"; - minExtent = "8 20"; - visible = "1"; - helpTag = "0"; - enumerate = "0"; columns = "0"; - resizeCell = "1"; fitParentWidth = "1"; clipColumnText = "0"; - noDuplicates = "false"; + position = "1 1"; + extent = "469 32"; + minExtent = "8 20"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextArrayProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; }; }; new GuiButtonCtrl(DR_CancelBtn) { - profile = "GuiButtonProfile"; - horizSizing = "right"; - vertSizing = "top"; - position = "396 306"; - extent = "110 20"; - minExtent = "8 8"; - visible = "1"; - command = "Canvas.popDialog(recordingsDlg);"; - accelerator = "escape"; - helpTag = "0"; text = "Cancel"; groupNum = "-1"; buttonType = "PushButton"; - }; - new GuiButtonCtrl(DR_StartDemoBtn) { - profile = "GuiButtonProfile"; - horizSizing = "right"; - vertSizing = "top"; - position = "25 305"; + useMouseEvents = "0"; + position = "396 306"; extent = "110 20"; minExtent = "8 8"; + horizSizing = "right"; + vertSizing = "top"; + profile = "GuiButtonProfile"; visible = "1"; - command = "StartSelectedDemo();"; - helpTag = "0"; + active = "1"; + command = "Canvas.popDialog(recordingsDlg);"; + accelerator = "escape"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl(DR_StartDemoBtn) { text = "Play"; groupNum = "-1"; buttonType = "PushButton"; + useMouseEvents = "0"; + position = "25 305"; + extent = "110 20"; + minExtent = "8 8"; + horizSizing = "right"; + vertSizing = "top"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "StartSelectedDemo();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "During gameplay press the following keys:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "23 30"; + extent = "206 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Start = F3"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "253 32"; + extent = "50 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Stop = F4"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "320 32"; + extent = "49 13"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl(DR_DelDemoBtn) { + text = "Delete"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "210 305"; + extent = "110 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; }; }; }; diff --git a/Templates/Full/game/core/art/gui/RecordingsDlg.gui b/Templates/Full/game/core/art/gui/RecordingsDlg.gui index 44df55ca1..28db1ae30 100644 --- a/Templates/Full/game/core/art/gui/RecordingsDlg.gui +++ b/Templates/Full/game/core/art/gui/RecordingsDlg.gui @@ -1,97 +1,227 @@ //--- OBJECT WRITE BEGIN --- %guiContent = new GuiControl(recordingsDlg) { - profile = "GuiDefaultProfile"; + position = "0 0"; + extent = "1024 768"; + minExtent = "8 8"; horizSizing = "right"; vertSizing = "bottom"; - position = "0 0"; - extent = "640 480"; - minExtent = "8 8"; + profile = "GuiDefaultProfile"; visible = "1"; - helpTag = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + helpTag = "0"; new GuiWindowCtrl() { - profile = "GuiWindowProfile"; - horizSizing = "center"; - vertSizing = "center"; - position = "55 65"; - extent = "530 338"; - minExtent = "48 92"; - visible = "1"; - helpTag = "0"; text = "Demo Recordings"; - maxLength = "255"; resizeWidth = "0"; resizeHeight = "0"; canMove = "1"; canClose = "1"; canMinimize = "0"; canMaximize = "0"; - minSize = "50 50"; + canCollapse = "0"; closeCommand = "Canvas.popDialog(recordingsDlg);"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "247 215"; + extent = "530 338"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "GuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; new GuiScrollCtrl() { - profile = "GuiScrollProfile"; - horizSizing = "right"; - vertSizing = "bottom"; - position = "23 37"; - extent = "484 260"; - minExtent = "32 32"; - visible = "1"; - helpTag = "0"; willFirstRespond = "1"; hScrollBar = "dynamic"; vScrollBar = "alwaysOn"; - lockHorizScroll = "false"; - lockVertScroll = "false"; + lockHorizScroll = "0"; + lockVertScroll = "0"; constantThumbHeight = "0"; childMargin = "0 0"; - defaultLineHeight = "15"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "23 60"; + extent = "484 237"; + minExtent = "32 32"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; new GuiTextListCtrl(RecordingsDlgList) { - profile = "GuiTextArrayProfile"; - horizSizing = "right"; - vertSizing = "bottom"; - position = "2 2"; - extent = "462 20"; - minExtent = "8 20"; - visible = "1"; - helpTag = "0"; - enumerate = "0"; columns = "0"; - resizeCell = "1"; fitParentWidth = "1"; clipColumnText = "0"; - noDuplicates = "false"; + position = "1 1"; + extent = "469 32"; + minExtent = "8 20"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextArrayProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; }; }; new GuiButtonCtrl(DR_CancelBtn) { - profile = "GuiButtonProfile"; - horizSizing = "right"; - vertSizing = "top"; - position = "396 306"; - extent = "110 20"; - minExtent = "8 8"; - visible = "1"; - command = "Canvas.popDialog(recordingsDlg);"; - accelerator = "escape"; - helpTag = "0"; text = "Cancel"; groupNum = "-1"; buttonType = "PushButton"; - }; - new GuiButtonCtrl(DR_StartDemoBtn) { - profile = "GuiButtonProfile"; - horizSizing = "right"; - vertSizing = "top"; - position = "25 305"; + useMouseEvents = "0"; + position = "396 306"; extent = "110 20"; minExtent = "8 8"; + horizSizing = "right"; + vertSizing = "top"; + profile = "GuiButtonProfile"; visible = "1"; - command = "StartSelectedDemo();"; - helpTag = "0"; + active = "1"; + command = "Canvas.popDialog(recordingsDlg);"; + accelerator = "escape"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl(DR_StartDemoBtn) { text = "Play"; groupNum = "-1"; buttonType = "PushButton"; + useMouseEvents = "0"; + position = "25 305"; + extent = "110 20"; + minExtent = "8 8"; + horizSizing = "right"; + vertSizing = "top"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "StartSelectedDemo();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "During gameplay press the following keys:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "23 30"; + extent = "206 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Start = F3"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "253 32"; + extent = "50 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Stop = F4"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "320 32"; + extent = "49 13"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl(DR_DelDemoBtn) { + text = "Delete"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "210 305"; + extent = "110 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; }; }; }; From c822d1310935eae4afaa28bd2c399bdd4bd2c591 Mon Sep 17 00:00:00 2001 From: John3 Date: Wed, 29 Jun 2016 19:16:25 -0500 Subject: [PATCH 3/4] added deleteDemo function --- .../Full/game/core/art/gui/RecordingsDlg.gui | 1 + .../Full/game/core/scripts/client/recordings.cs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/Templates/Full/game/core/art/gui/RecordingsDlg.gui b/Templates/Full/game/core/art/gui/RecordingsDlg.gui index 28db1ae30..0e863fff5 100644 --- a/Templates/Full/game/core/art/gui/RecordingsDlg.gui +++ b/Templates/Full/game/core/art/gui/RecordingsDlg.gui @@ -217,6 +217,7 @@ profile = "GuiButtonProfile"; visible = "1"; active = "1"; + command = "deleteDemoRecord();"; tooltipProfile = "GuiToolTipProfile"; hovertime = "1000"; isContainer = "0"; diff --git a/Templates/Full/game/core/scripts/client/recordings.cs b/Templates/Full/game/core/scripts/client/recordings.cs index 14f1a45d3..5609f0337 100644 --- a/Templates/Full/game/core/scripts/client/recordings.cs +++ b/Templates/Full/game/core/scripts/client/recordings.cs @@ -134,3 +134,19 @@ function demoPlaybackComplete() Canvas.pushDialog(RecordingsDlg); } + +function deleteDemoRecord() +{ + %sel = RecordingsDlgList.getSelectedId(); + %rowText = RecordingsDlgList.getRowTextById(%sel); + %file = $currentMod @ "/recordings/" @ getField(%rowText, 0) @ ".rec"; + + if(!isfile(%file)) + { + RecordingsDlgList.removeRowById(%sel); + return; + } + + RecordingsDlgList.removeRowById(%sel); + fileDelete(%file); +} From 100e18d232ee0234f6842d345a54b6fb34db30d0 Mon Sep 17 00:00:00 2001 From: John3 Date: Wed, 29 Jun 2016 19:21:01 -0500 Subject: [PATCH 4/4] forget the empty template XD added delete demo function --- .../Empty/game/core/art/gui/RecordingsDlg.gui | 1 + .../Empty/game/core/scripts/client/recordings.cs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/Templates/Empty/game/core/art/gui/RecordingsDlg.gui b/Templates/Empty/game/core/art/gui/RecordingsDlg.gui index 28db1ae30..0e863fff5 100644 --- a/Templates/Empty/game/core/art/gui/RecordingsDlg.gui +++ b/Templates/Empty/game/core/art/gui/RecordingsDlg.gui @@ -217,6 +217,7 @@ profile = "GuiButtonProfile"; visible = "1"; active = "1"; + command = "deleteDemoRecord();"; tooltipProfile = "GuiToolTipProfile"; hovertime = "1000"; isContainer = "0"; diff --git a/Templates/Empty/game/core/scripts/client/recordings.cs b/Templates/Empty/game/core/scripts/client/recordings.cs index 14f1a45d3..5609f0337 100644 --- a/Templates/Empty/game/core/scripts/client/recordings.cs +++ b/Templates/Empty/game/core/scripts/client/recordings.cs @@ -134,3 +134,19 @@ function demoPlaybackComplete() Canvas.pushDialog(RecordingsDlg); } + +function deleteDemoRecord() +{ + %sel = RecordingsDlgList.getSelectedId(); + %rowText = RecordingsDlgList.getRowTextById(%sel); + %file = $currentMod @ "/recordings/" @ getField(%rowText, 0) @ ".rec"; + + if(!isfile(%file)) + { + RecordingsDlgList.removeRowById(%sel); + return; + } + + RecordingsDlgList.removeRowById(%sel); + fileDelete(%file); +}