Client LuaCsForBarotrauma
NPCConversationsFile.cs
1
using
System.Xml.Linq;
2
3
namespace
Barotrauma
4
{
5
[NotSyncedInMultiplayer]
6
sealed
class
NPCConversationsFile
:
ContentFile
7
{
8
public
NPCConversationsFile
(
ContentPackage
contentPackage,
ContentPath
path) : base(contentPackage, path) { }
9
10
public
override
void
LoadFile
()
11
{
12
XDocument doc = XMLExtensions.TryLoadXml(Path);
13
if
(doc ==
null
) {
return
; }
14
var mainElement = doc.Root.FromPackage(
ContentPackage
);
15
bool
allowOverriding = doc.Root.IsOverride();
16
if
(allowOverriding)
17
{
18
mainElement = mainElement.FirstElement();
19
}
20
21
var npcConversationCollection =
new
NPCConversationCollection
(
this
, mainElement);
22
if
(!
NPCConversationCollection
.
Collections
.ContainsKey(npcConversationCollection.Language))
23
{
24
NPCConversationCollection
.
Collections
.Add(npcConversationCollection.Language,
new
PrefabCollection<NPCConversationCollection>
());
25
}
26
NPCConversationCollection
.
Collections
[npcConversationCollection.Language].Add(npcConversationCollection, allowOverriding);
27
}
28
29
public
override
void
UnloadFile
()
30
{
31
foreach
(var collection
in
NPCConversationCollection
.
Collections
.Values)
32
{
33
collection.RemoveByFile(
this
);
34
}
35
}
36
37
public
override
void
Sort
()
38
{
39
foreach
(var collection
in
NPCConversationCollection
.
Collections
.Values)
40
{
41
collection.SortAll();
42
}
43
}
44
}
45
}
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.NPCConversationCollection
Definition:
NPCConversation.cs:11
Barotrauma.NPCConversationCollection.Collections
static readonly Dictionary< LanguageIdentifier, PrefabCollection< NPCConversationCollection > > Collections
Definition:
NPCConversation.cs:12
Barotrauma.NPCConversationsFile
Definition:
NPCConversationsFile.cs:7
Barotrauma.NPCConversationsFile.UnloadFile
override void UnloadFile()
Definition:
NPCConversationsFile.cs:29
Barotrauma.NPCConversationsFile.LoadFile
override void LoadFile()
Definition:
NPCConversationsFile.cs:10
Barotrauma.NPCConversationsFile.Sort
override void Sort()
Definition:
NPCConversationsFile.cs:37
Barotrauma.NPCConversationsFile.NPCConversationsFile
NPCConversationsFile(ContentPackage contentPackage, ContentPath path)
Definition:
NPCConversationsFile.cs:8
Barotrauma.PrefabCollection
Definition:
PrefabCollection.cs:14
Barotrauma
Definition:
AchievementManager.cs:12
Barotrauma
BarotraumaShared
SharedSource
ContentManagement
ContentFile
NPCConversationsFile.cs
Generated by
1.9.1