2using System.Globalization;
35 if (File.Exists(
path +
".ini"))
37 IniData iniData =
new FileIniDataParser().ReadFile(
path +
".ini", Encoding.UTF8);
38 frame =
int.Parse(iniData.GetKey(
"frame") ??
"1");
39 scale =
int.Parse(iniData.GetKey(
"scale") ??
"50");
40 time =
float.Parse(iniData.GetKey(
"time") ??
"0.2", CultureInfo.InvariantCulture);
43 catch (Exception message)
46 Debug.Log(
"exception: Failed to parse:" +
path +
".ini");
61 if (File.Exists(
path +
".pref"))
79 DateTime lastWriteTime = File.GetLastWriteTime(
path +
".png");
80 bool flag = date.Year != 1 &&
date == lastWriteTime;
84 if (File.Exists(
path +
"_snow.png"))
92 public void Load(
bool dateMatched, ref Texture2D
tex, ref Sprite[]
sprites,
string suffix)
94 if (dateMatched && (
bool)
tex)
100 Texture2D texture2D = IO.LoadPNG(
path + suffix +
".png");
101 if (texture2D.width !=
tex.width || texture2D.height !=
tex.height)
103 Debug.Log(texture2D.width +
"/" + texture2D.height +
"/" +
path);
104 tex.Reinitialize(texture2D.width, texture2D.height);
106 tex.SetPixels32(texture2D.GetPixels32());
108 UnityEngine.Object.Destroy(texture2D);
112 tex = IO.LoadPNG(
path + suffix +
".png");
113 int num = tex.width /
frame;
114 int height =
tex.height;
116 for (
int i = 0; i <
frame; i++)
118 sprites[i] = Sprite.Create(
tex,
new Rect(i * num, 0f, num, height),
new Vector2(0.5f, 0.5f), 100f, 0u, SpriteMeshType.FullRect);
static SourcePref ReadFromIni(string path)
Sprite GetSprite(bool snow=false)
void Load(bool dateMatched, ref Texture2D tex, ref Sprite[] sprites, string suffix)