Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
LayerNewspaper Class Reference
Inheritance diagram for LayerNewspaper:
ELayer Layer IUISkin

Public Member Functions

override void OnInit ()
 
void OnClickPage ()
 
void RefreshPage ()
 
void OnClickComic ()
 
async void RefreshNews ()
 
void RefreshAD ()
 
async void RefreshChat ()
 
async void RefreshVote ()
 
void RefreshWeather ()
 
- Public Member Functions inherited from ELayer
override void OnBeforeAddLayer ()
 
void InitInspector ()
 
sealed override void Init ()
 
override void OnAfterAddLayer ()
 
void TryShowHelp ()
 
void AddLayerToUI (string id)
 
void TryShowHint (string _langHint=null)
 
void TalkHomeMemeber (string id)
 
void TalkMaid (string id)
 
override void OnRightClick ()
 
- Public Member Functions inherited from Layer
virtual string GetTextHeader (Window window)
 
virtual bool HeaderIsListOf (int id)
 
virtual void Init ()
 
virtual void OnInit ()
 
virtual void OnAfterInit ()
 
virtual void ApplySkin ()
 
void ShowScreenLock (string id)
 
void UpdateInput ()
 
virtual void OnUpdateInput ()
 
virtual void OnRightClick ()
 
virtual bool OnBack ()
 
virtual void OnChangeLayer ()
 
virtual void OnCreate ()
 
void _AddLayer (string id)
 
Layer AddLayer (string id)
 
AddLayer< T > ()
 
AddLayer< T > (string id)
 
AddLayerDontCloseOthers< T > ()
 
Layer AddLayerDontCloseOthers (Layer l)
 
GetOrAddLayer< T > ()
 
virtual void OnBeforeAddLayer ()
 
virtual void OnAfterAddLayer ()
 
Layer AddLayer (Layer l)
 
void ToggleLayer (string id)
 
ToggleLayer< T > (string id=null)
 
void WaitAndClose ()
 
void OnClickClose ()
 
virtual void Close ()
 
void CloseLayers ()
 
void RemoveLayers (bool removeImportant=false)
 
bool RemoveLayer< T > ()
 
void RemoveLayer (Layer l)
 
virtual void OnKill ()
 
Layer SetOnKill (Action action)
 
void DisableClose ()
 
void Delay (float duration=0.05f)
 
Layer SetDelay (float d)
 
Layer GetLayer (string id)
 
GetLayer< T > (bool fromTop=false)
 
Layer GetTopLayer ()
 
void SwitchContent (int idWindow, int i)
 
virtual void OnSwitchContent (Window window)
 
Layer SetTitles (string langList, string idHeaderRow=null)
 
bool IsBlockWidgetClick ()
 
bool IsHideHud ()
 
bool IsAllowGeneralInput ()
 
bool IsUseBlur ()
 
bool IsPointerOnLayer ()
 
void ApplySkin ()
 

Public Attributes

UIText textDate
 
UIText textFortune
 
UIText textVote
 
UIText textVoteRemaining
 
UIList listChat
 
UIList listWeather
 
UIList listVote
 
UIList listNews
 
Image imageHeadline
 
Image imageAdRight
 
Image moldAdBottom
 
List< Sprite > spritesAd
 
List< Sprite > spritesSmallAd
 
List< Sprite > spritesHeadline
 
LayoutGroup layoutAdBottom
 
LayoutGroup layoutPortrait
 
Portrait moldPortrait
 
List< string > desiredNews
 
UIButton buttonPage
 
GameObject goTop
 
GameObject goBack
 
Sprite spriteComicBig
 
bool topPage
 
- Public Attributes inherited from Layer
Option option
 
UnityEvent onKill
 
Anime animeIn
 
Anime animeOut
 
bool closeOthers
 
bool defaultActionMode = true
 
Button screenLock
 
Layer parent
 
string idLayer
 
List< Layerlayers = new List<Layer>()
 
Vector2 lastParentPos
 
List< Windowwindows = new List<Window>()
 
string langHint
 

Properties

DayData data [get]
 
- Properties inherited from ELayer
static Core core [get]
 
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static FactionBranch Branch [get]
 
static Faction Home [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static CoreConfig config [get]
 
static GameSetting setting [get]
 
static ColorProfile Colors [get]
 
static SourceManager sources [get]
 
static World world [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 
bool IsFloat [get]
 
virtual string IdHelp [get]
 
- Properties inherited from Layer
Layer TopLayer [get]
 
string uid [get]
 
virtual RectTransform rectLayers [get]
 
virtual bool blockWidgetClick [get]
 

Private Attributes

int seed
 

Additional Inherited Members

- Static Public Member Functions inherited from ELayer
static int rnd (int a)
 
- Static Public Member Functions inherited from Layer
static T Create< T > ()
 
static T Create< T > (string path)
 
static Layer Create (string path)
 
- Static Public Attributes inherited from Layer
static int skipInput
 
static bool closeOnRightClick
 
static bool rightClicked
 
static bool cancelKeyDown
 
static bool ignoreSounds
 
static Transform blurStopInstance
 
static string[] searchPath = new string[3] { "Layer", "Layer/Dialog", "Layer/LayerHome" }
 
- Protected Member Functions inherited from ELayer
sealed override void _Close ()
 
sealed override void Kill ()
 
- Protected Member Functions inherited from Layer
virtual void Awake ()
 
virtual void _Close ()
 
virtual void Kill ()
 
- Protected Attributes inherited from Layer
RectTransform _rect
 
bool isDestroyed
 

Detailed Description

Definition at line 7 of file LayerNewspaper.cs.

Member Function Documentation

◆ OnClickComic()

void LayerNewspaper.OnClickComic ( )
inline

Definition at line 97 of file LayerNewspaper.cs.

98 {
99 SE.Play("click_recipe");
100 ELayer.ui.AddLayer<LayerImage>().SetImage(spriteComicBig);
101 }
Definition: ELayer.cs:4
static UI ui
Definition: ELayer.cs:21
Sprite spriteComicBig

References spriteComicBig, and ELayer.ui.

◆ OnClickPage()

void LayerNewspaper.OnClickPage ( )
inline

Definition at line 83 of file LayerNewspaper.cs.

84 {
86 buttonPage.mainText.SetText((topPage ? "news_firstPage" : "news_secondPage").lang());
87 SE.Play("click_scroll");
89 }
UIButton buttonPage
UIText mainText
Definition: UIButton.cs:102
void SetText(string s)
Definition: UIText.cs:159

References buttonPage, UIButton.mainText, RefreshPage(), UIText.SetText(), and topPage.

◆ OnInit()

override void LayerNewspaper.OnInit ( )
inlinevirtual

Reimplemented from Layer.

Definition at line 59 of file LayerNewspaper.cs.

60 {
62 {
63 NewsList.dict = null;
65 }
66 seed = (ELayer.debug.enable ? (-1) : ELayer.world.dayData.seed);
67 Rand.UseSeed(seed, delegate
68 {
69 imageAdRight.sprite = spritesAd.RandomItem();
70 imageAdRight.SetNativeSize();
71 });
72 textDate.text = "news_date".lang(Lang.GetList("monthEng")[ELayer.world.date.month - 1], ELayer.world.date.day.ToString() ?? "", ELayer.world.date.year.ToString() ?? "");
73 int luck = (int)ELayer.world.dayData.luck;
74 textFortune.text = "news_tellLuck".lang(Lang.GetList("dayLuck")[luck], Lang.GetList("dayLuck2")[luck]);
75 RefreshAD();
81 }
bool enable
Definition: CoreDebug.cs:285
int day
Definition: Date.cs:62
int year
Definition: Date.cs:38
Luck luck
Definition: DayData.cs:15
int seed
Definition: DayData.cs:17
static World world
Definition: ELayer.cs:39
static CoreDebug debug
Definition: ELayer.cs:43
Definition: Lang.cs:6
static string[] GetList(string id)
Definition: Lang.cs:114
async void RefreshVote()
List< Sprite > spritesAd
async void RefreshChat()
async void RefreshNews()
Definition: Rand.cs:4
static void UseSeed(int seed, Action action)
Definition: Rand.cs:22
string lang
Definition: UIText.cs:9
void CreateDayData()
Definition: World.cs:43
GameDate date
Definition: World.cs:6
DayData dayData
Definition: World.cs:18

References World.CreateDayData(), World.date, Date.day, World.dayData, ELayer.debug, CoreDebug.enable, Lang.GetList(), imageAdRight, UIText.lang, DayData.luck, RefreshAD(), RefreshChat(), RefreshNews(), RefreshPage(), RefreshVote(), RefreshWeather(), DayData.seed, seed, spritesAd, textFortune, Rand.UseSeed(), ELayer.world, and Date.year.

◆ RefreshAD()

void LayerNewspaper.RefreshAD ( )
inline

Definition at line 171 of file LayerNewspaper.cs.

172 {
174 moldAdBottom = layoutAdBottom.CreateMold<Image>();
175 float num = layoutAdBottom.Rect().sizeDelta.x - 20f;
176 IList<Sprite> list = spritesSmallAd.Copy().Shuffle();
177 for (int i = 0; i < list.Count; i++)
178 {
179 Sprite sprite = list[i];
180 if (num > sprite.textureRect.width)
181 {
183 num = num - sprite.textureRect.width - 5f;
184 image.sprite = sprite;
185 image.SetNativeSize();
186 }
187 }
188 layoutAdBottom.RebuildLayout();
189 Rand.SetSeed();
190 }
LayoutGroup layoutAdBottom
List< Sprite > spritesSmallAd
static void SetSeed(int a=-1)
Definition: Rand.cs:37
Definition: Util.cs:10
static Transform Instantiate(string path, Component parent=null)
Definition: Util.cs:67

References layoutAdBottom, moldAdBottom, seed, Rand.SetSeed(), spritesSmallAd, and Util.

Referenced by OnInit().

◆ RefreshChat()

async void LayerNewspaper.RefreshChat ( )
inline

Definition at line 192 of file LayerNewspaper.cs.

193 {
194 List<Net.ChatLog> logs = await Net.GetChat(ChatCategory.Test, Lang.langCode);
195 if (isDestroyed || logs.Count == 0)
196 {
197 return;
198 }
199 listChat.callbacks = new UIList.Callback<Net.ChatLog, UIItem>
200 {
201 onInstantiate = delegate(Net.ChatLog a, UIItem b)
202 {
203 b.text1.SetText(a.msg);
204 },
205 onList = delegate
206 {
207 foreach (Net.ChatLog item in logs)
208 {
210 }
211 }
212 };
213 listChat.List();
214 }
ChatCategory
Definition: ChatCategory.cs:2
static string langCode
Definition: Lang.cs:28
bool isDestroyed
Definition: Layer.cs:98
Definition: Net.cs:11
static async UniTask< List< ChatLog > > GetChat(ChatCategory cat, string idLang)
Definition: Net.cs:350
Definition: UIItem.cs:5
UIText text1
Definition: UIItem.cs:6
Definition: UIList.cs:9
override void Add(object item)
Definition: UIList.cs:302
override void List()
Definition: UIList.cs:717

References UIList.Add(), Net.GetChat(), Layer.isDestroyed, item, Lang.langCode, UIList.List(), listChat, UIText.SetText(), and UIItem.text1.

Referenced by OnInit().

◆ RefreshNews()

async void LayerNewspaper.RefreshNews ( )
inline

Definition at line 103 of file LayerNewspaper.cs.

104 {
105 moldPortrait = layoutPortrait.CreateMold<Portrait>();
106 List<NewsList.Item> list = NewsList.GetNews(seed);
107 if (desiredNews.Count > 0)
108 {
109 for (int i = 0; i < desiredNews.Count; i++)
110 {
111 foreach (NewsList.Item item2 in NewsList.listAll)
112 {
113 if (item2.title.Contains(desiredNews[i]))
114 {
115 list[i] = item2;
116 break;
117 }
118 }
119 }
120 }
121 listNews.callbacks = new UIList.Callback<NewsList.Item, UIItem>
122 {
123 onInstantiate = delegate(NewsList.Item a, UIItem b)
124 {
125 b.text1.text = a.title;
126 b.text2.SetText(a.content);
127 },
128 onList = delegate
129 {
130 foreach (NewsList.Item item3 in list)
131 {
132 listNews.Add(item3);
133 }
134 }
135 };
136 listNews.List();
137 Rand.UseSeed(seed, delegate
138 {
139 imageHeadline.sprite = spritesHeadline.RandomItem();
140 });
141 foreach (NewsList.Item item4 in list)
142 {
143 List<string> listImageId = item4.listImageId;
144 if (listImageId.Count == 0)
145 {
146 continue;
147 }
148 Sprite sprite = Resources.Load<Sprite>("UI/Layer/LayerNewspaper/Headline/headline_" + listImageId[0]);
149 if (!sprite)
150 {
151 continue;
152 }
153 imageHeadline.sprite = sprite;
154 if (listImageId.Count <= 1)
155 {
156 break;
157 }
158 for (int j = 1; j < listImageId.Count; j++)
159 {
160 ModItem<Sprite> item = Portrait.modPortraits.GetItem(listImageId[j], returnNull: true);
161 if (item != null)
162 {
164 }
165 }
166 layoutPortrait.RebuildLayout();
167 break;
168 }
169 }
List< Sprite > spritesHeadline
List< string > desiredNews
Portrait moldPortrait
LayoutGroup layoutPortrait
ModItem< T > GetItem(string id, bool returnNull=false)
Definition: ModItemList.cs:61
static List< Item > GetNews(int seed)
Definition: NewsList.cs:80
static List< Item > listAll
Definition: NewsList.cs:17
static ModItemList< Sprite > modPortraits
Definition: Portrait.cs:12
UIText text2
Definition: UIItem.cs:8

References UIList.Add(), desiredNews, ModItemList< T >.GetItem(), NewsList.GetNews(), item, layoutPortrait, UIList.List(), NewsList.listAll, listNews, Portrait.modPortraits, moldPortrait, seed, UIText.SetText(), spritesHeadline, UIItem.text2, Rand.UseSeed(), and Util.

Referenced by OnInit().

◆ RefreshPage()

void LayerNewspaper.RefreshPage ( )
inline

Definition at line 91 of file LayerNewspaper.cs.

92 {
93 goTop.SetActive(topPage);
94 goBack.SetActive(!topPage);
95 }
GameObject goBack
GameObject goTop

References goBack, goTop, and topPage.

Referenced by OnClickPage(), and OnInit().

◆ RefreshVote()

async void LayerNewspaper.RefreshVote ( )
inline

Definition at line 216 of file LayerNewspaper.cs.

217 {
218 List<Net.VoteLog> logs = await Net.GetVote(Lang.langCode);
219 if (isDestroyed || logs.Count == 0)
220 {
221 return;
222 }
223 textVote.SetText(logs[0].name.StripBrackets());
224 int num = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
225 int num2 = (logs[0].time - num) / 60 / 60 / 24;
226 textVoteRemaining.SetText("news_voteLeft".lang(num2.ToString() ?? ""));
227 logs.RemoveAt(0);
228 logs.Sort((Net.VoteLog a, Net.VoteLog b) => b.count - a.count);
229 listVote.callbacks = new UIList.Callback<Net.VoteLog, UIItem>
230 {
231 onInstantiate = delegate(Net.VoteLog a, UIItem b)
232 {
233 b.text1.SetText(a.name);
234 b.text2.SetText(a.count.ToString() ?? "");
235 b.button1.SetOnClick(delegate
236 {
237 SE.Click();
238 Net.SendVote(a.index, Lang.langCode);
239 a.count++;
240 b.text2.SetText(a.count.ToString() ?? "");
241 foreach (UIList.ButtonPair button in listVote.buttons)
242 {
243 (button.component as UIItem).button1.SetActive(enable: false);
244 }
245 });
246 },
247 onList = delegate
248 {
249 foreach (Net.VoteLog item in logs)
250 {
252 }
253 }
254 };
255 listVote.List();
256 }
UIText textVoteRemaining
static async UniTask< List< VoteLog > > GetVote(string idLang)
Definition: Net.cs:255
static async UniTask< bool > SendVote(int id, string idLang)
Definition: Net.cs:227
UIButton button1
Definition: UIItem.cs:18
List< ButtonPair > buttons
Definition: UIList.cs:244

References UIList.Add(), UIItem.button1, UIList.buttons, Net.GetVote(), Layer.isDestroyed, item, Lang.langCode, UIList.List(), listVote, Net.SendVote(), UIText.SetText(), UIItem.text1, UIItem.text2, textVote, and textVoteRemaining.

Referenced by OnInit().

◆ RefreshWeather()

void LayerNewspaper.RefreshWeather ( )
inline

Definition at line 258 of file LayerNewspaper.cs.

259 {
261 listWeather.callbacks = new UIList.Callback<Weather.WeatherForecast, UIItem>
262 {
263 onInstantiate = delegate(Weather.WeatherForecast a, UIItem b)
264 {
265 string text = a.date.month + "/" + a.date.day;
266 foreach (KeyValuePair<Weather.Condition, int> item in a.cons.OrderByDescending((KeyValuePair<Weather.Condition, int> a) => a.Value))
267 {
268 if (b.image1.sprite == null)
269 {
270 b.image1.sprite = ELayer.core.refs.icons.weather[item.Key];
271 }
272 else if (b.image2.sprite == null)
273 {
274 b.image2.sprite = ELayer.core.refs.icons.weather[item.Key];
275 b.image2.SetActive(enable: true);
276 }
277 }
278 b.text1.text = text;
279 },
280 onList = delegate
281 {
282 for (int i = 0; i < 7; i++)
283 {
284 if (list.Count > i && list[i].cons.Count > 0)
285 {
286 listWeather.Add(list[i]);
287 }
288 }
289 }
290 };
292 }
UDIconWeather weather
Definition: CoreRef.cs:134
Icons icons
Definition: CoreRef.cs:339
CoreRef refs
Definition: Core.cs:51
static Core core
Definition: ELayer.cs:7
Image image2
Definition: UIItem.cs:16
Image image1
Definition: UIItem.cs:14
List< WeatherForecast > GetWeatherForecast()
Definition: Weather.cs:215
Weather weather
Definition: World.cs:12

References UIList.Add(), ELayer.core, Weather.GetWeatherForecast(), CoreRef.icons, UIItem.image1, UIItem.image2, item, UIList.List(), listWeather, Core.refs, CoreRef.Icons.weather, World.weather, and ELayer.world.

Referenced by OnInit().

Member Data Documentation

◆ buttonPage

UIButton LayerNewspaper.buttonPage

Definition at line 45 of file LayerNewspaper.cs.

Referenced by OnClickPage().

◆ desiredNews

List<string> LayerNewspaper.desiredNews

Definition at line 43 of file LayerNewspaper.cs.

Referenced by RefreshNews().

◆ goBack

GameObject LayerNewspaper.goBack

Definition at line 49 of file LayerNewspaper.cs.

Referenced by RefreshPage().

◆ goTop

GameObject LayerNewspaper.goTop

Definition at line 47 of file LayerNewspaper.cs.

Referenced by RefreshPage().

◆ imageAdRight

Image LayerNewspaper.imageAdRight

Definition at line 27 of file LayerNewspaper.cs.

Referenced by OnInit().

◆ imageHeadline

Image LayerNewspaper.imageHeadline

Definition at line 25 of file LayerNewspaper.cs.

◆ layoutAdBottom

LayoutGroup LayerNewspaper.layoutAdBottom

Definition at line 37 of file LayerNewspaper.cs.

Referenced by RefreshAD().

◆ layoutPortrait

LayoutGroup LayerNewspaper.layoutPortrait

Definition at line 39 of file LayerNewspaper.cs.

Referenced by RefreshNews().

◆ listChat

UIList LayerNewspaper.listChat

Definition at line 17 of file LayerNewspaper.cs.

Referenced by RefreshChat().

◆ listNews

UIList LayerNewspaper.listNews

Definition at line 23 of file LayerNewspaper.cs.

Referenced by RefreshNews().

◆ listVote

UIList LayerNewspaper.listVote

Definition at line 21 of file LayerNewspaper.cs.

Referenced by RefreshVote().

◆ listWeather

UIList LayerNewspaper.listWeather

Definition at line 19 of file LayerNewspaper.cs.

Referenced by RefreshWeather().

◆ moldAdBottom

Image LayerNewspaper.moldAdBottom

Definition at line 29 of file LayerNewspaper.cs.

Referenced by RefreshAD().

◆ moldPortrait

Portrait LayerNewspaper.moldPortrait

Definition at line 41 of file LayerNewspaper.cs.

Referenced by RefreshNews().

◆ seed

int LayerNewspaper.seed
private

Definition at line 55 of file LayerNewspaper.cs.

Referenced by OnInit(), RefreshAD(), and RefreshNews().

◆ spriteComicBig

Sprite LayerNewspaper.spriteComicBig

Definition at line 51 of file LayerNewspaper.cs.

Referenced by OnClickComic().

◆ spritesAd

List<Sprite> LayerNewspaper.spritesAd

Definition at line 31 of file LayerNewspaper.cs.

Referenced by OnInit().

◆ spritesHeadline

List<Sprite> LayerNewspaper.spritesHeadline

Definition at line 35 of file LayerNewspaper.cs.

Referenced by RefreshNews().

◆ spritesSmallAd

List<Sprite> LayerNewspaper.spritesSmallAd

Definition at line 33 of file LayerNewspaper.cs.

Referenced by RefreshAD().

◆ textDate

UIText LayerNewspaper.textDate

Definition at line 9 of file LayerNewspaper.cs.

◆ textFortune

UIText LayerNewspaper.textFortune

Definition at line 11 of file LayerNewspaper.cs.

Referenced by OnInit().

◆ textVote

UIText LayerNewspaper.textVote

Definition at line 13 of file LayerNewspaper.cs.

Referenced by RefreshVote().

◆ textVoteRemaining

UIText LayerNewspaper.textVoteRemaining

Definition at line 15 of file LayerNewspaper.cs.

Referenced by RefreshVote().

◆ topPage

bool LayerNewspaper.topPage

Definition at line 53 of file LayerNewspaper.cs.

Referenced by OnClickPage(), and RefreshPage().

Property Documentation

◆ data

DayData LayerNewspaper.data
get

Definition at line 57 of file LayerNewspaper.cs.


The documentation for this class was generated from the following file: