Elin Modding Docs Doc
Loading...
Searching...
No Matches
ContentGallery.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using UnityEngine;
5using UnityEngine.UI;
6
7// Token: 0x02000585 RID: 1413
8public class ContentGallery : EContent
9{
10 // Token: 0x060026F7 RID: 9975 RVA: 0x000DCE18 File Offset: 0x000DB018
11 public override void OnSwitchContent(int idTab)
12 {
13 if (!this.first)
14 {
15 return;
16 }
17 if (EClass.debug.allArt)
18 {
19 EClass.player.sketches.Clear();
20 foreach (int item in EClass.core.refs.dictSketches.Keys)
21 {
22 EClass.player.sketches.Add(item);
23 }
24 }
25 this.Refresh();
26 this.first = false;
27 }
28
29 // Token: 0x060026F8 RID: 9976 RVA: 0x000DCEB0 File Offset: 0x000DB0B0
30 public void Refresh()
31 {
32 this.book.pages.Clear();
33 GridLayoutGroup[] array = this.grids;
34 for (int i = 0; i < array.Length; i++)
35 {
36 array[i].cellSize = this.gridSize[ContentGallery.listMode ? 1 : 0];
37 }
39 List<int> list = EClass.player.sketches.ToList<int>();
40 list.Sort((int a, int b) => a - b);
41 foreach (int num in list)
42 {
43 page.ids.Add(num.ToString() ?? "");
44 if (page.ids.Count >= (ContentGallery.listMode ? 8 : 2))
45 {
46 this.book.AddPage(page);
47 page = new ContentGallery.Page();
48 }
49 }
50 if (page.ids.Count > 0)
51 {
52 this.book.AddPage(page);
53 }
54 this.book.currentPage = ContentGallery.lastPage;
55 this.book.Show();
56 this.textCollected.SetText("sketch_collected".lang((list.Count * 100 / EClass.core.refs.dictSketches.Count<KeyValuePair<int, string>>()).ToString() ?? "", null, null, null, null));
57 }
58
59 // Token: 0x060026F9 RID: 9977 RVA: 0x000DD03C File Offset: 0x000DB23C
60 public void OnClickHelp()
61 {
62 LayerHelp.Toggle("other", "gallery");
63 }
64
65 // Token: 0x060026FA RID: 9978 RVA: 0x000DD050 File Offset: 0x000DB250
66 public void ToggleMode()
67 {
68 ContentGallery.listMode = !ContentGallery.listMode;
69 ContentGallery.lastPage = (ContentGallery.listMode ? (this.book.currentPage / 4) : (this.book.currentPage * 4));
70 SE.Tab();
71 this.Refresh();
72 }
73
74 // Token: 0x060026FB RID: 9979 RVA: 0x000DD09D File Offset: 0x000DB29D
75 private void OnDestroy()
76 {
77 ContentGallery.lastPage = this.book.currentPage;
78 }
79
80 // Token: 0x0400157C RID: 5500
81 public static int lastPage;
82
83 // Token: 0x0400157D RID: 5501
84 public static bool listMode;
85
86 // Token: 0x0400157E RID: 5502
87 public Transform transBig;
88
89 // Token: 0x0400157F RID: 5503
90 public Image imageBig;
91
92 // Token: 0x04001580 RID: 5504
93 public UIBook book;
94
95 // Token: 0x04001581 RID: 5505
96 public UIText textCollected;
97
98 // Token: 0x04001582 RID: 5506
99 public GridLayoutGroup[] grids;
100
101 // Token: 0x04001583 RID: 5507
102 public Vector2[] gridSize;
103
104 // Token: 0x04001584 RID: 5508
105 private bool first = true;
106
107 // Token: 0x02000ACC RID: 2764
108 public class Page : UIBook.Page
109 {
110 // Token: 0x06004213 RID: 16915 RVA: 0x0015534C File Offset: 0x0015354C
111 public override void BuildNote(UINote n, string idTopic)
112 {
113 foreach (string text in this.ids)
114 {
115 UIItem uiitem = n.AddItem("ItemGallery");
116 int num = text.ToInt();
117 Sprite sprite = Resources.Load<Sprite>("Media/Gallery/" + CoreRef.GetArtDir(num) + "/" + EClass.core.refs.dictSketches[num]);
118 uiitem.image1.sprite = sprite;
119 uiitem.text1.text = "#" + text;
120 uiitem.button1.SetOnClick(delegate
121 {
122 SE.Play("click_recipe");
123 EClass.ui.AddLayer<LayerImage>().SetImage(sprite);
124 });
125 }
126 }
127
128 // Token: 0x04002BF8 RID: 11256
129 public List<string> ids = new List<string>();
130
131 // Token: 0x02000C6D RID: 3181
132 public class Item
133 {
134 // Token: 0x040030E2 RID: 12514
135 public int id;
136
137 // Token: 0x040030E3 RID: 12515
138 public Sprite sprite;
139 }
140 }
141}