From a0814d5d5d322ccfc6ccd950ddf608ac4f9df9b7 Mon Sep 17 00:00:00 2001 From: Victor-Philipp Negoescu Date: Thu, 1 Dec 2016 20:33:21 +0100 Subject: [PATCH] Version 1.8.1: - Updated translations: Polish, Chinese (simplified) - Bugfix: Mod crashed when loading a second savegame --- README.md | 4 ++ TLM/TLM/LoadingExtension.cs | 10 +++-- TLM/TLM/Resources/lang_pl.txt | 66 ++++++++++++++++---------------- TLM/TLM/Resources/lang_zh-cn.txt | 60 ++++++++++++++--------------- TLM/TLM/State/GlobalConfig.cs | 9 ++--- TLM/TLM/TrafficManagerMod.cs | 2 +- TLM/TLM/UI/UIMainMenuButton.cs | 5 ++- TLM/TLM/UI/UITransportDemand.cs | 11 ++++-- 8 files changed, 90 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index b1141075..669c9201 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,10 @@ A work-in-progress modification for **Cities: Skylines** to add additional traff User manual: http://www.viathinksoft.de/tmpe # Changelog +1.8.1, 12/1/2016 +- Updated translations: Polish, Chinese (simplified) +- Bugfix: Mod crashed when loading a second savegame + 1.8.0, 11/29/2016 - Updated to game version 1.6.0-f4 - New feature: Default speed limits diff --git a/TLM/TLM/LoadingExtension.cs b/TLM/TLM/LoadingExtension.cs index 3d2cd54e..8e638a5b 100644 --- a/TLM/TLM/LoadingExtension.cs +++ b/TLM/TLM/LoadingExtension.cs @@ -1836,16 +1836,18 @@ public override void OnLevelUnloading() { } public override void OnLevelLoaded(LoadMode mode) { - Log.Info("OnLevelLoaded"); + SimulationManager.UpdateMode updateMode = SimulationManager.instance.m_metaData.m_updateMode; + Log.Info($"OnLevelLoaded({mode}) called. updateMode={updateMode}"); base.OnLevelLoaded(mode); Log._Debug("OnLevelLoaded Returned from base, calling custom code."); Instance = this; gameLoaded = false; - switch (mode) { - case LoadMode.NewGame: - case LoadMode.LoadGame: + switch (updateMode) { + case SimulationManager.UpdateMode.NewGameFromMap: + case SimulationManager.UpdateMode.NewGameFromScenario: + case SimulationManager.UpdateMode.LoadGame: if (BuildConfig.applicationVersion != BuildConfig.VersionToString(TrafficManagerMod.GameVersion, false)) { string[] majorVersionElms = BuildConfig.applicationVersion.Split('-'); string[] versionElms = majorVersionElms[0].Split('.'); diff --git a/TLM/TLM/Resources/lang_pl.txt b/TLM/TLM/Resources/lang_pl.txt index 4429ee56..66a816bd 100644 --- a/TLM/TLM/Resources/lang_pl.txt +++ b/TLM/TLM/Resources/lang_pl.txt @@ -124,36 +124,36 @@ Unit_system System jednostek Metric Metryczne Imperial Imperialne Use_more_CPU_cores_for_route_calculation_if_available Użyj więcej rdzeni procesora do obliczania tras (jeśli dostępne) -Activated_features Activated features -Junction_restrictions Junction restrictions -Prohibit_spawning_of_pocket_cars Prohibit spawning of pocket cars -Reset_stuck_cims_and_vehicles Reset stuck cims and vehicles -Default_speed_limits Default speed limits -Looking_for_a_parking_spot Looking for a parking spot -Driving_to_a_parking_spot Driving to a parking spot -Driving_to_another_parking_spot Driving to another parking spot -Entering_vehicle Entering vehicle -Walking_to_car Walking to car -Using_public_transport Using public transport -Walking Walking -Thinking_of_a_good_parking_spot Thinking of a good parking spot -Switch_view Switch view -Outgoing_demand Outgoing demand -Incoming_demand Incoming demand -Advanced_Vehicle_AI Advanced Vehicle AI -Heavy_trucks_prefer_outer_lanes_on_highways Heavy vehicles prefer outer lanes on highways -Parking_AI Parking AI -Enable_more_realistic_parking Enable more realistic parking -Reset_custom_speed_limits Reset custom speed limits -Reload_global_configuration Reload global configuration -Reset_global_configuration Reset global configuration -General General -Gameplay Gameplay -Overlays Overlays -Realistic_speeds Realistic speeds -Evacuation_busses_may_ignore_traffic_rules Evacuation busses may ignore traffic rules -Evacuation_busses_may_only_be_used_to_reach_a_shelter Evacuation busses may only be used to reach a shelter -Vehicle_behavior Vehicle behavior -Policies_&_Restrictions Policies & Restrictions -At_junctions At junctions -In_case_of_emergency In case of emergency \ No newline at end of file +Activated_features Aktywowane funkcje +Junction_restrictions Ograniczenia na skrzyżowaniach +Prohibit_spawning_of_pocket_cars Zabroń używania "kieszonkowych samochodów" +Reset_stuck_cims_and_vehicles Zresetuj zablokowane samochody i ludzi +Default_speed_limits Standardowe limity prędkości +Looking_for_a_parking_spot Poszukuje miejsca parkingowego +Driving_to_a_parking_spot Jedzie do miejsca parkingowego +Driving_to_another_parking_spot Jedzie do innego miejsca parkingowego +Entering_vehicle Wsiada do samochodu +Walking_to_car Idzie do samochodu +Using_public_transport Używa transportu publicznego +Walking Idzie +Thinking_of_a_good_parking_spot Myśli o odpowiednim miejscem parkingowym +Switch_view Zmień widok +Outgoing_demand Zapotrzebowanie - wychodzące +Incoming_demand Zapotrzebowanie - przychodzące +Advanced_Vehicle_AI Zaawansowana SI pojazdów +Heavy_trucks_prefer_outer_lanes_on_highways Samochody ciężarowe preferują zewnętrzne pasy na autostradach +Parking_AI SI parkowania +Enable_more_realistic_parking Aktywuj bardziej realistyczny system parkowania samochodów +Reset_custom_speed_limits Zresetuj limity prędkości użytkownika +Reload_global_configuration Przeładuj ustawienia globalne +Reset_global_configuration Zresetuj ustawienia globalne +General Ogólne +Gameplay Rozgrywka +Overlays Nakładki +Realistic_speeds Realistyczne prędkości +Evacuation_busses_may_ignore_traffic_rules Autobusy ewakuacyjne mogą ignorować przepisy +Evacuation_busses_may_only_be_used_to_reach_a_shelter Autobusy ewakuacyjne mogą przewozić tylko do schroniena +Vehicle_behavior Zachowanie pojazdu +Policies_&_Restrictions Zasady i Ograniczenia +At_junctions Na strzyżowaniach +In_case_of_emergency W sytuacjach nadzwyczajnych \ No newline at end of file diff --git a/TLM/TLM/Resources/lang_zh-cn.txt b/TLM/TLM/Resources/lang_zh-cn.txt index c42c0328..01ef6d8c 100644 --- a/TLM/TLM/Resources/lang_zh-cn.txt +++ b/TLM/TLM/Resources/lang_zh-cn.txt @@ -127,33 +127,33 @@ Use_more_CPU_cores_for_route_calculation_if_available 计算路线将使用更 Activated_features 激活功能 Junction_restrictions 路口管制 Prohibit_spawning_of_pocket_cars 禁止口袋胶囊汽车生产(测试版功能) -Reset_stuck_cims_and_vehicles Reset stuck cims and vehicles -Default_speed_limits Default speed limits -Looking_for_a_parking_spot Looking for a parking spot -Driving_to_a_parking_spot Driving to a parking spot -Driving_to_another_parking_spot Driving to another parking spot -Entering_vehicle Entering vehicle -Walking_to_car Walking to car -Using_public_transport Using public transport -Walking Walking -Thinking_of_a_good_parking_spot Thinking of a good parking spot -Switch_view Switch view -Outgoing_demand Outgoing demand -Incoming_demand Incoming demand -Advanced_Vehicle_AI Advanced Vehicle AI -Heavy_trucks_prefer_outer_lanes_on_highways Heavy vehicles prefer outer lanes on highways -Parking_AI Parking AI -Enable_more_realistic_parking Enable more realistic parking -Reset_custom_speed_limits Reset custom speed limits -Reload_global_configuration Reload global configuration -Reset_global_configuration Reset global configuration -General General -Gameplay Gameplay -Overlays Overlays -Realistic_speeds Realistic speeds -Evacuation_busses_may_ignore_traffic_rules Evacuation busses may ignore traffic rules -Evacuation_busses_may_only_be_used_to_reach_a_shelter Evacuation busses may only be used to reach a shelter -Vehicle_behavior Vehicle behavior -Policies_&_Restrictions Policies & Restrictions -At_junctions At junctions -In_case_of_emergency In case of emergency \ No newline at end of file +Reset_stuck_cims_and_vehicles 重置卡住的行人和车辆 +Default_speed_limits 默认速度限制 +Looking_for_a_parking_spot 寻找停车位 +Driving_to_a_parking_spot 行驶到停车位 +Driving_to_another_parking_spot 行驶到另一个停车位 +Entering_vehicle 进入车辆 +Walking_to_car 走向汽车 +Using_public_transport 使用公共交通 +Walking 步行 +Thinking_of_a_good_parking_spot 盘算一个好停车位 +Switch_view 切换视图 +Outgoing_demand 出货需求 +Incoming_demand 进货需求 +Advanced_Vehicle_AI 高级车辆AI +Heavy_trucks_prefer_outer_lanes_on_highways 大型车辆在高速公路上优先行驶右侧车道 +Parking_AI 停车AI +Enable_more_realistic_parking 启用更真实的停车位 +Reset_custom_speed_limits 重置自定义速度限制 +Reload_global_configuration 重新加载所有设定 +Reset_global_configuration 重置所有设定 +General 常规 +Gameplay 游戏 +Overlays 重叠 +Realistic_speeds 真实的速度 +Evacuation_busses_may_ignore_traffic_rules 应急疏散巴士可忽略交通规则 +Evacuation_busses_may_only_be_used_to_reach_a_shelter 应急疏散巴士仅可用于到达避难所 +Vehicle_behavior 车辆行为 +Policies_&_Restrictions 政策和限制 +At_junctions 位于十字路口 +In_case_of_emergency 在紧急情况下 \ No newline at end of file diff --git a/TLM/TLM/State/GlobalConfig.cs b/TLM/TLM/State/GlobalConfig.cs index 5eddc23c..d58093a4 100644 --- a/TLM/TLM/State/GlobalConfig.cs +++ b/TLM/TLM/State/GlobalConfig.cs @@ -29,8 +29,11 @@ public class GlobalConfig { public static GlobalConfig Instance { get; private set; } = null; + static GlobalConfig() { + Reload(); + } + internal static void OnLevelUnloading() { - Instance = null; #if RUSHHOUR rushHourConfigModifiedTime = null; lastRushHourConfigCheck = 0; @@ -53,10 +56,6 @@ internal static void OnLevelUnloading() { private static DateTime ModifiedTime = DateTime.MinValue; - static GlobalConfig() { - Reload(); - } - /// /// Configuration version /// diff --git a/TLM/TLM/TrafficManagerMod.cs b/TLM/TLM/TrafficManagerMod.cs index ea8177df..f6210b15 100644 --- a/TLM/TLM/TrafficManagerMod.cs +++ b/TLM/TLM/TrafficManagerMod.cs @@ -5,7 +5,7 @@ namespace TrafficManager { public class TrafficManagerMod : IUserMod { - public static readonly string Version = "1.8.0"; + public static readonly string Version = "1.8.1"; public static readonly uint GameVersion = 159507472u; public static readonly uint GameVersionA = 1u; diff --git a/TLM/TLM/UI/UIMainMenuButton.cs b/TLM/TLM/UI/UIMainMenuButton.cs index b3baa401..5de1bc08 100644 --- a/TLM/TLM/UI/UIMainMenuButton.cs +++ b/TLM/TLM/UI/UIMainMenuButton.cs @@ -57,10 +57,13 @@ protected override void OnClick(UIMouseEventParameter p) { protected override void OnPositionChanged() { GlobalConfig config = GlobalConfig.Instance; + bool saveConfig = (config.MainMenuButtonX != (int)absolutePosition.x || config.MainMenuButtonY != (int)absolutePosition.y); + config.MainMenuButtonX = (int)absolutePosition.x; config.MainMenuButtonY = (int)absolutePosition.y; - GlobalConfig.WriteConfig(); + if (saveConfig) + GlobalConfig.WriteConfig(); } internal void UpdateSprites() { diff --git a/TLM/TLM/UI/UITransportDemand.cs b/TLM/TLM/UI/UITransportDemand.cs index 32653ddb..2d1783d0 100644 --- a/TLM/TLM/UI/UITransportDemand.cs +++ b/TLM/TLM/UI/UITransportDemand.cs @@ -81,9 +81,14 @@ private void clickSwitchViewMode(UIComponent component, UIMouseEventParameter ev private void ParentVisibilityChanged(UIComponent component, bool value) { Log._Debug($"Public transport info view panel changed visibility: {value}"); - if (value && Options.prohibitPocketCars) - this.Show(); - else + if (value && Options.prohibitPocketCars) { + TrafficManagerTool.CurrentTransportDemandViewMode = TransportDemandViewMode.Outgoing; + if (viewModeLabel != null) + viewModeLabel.text = Translation.GetString("Outgoing_demand"); + if (switchViewModeButton != null) + switchViewModeButton.text = Translation.GetString("Switch_view"); + this.Show(); + } else this.Hide(); } }