Elin Modding Docs Doc
Loading...
Searching...
No Matches
LayerSleep.cs
1using System;
2using UnityEngine;
3
4// Token: 0x020005BF RID: 1471
5public class LayerSleep : ELayer
6{
7 // Token: 0x06002855 RID: 10325 RVA: 0x000E4134 File Offset: 0x000E2334
8 public override void OnAfterInit()
9 {
10 ELayer.ui.ShowCover(this.coverShow, this.coverAlpha, null, default(Color));
11 }
12
13 // Token: 0x06002856 RID: 10326 RVA: 0x000E4161 File Offset: 0x000E2361
14 public void Wait(float duration = 5f)
15 {
16 ELayer.Sound.Play("jingle_sleep");
17 TweenUtil.Tween(duration, null, delegate()
18 {
19 ELayer.ui.HideCover(this.coverHide, delegate
20 {
21 this.Close();
22 });
23 });
24 }
25
26 // Token: 0x06002857 RID: 10327 RVA: 0x000E4188 File Offset: 0x000E2388
27 public void Sleep(int _hours, Thing _bed, Thing _pillow = null)
28 {
29 ELayer.Sound.Play("jingle_sleep");
30 this.hours = _hours;
31 this.bed = _bed;
32 this.pillow = _pillow;
33 this.maxMin = this.hours * 60;
34 base.InvokeRepeating("Advance", this.repeatRate, this.repeatRate);
35 ELayer.pc.faith.Revelation("sleep", 100);
36 ELayer.player.stats.slept++;
37 }
38
39 // Token: 0x06002858 RID: 10328 RVA: 0x000E4210 File Offset: 0x000E2410
40 public void Advance()
41 {
42 if (this.min > this.maxMin)
43 {
44 base.CancelInvoke();
45 if (!ELayer._zone.IsInstance && (ELayer._zone.IsPCFaction || ELayer._zone is Zone_Field || ELayer._zone.IsRegion))
46 {
47 ELayer.player.SimulateFaction();
48 }
49 foreach (Chara chara in ELayer.pc.party.members)
50 {
51 chara.OnSleep(this.bed, 1);
52 }
53 Msg.Say("slept", this.hours.ToString() ?? "", null, null, null);
54 if (this.pillow != null && this.pillow.trait is TraitPillowOpatos)
55 {
56 ELayer.world.region.RenewRandomSites();
57 }
58 if (!ELayer.debug.ignoreAutoSave)
59 {
60 ELayer.game.Save(false, null, false);
61 }
62 if (ELayer._zone.IsRegion)
63 {
64 ELayer._zone.Region.UpdateRandomSites();
65 }
66 ELayer.ui.ShowCover(0f, 1f, null, default(Color));
67 TweenUtil.Delay(this.hideDelay, delegate
68 {
69 ELayer.ui.HideCover(this.coverHide, delegate
70 {
71 this.Close();
72 });
73 });
74 return;
75 }
76 this.min += 10;
77 ELayer.world.date.AdvanceMin(10);
78 }
79
80 // Token: 0x0400167F RID: 5759
81 public float repeatRate;
82
83 // Token: 0x04001680 RID: 5760
84 public float coverAlpha;
85
86 // Token: 0x04001681 RID: 5761
87 public float coverShow;
88
89 // Token: 0x04001682 RID: 5762
90 public float coverHide;
91
92 // Token: 0x04001683 RID: 5763
93 public float hideDelay;
94
95 // Token: 0x04001684 RID: 5764
96 private int hours;
97
98 // Token: 0x04001685 RID: 5765
99 private int min;
100
101 // Token: 0x04001686 RID: 5766
102 private int maxMin;
103
104 // Token: 0x04001687 RID: 5767
105 private Thing bed;
106
107 // Token: 0x04001688 RID: 5768
108 private Thing pillow;
109}
Definition Chara.cs:12
Definition Msg.cs:7
Definition Thing.cs:10
Definition Wait.cs:5