internal static void MoveMechRoleInfo(MechLabPanel mechLabPanel)
        {
            var Representation = mechLabPanel.transform.GetChild("Representation");
            var OBJ_mech       = Representation.GetChild("OBJ_mech");

            var layout_details = OBJ_mech
                                 .GetChild("Centerline")
                                 .GetChild("layout_details");

            if (layout_details != null)
            {
                var go = layout_details.gameObject;
                MechLabFixWidgetLayouts.EnableLayout(go);
                go.GetComponent <LayoutElement>().ignoreLayout = true;

                var leftArm = OBJ_mech.GetChild("LeftArm");
                var vlg     = leftArm.GetComponent <VerticalLayoutGroup>();
                vlg.padding = new RectOffset(0, 0, MechLabSlotsFeature.settings.MechLabArmTopPadding, 0);
                //layout_details.parent = leftArm;
                //layout_details.SetAsFirstSibling();

                var leftArmWidget = leftArm.GetChild(0);
                layout_details.SetParent(leftArmWidget, false);
                var rect = go.GetComponent <RectTransform>();
                rect.pivot         = new Vector2(0, 0);
                rect.localPosition = new Vector3(0, 0);
            }
        }
        internal static void MoveMechRoleInfo(MechLabPanel panel)
        {
            var armWidget = panel.rightArmWidget;

            var layout_details = panel.transform
                                 .GetChild("Representation")
                                 .GetChild("OBJ_mech")
                                 .GetChild("Centerline")
                                 .GetChild("layout_details")
                                 ?? armWidget.transform.GetChild("layout_details");

            if (layout_details == null)
            {
                return;
            }

            var go = layout_details.gameObject;

            go.SetActive(!panel.IsSimGame);

            if (layout_details.parent == armWidget.transform)
            {
                return;
            }

            var arm = armWidget.transform.parent;

            MechLabFixWidgetLayouts.EnableLayout(arm.gameObject);
            {
                var component = go.GetComponent <RectTransform>();
                component.pivot            = new Vector2(0, 1);
                component.anchorMin        = new Vector2(0, 0);
                component.anchorMax        = new Vector2(0, 0);
                component.anchoredPosition = new Vector2(0, -40);
            }
            {
                var component = go.GetComponent <LayoutElement>() ?? go.AddComponent <LayoutElement>();
                component.ignoreLayout = true;
                component.enabled      = true;
            }
            layout_details.transform.SetParent(arm.transform, false);
        }
Beispiel #3
0
        internal static void MoveMechRoleInfo(MechLabPanel panel)
        {
            var layout_details = panel.transform
                                 .GetChild("Representation")
                                 .GetChild("OBJ_mech")
                                 .GetChild("Centerline")
                                 .GetChild("layout_details");

            if (layout_details == null)
            {
                return;
            }

            var leftArmWidget = panel.leftArmWidget;
            var leftArm       = leftArmWidget.gameObject.transform.parent;

            MechLabFixWidgetLayouts.EnableLayout(leftArm.gameObject);

            var vlg = leftArm.GetComponent <VerticalLayoutGroup>();

            vlg.padding = new RectOffset(0, 0, MechLabSlotsFeature.settings.MechLabArmTopPadding, 0);

            layout_details.transform.SetParent(leftArmWidget.transform, false);

            {
                var go = layout_details.gameObject;

                MechLabFixWidgetLayouts.EnableLayout(go);

                go.GetComponent <LayoutElement>().ignoreLayout = true;

                var rect = go.GetComponent <RectTransform>();
                //rect.localPosition = new Vector3(0, 0);
                rect.pivot            = new Vector2(0, 0);
                rect.anchoredPosition = new Vector2(0, 0);
            }
        }