Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
SpriteReplacer.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.IO;
4using UnityEngine;
5
6public class SpriteReplacer
7{
8 public static Dictionary<string, string> dictModItems = new Dictionary<string, string>();
9
10 public bool hasChacked;
11
13
14 public bool HasSprite(string id)
15 {
16 if (!hasChacked)
17 {
18 try
19 {
20 string text = CorePath.packageCore + "Texture/Item/" + id;
21 if (dictModItems.ContainsKey(id))
22 {
23 Debug.Log(id + ":" + dictModItems[id]);
24 data = new SpriteData
25 {
26 path = dictModItems[id]
27 };
28 data.Init();
29 }
30 else if (File.Exists(text + ".png"))
31 {
32 data = new SpriteData
33 {
34 path = text
35 };
36 data.Init();
37 }
38 hasChacked = true;
39 }
40 catch (Exception ex)
41 {
42 Debug.Log("Error during fetching spirte:" + ex);
43 }
44 }
45 return data != null;
46 }
47}
void Init()
Definition: SpriteData.cs:31
SpriteData data
static Dictionary< string, string > dictModItems
bool HasSprite(string id)