cull(engine-cleanup): pass-8 phase-2 cascade round 2 after GachaUI stub
This commit is contained in:
@@ -13,34 +13,6 @@ public class CenteringUIWidget : MonoBehaviour
|
||||
[SerializeField]
|
||||
private bool _isCenteringVertical;
|
||||
|
||||
public void Reposition()
|
||||
{
|
||||
if (_offset == null || (!_isCenteringHorizontal && !_isCenteringVertical))
|
||||
{
|
||||
return;
|
||||
}
|
||||
UIWidget[] componentsInChildren = _offset.GetComponentsInChildren<UIWidget>();
|
||||
if (componentsInChildren.Length != 0)
|
||||
{
|
||||
_offset.localPosition = Vector3.zero;
|
||||
Bounds bounds = GetBounds(componentsInChildren[0], _offset);
|
||||
for (int i = 1; i < componentsInChildren.Length; i++)
|
||||
{
|
||||
bounds.Encapsulate(GetBounds(componentsInChildren[i], _offset));
|
||||
}
|
||||
Vector3 localPosition = _offset.localPosition;
|
||||
if (_isCenteringHorizontal)
|
||||
{
|
||||
localPosition.x = 0f - bounds.center.x;
|
||||
}
|
||||
if (_isCenteringVertical)
|
||||
{
|
||||
localPosition.y = 0f - bounds.center.y;
|
||||
}
|
||||
_offset.localPosition = localPosition;
|
||||
}
|
||||
}
|
||||
|
||||
private static Bounds GetBounds(UIWidget widget, Transform parent)
|
||||
{
|
||||
if (!(widget is UILabel))
|
||||
|
||||
Reference in New Issue
Block a user