Elin Decompiled Documentation
EA 23.102 Nightly
Loading...
Searching...
No Matches
ContentGallery.cs
Go to the documentation of this file.
1
using
System.Collections.Generic;
2
using
System.Linq;
3
using
UnityEngine;
4
using
UnityEngine.UI;
5
6
public
class
ContentGallery
:
EContent
7
{
8
public
class
Page
:
UIBook
.
Page
9
{
10
public
class
Item
11
{
12
public
int
id
;
13
14
public
Sprite
sprite
;
15
}
16
17
public
List<string>
ids
=
new
List<string>();
18
19
public
override
void
BuildNote
(
UINote
n,
string
idTopic)
20
{
21
foreach
(
string
id
in
ids
)
22
{
23
UIItem
uIItem = n.AddItem(
"ItemGallery"
);
24
int
num =
id
.ToInt();
25
Sprite sprite = Resources.Load<Sprite>(
"Media/Gallery/"
+
CoreRef
.
GetArtDir
(num) +
"/"
+
EClass
.
core
.
refs
.
dictSketches
[num]);
26
uIItem.image1.sprite = sprite;
27
uIItem.text1.text =
"#"
+ id;
28
uIItem.
button1
.SetOnClick(delegate
29
{
30
SE.Play(
"click_recipe"
);
31
EClass
.
ui
.AddLayer<
LayerImage
>().SetImage(sprite);
32
});
33
}
34
}
35
}
36
37
public
static
int
lastPage
;
38
39
public
static
bool
listMode
;
40
41
public
Transform
transBig
;
42
43
public
Image
imageBig
;
44
45
public
UIBook
book
;
46
47
public
UIText
textCollected
;
48
49
public
GridLayoutGroup[]
grids
;
50
51
public
Vector2[]
gridSize
;
52
53
private
bool
first
=
true
;
54
55
public
override
void
OnSwitchContent
(
int
idTab)
56
{
57
if
(!
first
)
58
{
59
return
;
60
}
61
if
(
EClass
.
debug
.
allArt
)
62
{
63
EClass
.
player
.
sketches
.Clear();
64
foreach
(
int
key
in
EClass
.
core
.
refs
.
dictSketches
.
Keys
)
65
{
66
EClass
.
player
.
sketches
.Add(key);
67
}
68
}
69
Refresh
();
70
first
=
false
;
71
}
72
73
public
void
Refresh
()
74
{
75
book
.
pages
.Clear();
76
GridLayoutGroup[] array =
grids
;
77
for
(
int
i = 0; i < array.Length; i++)
78
{
79
array[i].cellSize =
gridSize
[
listMode
? 1 : 0];
80
}
81
Page
page =
new
Page
();
82
List<int> list =
EClass
.
player
.
sketches
.ToList();
83
list.Sort((
int
a,
int
b) => a - b);
84
foreach
(
int
item
in
list)
85
{
86
page.ids.Add(
item
.ToString() ??
""
);
87
if
(page.ids.Count >= (
listMode
? 8 : 2))
88
{
89
book
.
AddPage
(page);
90
page =
new
Page
();
91
}
92
}
93
if
(page.ids.Count > 0)
94
{
95
book
.
AddPage
(page);
96
}
97
book.currentPage =
lastPage
;
98
book
.
Show
();
99
textCollected
.
SetText
(
"sketch_collected"
.lang((list.Count * 100 /
EClass
.
core
.
refs
.
dictSketches
.
Count
()).ToString() ??
""
));
100
}
101
102
public
void
OnClickHelp
()
103
{
104
LayerHelp
.
Toggle
(
"other"
,
"gallery"
);
105
}
106
107
public
void
ToggleMode
()
108
{
109
listMode
= !
listMode
;
110
lastPage
= (
listMode
? (book.currentPage / 4) : (
book
.
currentPage
* 4));
111
SE.Tab();
112
Refresh
();
113
}
114
115
private
void
OnDestroy
()
116
{
117
lastPage
=
book
.
currentPage
;
118
}
119
}
ContainerFlag.item
@ item
ContentGallery.Page.Item
Definition:
ContentGallery.cs:11
ContentGallery.Page.Item.id
int id
Definition:
ContentGallery.cs:12
ContentGallery.Page.Item.sprite
Sprite sprite
Definition:
ContentGallery.cs:14
ContentGallery.Page
Definition:
ContentGallery.cs:9
ContentGallery.Page.ids
List< string > ids
Definition:
ContentGallery.cs:17
ContentGallery.Page.BuildNote
override void BuildNote(UINote n, string idTopic)
Definition:
ContentGallery.cs:19
ContentGallery
Definition:
ContentGallery.cs:7
ContentGallery.listMode
static bool listMode
Definition:
ContentGallery.cs:39
ContentGallery.gridSize
Vector2[] gridSize
Definition:
ContentGallery.cs:51
ContentGallery.lastPage
static int lastPage
Definition:
ContentGallery.cs:37
ContentGallery.transBig
Transform transBig
Definition:
ContentGallery.cs:41
ContentGallery.first
bool first
Definition:
ContentGallery.cs:53
ContentGallery.OnSwitchContent
override void OnSwitchContent(int idTab)
Definition:
ContentGallery.cs:55
ContentGallery.Refresh
void Refresh()
Definition:
ContentGallery.cs:73
ContentGallery.ToggleMode
void ToggleMode()
Definition:
ContentGallery.cs:107
ContentGallery.OnClickHelp
void OnClickHelp()
Definition:
ContentGallery.cs:102
ContentGallery.book
UIBook book
Definition:
ContentGallery.cs:45
ContentGallery.OnDestroy
void OnDestroy()
Definition:
ContentGallery.cs:115
ContentGallery.imageBig
Image imageBig
Definition:
ContentGallery.cs:43
ContentGallery.grids
GridLayoutGroup[] grids
Definition:
ContentGallery.cs:49
ContentGallery.textCollected
UIText textCollected
Definition:
ContentGallery.cs:47
CoreDebug.allArt
bool allArt
Definition:
CoreDebug.cs:196
CoreRef
Definition:
CoreRef.cs:7
CoreRef.dictSketches
UD_Int_String dictSketches
Definition:
CoreRef.cs:397
CoreRef.GetArtDir
static string GetArtDir(int a)
Definition:
CoreRef.cs:473
Core.refs
CoreRef refs
Definition:
Core.cs:51
EClass
Definition:
EClass.cs:5
EClass.core
static Core core
Definition:
EClass.cs:6
EClass.player
static Player player
Definition:
EClass.cs:12
EClass.debug
static CoreDebug debug
Definition:
EClass.cs:48
EClass.ui
static UI ui
Definition:
EClass.cs:16
EContent
Definition:
EContent.cs:2
LayerHelp
Definition:
LayerHelp.cs:2
LayerHelp.Toggle
static void Toggle(string idFile, string idTopic=null)
Definition:
LayerHelp.cs:32
LayerImage
Definition:
LayerImage.cs:5
Player.sketches
HashSet< int > sketches
Definition:
Player.cs:871
UDictionary.Keys
ICollection< TKey > Keys
Definition:
UDictionary.cs:25
UDictionary.Count
int Count
Definition:
UDictionary.cs:64
UIBook
Definition:
UIBook.cs:9
UIBook.currentPage
int currentPage
Definition:
UIBook.cs:264
UIBook.AddPage
void AddPage(Page page)
Definition:
UIBook.cs:538
UIBook.Show
void Show(string _idFile=null, string _idTopic=null, string title=null, BookList.Item _bookItem=null)
Definition:
UIBook.cs:457
UIBook.pages
List< Page > pages
Definition:
UIBook.cs:266
UIItem
Definition:
UIItem.cs:5
UIItem.button1
UIButton button1
Definition:
UIItem.cs:18
UINote
Definition:
UINote.cs:6
UIText
Definition:
UIText.cs:6
UIText.SetText
void SetText(string s)
Definition:
UIText.cs:159
Elin
ContentGallery.cs
Generated by
1.9.6