-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHighlight.cs
57 lines (45 loc) · 1.71 KB
/
Highlight.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System;
using System.Collections.Generic;
using System.Text;
using NVIDIA;
namespace LC_Highlights
{
internal class Highlight
{
private static DateTime _startTime;
private static string _lastName;
public static void LogCallback(Highlights.ReturnCode ret, int id)
{
Plugin.Log.LogDebug($"Callback from NVIDIA SDK with code {ret} for ID {id}.");
}
public static void SaveRecording(string name)
{
_lastName = name;
if (!Plugin.cfgEnabled.Value)
return;
DateTime currentTime = DateTime.Now;
DateTime timeBefore = currentTime.AddSeconds(-15);
TimeSpan difference = DateTime.Now - timeBefore;
Highlights.VideoHighlightParams vhp = new Highlights.VideoHighlightParams();
vhp.highlightId = "MAP_PLAY";
vhp.groupId = "MAP_PLAY_GROUP";
vhp.startDelta = (int)-difference.TotalMilliseconds;
vhp.endDelta = 0;
vhp.startDelta += 0;
vhp.endDelta += Plugin.cfgAfterDeathDelta.Value;
Highlights.SetVideoHighlight(vhp, LogCallback);
}
public static void ShowSummary()
{
if (!Plugin.cfgEnabled.Value)
return;
Highlights.GroupView[] groupViews = new Highlights.GroupView[1];
Highlights.GroupView gv1 = new Highlights.GroupView();
gv1.GroupId = "MAP_PLAY_GROUP";
gv1.SignificanceFilter = Highlights.HighlightSignificance.Good;
gv1.TagFilter = Highlights.HighlightType.Achievement;
groupViews[0] = gv1;
Highlights.OpenSummary(groupViews, LogCallback);
}
}
}