mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
extension
This commit is contained in:
parent
9aa6bf540c
commit
06dab3fa5b
@ -29,7 +29,7 @@ namespace NewHorizons.Handlers
|
||||
GameObject panRoot = SearchUtilities.Find(PAN_ROOT_PATH);
|
||||
if (panRoot != null)
|
||||
{
|
||||
List<GameObject> gameObjects = SearchUtilities.GetAllChildren(panRoot);
|
||||
List<GameObject> gameObjects = panRoot.GetAllChildren();
|
||||
_vanillaBodies = gameObjects.ConvertAll(g => g.name).ToArray();
|
||||
_vanillaBodyIDs = gameObjects.ConvertAll(g => g.GetComponent<ShipLogAstroObject>()?.GetID()).ToArray();
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ namespace NewHorizons.Patches
|
||||
__instance._startingAstroObjectID = navMatrix[1][0].GetID();
|
||||
if (Main.Instance.CurrentStarSystem != "SolarSystem")
|
||||
{
|
||||
List<GameObject> delete = SearchUtilities.GetAllChildren(panRoot).Where(g => g.name.Contains("_ShipLog") == false).ToList();
|
||||
List<GameObject> delete = panRoot.GetAllChildren().Where(g => g.name.Contains("_ShipLog") == false).ToList();
|
||||
foreach (GameObject gameObject in delete)
|
||||
{
|
||||
Object.Destroy(SearchUtilities.Find(ShipLogHandler.PAN_ROOT_PATH + "/" + gameObject.name));
|
||||
@ -182,7 +182,7 @@ namespace NewHorizons.Patches
|
||||
Transform detailsParent = __instance.transform.Find("Details");
|
||||
if (detailsParent != null)
|
||||
{
|
||||
foreach (GameObject child in SearchUtilities.GetAllChildren(detailsParent.gameObject))
|
||||
foreach (GameObject child in detailsParent.gameObject.GetAllChildren())
|
||||
{
|
||||
if (child.TryGetComponent(typeof(ShipLogDetail), out Component detail))
|
||||
{
|
||||
|
||||
@ -160,7 +160,7 @@ namespace NewHorizons.Utility
|
||||
}
|
||||
}
|
||||
|
||||
public static List<GameObject> GetAllChildren(GameObject parent)
|
||||
public static List<GameObject> GetAllChildren(this GameObject parent)
|
||||
{
|
||||
List<GameObject> children = new List<GameObject>();
|
||||
foreach (Transform child in parent.transform)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user