31 lines
806 B
C#
31 lines
806 B
C#
using UIWidgets;
|
|
using UnityEngine;
|
|
|
|
[RequireComponent(typeof(EquipmentTileViewComponent))]
|
|
[RequireComponent(typeof(Resizable))]
|
|
public class EquipmentTileViewResizeHelper : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private EquipmentTileView Tiles;
|
|
|
|
private void Start()
|
|
{
|
|
GetComponent<Resizable>().OnEndResize.AddListener(OnResize);
|
|
}
|
|
|
|
private void OnResize(Resizable item)
|
|
{
|
|
Vector2 size = (item.transform as RectTransform).rect.size;
|
|
Tiles.ForEachComponent(delegate(ListViewItem x)
|
|
{
|
|
if (!(x.gameObject == item.gameObject))
|
|
{
|
|
RectTransform rectTransform = x.transform as RectTransform;
|
|
rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, size.x);
|
|
rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, size.y);
|
|
}
|
|
});
|
|
Tiles.Resize();
|
|
}
|
|
}
|