-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDvTimeAdapter.cs
More file actions
44 lines (40 loc) · 925 Bytes
/
DvTimeAdapter.cs
File metadata and controls
44 lines (40 loc) · 925 Bytes
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
using RedworkDE.DvTime;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace ProceduralSkyMod
{
public static class DvTimeAdapter
{
static DvTimeAdapter()
{
try
{
DoInitialize(); // separate function to be able to catch dll load exceptions when DvTime is not installed
}
catch (Exception ex)
{
#if DEBUG
Debug.Log($"unable to load DVTime: {ex}");
#endif
}
}
private static void DoInitialize()
{
#if DEBUG
Debug.Log($">>> >>> >>> initializing DvTimeAdapter");
#endif
_ = CurrentTime.Time;
GetTime = () => CurrentTime.Time;
}
public static void InstallProSkyTimeSource (List<ITimeSource> sources)
{
#if DEBUG
Debug.Log($">>> >>> >>> installing ProceduralSkyTimeSource");
#endif
sources.Insert(0, ProceduralSkyTimeSource.Instance);
}
public static bool Available => GetTime != null;
public static Func<DateTime> GetTime;
}
}