-
Notifications
You must be signed in to change notification settings - Fork 114
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
Added a way to change the light color in the main menu #307
Conversation
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.
Sorry for not looking at this for such a long time, finally had a chance to check it out.
src/Kopernicus/Templates.cs
Outdated
@@ -52,6 +52,9 @@ public class Templates | |||
// The body that should appear in MainMenu | |||
public static String menuBody { get; set; } | |||
|
|||
// The main menu color | |||
public static ColorParser mainMenuLightColor = new ColorParser(new Color(1, 1, 1, 1)); |
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.
You should just use a Color here, not a color parser.
Also, it would be awesome if the color in the main menu could be automatically fetched from the star the main menu body is orbiting. I am not sure if Kopernicus already has an API for that (probably KopernicusStar.GetNearest(MainMenuBody).lightShifter.lightColor
or so), if not I can write down the exact code later.
if (HighLogic.LoadedScene == GameScenes.MAINMENU) | ||
{ | ||
// I have to check two times if the game object exists, if i don't a nullref appears, and no-one likes nullref. | ||
if(GameObject.Find("Directional light")) |
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.
You should probably cache that GameObject.
Maybe it can be possible to do that with searching the first Star body main menu body's hierarchy.. |
Yeah, thats what I tried to describe. |
I know it's not entirely helpful but Contract Configurator has a function in place where you can call the parent body, that body's star, then any children of that star etc. so it must have a similar API in place that would be required here. |
I don't really think that's really useful, sind since it's already very easy to loop parents and check if it's a star |
…in a configuration file
…ecified in a configuration file" This reverts commit a1cfbdf.
@@ -357,11 +357,11 @@ void LateUpdate() | |||
{ | |||
FieldInfo mode_f = typeof(OrbitTargeter).GetFields(BindingFlags.NonPublic | BindingFlags.Instance).FirstOrDefault(f => f.FieldType.IsEnum && f.FieldType.IsNested); | |||
FieldInfo context_f = typeof(OrbitTargeter).GetFields(BindingFlags.NonPublic | BindingFlags.Instance).FirstOrDefault(f => f.FieldType == typeof(MapContextMenu)); | |||
#if !KSP131 | |||
#if !KSP131 |
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.
revert those formatting changes please
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.
I thought I didn't apply them... Alright
|
||
else | ||
{ | ||
Logger.Default.Log("Unable to find main menu body's celestialbody componant!"); |
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.
Since this is executed at runtime you should probably use Logger.Active.Log
to it ends up in Kopernicus.Runtime.log
(created at RuntimeUtility.Awake() iirc)
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.
Should be ok now... I guess..
SQUAD removed the old Light object from the MainMenu so I doubt this solution would still work however I think it's fair to say this is a feature we should look into adding to Kopernicus as a baseline, probably even automate the process to use the light from the parent star to the body displayed in the menu |
No description provided.