-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scale unity GUI #1152
Scale unity GUI #1152
Conversation
Just bump up GlobalConfig version and mod will recreate it with new settings
I don't understand your concern 🤔 Anyways I'll test it later today 😉 |
TLM/TLM/U/UIScaler.cs
Outdated
@@ -49,14 +49,14 @@ public static class UIScaler { | |||
public static float MaxWidth { | |||
get { | |||
float ret = Config.GuiScaleToResolution ? BaseResolutionX : Screen.width; | |||
return ret / Config.GuiScale; | |||
return ret / (Config.GuiScale * 0.01f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no magic numbers plz. make the 0.01f a variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kianzarrin I don't remember what range GuiScale is (probably 30...200+) but if it's percentage then it does not look right to me. For 100 it will return ret/1f
which is ok, but for 200 it will be ret/2f
, so 2x smaller?? 🤔
TLM/TLM/U/UIScaler.cs
Outdated
} | ||
} | ||
|
||
public static float MaxHeight { | ||
get { | ||
float ret = Config.GuiScaleToResolution ? BaseResolutionY : Screen.height; | ||
return ret / Config.GuiScale; | ||
return ret / (Config.GuiScale * 0.01f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same var
@@ -142,6 +143,8 @@ public SpeedLimitsTool(TrafficManagerTool mainTool) | |||
|
|||
public override void OnToolGUI(Event e) { | |||
base.OnToolGUI(e); | |||
var oldMatrix = GUI.matrix; | |||
GUI.matrix = UIScaler.ScaleMatrix; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this matrix switching thing?
currently on the train, can't look it up easily.
is GUI.matrix our code?
if not and we can't change it than this is ok.
if its ours we really should change it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GUI.matrix
is Unity code for immediate gui, works pretty much like GUI.color
, but obviously changes different thing 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kk .. in that case the code is fine.
@@ -308,6 +309,8 @@ public TimedTrafficLightsTool(TrafficManagerTool mainTool) | |||
|
|||
public override void OnToolGUI(Event e) { | |||
base.OnToolGUI(e); | |||
var oldMatrix = GUI.matrix; | |||
GUI.matrix = UIScaler.ScaleMatrix; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as for speedlimitstool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all fine
TLM/CSUtil.Commons/Log.cs
Outdated
File.Delete(LogFilePath); // delete old file to avoid confusion. | ||
} | ||
|
||
var args = Environment.GetCommandLineArgs().ToList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to convert ToList() here since you don't use it as a list further down in the method.
Better to keep it a string array and use Array.FindIndex(args, a => a == "-logFile") in the next line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not part of this review. I updated the branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TTL signs gui is correctly positioned, all good 👍
fixes #573
Speed limit tool and TTL now have constant size regardless of resolution (+ minor bug fixes)
To test this you need to remove TMPE_GlobalConfig.xml or set GuiScaleToResolution to true.
we have not released this so it won't be an issue for WS users but what about testers?
TMPE.zip