forked from FabianTerhorst/coreclr-module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
InteractionsServiceBuilder.cs
52 lines (42 loc) · 1.31 KB
/
InteractionsServiceBuilder.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
using System;
namespace AltV.Net.Interactions;
public class InteractionsServiceBuilder
{
private InteractionsServiceOptions serviceOptions;
public InteractionsServiceBuilder(InteractionsServiceOptions serviceOptions)
{
this.serviceOptions = serviceOptions;
}
public void AddGlobalThreadMapping(Func<ulong, ulong, ulong> mapping)
{
serviceOptions.GlobalThreadMapping = mapping;
}
public void AddThreadForType(params ulong[] types)
{
AddThreadForType(null, types);
}
public void AddThreadForType(Grid grid, params ulong[] types)
{
for (int i = 0, length = types.Length; i < length; i++)
{
serviceOptions.Types.Add(types[i]);
}
serviceOptions.Threads.Add((types, grid ?? BuildDefaultGrid()));
}
public void AddThread(Grid grid = null)
{
serviceOptions.Threads.Add((null, grid ?? BuildDefaultGrid()));
}
public void AddType(ulong type)
{
serviceOptions.Types.Add(type);
}
private static Grid BuildDefaultGrid()
{
return new Grid(50_000, 50_000, 100, 10_000, 10_000);
}
public InteractionsService Build()
{
return new InteractionsService(serviceOptions.Types, serviceOptions.Threads, serviceOptions.GlobalThreadMapping);
}
}