diff --git a/source/ContractConfigurator/MissionControlUI.cs b/source/ContractConfigurator/MissionControlUI.cs index 6bbec456..fec765c9 100644 --- a/source/ContractConfigurator/MissionControlUI.cs +++ b/source/ContractConfigurator/MissionControlUI.cs @@ -346,7 +346,7 @@ public void Update() { toggleAllObj = UnityEngine.Object.Instantiate(toggleAvailable); toggleAllObj.name = "Toggle All"; - toggleAllObj.transform.SetParent(sortGroup.transform); + toggleAllObj.transform.SetParent(sortGroup.transform, false); toggleAllObj.transform.SetAsFirstSibling(); } @@ -1012,7 +1012,7 @@ protected void SetupGroupItem(GroupContainer groupContainer) { availableTextObject = UnityEngine.Object.Instantiate(groupContainer.mcListItem.title.gameObject); availableTextObject.name = "AvailableText"; - availableTextObject.transform.SetParent(groupContainer.mcListItem.title.transform.parent); + availableTextObject.transform.SetParent(groupContainer.mcListItem.title.transform.parent, false); RectTransform availableTextRect = availableTextObject.GetComponent(); availableTextRect.anchoredPosition3D = textRect.anchoredPosition3D; availableTextRect.sizeDelta = new Vector2(textRect.sizeDelta.x + 4, textRect.sizeDelta.y - 4); @@ -1070,7 +1070,7 @@ protected void CreateContractItem(ContractContainer cc, int indent = 0, KSP.UI.U cc.statusImage = statusImage.AddComponent(); cc.statusImage.states = itemStatusStates; cc.statusImage.image = statusImage.AddComponent(); - statusImage.transform.SetParent(mcListItem.transform); + statusImage.transform.SetParent(mcListItem.transform, false); // Finalize difficulty UI RectTransform diffRect = mcListItem.difficulty.GetComponent(); @@ -1148,7 +1148,7 @@ protected void InsertIntoList(Container container, int indent, KSP.UI.UIListItem UIList childUIList = (UIList)childUIListField.GetValue(MissionControl.Instance.scrollListContracts); List> listData = (List>)listDataField.GetValue(childUIList); listData.Insert(index + 1, new UIListData((KSP.UI.UIListItem)null, container.mcListItem.container)); - container.mcListItem.container.transform.SetParent(childUIList.listAnchor); + container.mcListItem.container.transform.SetParent(childUIList.listAnchor, false); container.mcListItem.container.transform.localPosition = new Vector3(container.mcListItem.container.transform.localPosition.x, container.mcListItem.container.transform.localPosition.y, 0.0f); container.listItemTransform = container.mcListItem.transform; @@ -1214,7 +1214,7 @@ protected void SetIndent(MCListItem mcListItem, int indent) // Re-order the hierarchy to add spacers for indented items GameObject go = new GameObject("GroupContainer"); - go.transform.parent = mcListItem.transform.parent; + go.transform.SetParent(mcListItem.transform.parent, false); go.AddComponent(); go.AddComponent(); go.AddComponent(); @@ -1229,8 +1229,8 @@ protected void SetIndent(MCListItem mcListItem, int indent) spacerFitter.horizontalFit = ContentSizeFitter.FitMode.MinSize; // Re-parent the spacer and list item - spacer.transform.SetParent(go.transform); - mcListItem.transform.SetParent(go.transform); + spacer.transform.SetParent(go.transform, false); + mcListItem.transform.SetParent(go.transform, false); // Perform some surgery on the list item to set its preferred width to the correct value LayoutElement le = mcListItem.GetComponent(); diff --git a/source/ContractConfigurator/TrackingStationUI.cs b/source/ContractConfigurator/TrackingStationUI.cs index 73f6f75d..b5d3e078 100644 --- a/source/ContractConfigurator/TrackingStationUI.cs +++ b/source/ContractConfigurator/TrackingStationUI.cs @@ -53,9 +53,10 @@ public void Awake() offeredOrbitEnabledSprite = UnityEngine.Sprite.Create(uiAtlas, new Rect(0, 8, 40, 40), new Vector2(0, 0)); offeredOrbitDisabledSprite = UnityEngine.Sprite.Create(uiAtlas, new Rect(40, 8, 40, 40), new Vector2(0, 0)); } + this.foostart(); } - public void Start() + public void foostart() { LoggingUtil.LogVerbose(this, "Start"); @@ -80,12 +81,6 @@ public void Start() offeredOrbitButton = UnityEngine.Object.Instantiate(lastButton.button.gameObject); offeredOrbitButton.name = "Button Offered Orbits"; - // Fix z coordinates - activeWaypointButton.GetComponent().SetLocalPositionZ(750); - offeredWaypointButton.GetComponent().SetLocalPositionZ(750); - activeOrbitButton.GetComponent().SetLocalPositionZ(750); - offeredOrbitButton.GetComponent().SetLocalPositionZ(750); - // Set up the tool-tips activeWaypointButton.GetComponent().textString = "Toggle Active Waypoints"; offeredWaypointButton.GetComponent().textString = "Toggle Offered Waypoints"; @@ -133,12 +128,10 @@ public void Start() // Re-parent GameObject trackingFilters = lastButton.button.transform.parent.gameObject; - RectTransform trackingFiltersRect = trackingFilters.GetComponent(); - trackingFiltersRect.sizeDelta = new Vector2(trackingFiltersRect.sizeDelta.x + 44 * 2, trackingFiltersRect.sizeDelta.y); - activeWaypointButton.transform.SetParent(trackingFilters.transform); - offeredWaypointButton.transform.SetParent(trackingFilters.transform); - activeOrbitButton.transform.SetParent(trackingFilters.transform); - offeredOrbitButton.transform.SetParent(trackingFilters.transform); + activeWaypointButton.transform.SetParent(trackingFilters.transform, false); + offeredWaypointButton.transform.SetParent(trackingFilters.transform, false); + activeOrbitButton.transform.SetParent(trackingFilters.transform, false); + offeredOrbitButton.transform.SetParent(trackingFilters.transform, false); activeWaypointButton.SetActive(true); offeredWaypointButton.SetActive(true); activeOrbitButton.SetActive(true); @@ -149,7 +142,7 @@ public void Start() if (commNet != null) { RectTransform r = commNet.GetComponent(); - r.localPosition = new Vector3(r.localPosition.x + 132, r.localPosition.y); + r.localPosition = new Vector3(r.localPosition.x + 140, r.localPosition.y); } LoggingUtil.LogVerbose(this, "Finished setup");