diff --git a/TLM/TLM/Resources/MainMenu/MainMenuButton-bg-active.png b/TLM/TLM/Resources/MainMenu/MainMenuButton-bg-active.png index cb20579df..66ea7258b 100644 Binary files a/TLM/TLM/Resources/MainMenu/MainMenuButton-bg-active.png and b/TLM/TLM/Resources/MainMenu/MainMenuButton-bg-active.png differ diff --git a/TLM/TLM/Resources/MainMenu/MainMenuButton-bg-hovered.png b/TLM/TLM/Resources/MainMenu/MainMenuButton-bg-hovered.png index 7077eac51..754265d5a 100644 Binary files a/TLM/TLM/Resources/MainMenu/MainMenuButton-bg-hovered.png and b/TLM/TLM/Resources/MainMenu/MainMenuButton-bg-hovered.png differ diff --git a/TLM/TLM/Resources/MainMenu/MainMenuButton-bg-normal.png b/TLM/TLM/Resources/MainMenu/MainMenuButton-bg-normal.png index 651080f50..1592039a5 100644 Binary files a/TLM/TLM/Resources/MainMenu/MainMenuButton-bg-normal.png and b/TLM/TLM/Resources/MainMenu/MainMenuButton-bg-normal.png differ diff --git a/TLM/TLM/Resources/MainMenu/MainMenuButton-fg-active.png b/TLM/TLM/Resources/MainMenu/MainMenuButton-fg-active.png index bda37bb6e..59158f95f 100644 Binary files a/TLM/TLM/Resources/MainMenu/MainMenuButton-fg-active.png and b/TLM/TLM/Resources/MainMenu/MainMenuButton-fg-active.png differ diff --git a/TLM/TLM/Resources/MainMenu/MainMenuButton-fg-hovered.png b/TLM/TLM/Resources/MainMenu/MainMenuButton-fg-hovered.png index 43994b189..59158f95f 100644 Binary files a/TLM/TLM/Resources/MainMenu/MainMenuButton-fg-hovered.png and b/TLM/TLM/Resources/MainMenu/MainMenuButton-fg-hovered.png differ diff --git a/TLM/TLM/Resources/MainMenu/MainMenuButton-fg-normal.png b/TLM/TLM/Resources/MainMenu/MainMenuButton-fg-normal.png index bb5df12e9..a990f9305 100644 Binary files a/TLM/TLM/Resources/MainMenu/MainMenuButton-fg-normal.png and b/TLM/TLM/Resources/MainMenu/MainMenuButton-fg-normal.png differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/ClearTraffic-fg-active.png b/TLM/TLM/Resources/MainMenu/Tool/ClearTraffic-fg-active.png deleted file mode 100644 index d2f9fe627..000000000 Binary files a/TLM/TLM/Resources/MainMenu/Tool/ClearTraffic-fg-active.png and /dev/null differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/ClearTraffic-fg-normal.png b/TLM/TLM/Resources/MainMenu/Tool/ClearTraffic-fg-normal.png index df85c2bbb..dcfdd2c9e 100644 Binary files a/TLM/TLM/Resources/MainMenu/Tool/ClearTraffic-fg-normal.png and b/TLM/TLM/Resources/MainMenu/Tool/ClearTraffic-fg-normal.png differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/Help-fg-active.png b/TLM/TLM/Resources/MainMenu/Tool/Help-fg-active.png index 2f1fefaa7..83000ee75 100644 Binary files a/TLM/TLM/Resources/MainMenu/Tool/Help-fg-active.png and b/TLM/TLM/Resources/MainMenu/Tool/Help-fg-active.png differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/Help-fg-normal.png b/TLM/TLM/Resources/MainMenu/Tool/Help-fg-normal.png index a4f4fcb11..9d873352a 100644 Binary files a/TLM/TLM/Resources/MainMenu/Tool/Help-fg-normal.png and b/TLM/TLM/Resources/MainMenu/Tool/Help-fg-normal.png differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/JunctionRestrictions-fg-active.png b/TLM/TLM/Resources/MainMenu/Tool/JunctionRestrictions-fg-active.png deleted file mode 100644 index 5339ef94e..000000000 Binary files a/TLM/TLM/Resources/MainMenu/Tool/JunctionRestrictions-fg-active.png and /dev/null differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/JunctionRestrictions-fg-normal.png b/TLM/TLM/Resources/MainMenu/Tool/JunctionRestrictions-fg-normal.png index 27c9546c7..96a6c829b 100644 Binary files a/TLM/TLM/Resources/MainMenu/Tool/JunctionRestrictions-fg-normal.png and b/TLM/TLM/Resources/MainMenu/Tool/JunctionRestrictions-fg-normal.png differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/LaneArrows-fg-active.png b/TLM/TLM/Resources/MainMenu/Tool/LaneArrows-fg-active.png deleted file mode 100644 index bc888fe1c..000000000 Binary files a/TLM/TLM/Resources/MainMenu/Tool/LaneArrows-fg-active.png and /dev/null differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/LaneArrows-fg-normal.png b/TLM/TLM/Resources/MainMenu/Tool/LaneArrows-fg-normal.png index 711754905..9fd3309ed 100644 Binary files a/TLM/TLM/Resources/MainMenu/Tool/LaneArrows-fg-normal.png and b/TLM/TLM/Resources/MainMenu/Tool/LaneArrows-fg-normal.png differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/LaneConnector-fg-active.png b/TLM/TLM/Resources/MainMenu/Tool/LaneConnector-fg-active.png deleted file mode 100644 index a807fc47b..000000000 Binary files a/TLM/TLM/Resources/MainMenu/Tool/LaneConnector-fg-active.png and /dev/null differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/LaneConnector-fg-normal.png b/TLM/TLM/Resources/MainMenu/Tool/LaneConnector-fg-normal.png index d48e2f929..2edfc53c4 100644 Binary files a/TLM/TLM/Resources/MainMenu/Tool/LaneConnector-fg-normal.png and b/TLM/TLM/Resources/MainMenu/Tool/LaneConnector-fg-normal.png differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/ManualTL-fg-active.png b/TLM/TLM/Resources/MainMenu/Tool/ManualTL-fg-active.png deleted file mode 100644 index f35561701..000000000 Binary files a/TLM/TLM/Resources/MainMenu/Tool/ManualTL-fg-active.png and /dev/null differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/ManualTL-fg-normal.png b/TLM/TLM/Resources/MainMenu/Tool/ManualTL-fg-normal.png index f3edc4244..64729c4d0 100644 Binary files a/TLM/TLM/Resources/MainMenu/Tool/ManualTL-fg-normal.png and b/TLM/TLM/Resources/MainMenu/Tool/ManualTL-fg-normal.png differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/ParkingRestrictions-fg-active.png b/TLM/TLM/Resources/MainMenu/Tool/ParkingRestrictions-fg-active.png deleted file mode 100644 index aec1a6786..000000000 Binary files a/TLM/TLM/Resources/MainMenu/Tool/ParkingRestrictions-fg-active.png and /dev/null differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/ParkingRestrictions-fg-normal.png b/TLM/TLM/Resources/MainMenu/Tool/ParkingRestrictions-fg-normal.png index 8d728a3a7..da64a956d 100644 Binary files a/TLM/TLM/Resources/MainMenu/Tool/ParkingRestrictions-fg-normal.png and b/TLM/TLM/Resources/MainMenu/Tool/ParkingRestrictions-fg-normal.png differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/PrioritySigns-fg-active.png b/TLM/TLM/Resources/MainMenu/Tool/PrioritySigns-fg-active.png deleted file mode 100644 index bb5bddb0c..000000000 Binary files a/TLM/TLM/Resources/MainMenu/Tool/PrioritySigns-fg-active.png and /dev/null differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/PrioritySigns-fg-normal.png b/TLM/TLM/Resources/MainMenu/Tool/PrioritySigns-fg-normal.png index 6f58dab9e..ae896cda7 100644 Binary files a/TLM/TLM/Resources/MainMenu/Tool/PrioritySigns-fg-normal.png and b/TLM/TLM/Resources/MainMenu/Tool/PrioritySigns-fg-normal.png differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/RoundButton-bg-active.png b/TLM/TLM/Resources/MainMenu/Tool/RoundButton-bg-active.png index 0ebd41ef6..6ec470589 100644 Binary files a/TLM/TLM/Resources/MainMenu/Tool/RoundButton-bg-active.png and b/TLM/TLM/Resources/MainMenu/Tool/RoundButton-bg-active.png differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/RoundButton-bg-disabled.png b/TLM/TLM/Resources/MainMenu/Tool/RoundButton-bg-disabled.png index 36d2db391..4420d55bc 100644 Binary files a/TLM/TLM/Resources/MainMenu/Tool/RoundButton-bg-disabled.png and b/TLM/TLM/Resources/MainMenu/Tool/RoundButton-bg-disabled.png differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/RoundButton-bg-hovered.png b/TLM/TLM/Resources/MainMenu/Tool/RoundButton-bg-hovered.png index adc7eeb73..56d6c7d7c 100644 Binary files a/TLM/TLM/Resources/MainMenu/Tool/RoundButton-bg-hovered.png and b/TLM/TLM/Resources/MainMenu/Tool/RoundButton-bg-hovered.png differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/RoundButton-bg-normal.png b/TLM/TLM/Resources/MainMenu/Tool/RoundButton-bg-normal.png index 75e9e5b65..8711fd6b5 100644 Binary files a/TLM/TLM/Resources/MainMenu/Tool/RoundButton-bg-normal.png and b/TLM/TLM/Resources/MainMenu/Tool/RoundButton-bg-normal.png differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/SpeedLimits-fg-active.png b/TLM/TLM/Resources/MainMenu/Tool/SpeedLimits-fg-active.png deleted file mode 100644 index e3d0e5dab..000000000 Binary files a/TLM/TLM/Resources/MainMenu/Tool/SpeedLimits-fg-active.png and /dev/null differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/SpeedLimits-fg-normal.png b/TLM/TLM/Resources/MainMenu/Tool/SpeedLimits-fg-normal.png index 632e4a673..9092aa139 100644 Binary files a/TLM/TLM/Resources/MainMenu/Tool/SpeedLimits-fg-normal.png and b/TLM/TLM/Resources/MainMenu/Tool/SpeedLimits-fg-normal.png differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/TimedTL-fg-active.png b/TLM/TLM/Resources/MainMenu/Tool/TimedTL-fg-active.png deleted file mode 100644 index c17d4df28..000000000 Binary files a/TLM/TLM/Resources/MainMenu/Tool/TimedTL-fg-active.png and /dev/null differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/TimedTL-fg-normal.png b/TLM/TLM/Resources/MainMenu/Tool/TimedTL-fg-normal.png index 8d22d41ef..44c5aa3e5 100644 Binary files a/TLM/TLM/Resources/MainMenu/Tool/TimedTL-fg-normal.png and b/TLM/TLM/Resources/MainMenu/Tool/TimedTL-fg-normal.png differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/ToggleTL-fg-active.png b/TLM/TLM/Resources/MainMenu/Tool/ToggleTL-fg-active.png deleted file mode 100644 index f1c4fa1ae..000000000 Binary files a/TLM/TLM/Resources/MainMenu/Tool/ToggleTL-fg-active.png and /dev/null differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/ToggleTL-fg-normal.png b/TLM/TLM/Resources/MainMenu/Tool/ToggleTL-fg-normal.png index 5c73ccfbe..6b8b4c7e2 100644 Binary files a/TLM/TLM/Resources/MainMenu/Tool/ToggleTL-fg-normal.png and b/TLM/TLM/Resources/MainMenu/Tool/ToggleTL-fg-normal.png differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/TrafficDespawning-fg-active.png b/TLM/TLM/Resources/MainMenu/Tool/TrafficDespawning-fg-active.png index ef56979a9..6e984bac6 100644 Binary files a/TLM/TLM/Resources/MainMenu/Tool/TrafficDespawning-fg-active.png and b/TLM/TLM/Resources/MainMenu/Tool/TrafficDespawning-fg-active.png differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/TrafficDespawning-fg-normal.png b/TLM/TLM/Resources/MainMenu/Tool/TrafficDespawning-fg-normal.png index 426e25d9e..3da420d8f 100644 Binary files a/TLM/TLM/Resources/MainMenu/Tool/TrafficDespawning-fg-normal.png and b/TLM/TLM/Resources/MainMenu/Tool/TrafficDespawning-fg-normal.png differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/VehicleRestrictions-fg-active.png b/TLM/TLM/Resources/MainMenu/Tool/VehicleRestrictions-fg-active.png deleted file mode 100644 index 9aa906afd..000000000 Binary files a/TLM/TLM/Resources/MainMenu/Tool/VehicleRestrictions-fg-active.png and /dev/null differ diff --git a/TLM/TLM/Resources/MainMenu/Tool/VehicleRestrictions-fg-normal.png b/TLM/TLM/Resources/MainMenu/Tool/VehicleRestrictions-fg-normal.png index 988d41519..1b1f47334 100644 Binary files a/TLM/TLM/Resources/MainMenu/Tool/VehicleRestrictions-fg-normal.png and b/TLM/TLM/Resources/MainMenu/Tool/VehicleRestrictions-fg-normal.png differ diff --git a/TLM/TLM/Resources/UI-buttons.svg b/TLM/TLM/Resources/UI-buttons.svg new file mode 100644 index 000000000..dbd70cafb --- /dev/null +++ b/TLM/TLM/Resources/UI-buttons.svg @@ -0,0 +1,2152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + Main menu fg icon(mind the 0% opacity background circle)click "Hide all except selected", size 128px + + HoveredBlue Hue: 216 + Reference bitmaps from MainMenu/Tools RoundButton + + + UI Buttons default textures + + + + + + NormalGreen Hue: 96 + Disabled + Active (Toggle ON)Blue Hue: 216 + + + Reference bitmaps from MainMenu + + + Default round button backgrounds for all buttons + + + + + Main menu fg icons for subtools(mind the 0% opacity background circle)click "Hide all except selected", size 128pxfor extra quality with large UI scale + + + + + + + + + + + + Clear Traffic + Enable DespawningNo Despawn Despawn + Help (small ?); Texture size 80px + + + ? + + + + ? + + + + + + + + + + + + + Toggle TL + + + + + + + + + + + + + + + + + Toggle Timed TL + Manual TL Control + Lane Connectors + Lane Arrows + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Junction Restrictions + + + + + + + + + + + + Junction Restrictions + Speed Limits + No Parking + Vehicle Restrictions + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Traffic by Vicons Designfrom NounProject.com + + + + + + + + + + + + + + + Composed 2 icons: Car from Traffic byVicons Design and Traffic Jam by Bence Bezeredyfrom NounProject.com + + + + + + + + + + + Point by Kevin from NounProject.com + + diff --git a/TLM/TLM/TLM.csproj b/TLM/TLM/TLM.csproj index c05a188e8..198920d8e 100644 --- a/TLM/TLM/TLM.csproj +++ b/TLM/TLM/TLM.csproj @@ -556,7 +556,6 @@ - @@ -958,32 +957,20 @@ - - - - - - - - - - - - @@ -1151,6 +1138,12 @@ + + + + + + diff --git a/TLM/TLM/U/AtlasBuilder.cs b/TLM/TLM/U/AtlasBuilder.cs index 68fe16953..ca1f67d12 100644 --- a/TLM/TLM/U/AtlasBuilder.cs +++ b/TLM/TLM/U/AtlasBuilder.cs @@ -1,9 +1,11 @@ namespace TrafficManager.U { + using System; using System.Collections.Generic; using System.Linq; using ColossalFramework.UI; using TrafficManager.Util; using TrafficManager.Util.Extensions; + using UnityEngine; /// /// Populates a set of spritedefs as your UI form is populated with controls. Allows to use @@ -46,6 +48,19 @@ public void Add(AtlasSpriteDef spriteDef) { this.spriteDefs_.Add(spriteDef); } + /// + /// Find and override + /// + /// + public void OverrideGetTextureFor(string name, Func getTexture) { + foreach (var sd in this.spriteDefs_) { + if (sd.Name == name) { + sd.GetTexture = getTexture; + return; + } + } + } + /// Following the settings in the Skin fields, load sprites into an UI atlas. /// Longer list of atlas keys can be loaded into one atlas. /// New UI atlas. diff --git a/TLM/TLM/U/AtlasSpriteDef.cs b/TLM/TLM/U/AtlasSpriteDef.cs index f44141550..2653a8ae9 100644 --- a/TLM/TLM/U/AtlasSpriteDef.cs +++ b/TLM/TLM/U/AtlasSpriteDef.cs @@ -1,6 +1,10 @@ namespace TrafficManager.U { using System; + using CSUtil.Commons; + using JetBrains.Annotations; + using TrafficManager.UI.Textures; using TrafficManager.Util; + using UnityEngine; /// /// Defines a sprite to be loaded into a Sprite Atlas (usually for buttons and other UI elements). @@ -17,6 +21,17 @@ public class AtlasSpriteDef : IEquatable { /// Texture size assumed by the developer. public IntVector2 Size; + /// If defined, this will be used instead of loading a DLL resource. + [CanBeNull] + public Func GetTexture; + + /// + /// Initializes a new instance of the class. + /// Set to override DLL resource loading and provide an existing + /// Texture2D from elsewhere, like pick a sign from a theme for example. + /// + /// Texture filename without PNG. + /// Size hint in pixels. public AtlasSpriteDef(string name, IntVector2 size) { Name = name; Size = size; @@ -25,5 +40,27 @@ public AtlasSpriteDef(string name, IntVector2 size) { public bool Equals(AtlasSpriteDef other) { return other != null && this.Name == other.Name; } + + public Texture2D LoadTexture2D(bool debugResourceLoading, string prefix) { + if (this.GetTexture != null) { + return this.GetTexture(); + } + + // Allow spritedef resouce prefix to override prefix given to this func + string resourceName = this.Name.StartsWith("/") + ? $"{this.Name.Substring(1)}.png" + : $"{prefix}.{this.Name}.png"; + + //-------------------------- + // Try loading the texture + //-------------------------- + if (debugResourceLoading) { + Log._Debug($"AtlasSpriteDef: Loading {resourceName} for sprite={this.Name}"); + } + + return TextureResources.LoadDllResource( + resourceName: resourceName, + size: this.Size); + } } } \ No newline at end of file diff --git a/TLM/TLM/U/TextureUtil.cs b/TLM/TLM/U/TextureUtil.cs index 20da36943..f381bf94d 100644 --- a/TLM/TLM/U/TextureUtil.cs +++ b/TLM/TLM/U/TextureUtil.cs @@ -3,7 +3,7 @@ namespace TrafficManager.U { using System.Collections.Generic; using ColossalFramework.UI; using CSUtil.Commons; - using TrafficManager.State; + using JetBrains.Annotations; using TrafficManager.State.ConfigData; using TrafficManager.UI.Textures; using UnityEngine; @@ -24,7 +24,7 @@ public static class TextureUtil { /// Texture with this side size is created. public static UITextureAtlas CreateAtlas(string atlasName, string resourcePrefix, - U.AtlasSpriteDef[] spriteDefs, + [NotNull] U.AtlasSpriteDef[] spriteDefs, IntVector2 atlasSizeHint) { var loadedTextures = new List(spriteDefs.Length); var loadedSpriteNames = new List(); @@ -36,28 +36,7 @@ public static UITextureAtlas CreateAtlas(string atlasName, // Load separate sprites and then pack it in a texture together foreach (U.AtlasSpriteDef spriteDef in spriteDefs) { - // Allow spritedef resouce prefix to override prefix given to this func - string prefix = resourcePrefix; - string resourceName; - - if (spriteDef.Name.StartsWith("/")) { - // If sprite name starts with /, use it as full resource path without .PNG - resourceName = $"{spriteDef.Name.Substring(1)}.png"; - } else { - // Otherwise use prefix + sprite name + .PNG - resourceName = $"{prefix}.{spriteDef.Name}.png"; - } - - //-------------------------- - // Try loading the texture - //-------------------------- - if (debugResourceLoading) { - Log._Debug($"TextureUtil: Loading {resourceName} for sprite={spriteDef.Name}"); - } - - Texture2D tex = TextureResources.LoadDllResource( - resourceName: resourceName, - size: spriteDef.Size); + Texture2D tex = spriteDef.LoadTexture2D(debugResourceLoading, resourcePrefix); if (tex != null) { loadedTextures.Add(tex); @@ -75,10 +54,10 @@ public static UITextureAtlas CreateAtlas(string atlasName, return PackTextures(atlasName, atlasSizeHint, loadedTextures, loadedSpriteNames); } - private static UITextureAtlas PackTextures(string atlasName, + private static UITextureAtlas PackTextures([NotNull] string atlasName, IntVector2 atlasSizeHint, - List loadedTextures, - List loadedSpriteNames) { + [NotNull] List loadedTextures, + [NotNull] List loadedSpriteNames) { Texture2D texture2D = new Texture2D( width: atlasSizeHint.x, height: atlasSizeHint.y, @@ -115,7 +94,8 @@ private static UITextureAtlas PackTextures(string atlasName, /// Copy from. /// New alpha. /// New texture. - public static Texture2D AdjustAlpha(Texture2D tex, float alpha) { + public static Texture2D AdjustAlpha([NotNull] Texture2D tex, + float alpha) { Color[] texColors = tex.GetPixels(); Color[] retPixels = new Color[texColors.Length]; diff --git a/TLM/TLM/UI/MainMenu/ClearTrafficButton.cs b/TLM/TLM/UI/MainMenu/ClearTrafficButton.cs index 4d453cacc..a30eff800 100644 --- a/TLM/TLM/UI/MainMenu/ClearTrafficButton.cs +++ b/TLM/TLM/UI/MainMenu/ClearTrafficButton.cs @@ -9,7 +9,8 @@ namespace TrafficManager.UI.MainMenu { public class ClearTrafficButton : BaseMenuButton { protected override bool IsActive() => false; - protected override string U_OverrideTooltipText() => Translation.Menu.Get("Tooltip:Clear traffic"); + protected override string U_OverrideTooltipText() => + Translation.Menu.Get("Tooltip:Clear traffic"); protected override bool IsVisible() => true; @@ -18,11 +19,10 @@ public override void SetupButtonSkin(AtlasBuilder futureAtlas) { this.Skin = ButtonSkin.CreateSimple( foregroundPrefix: "ClearTraffic", backgroundPrefix: UConst.MAINMENU_ROUND_BUTTON_BG) - .CanHover(foreground: false) - .CanActivate(); + .CanHover(foreground: false); this.Skin.UpdateAtlasBuilder( atlasBuilder: futureAtlas, - spriteSize: new IntVector2(50)); + spriteSize: new IntVector2(128)); } protected override void OnClick(UIMouseEventParameter p) { @@ -40,4 +40,4 @@ protected override void OnClick(UIMouseEventParameter p) { base.OnClick(p); } } -} +} \ No newline at end of file diff --git a/TLM/TLM/UI/MainMenu/DespawnButton.cs b/TLM/TLM/UI/MainMenu/DespawnButton.cs index b78236728..dbd5befc8 100644 --- a/TLM/TLM/UI/MainMenu/DespawnButton.cs +++ b/TLM/TLM/UI/MainMenu/DespawnButton.cs @@ -27,7 +27,7 @@ public override void SetupButtonSkin(AtlasBuilder futureAtlas) { .CanActivate(); this.Skin.UpdateAtlasBuilder( atlasBuilder: futureAtlas, - spriteSize: new IntVector2(50)); + spriteSize: new IntVector2(128)); } protected override void OnClick(UIMouseEventParameter p) { diff --git a/TLM/TLM/UI/MainMenu/JunctionRestrictionsButton.cs b/TLM/TLM/UI/MainMenu/JunctionRestrictionsButton.cs index 107842930..9e23ccd36 100644 --- a/TLM/TLM/UI/MainMenu/JunctionRestrictionsButton.cs +++ b/TLM/TLM/UI/MainMenu/JunctionRestrictionsButton.cs @@ -13,10 +13,10 @@ public override void SetupButtonSkin(AtlasBuilder futureAtlas) { foregroundPrefix: "JunctionRestrictions", backgroundPrefix: UConst.MAINMENU_ROUND_BUTTON_BG) .CanHover(foreground: false) - .CanActivate(); + .CanActivate(foreground: false); this.Skin.UpdateAtlasBuilder( atlasBuilder: futureAtlas, - spriteSize: new IntVector2(50)); + spriteSize: new IntVector2(128)); } protected override string U_OverrideTooltipText() => diff --git a/TLM/TLM/UI/MainMenu/LaneArrowsMenuButton.cs b/TLM/TLM/UI/MainMenu/LaneArrowsMenuButton.cs index 6884ac02d..1c5ad8439 100644 --- a/TLM/TLM/UI/MainMenu/LaneArrowsMenuButton.cs +++ b/TLM/TLM/UI/MainMenu/LaneArrowsMenuButton.cs @@ -12,10 +12,10 @@ public override void SetupButtonSkin(AtlasBuilder futureAtlas) { foregroundPrefix: "LaneArrows", backgroundPrefix: UConst.MAINMENU_ROUND_BUTTON_BG) .CanHover(foreground: false) - .CanActivate(); + .CanActivate(foreground: false); this.Skin.UpdateAtlasBuilder( atlasBuilder: futureAtlas, - spriteSize: new IntVector2(50)); + spriteSize: new IntVector2(128)); } protected override string U_OverrideTooltipText() => Translation.Menu.Get("Tooltip:Change lane arrows"); diff --git a/TLM/TLM/UI/MainMenu/LaneConnectorButton.cs b/TLM/TLM/UI/MainMenu/LaneConnectorButton.cs index a27741add..9f0622b5d 100644 --- a/TLM/TLM/UI/MainMenu/LaneConnectorButton.cs +++ b/TLM/TLM/UI/MainMenu/LaneConnectorButton.cs @@ -14,10 +14,10 @@ public override void SetupButtonSkin(AtlasBuilder atlasBuilder) { foregroundPrefix: "LaneConnector", backgroundPrefix: UConst.MAINMENU_ROUND_BUTTON_BG) .CanHover(foreground: false) - .CanActivate(); + .CanActivate(foreground: false); this.Skin.UpdateAtlasBuilder( atlasBuilder: atlasBuilder, - spriteSize: new IntVector2(50)); + spriteSize: new IntVector2(128)); } protected override string U_OverrideTooltipText() => diff --git a/TLM/TLM/UI/MainMenu/MainMenuButton.cs b/TLM/TLM/UI/MainMenu/MainMenuButton.cs index efdf85e2f..59b1daa1b 100644 --- a/TLM/TLM/UI/MainMenu/MainMenuButton.cs +++ b/TLM/TLM/UI/MainMenu/MainMenuButton.cs @@ -40,7 +40,7 @@ public override void Start() { sizeHint: new IntVector2(256)); this.Skin.UpdateAtlasBuilder( atlasBuilder: atlasBuilder, - spriteSize: new IntVector2(50)); + spriteSize: new IntVector2(64)); this.atlas = atlasBuilder.CreateAtlas(); UpdateButtonSkinAndTooltip(); @@ -67,13 +67,7 @@ public override void Start() { } } - private static float GetButtonDimensions() { - // The new behaviour, scales with screen size but never less than 50px - // var scaledSize = U.UIScaler.ScreenSizeSmallestFraction(0.026f, 0.046f); - // return Mathf.Max(scaledSize, 50f); - - return 50f; // always 50px the original behaviour - } + private static float GetButtonDimensions() => 50f; // always 50px the original behaviour protected override bool IsActive() { return ModUI.Instance.IsVisible(); diff --git a/TLM/TLM/UI/MainMenu/MainMenuPanel.cs b/TLM/TLM/UI/MainMenu/MainMenuPanel.cs deleted file mode 100644 index e69de29bb..000000000 diff --git a/TLM/TLM/UI/MainMenu/MainMenuWindow.cs b/TLM/TLM/UI/MainMenu/MainMenuWindow.cs index aaa69f7ec..e4bd4bcb9 100644 --- a/TLM/TLM/UI/MainMenu/MainMenuWindow.cs +++ b/TLM/TLM/UI/MainMenu/MainMenuWindow.cs @@ -194,7 +194,7 @@ public void SetupControls(UBuilder builder) { // By default the atlas will include backgrounds: DefaultRound-bg-normal tmpSkin.UpdateAtlasBuilder( atlasBuilder: builder.AtlasBuilder, - spriteSize: new IntVector2(50)); + spriteSize: new IntVector2(128)); // Create Version Label and Help button: // [ TM:PE 11.x ] [?] @@ -279,7 +279,7 @@ private UILabel SetupControls_TopRow(UBuilder builder) { .CanActivate(); skin.UpdateAtlasBuilder( atlasBuilder: builder.AtlasBuilder, - spriteSize: new IntVector2(50)); + spriteSize: new IntVector2(80)); osdToggle.Skin = skin; osdToggle.ApplyButtonSkin(); diff --git a/TLM/TLM/UI/MainMenu/ManualTrafficLightsButton.cs b/TLM/TLM/UI/MainMenu/ManualTrafficLightsButton.cs index a1f21fbe6..16d086d9c 100644 --- a/TLM/TLM/UI/MainMenu/ManualTrafficLightsButton.cs +++ b/TLM/TLM/UI/MainMenu/ManualTrafficLightsButton.cs @@ -12,10 +12,10 @@ public override void SetupButtonSkin(AtlasBuilder futureAtlas) { foregroundPrefix: "ManualTL", backgroundPrefix: UConst.MAINMENU_ROUND_BUTTON_BG) .CanHover(foreground: false) - .CanActivate(); + .CanActivate(foreground: false); this.Skin.UpdateAtlasBuilder( atlasBuilder: futureAtlas, - spriteSize: new IntVector2(50)); + spriteSize: new IntVector2(128)); } protected override string U_OverrideTooltipText() => diff --git a/TLM/TLM/UI/MainMenu/ParkingRestrictionsButton.cs b/TLM/TLM/UI/MainMenu/ParkingRestrictionsButton.cs index 6b8c4117b..d96b53249 100644 --- a/TLM/TLM/UI/MainMenu/ParkingRestrictionsButton.cs +++ b/TLM/TLM/UI/MainMenu/ParkingRestrictionsButton.cs @@ -12,10 +12,10 @@ public override void SetupButtonSkin(AtlasBuilder futureAtlas) { foregroundPrefix: "ParkingRestrictions", backgroundPrefix: UConst.MAINMENU_ROUND_BUTTON_BG) .CanHover(foreground: false) - .CanActivate(); + .CanActivate(foreground: false); this.Skin.UpdateAtlasBuilder( atlasBuilder: futureAtlas, - spriteSize: new IntVector2(50)); + spriteSize: new IntVector2(128)); } protected override string U_OverrideTooltipText() => diff --git a/TLM/TLM/UI/MainMenu/PrioritySignsButton.cs b/TLM/TLM/UI/MainMenu/PrioritySignsButton.cs index fb5805f65..a800fb90d 100644 --- a/TLM/TLM/UI/MainMenu/PrioritySignsButton.cs +++ b/TLM/TLM/UI/MainMenu/PrioritySignsButton.cs @@ -13,10 +13,10 @@ public override void SetupButtonSkin(AtlasBuilder futureAtlas) { foregroundPrefix: "PrioritySigns", backgroundPrefix: UConst.MAINMENU_ROUND_BUTTON_BG) .CanHover(foreground: false) - .CanActivate(); + .CanActivate(foreground: false); this.Skin.UpdateAtlasBuilder( atlasBuilder: futureAtlas, - spriteSize: new IntVector2(50)); + spriteSize: new IntVector2(128)); } protected override string U_OverrideTooltipText() => diff --git a/TLM/TLM/UI/MainMenu/SpeedLimitsButton.cs b/TLM/TLM/UI/MainMenu/SpeedLimitsButton.cs index 0c22b197f..e79f03292 100644 --- a/TLM/TLM/UI/MainMenu/SpeedLimitsButton.cs +++ b/TLM/TLM/UI/MainMenu/SpeedLimitsButton.cs @@ -14,10 +14,10 @@ public override void SetupButtonSkin(AtlasBuilder futureAtlas) { foregroundPrefix: "SpeedLimits", backgroundPrefix: UConst.MAINMENU_ROUND_BUTTON_BG) .CanHover(foreground: false) - .CanActivate(); + .CanActivate(foreground: false); this.Skin.UpdateAtlasBuilder( atlasBuilder: futureAtlas, - spriteSize: new IntVector2(50)); + spriteSize: new IntVector2(128)); } protected override string U_OverrideTooltipText() => Translation.Menu.Get("Tooltip:Speed limits"); diff --git a/TLM/TLM/UI/MainMenu/TimedTrafficLightsButton.cs b/TLM/TLM/UI/MainMenu/TimedTrafficLightsButton.cs index ed1eaf397..49f9fd076 100644 --- a/TLM/TLM/UI/MainMenu/TimedTrafficLightsButton.cs +++ b/TLM/TLM/UI/MainMenu/TimedTrafficLightsButton.cs @@ -12,10 +12,10 @@ public override void SetupButtonSkin(AtlasBuilder futureAtlas) { foregroundPrefix: "TimedTL", backgroundPrefix: UConst.MAINMENU_ROUND_BUTTON_BG) .CanHover(foreground: false) - .CanActivate(); + .CanActivate(foreground: false); this.Skin.UpdateAtlasBuilder( atlasBuilder: futureAtlas, - spriteSize: new IntVector2(50)); + spriteSize: new IntVector2(128)); } protected override string U_OverrideTooltipText() => diff --git a/TLM/TLM/UI/MainMenu/ToggleTrafficLightsButton.cs b/TLM/TLM/UI/MainMenu/ToggleTrafficLightsButton.cs index 473bea60d..0e18c9156 100644 --- a/TLM/TLM/UI/MainMenu/ToggleTrafficLightsButton.cs +++ b/TLM/TLM/UI/MainMenu/ToggleTrafficLightsButton.cs @@ -12,10 +12,10 @@ public override void SetupButtonSkin(AtlasBuilder futureAtlas) { foregroundPrefix: "ToggleTL", backgroundPrefix: UConst.MAINMENU_ROUND_BUTTON_BG) .CanHover(foreground: false) - .CanActivate(); + .CanActivate(foreground: false); this.Skin.UpdateAtlasBuilder( atlasBuilder: futureAtlas, - spriteSize: new IntVector2(50)); + spriteSize: new IntVector2(128)); } protected override string U_OverrideTooltipText() => diff --git a/TLM/TLM/UI/MainMenu/VehicleRestrictionsButton.cs b/TLM/TLM/UI/MainMenu/VehicleRestrictionsButton.cs index 0cb8a0278..0056c0714 100644 --- a/TLM/TLM/UI/MainMenu/VehicleRestrictionsButton.cs +++ b/TLM/TLM/UI/MainMenu/VehicleRestrictionsButton.cs @@ -12,10 +12,10 @@ public override void SetupButtonSkin(AtlasBuilder futureAtlas) { foregroundPrefix: "VehicleRestrictions", backgroundPrefix: UConst.MAINMENU_ROUND_BUTTON_BG) .CanHover(foreground: false) - .CanActivate(); + .CanActivate(foreground: false); this.Skin.UpdateAtlasBuilder( atlasBuilder: futureAtlas, - spriteSize: new IntVector2(50)); + spriteSize: new IntVector2(128)); } protected override string U_OverrideTooltipText() =>