Client LuaCsForBarotrauma
JobsFile.cs
1
using
Barotrauma
;
2
using
System;
3
using
System.
Linq
;
4
using
System.Xml.Linq;
5
6
namespace
Barotrauma
7
{
8
9
[
RequiredByCorePackage
]
10
sealed
class
JobsFile
:
ContentFile
11
{
12
public
JobsFile
(
ContentPackage
contentPackage,
ContentPath
path) : base(contentPackage, path) { }
13
14
public
override
void
LoadFile
()
15
{
16
XDocument doc = XMLExtensions.TryLoadXml(Path);
17
if
(doc ==
null
) {
return
; }
18
LoadElements(doc.Root.FromPackage(
ContentPackage
),
false
);
19
}
20
21
private
void
LoadElements(
ContentXElement
mainElement,
bool
isOverride)
22
{
23
foreach
(var element
in
mainElement.
Elements
())
24
{
25
if
(element.NameAsIdentifier() ==
"ItemRepairPriorities"
)
26
{
27
foreach
(var subElement
in
element.Elements())
28
{
29
ItemRepairPriority
prio =
new
ItemRepairPriority
(subElement,
this
);
30
ItemRepairPriority
.
Prefabs
.Add(prio, isOverride);
31
}
32
}
33
else
if
(element.IsOverride())
34
{
35
LoadElements(element,
true
);
36
}
37
else
38
{
39
var job =
new
JobPrefab
(element,
this
);
40
JobPrefab
.
Prefabs
.Add(job, isOverride);
41
}
42
}
43
}
44
45
public
override
void
UnloadFile
()
46
{
47
JobPrefab
.
Prefabs
.RemoveByFile(
this
);
48
ItemRepairPriority
.
Prefabs
.RemoveByFile(
this
);
49
}
50
51
public
override
void
Sort
()
52
{
53
JobPrefab
.
Prefabs
.SortAll();
54
}
55
}
56
}
Barotrauma.ContentFile
Base class for content file types, which are loaded from filelist.xml via reflection....
Definition:
ContentFile.cs:23
Barotrauma.ContentPackage
Definition:
ContentPackage.cs:18
Barotrauma.ContentPath
Definition:
ContentPath.cs:11
Barotrauma.ContentXElement
Definition:
ContentXElement.cs:13
Barotrauma.ContentXElement.Elements
IEnumerable< ContentXElement > Elements()
Barotrauma.ItemRepairPriority
Definition:
BarotraumaShared/SharedSource/Characters/Jobs/JobPrefab.cs:44
Barotrauma.ItemRepairPriority.Prefabs
static readonly PrefabCollection< ItemRepairPriority > Prefabs
Definition:
BarotraumaShared/SharedSource/Characters/Jobs/JobPrefab.cs:45
Barotrauma.JobPrefab
Definition:
BarotraumaShared/SharedSource/Characters/Jobs/JobPrefab.cs:74
Barotrauma.JobPrefab.Prefabs
static readonly PrefabCollection< JobPrefab > Prefabs
Definition:
BarotraumaShared/SharedSource/Characters/Jobs/JobPrefab.cs:75
Barotrauma.JobsFile
Definition:
JobsFile.cs:11
Barotrauma.JobsFile.Sort
override void Sort()
Definition:
JobsFile.cs:51
Barotrauma.JobsFile.UnloadFile
override void UnloadFile()
Definition:
JobsFile.cs:45
Barotrauma.JobsFile.LoadFile
override void LoadFile()
Definition:
JobsFile.cs:14
Barotrauma.JobsFile.JobsFile
JobsFile(ContentPackage contentPackage, ContentPath path)
Definition:
JobsFile.cs:12
Barotrauma.RequiredByCorePackage
Definition:
CorePackage.cs:13
Barotrauma
Definition:
AchievementManager.cs:12
Linq
Barotrauma
BarotraumaShared
SharedSource
ContentManagement
ContentFile
JobsFile.cs
Generated by
1.9.1