Skip to content

Commit

Permalink
Add the ability to hover over the part and press "J" to recolor @Theysen
Browse files Browse the repository at this point in the history
  • Loading branch information
pap1723 committed May 25, 2021
1 parent 4b391c7 commit d4a18a0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Binary file modified GameData/ROLib/Plugins/ROLib.dll
Binary file not shown.
23 changes: 23 additions & 0 deletions Source/ROLib/Modules/ModuleROTank.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ private ModelDefinitionVariantSet GetVariantSet(string name)

private bool noseModuleCanRotate = false;
private bool mountModuleCanRotate = false;
public KeyCode onHoverKeyCode = KeyCode.J;

/// <summary>
/// Find the first variant set containing a definition with ModelDefinitionLayoutOptions def. Will not create a new set if not found.
Expand Down Expand Up @@ -965,6 +966,28 @@ public void EditDimensions()
}
}

private bool _isRecoloringWindowOpen = false;

private void OnMouseOver()
{
if (!HighLogic.LoadedSceneIsEditor)
{
return;
}

if (!Input.GetKeyDown(onHoverKeyCode)) return;

if (Input.GetKeyDown(onHoverKeyCode) && _isRecoloringWindowOpen)
{
gameObject.AddComponent<SSTURecolorGUI>().recolorClose();
_isRecoloringWindowOpen = false;
return;
}

gameObject.AddComponent<SSTURecolorGUI>().recolorGUIEvent();
_isRecoloringWindowOpen = true;
}

#endregion GUI

}
Expand Down

0 comments on commit d4a18a0

Please sign in to comment.