Elin Modding Docs Doc
Loading...
Searching...
No Matches
TextureReplace.cs
1using System;
2using System.IO;
3using UnityEngine;
4
5// Token: 0x02000132 RID: 306
6public class TextureReplace
7{
8 // Token: 0x170001C8 RID: 456
9 // (get) Token: 0x06000831 RID: 2097 RVA: 0x000361EF File Offset: 0x000343EF
10 public bool user
11 {
12 get
13 {
14 return this.source == TextureReplace.Source.User;
15 }
16 }
17
18 // Token: 0x06000832 RID: 2098 RVA: 0x000361FC File Offset: 0x000343FC
19 public void TryRefresh(bool force)
20 {
21 if (!File.Exists(this.file.FullName))
22 {
23 return;
24 }
25 DateTime lastWriteTime = File.GetLastWriteTime(this.file.FullName);
26 bool flag = this.date.Year != 1 && this.date.Equals(lastWriteTime);
27 if (!flag || force || !this.tex)
28 {
29 this.Load(flag);
30 }
31 this.date = lastWriteTime;
32 }
33
34 // Token: 0x06000833 RID: 2099 RVA: 0x00036270 File Offset: 0x00034470
35 public void Load(bool dateMatched)
36 {
37 if (this.tex)
38 {
39 UnityEngine.Object.Destroy(this.tex);
40 }
41 this.tex = IO.LoadPNG(this.file.FullName, FilterMode.Point);
42 this.w = this.tex.width;
43 this.h = this.tex.height;
44 int dstX = this.index % 100 * this.data.tileW;
45 int dstY = this.data.tex.height - this.index / 100 * this.data.tileH - this.tex.height;
46 Graphics.CopyTexture(this.tex, 0, 0, 0, 0, this.tex.width, this.tex.height, this.data.tex, 0, 0, dstX, dstY);
47 }
48
49 // Token: 0x06000834 RID: 2100 RVA: 0x0003634B File Offset: 0x0003454B
50 public void DestoryTex()
51 {
52 UnityEngine.Object.Destroy(this.tex);
53 }
54
55 // Token: 0x0400088E RID: 2190
56 public DateTime date;
57
58 // Token: 0x0400088F RID: 2191
59 public Texture2D tex;
60
61 // Token: 0x04000890 RID: 2192
62 public FileInfo file;
63
64 // Token: 0x04000891 RID: 2193
65 public TextureData data;
66
67 // Token: 0x04000892 RID: 2194
68 public int index;
69
70 // Token: 0x04000893 RID: 2195
71 public int w;
72
73 // Token: 0x04000894 RID: 2196
74 public int h;
75
76 // Token: 0x04000895 RID: 2197
77 public TextureReplace.Source source;
78
79 // Token: 0x04000896 RID: 2198
80 public TextureReplace original;
81
82 // Token: 0x02000858 RID: 2136
83 public enum Source
84 {
85 // Token: 0x040023AC RID: 9132
86 User,
87 // Token: 0x040023AD RID: 9133
88 Mod,
89 // Token: 0x040023AE RID: 9134
90 Local
91 }
92}