Elin Modding Docs Doc
Loading...
Searching...
No Matches
SourceBlock.cs
1using System;
2using System.Collections.Generic;
3
4// Token: 0x02000011 RID: 17
5public class SourceBlock : SourceDataInt<SourceBlock.Row>
6{
7 // Token: 0x060000D9 RID: 217 RVA: 0x00009394 File Offset: 0x00007594
8 public override SourceBlock.Row CreateRow()
9 {
10 return new SourceBlock.Row
11 {
12 id = SourceData.GetInt(0),
13 alias = SourceData.GetString(1),
14 name_JP = SourceData.GetString(2),
15 name = SourceData.GetString(3),
16 sort = SourceData.GetInt(4),
17 reqHarvest = SourceData.GetStringArray(5),
18 hp = SourceData.GetInt(6),
19 idThing = SourceData.GetString(7),
20 _tileType = SourceData.GetString(8),
21 _idRenderData = SourceData.GetString(9),
22 tiles = SourceData.GetIntArray(10),
23 snowTile = SourceData.GetInt(11),
24 colorMod = SourceData.GetInt(12),
25 colorType = SourceData.GetString(13),
26 value = SourceData.GetInt(14),
27 LV = SourceData.GetInt(15),
28 recipeKey = SourceData.GetStringArray(16),
29 factory = SourceData.GetStringArray(17),
30 components = SourceData.GetStringArray(18),
31 defMat = SourceData.GetString(19),
32 category = SourceData.GetString(20),
33 roof = SourceData.GetInt(21),
34 autoFloor = SourceData.GetString(22),
35 concrete = SourceData.GetBool(23),
36 transparent = SourceData.GetBool(24),
37 transition = SourceData.GetIntArray(25),
38 tag = SourceData.GetStringArray(26),
39 soundFoot = SourceData.GetString(27),
40 detail_JP = SourceData.GetString(28),
41 detail = SourceData.GetString(29)
42 };
43 }
44
45 // Token: 0x060000DA RID: 218 RVA: 0x00009523 File Offset: 0x00007723
46 public override void SetRow(SourceBlock.Row r)
47 {
48 this.map[r.id] = r;
49 }
50
51 // Token: 0x060000DB RID: 219 RVA: 0x00009538 File Offset: 0x00007738
52 public override void BackupPref()
53 {
54 this._rows.Clear();
55 foreach (SourceBlock.Row row in this.rows)
56 {
57 this._rows[row.id] = row;
58 }
59 }
60
61 // Token: 0x060000DC RID: 220 RVA: 0x000095A4 File Offset: 0x000077A4
62 public override void RestorePref()
63 {
64 foreach (SourceBlock.Row row in this.rows)
65 {
66 RenderRow renderRow = row;
67 SourceBlock.Row row2 = this._rows.TryGetValue(row.id, null);
68 renderRow.pref = (((row2 != null) ? row2.pref : null) ?? new SourcePref());
69 }
70 }
71
72 // Token: 0x060000DD RID: 221 RVA: 0x00009620 File Offset: 0x00007820
73 public override void ValidatePref()
74 {
75 foreach (SourceBlock.Row row in this.rows)
76 {
77 row.pref.Validate();
78 }
79 }
80
81 // Token: 0x060000DE RID: 222 RVA: 0x00009678 File Offset: 0x00007878
82 public override void OnAfterImportData()
83 {
84 int num = 0;
85 foreach (SourceBlock.Row row in this.rows)
86 {
87 if (row.sort != 0)
88 {
89 num = row.sort;
90 }
91 row.sort = num;
92 num++;
93 }
94 this.rows.Sort((SourceBlock.Row a, SourceBlock.Row b) => a.id - b.id);
95 }
96
97 // Token: 0x060000DF RID: 223 RVA: 0x0000970C File Offset: 0x0000790C
98 public override void OnInit()
99 {
100 SourceBlock.FallbackRenderData = ResourceCache.Load<RenderData>("Scene/Render/Data/block");
101 Cell.blockList = this.rows;
102 SourceFloor floors = Core.Instance.sources.floors;
103 foreach (SourceBlock.Row row in this.rows)
104 {
105 row.Init();
106 row.sourceAutoFloor = (row.autoFloor.IsEmpty() ? floors.rows[40] : floors.alias[row.autoFloor]);
107 }
108 }
109
110 // Token: 0x040000D0 RID: 208
111 public Dictionary<int, SourceBlock.Row> _rows = new Dictionary<int, SourceBlock.Row>();
112
113 // Token: 0x040000D1 RID: 209
114 public static RenderData FallbackRenderData;
115
116 // Token: 0x02000790 RID: 1936
117 [Serializable]
118 public class Row : TileRow
119 {
120 // Token: 0x170010BF RID: 4287
121 // (get) Token: 0x060036FA RID: 14074 RVA: 0x0012A09A File Offset: 0x0012829A
122 public override bool UseAlias
123 {
124 get
125 {
126 return true;
127 }
128 }
129
130 // Token: 0x170010C0 RID: 4288
131 // (get) Token: 0x060036FB RID: 14075 RVA: 0x0012A09D File Offset: 0x0012829D
132 public override string GetAlias
133 {
134 get
135 {
136 return this.alias;
137 }
138 }
139
140 // Token: 0x170010C1 RID: 4289
141 // (get) Token: 0x060036FC RID: 14076 RVA: 0x0012A0A5 File Offset: 0x001282A5
142 public override string RecipeID
143 {
144 get
145 {
146 return "b" + this.id.ToString();
147 }
148 }
149
150 // Token: 0x170010C2 RID: 4290
151 // (get) Token: 0x060036FD RID: 14077 RVA: 0x0012A0BC File Offset: 0x001282BC
152 public override RenderData defaultRenderData
153 {
154 get
155 {
156 return SourceBlock.FallbackRenderData;
157 }
158 }
159
160 // Token: 0x060036FE RID: 14078 RVA: 0x0012A0C3 File Offset: 0x001282C3
161 public override void OnInit()
162 {
163 this.isBlockOrRamp = (this.tileType == TileType.Block || this.tileType.IsRamp);
164 }
165
166 // Token: 0x060036FF RID: 14079 RVA: 0x0012A0E6 File Offset: 0x001282E6
167 public override int GetTile(SourceMaterial.Row mat, int dir = 0)
168 {
169 return this._tiles[dir % this._tiles.Length];
170 }
171
172 // Token: 0x06003700 RID: 14080 RVA: 0x0012A0FC File Offset: 0x001282FC
173 public override RenderParam GetRenderParam(SourceMaterial.Row mat, int dir, Point point = null, int bridgeHeight = -1)
174 {
175 RenderParam renderParam = base.GetRenderParam(mat, dir, point, bridgeHeight);
176 if (this.tileType == TileType.HalfBlock)
177 {
178 int num = 104025;
179 SourceBlock.Row row = (this.id == 5) ? base.sources.blocks.rows[mat.defBlock] : this;
180 renderParam.tile = (float)row._tiles[0];
181 renderParam.matColor = (float)((row.colorMod == 0) ? num : BaseTileMap.GetColorInt(ref mat.matColor, row.colorMod));
182 renderParam.tile2 = row.sourceAutoFloor._tiles[0];
183 renderParam.halfBlockColor = ((row.sourceAutoFloor.colorMod == 0) ? num : BaseTileMap.GetColorInt(ref mat.matColor, row.sourceAutoFloor.colorMod));
184 }
185 return renderParam;
186 }
187
188 // Token: 0x04001EFB RID: 7931
189 public string[] reqHarvest;
190
191 // Token: 0x04001EFC RID: 7932
192 public string idThing;
193
194 // Token: 0x04001EFD RID: 7933
195 public int roof;
196
197 // Token: 0x04001EFE RID: 7934
198 public string autoFloor;
199
200 // Token: 0x04001EFF RID: 7935
201 public bool concrete;
202
203 // Token: 0x04001F00 RID: 7936
204 public bool transparent;
205
206 // Token: 0x04001F01 RID: 7937
207 public int[] transition;
208
209 // Token: 0x04001F02 RID: 7938
210 [NonSerialized]
211 public bool isBlockOrRamp;
212
213 // Token: 0x04001F03 RID: 7939
214 [NonSerialized]
215 public SourceFloor.Row sourceAutoFloor;
216
217 // Token: 0x04001F04 RID: 7940
218 public string name_L;
219
220 // Token: 0x04001F05 RID: 7941
221 public string detail_L;
222 }
223}
Definition Point.cs:11