{ "code": [ { "line": 1, "content": "if (gameObject.activeInHierarchy == false)" }, { "line": 2, "content": "{" }, { "line": 3, "content": " gameObject.SetActive(true);" }, { "line": 4, "content": "}" }, { "line": 5, "content": "" }, { "line": 6, "content": "Vector3 pos = transform.localPosition;" }, { "line": 7, "content": "transform.parent = null;" }, { "line": 8, "content": "PanelScript script = transform.GetComponentInChildren<PanelScript>();" }, { "line": 9, "content": "if (script == null)" }, { "line": 10, "content": "{" }, { "line": 11, "content": " Debug.LogError(\\\"No PanelScript found!\\\", gameObject);" }, { "line": 12, "content": "}" }, { "line": 13, "content": "" }, { "line": 14, "content": "Vector3 pivot = script.transform.localPosition;" }, { "line": 15, "content": "pivot.y += (script.rectTransform.height - script.clipRange.w);" }, { "line": 16, "content": "script.transform.localPosition = pivot;" }, { "line": 17, "content": "" }, { "line": 18, "content": "Vector3 parentPos = script.rectTransform.parent.GetComponent<RectTransform>().localPosition;" }, { "line": 19, "content": "parentPos.y += (script.clipRange.w / 2);" }, { "line": 20, "content": "script.rectTransform.parent.GetComponent<RectTransform>().localPosition = parentPos;" }, { "line": 21, "content": "" }, { "line": 22, "content": "transform.localPosition = pos;" }, { "line": 23, "content": "Vector4 size = script.clipRange;" }, { "line": 24, "content": "size.w += (script.rectTransform.height - script.clipRange.w);" }, { "line": 25, "content": "script.clipRange = size;" }, { "line": 26, "content": "" }, { "line": 27, "content": "float scale = Camera.main.orthographicSize / (size.w * 0.8f);" }, { "line": 28, "content": "transform.localScale = new Vector3(scale, scale, 1);" }, { "line": 29, "content": "" }, { "line": 30, "content": "if (script == null)" }, { "line": 31, "content": "{" }, { "line": 32, "content": " return;" }, { "line": 33, "content": "}" }, { "line": 34, "content": "" }, { "line": 35, "content": "Vector3 parentScale = script.rectTransform.parent.GetComponent<RectTransform>().localScale;" }, { "line": 36, "content": "parentScale.y *= scale;" }, { "line": 37, "content": "script.rectTransform.parent.GetComponent<RectTransform>().localScale = parentScale;" } ] }