Elin Modding Docs Doc
Loading...
Searching...
No Matches
SourceAsset.cs
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4
5// Token: 0x0200004C RID: 76
6public class SourceAsset : EScriptable
7{
8 // Token: 0x17000042 RID: 66
9 // (get) Token: 0x060001AA RID: 426 RVA: 0x0000E6CC File Offset: 0x0000C8CC
10 public static string PrefPath
11 {
12 get
13 {
14 return Application.dataPath + "/Resources/Data/Export/";
15 }
16 }
17
18 // Token: 0x060001AB RID: 427 RVA: 0x0000E6DD File Offset: 0x0000C8DD
19 public void DoFix()
20 {
21 }
22
23 // Token: 0x060001AC RID: 428 RVA: 0x0000E6DF File Offset: 0x0000C8DF
24 public void SavePrefs(string id = "prefs")
25 {
26 SourceAsset._SavePrefs(id);
27 }
28
29 // Token: 0x060001AD RID: 429 RVA: 0x0000E6E8 File Offset: 0x0000C8E8
30 public static void _SavePrefs(string id = "prefs")
31 {
32 IO.CopyAs(SourceAsset.PrefPath + id, SourceAsset.PrefPath + id + "_bk");
34 prefs.version = 2;
35 Debug.Log(EClass.sources.things.rows.Count);
36 foreach (SourceThing.Row row in EClass.sources.things.rows)
37 {
38 if (prefs.things.dict.ContainsKey(row.id))
39 {
40 Debug.LogError("exception: duplicate id:" + row.id + "/" + row.name);
41 }
42 else
43 {
44 prefs.things.dict.Add(row.id, row.pref);
45 }
46 }
47 IO.SaveFile(SourceAsset.PrefPath + id, prefs, false, null);
48 Debug.Log("Exported Prefs:" + id);
49 }
50
51 // Token: 0x060001AE RID: 430 RVA: 0x0000E804 File Offset: 0x0000CA04
52 public void LoadPrefs()
53 {
54 SourceAsset._LoadPrefs(this.idLoad);
55 }
56
57 // Token: 0x060001AF RID: 431 RVA: 0x0000E814 File Offset: 0x0000CA14
58 public static void _LoadPrefs(string id = "prefs")
59 {
60 IO.CopyAs(SourceAsset.PrefPath + id, SourceAsset.PrefPath + id + "_loadbk");
61 SourceAsset.Prefs prefs = IO.LoadFile<SourceAsset.Prefs>(SourceAsset.PrefPath + id, false, null);
62 foreach (SourceThing.Row row in EClass.sources.things.rows)
63 {
64 if (prefs.things.dict.ContainsKey(row.id))
65 {
66 row.pref = prefs.things.dict[row.id];
67 }
68 if (prefs.version == 0)
69 {
70 row.pref.y = 0f;
71 }
72 }
73 Debug.Log("Imported Prefs:" + id);
74 }
75
76 // Token: 0x04000468 RID: 1128
77 public string idLoad = "prefs";
78
79 // Token: 0x04000469 RID: 1129
80 public UD_String_String renames;
81
82 // Token: 0x020007C5 RID: 1989
83 public class PrefData
84 {
85 // Token: 0x040021CF RID: 8655
86 public Dictionary<string, SourcePref> dict = new Dictionary<string, SourcePref>();
87 }
88
89 // Token: 0x020007C6 RID: 1990
90 public class Prefs
91 {
92 // Token: 0x040021D0 RID: 8656
93 public int version;
94
95 // Token: 0x040021D1 RID: 8657
96 public SourceAsset.PrefData things = new SourceAsset.PrefData();
97 }
98}