Elin Decompiled Documentation EA 23.316 Nightly
Loading...
Searching...
No Matches
SourceSpawnList.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3
4public class SourceSpawnList : SourceDataString<SourceSpawnList.Row>
5{
6 [Serializable]
7 public class Row : BaseRow
8 {
9 public string id;
10
11 public string parent;
12
13 public string type;
14
15 public string[] category;
16
17 public string[] idCard;
18
19 public string[] tag;
20
21 public string[] filter;
22
23 public override bool UseAlias => false;
24
25 public override string GetAlias => "n";
26
27 public override string GetEditorListName()
28 {
29 return this.GetField<string>("id") ?? "";
30 }
31 }
32
33 public static readonly IReadOnlyDictionary<string, int> RowMapping = new Dictionary<string, int>
34 {
35 ["id"] = 0,
36 ["parent"] = 2,
37 ["type"] = 3,
38 ["category"] = 4,
39 ["idCard"] = 5,
40 ["tag"] = 6,
41 ["filter"] = 7
42 };
43
44 public static readonly IReadOnlyDictionary<string, string> TypeMapping = new Dictionary<string, string>
45 {
46 ["id"] = "string",
47 ["parent"] = "string",
48 ["type"] = "string",
49 ["category"] = "string[]",
50 ["idCard"] = "string[]",
51 ["tag"] = "string[]",
52 ["filter"] = "string[]"
53 };
54
55 public override Row CreateRow()
56 {
57 return new Row
58 {
59 id = SourceData.GetString(0),
60 parent = SourceData.GetString(2),
61 type = SourceData.GetString(3),
62 category = SourceData.GetStringArray(4),
63 idCard = SourceData.GetStringArray(5),
65 filter = SourceData.GetStringArray(7)
66 };
67 }
68
69 public override Row CreateRowByMapping(IReadOnlyDictionary<string, int> mapping)
70 {
71 return new Row
72 {
73 id = SourceData.GetString(mapping["id"]),
74 parent = SourceData.GetString(mapping["parent"]),
75 type = SourceData.GetString(mapping["type"]),
76 category = SourceData.GetStringArray(mapping["category"]),
77 idCard = SourceData.GetStringArray(mapping["idCard"]),
78 tag = SourceData.GetStringArray(mapping["tag"]),
79 filter = SourceData.GetStringArray(mapping["filter"])
80 };
81 }
82
83 public override void SetRow(Row r)
84 {
85 map[r.id] = r;
86 }
87
88 public override IReadOnlyDictionary<string, int> GetRowMapping()
89 {
90 return RowMapping;
91 }
92
93 public override IReadOnlyDictionary<string, string> GetTypeMapping()
94 {
95 return TypeMapping;
96 }
97}
static string[] GetStringArray(int id)
Definition: SourceData.cs:1011
static string GetString(int id)
Definition: SourceData.cs:1016
override string GetAlias
override bool UseAlias
override string GetEditorListName()
override void SetRow(Row r)
override Row CreateRow()
static readonly IReadOnlyDictionary< string, string > TypeMapping
override Row CreateRowByMapping(IReadOnlyDictionary< string, int > mapping)
static readonly IReadOnlyDictionary< string, int > RowMapping
override IReadOnlyDictionary< string, int > GetRowMapping()
override IReadOnlyDictionary< string, string > GetTypeMapping()