-
Notifications
You must be signed in to change notification settings - Fork 1
/
ReadingSettings.cs
48 lines (39 loc) · 1.29 KB
/
ReadingSettings.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using ModSettings;
using UnityEngine;
namespace ShorterReadingIntervals {
internal class ReadingSettings : JsonModSettings {
[Name("Reading interval length")]
[Description("Sets the shortest amount of time that a book can be read for.")]
[Choice("15 minutes", "30 minutes", "60 minutes")]
public IntervalLength intervalLength = IntervalLength.MINS_30;
[Name("Count interrupted progress")]
[Description("Whether progress within a reading interval should still be counted when you're interrupted.")]
public bool allowInterruptions = true;
}
internal static class Settings {
private static ReadingSettings settings;
public static void OnLoad() {
settings = new ReadingSettings();
settings.AddToModSettings("Shorter Reading Intervals");
}
internal static float GetReadingIntervalHours() {
switch (settings.intervalLength) {
case IntervalLength.MINS_60:
return 1f;
case IntervalLength.MINS_30:
return 0.5f;
case IntervalLength.MINS_15:
return 0.25f;
default:
Debug.LogError("[ShorterReadingIntervals] Unknown interval length: " + settings.intervalLength);
return 1f;
}
}
internal static bool GetAllowInterruptions() {
return settings.allowInterruptions;
}
}
internal enum IntervalLength {
MINS_15, MINS_30, MINS_60
}
}