Elin Decompiled Documentation
EA 23.102 Nightly
Loading...
Searching...
No Matches
SpriteReplacerAnimation.cs
Go to the documentation of this file.
1
using
System;
2
using
System.Collections.Generic;
3
using
UnityEngine;
4
5
public
class
SpriteReplacerAnimation
: MonoBehaviour
6
{
7
public
enum
Type
8
{
9
Default
,
10
Boat
11
}
12
13
public
static
Dictionary<string, SpriteData>
dict
=
new
Dictionary<string, SpriteData>();
14
15
public
Type
type
;
16
17
public
string
id
;
18
19
public
SpriteData
data
;
20
21
[NonSerialized]
22
public
SpriteRenderer
sr
;
23
24
private
int
index
;
25
26
private
void
Awake
()
27
{
28
if
(!
id
.IsEmpty())
29
{
30
SetData
(
id
);
31
}
32
}
33
34
public
void
SetData
(
string
id
)
35
{
36
this.id =
id
;
37
string
text =
id
.IsEmpty(base.name +
"_anime"
);
38
string
path = CorePath.packageCore +
"Texture/Item/"
+ text;
39
data
=
dict
.TryGetValue(text);
40
if
(
data
==
null
)
41
{
42
data
=
new
SpriteData
43
{
44
path = path
45
};
46
data
.
Init
();
47
dict
.Add(text,
data
);
48
}
49
sr
= GetComponent<SpriteRenderer>();
50
sr.sprite =
data
.
GetSprite
();
51
if
(
type
==
Type
.Default)
52
{
53
CancelInvoke();
54
InvokeRepeating(
"Refresh"
, 0f,
data
.
time
);
55
}
56
}
57
58
private
void
Refresh
()
59
{
60
index
++;
61
if
(
index
>=
data
.
frame
)
62
{
63
index
= 0;
64
}
65
sr.sprite =
data
.
GetSprites
()[
index
];
66
}
67
}
SpriteData
Definition:
SpriteData.cs:10
SpriteData.Init
void Init()
Definition:
SpriteData.cs:31
SpriteData.frame
int frame
Definition:
SpriteData.cs:25
SpriteData.GetSprite
Sprite GetSprite(bool snow=false)
Definition:
SpriteData.cs:58
SpriteData.time
float time
Definition:
SpriteData.cs:29
SpriteData.GetSprites
Sprite[] GetSprites()
Definition:
SpriteData.cs:52
SpriteReplacerAnimation
Definition:
SpriteReplacerAnimation.cs:6
SpriteReplacerAnimation.data
SpriteData data
Definition:
SpriteReplacerAnimation.cs:19
SpriteReplacerAnimation.dict
static Dictionary< string, SpriteData > dict
Definition:
SpriteReplacerAnimation.cs:13
SpriteReplacerAnimation.type
Type type
Definition:
SpriteReplacerAnimation.cs:15
SpriteReplacerAnimation.Refresh
void Refresh()
Definition:
SpriteReplacerAnimation.cs:58
SpriteReplacerAnimation.Type
Type
Definition:
SpriteReplacerAnimation.cs:8
SpriteReplacerAnimation.Type.Default
@ Default
SpriteReplacerAnimation.Type.Boat
@ Boat
SpriteReplacerAnimation.SetData
void SetData(string id)
Definition:
SpriteReplacerAnimation.cs:34
SpriteReplacerAnimation.Awake
void Awake()
Definition:
SpriteReplacerAnimation.cs:26
SpriteReplacerAnimation.index
int index
Definition:
SpriteReplacerAnimation.cs:24
SpriteReplacerAnimation.id
string id
Definition:
SpriteReplacerAnimation.cs:17
SpriteReplacerAnimation.sr
SpriteRenderer sr
Definition:
SpriteReplacerAnimation.cs:22
Elin
Plugins.basecore
SpriteReplacerAnimation.cs
Generated by
1.9.6