Client LuaCsForBarotrauma
OrdersFile.cs
1
using
System.Xml.Linq;
2
3
namespace
Barotrauma
4
{
5
#warning TODO: this is almost a GenericPrefabFile. Must refactor further.
6
[RequiredByCorePackage]
7
sealed
class
OrdersFile
:
ContentFile
8
{
9
public
OrdersFile
(
ContentPackage
contentPackage,
ContentPath
path) : base(contentPackage, path) { }
10
11
public
void
LoadFromXElement
(
ContentXElement
parentElement,
bool
overriding)
12
{
13
Identifier elemName =
new
Identifier(parentElement.
Name
.ToString());
14
if
(parentElement.
IsOverride
())
15
{
16
foreach
(var element
in
parentElement.
Elements
())
17
{
18
LoadFromXElement
(element,
true
);
19
}
20
}
21
else
if
(elemName ==
"order"
)
22
{
23
OrderPrefab
prefab =
new
OrderPrefab
(parentElement,
this
);
24
OrderPrefab
.
Prefabs
.Add(prefab, overriding);
25
}
26
else
if
(elemName ==
"ordercategory"
)
27
{
28
OrderCategoryIcon
prefab =
new
OrderCategoryIcon
(parentElement,
this
);
29
OrderCategoryIcon
.
OrderCategoryIcons
.Add(prefab, overriding);
30
}
31
else
if
(elemName ==
"orders"
)
32
{
33
foreach
(var element
in
parentElement.
Elements
())
34
{
35
LoadFromXElement
(element, overriding);
36
}
37
}
38
else
if
(elemName ==
"clear"
)
39
{
40
OrderCategoryIcon
.
OrderCategoryIcons
.AddOverrideFile(
this
);
41
OrderPrefab
.
Prefabs
.AddOverrideFile(
this
);
42
}
43
else
44
{
45
DebugConsole.ThrowError($
"OrdersFile: Invalid {GetType().Name} element: {parentElement.Name} in {Path}"
,
46
contentPackage: parentElement?.
ContentPackage
);
47
}
48
}
49
50
public
override
sealed
void
LoadFile
()
51
{
52
XDocument doc = XMLExtensions.TryLoadXml(Path);
53
if
(doc ==
null
) {
return
; }
54
55
var rootElement = doc.Root.FromPackage(
ContentPackage
);
56
LoadFromXElement
(rootElement,
false
);
57
}
58
59
public
override
sealed
void
UnloadFile
()
60
{
61
OrderCategoryIcon
.
OrderCategoryIcons
.RemoveByFile(
this
);
62
OrderPrefab
.
Prefabs
.RemoveByFile(
this
);
63
}
64
65
public
override
sealed
void
Sort
()
66
{
67
OrderCategoryIcon
.
OrderCategoryIcons
.SortAll();
68
OrderPrefab
.
Prefabs
.SortAll();
69
}
70
}
71
}
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.Name
XName Name
Definition:
ContentXElement.cs:27
Barotrauma.ContentXElement.Elements
IEnumerable< ContentXElement > Elements()
Barotrauma.ContentXElement.IsOverride
bool IsOverride()
Barotrauma.OrderCategoryIcon
Definition:
Order.cs:21
Barotrauma.OrderCategoryIcon.OrderCategoryIcons
static readonly PrefabCollection< OrderCategoryIcon > OrderCategoryIcons
Definition:
Order.cs:22
Barotrauma.OrderPrefab
Definition:
Order.cs:40
Barotrauma.OrderPrefab.Prefabs
static readonly PrefabCollection< OrderPrefab > Prefabs
Definition:
Order.cs:41
Barotrauma.OrdersFile
Definition:
OrdersFile.cs:8
Barotrauma.OrdersFile.LoadFromXElement
void LoadFromXElement(ContentXElement parentElement, bool overriding)
Definition:
OrdersFile.cs:11
Barotrauma.OrdersFile.OrdersFile
OrdersFile(ContentPackage contentPackage, ContentPath path)
Definition:
OrdersFile.cs:9
Barotrauma.OrdersFile.UnloadFile
override sealed void UnloadFile()
Definition:
OrdersFile.cs:59
Barotrauma.OrdersFile.Sort
override sealed void Sort()
Definition:
OrdersFile.cs:65
Barotrauma.OrdersFile.LoadFile
override sealed void LoadFile()
Definition:
OrdersFile.cs:50
Barotrauma
Definition:
AchievementManager.cs:12
Barotrauma
BarotraumaShared
SharedSource
ContentManagement
ContentFile
OrdersFile.cs
Generated by
1.9.1