Skip to content
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

Closed
wants to merge 7 commits into from
Closed

Added a way to change the light color in the main menu #307

wants to merge 7 commits into from

Conversation

Arekva
Copy link

@Arekva Arekva commented Aug 25, 2018

No description provided.

Copy link
Member

@StollD StollD left a 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.

@@ -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));
Copy link
Member

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"))
Copy link
Member

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.

@Arekva
Copy link
Author

Arekva commented Sep 21, 2018

Maybe it can be possible to do that with searching the first Star body main menu body's hierarchy..

@StollD
Copy link
Member

StollD commented Sep 21, 2018

Yeah, thats what I tried to describe. KopernicusStar.GetNearest() basically does this, but it just checks for the distance between the two objects.

@Poodmund
Copy link

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.

@Arekva
Copy link
Author

Arekva commented Sep 21, 2018

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

@Arekva Arekva closed this Sep 21, 2018
@StollD StollD reopened this Sep 21, 2018
@@ -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
Copy link
Member

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

Copy link
Author

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!");
Copy link
Member

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)

Copy link
Author

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..

Sorry, something went wrong.

@Sigma88
Copy link
Contributor

Sigma88 commented Nov 9, 2018

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

Sorry, something went wrong.

@StollD StollD closed this Dec 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants