forked from RemoteTechnologiesGroup/RemoteTech
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRTSettings.cs
More file actions
69 lines (62 loc) · 2.33 KB
/
Copy pathRTSettings.cs
File metadata and controls
69 lines (62 loc) · 2.33 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using UnityEngine;
namespace RemoteTech
{
public class RTSettings
{
private static Settings mInstance;
public static Settings Instance
{
get
{
return mInstance = mInstance ?? Settings.Load();
}
}
}
public class Settings
{
[Persistent] public float ConsumptionMultiplier = 1.0f;
[Persistent] public float RangeMultiplier = 1.0f;
[Persistent] public String ActiveVesselGuid = "35b89a0d664c43c6bec8d0840afc97b2";
[Persistent] public float SpeedOfLight = 3e8f;
[Persistent] public MapFilter MapFilter = MapFilter.Path | MapFilter.Omni | MapFilter.Dish;
[Persistent] public bool EnableSignalDelay = true;
[Persistent] public RangeModel RangeModelType = RangeModel.Standard;
[Persistent] public double MultipleAntennaMultiplier = 0.0;
[Persistent] public bool ThrottleTimeWarp = true;
[Persistent] public Color DishConnectionColor = XKCDColors.Amber;
[Persistent] public Color OmniConnectionColor = XKCDColors.BrownGrey;
[Persistent] public Color ActiveConnectionColor = XKCDColors.ElectricLime;
[Persistent(collectionIndex="STATION")]
public MissionControlSatellite[] GroundStations = new MissionControlSatellite[] { new MissionControlSatellite() };
private static String File {
get { return KSPUtil.ApplicationRootPath + "/GameData/RemoteTech2/RemoteTech_Settings.cfg"; }
}
public void Save()
{
try
{
ConfigNode save = new ConfigNode();
ConfigNode.CreateConfigFromObject(this, 0, save);
save.Save(File);
}
catch (Exception e) { RTLog.Notify("An error occurred while attempting to save: " + e.Message); }
}
public static Settings Load()
{
ConfigNode load = ConfigNode.Load(File);
Settings settings = new Settings();
if (load == null)
{
settings.Save();
return settings;
}
ConfigNode.LoadObjectFromConfig(settings, load);
return settings;
}
}
}