| | |
| | | var scale = 1f; |
| | | var rect = cellContainer.GetComponent<RectTransform>(); |
| | | var parentRect = transform.GetComponent<RectTransform>(); |
| | | scale = parentRect.sizeDelta.x / rect.sizeDelta.x; |
| | | float width = parentRect.sizeDelta.x; |
| | | if (width <= 0f) |
| | | { |
| | | //外部控制了尺寸获取为0 |
| | | GridLayoutGroup grid = GetComponentInParent<GridLayoutGroup>(); |
| | | if (grid != null) |
| | | { |
| | | width = grid.cellSize.x; |
| | | } |
| | | |
| | | } |
| | | scale = width / rect.sizeDelta.x; |
| | | cellContainer.transform.localScale = new Vector3(scale, scale, scale); |
| | | heroNameOutline = nameText.GetComponent<OutlineEx>(); |
| | | heroLVOutline = lvText.GetComponent<OutlineEx>(); |