This repository has been archived by the owner on Nov 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
/
TransportLinesManager.cs
122 lines (103 loc) · 5.58 KB
/
TransportLinesManager.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
using ColossalFramework;
using ColossalFramework.Globalization;
using ColossalFramework.UI;
using Klyte.Commons.Extensions;
using Klyte.Commons.Interfaces;
using Klyte.Commons.Utils;
using Klyte.TransportLinesManager.CommonsWindow;
using Klyte.TransportLinesManager.Extensions;
using Klyte.TransportLinesManager.MapDrawer;
using Klyte.TransportLinesManager.OptionsMenu;
using Klyte.TransportLinesManager.Xml;
using System.Collections.Generic;
using System.Reflection;
[assembly: AssemblyVersion("14.3.0.*")]
namespace Klyte.TransportLinesManager
{
public class TransportLinesManagerMod : BasicIUserMod<TransportLinesManagerMod, TLMController, TLMPanel>
{
public override string SimpleName => "Transport Lines Manager";
public override string Description => "Allows to customize and manage your public transport systems.";
public override bool UseGroup9 => false;
protected override Dictionary<ulong, string> IncompatibleModList { get; } = new Dictionary<ulong, string>();
public TransportLinesManagerMod() : base()
{
IncompatibleModList[TLMController.IPT2_MOD_ID] = "IPT2 is incompatible since TLM changes the same code behavior. Isn't recommended to use both together.";
IncompatibleModList[TLMController.RETURN_VEHICLE_MOD_ID] = "Transport Vehicle Return Patch is not necessary to use along the TLM since version 14." +
" With the introduction of the Express Buses system, now the vehicles are emptied in the next terminal stop before get to the depot.";
}
protected override List<string> IncompatibleDllModList { get; } = new List<string>()
{
"ImprovedPublicTransport2"
};
public override void TopSettingsUI(UIHelperExtension helper) => TLMConfigOptions.instance.GenerateOptionsMenu(helper);
internal void PopulateGroup9(UIHelperExtension helper) => CreateGroup9(helper);
public override void Group9SettingsUI(UIHelperExtension group9)
{
group9.AddButton(Locale.Get("K45_TLM_DRAW_CITY_MAP"), TLMMapDrawer.DrawCityMap);
group9.AddButton("Open generated map folder", () => ColossalFramework.Utils.OpenInFileBrowser(TLMController.ExportedMapsFolder));
group9.AddSpace(2);
group9.AddButton(Locale.Get("K45_TLM_RELOAD_DEFAULT_CONFIGURATION"), () =>
{
TLMBaseConfigXML.ReloadGlobalFile();
TLMConfigOptions.instance.ReloadData();
});
if (IsCityLoaded)
{
group9.AddButton(Locale.Get("K45_TLM_SAVE_CURRENT_CITY_CONFIG_AS_DEFAULT"), () =>
{
TLMBaseConfigXML.Instance.ExportAsGlobalConfig();
TLMConfigWarehouse.GetConfig(null, null).ReloadFromDisk();
TLMConfigOptions.instance.ReloadData();
});
group9.AddButton(Locale.Get("K45_TLM_LOAD_DEFAULT_AS_CURRENT_CITY_CONFIG"), () =>
{
TLMBaseConfigXML.Instance.LoadFromGlobal();
TLMConfigOptions.instance.ReloadData();
});
}
else
{
group9.AddButton(Locale.Get("K45_TLM_SAVE_CURRENT_CITY_CONFIG_AS_DEFAULT"), TLMBaseConfigXML.GlobalFile.ExportAsGlobalConfig);
}
TLMConfigOptions.instance.ReloadData();
base.Group9SettingsUI(group9);
}
protected override void OnLevelLoadingInternal()
{
base.OnLevelLoadingInternal();
TLMController.VerifyIfIsRealTimeEnabled();
TransportSystemDefinition.TransportInfoDict.ToString();
}
private static readonly SavedBool m_savedShowNearLinesInCityServicesWorldInfoPanel = new SavedBool("K45_TLM_showNearLinesInCityServicesWorldInfoPanel", Settings.gameSettingsFile, true, true);
private static readonly SavedBool m_savedShowNearLinesInZonedBuildingWorldInfoPanel = new SavedBool("K45_TLM_showNearLinesInZonedBuildingWorldInfoPanel", Settings.gameSettingsFile, false, true);
private static readonly SavedBool m_savedUseGameClockAsReferenceIfNoDayNightCycle = new SavedBool("K45_TLM_useGameClockAsReferenceIfNoDayNightCycle", Settings.gameSettingsFile, false, true);
private static readonly SavedBool m_showDistanceInLinearMap = new SavedBool("K45_TLM_showDistanceInLinearMap", Settings.gameSettingsFile, true, true);
public static bool ShowNearLinesPlop
{
get => m_savedShowNearLinesInCityServicesWorldInfoPanel.value;
set => m_savedShowNearLinesInCityServicesWorldInfoPanel.value = value;
}
public static bool ShowNearLinesGrow
{
get => m_savedShowNearLinesInZonedBuildingWorldInfoPanel.value;
set => m_savedShowNearLinesInZonedBuildingWorldInfoPanel.value = value;
}
public static bool ShowDistanceLinearMap
{
get => m_showDistanceInLinearMap.value;
set => m_showDistanceInLinearMap.value = value;
}
public static bool UseGameClockAsReferenceIfNoDayNight
{
get => m_savedUseGameClockAsReferenceIfNoDayNightCycle.value;
set => m_savedUseGameClockAsReferenceIfNoDayNightCycle.value = value;
}
public override string IconName => "K45_TLM_Icon";
protected override Tuple<string, string> GetButtonLink() => Tuple.New("View details of v14.1 at TLM's GitHub", "https://github.com/klyte45/TransportLinesManager/issues?q=milestone%3Av14.1+is%3Aclosed");
}
public class UIButtonLineInfo : UIButton
{
public ushort lineID;
}
}