17 return ELayer.world.dayData;
22 public override void OnInit()
27 ELayer.world.CreateDayData();
29 this.seed = (ELayer.debug.enable ? -1 :
ELayer.world.dayData.seed);
30 Rand.UseSeed(this.seed, delegate
32 this.imageAdRight.sprite = this.spritesAd.RandomItem<Sprite>();
33 this.imageAdRight.SetNativeSize();
35 this.textDate.text =
"news_date".lang(Lang.GetList(
"monthEng")[
ELayer.world.date.month - 1],
ELayer.world.date.day.ToString() ??
"",
ELayer.world.date.year.ToString() ??
"",
null,
null);
36 int luck = (int)
ELayer.world.dayData.luck;
37 this.textFortune.text =
"news_tellLuck".lang(Lang.GetList(
"dayLuck")[luck], Lang.GetList(
"dayLuck2")[luck],
null,
null,
null);
41 this.RefreshWeather();
47 public void OnClickPage()
49 this.topPage = !this.topPage;
50 this.buttonPage.mainText.SetText((this.topPage ?
"news_firstPage" :
"news_secondPage").lang());
51 SE.Play(
"click_scroll");
56 public void RefreshPage()
58 this.goTop.SetActive(this.topPage);
59 this.goBack.SetActive(!this.topPage);
63 public void RefreshNews()
66 <RefreshNews>d__.<>t__builder = AsyncVoidMethodBuilder.Create();
67 <RefreshNews>d__.<>4__this =
this;
68 <RefreshNews>d__.<>1__state = -1;
69 <RefreshNews>d__.<>t__builder.Start<
LayerNewspaper.<RefreshNews>d__28>(ref <RefreshNews>d__);
73 public void RefreshAD()
75 Rand.SetSeed(this.seed);
76 this.moldAdBottom = this.layoutAdBottom.CreateMold(
null);
77 float num = this.layoutAdBottom.Rect().sizeDelta.x - 20f;
78 IList<Sprite> list = this.spritesSmallAd.Copy<Sprite>().Shuffle<Sprite>();
79 for (
int i = 0; i < list.Count; i++)
81 Sprite sprite = list[i];
82 if (num > sprite.textureRect.width)
84 Image image = Util.Instantiate<Image>(this.moldAdBottom, this.layoutAdBottom);
85 num = num - sprite.textureRect.width - 5f;
86 image.sprite = sprite;
87 image.SetNativeSize();
90 this.layoutAdBottom.RebuildLayout(
false);
95 public void RefreshChat()
98 <RefreshChat>d__.<>t__builder = AsyncVoidMethodBuilder.Create();
99 <RefreshChat>d__.<>4__this =
this;
100 <RefreshChat>d__.<>1__state = -1;
101 <RefreshChat>d__.<>t__builder.Start<
LayerNewspaper.<RefreshChat>d__30>(ref <RefreshChat>d__);
105 public void RefreshVote()
108 <RefreshVote>d__.<>t__builder = AsyncVoidMethodBuilder.Create();
109 <RefreshVote>d__.<>4__this =
this;
110 <RefreshVote>d__.<>1__state = -1;
111 <RefreshVote>d__.<>t__builder.Start<
LayerNewspaper.<RefreshVote>d__31>(ref <RefreshVote>d__);
115 public void RefreshWeather()
118 BaseList baseList = this.listWeather;
122 string text = a.date.month.ToString() +
"/" + a.date.day.ToString();
123 foreach (KeyValuePair<Weather.Condition, int> keyValuePair
in from a
in a.cons
124 orderby a.Value descending
127 if (b.image1.sprite ==
null)
129 b.image1.sprite =
ELayer.core.refs.icons.weather[keyValuePair.Key];
131 else if (b.image2.sprite ==
null)
133 b.image2.sprite =
ELayer.core.refs.icons.weather[keyValuePair.Key];
134 b.image2.SetActive(
true);
139 callback.onList = delegate(UIList.SortMode m)
141 for (
int i = 0; i < 7; i++)
143 if (list.Count > i && list[i].cons.Count > 0)
145 this.listWeather.Add(list[i]);
149 baseList.callbacks = callback;
150 this.listWeather.List(
false);
154 public UIText textDate;
157 public UIText textFortune;
160 public UIText textVote;
163 public UIText textVoteRemaining;
166 public UIList listChat;
169 public UIList listWeather;
172 public UIList listVote;
175 public UIList listNews;
178 public Image imageHeadline;
181 public Image imageAdRight;
184 public Image moldAdBottom;
187 public List<Sprite> spritesAd;
190 public List<Sprite> spritesSmallAd;
193 public List<Sprite> spritesHeadline;
196 public LayoutGroup layoutAdBottom;
199 public LayoutGroup layoutPortrait;
205 public List<string> desiredNews;
208 public UIButton buttonPage;
211 public GameObject goTop;
214 public GameObject goBack;