-
Notifications
You must be signed in to change notification settings - Fork 4
/
RDR1Prefabs.cs
83 lines (74 loc) · 2.13 KB
/
RDR1Prefabs.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using CodeX.Core.Engine;
using CodeX.Games.RDR1.Prefabs;
using CodeX.Games.RDR1.RPF6;
namespace CodeX.Games.RDR1
{
public class RDR1Prefabs : PrefabManager
{
public Rpf6FileManager FileManager;
public RDR1Peds Peds;
public RDR1Animals Animals;
public RDR1Vehicles Vehicles;
public RDR1Prefabs(RDR1Game game)
{
Game = game;
}
public override bool Init()
{
FileManager = Game.GetFileManager() as Rpf6FileManager;
if (FileManager == null) return false;
return true;
}
public override string[] GetTypeList()
{
return new[] { "Peds", "Vehicles", "Animals" };
}
public override string[] GetPrefabList(string type)
{
switch (type)
{
case "Peds":
EnsurePeds();
return Peds?.PedNames;
case "Vehicles":
EnsureVehicles();
return Vehicles?.VehicleNames;
case "Animals":
EnsureAnimals();
return Animals?.AnimalNames;
}
return null;
}
public override Prefab GetPrefab(string type, string id)
{
switch (type)
{
case "Peds":
return Peds?.GetPrefab(id);
case "Vehicles":
return Vehicles?.GetPrefab(id);
case "Animals":
return Animals?.GetPrefab(id);
}
return null;
}
private void EnsurePeds()
{
if (Peds != null) return;
Peds = new RDR1Peds();
Peds.Init(FileManager);
}
private void EnsureVehicles()
{
if (Vehicles != null) return;
Vehicles = new RDR1Vehicles();
Vehicles.Init(FileManager);
}
private void EnsureAnimals()
{
if (Animals != null) return;
Animals = new RDR1Animals();
Animals.Init(FileManager);
}
}
}