Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
TimeTable.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2
3public class TimeTable : EClass
4{
5 public enum Span
6 {
7 Free,
8 Eat,
9 Work,
10 Sleep
11 }
12
13 public static Dictionary<string, TimeTable> dict = new Dictionary<string, TimeTable>();
14
15 private static bool unityInit;
16
17 public Span[] spans = new Span[24];
18
19 public static void Init()
20 {
21 if (!unityInit)
22 {
23 Add("zzzzzz ewwwwwwwwwwe z", "default");
24 Add("zzzzzz ewwwwwwwwwwe z", "owl");
25 unityInit = true;
26 }
27 }
28
29 public static TimeTable Add(string raw, string id)
30 {
31 TimeTable timeTable = new TimeTable();
32 for (int i = 0; i < 24; i++)
33 {
34 timeTable.spans[i] = GetSpan(raw[i]);
35 }
36 dict.Add(id, timeTable);
37 return timeTable;
38 }
39
40 public static TimeTable GetTimeTable(string id)
41 {
42 return dict[id];
43 }
44
45 public static Span GetSpan(string id, int hour)
46 {
47 return dict[id].spans[hour];
48 }
49
50 private static Span GetSpan(char s)
51 {
52 return s switch
53 {
54 'z' => Span.Sleep,
55 'e' => Span.Eat,
56 'w' => Span.Work,
57 _ => Span.Free,
58 };
59 }
60
61 public Span GetSpan(int hour)
62 {
63 return Span.Free;
64 }
65}
Definition: EClass.cs:5
static bool unityInit
Definition: TimeTable.cs:15
Span GetSpan(int hour)
Definition: TimeTable.cs:61
Span[] spans
Definition: TimeTable.cs:17
static void Init()
Definition: TimeTable.cs:19
static Span GetSpan(string id, int hour)
Definition: TimeTable.cs:45
static Dictionary< string, TimeTable > dict
Definition: TimeTable.cs:13
static TimeTable Add(string raw, string id)
Definition: TimeTable.cs:29
static Span GetSpan(char s)
Definition: TimeTable.cs:50
static TimeTable GetTimeTable(string id)
Definition: TimeTable.cs:40