Update Cryville.Common.
This commit is contained in:
@@ -2,30 +2,60 @@
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Cryville.Common.Unity.UI {
|
||||
/// <summary>
|
||||
/// A <see cref="LayoutGroup" /> that docks its first child element to one side.
|
||||
/// </summary>
|
||||
public abstract class DockLayoutGroup : LayoutGroup {
|
||||
/// <summary>
|
||||
/// The dock side.
|
||||
/// </summary>
|
||||
public enum Side {
|
||||
/// <summary>
|
||||
/// Top.
|
||||
/// </summary>
|
||||
Top = 0,
|
||||
/// <summary>
|
||||
/// Right.
|
||||
/// </summary>
|
||||
Right = 1,
|
||||
/// <summary>
|
||||
/// Bottom.
|
||||
/// </summary>
|
||||
Bottom = 2,
|
||||
/// <summary>
|
||||
/// Left.
|
||||
/// </summary>
|
||||
Left = 3,
|
||||
}
|
||||
[SerializeField]
|
||||
[Tooltip("The docking side of the first child element.")]
|
||||
private Side m_side;
|
||||
/// <summary>
|
||||
/// The docking side of the first child element.
|
||||
/// </summary>
|
||||
public Side DockSide {
|
||||
get { return m_side; }
|
||||
set { base.SetProperty(ref m_side, value); }
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
[Tooltip("The slide index. The children slide along the cross axis.")]
|
||||
private float m_slideIndex;
|
||||
/// <summary>
|
||||
/// The slide index. The children slide along the axis.
|
||||
/// </summary>
|
||||
public float SlideIndex {
|
||||
get { return m_slideIndex; }
|
||||
set { base.SetProperty(ref m_slideIndex, value); }
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public sealed override void CalculateLayoutInputHorizontal() { base.CalculateLayoutInputHorizontal(); }
|
||||
/// <inheritdoc />
|
||||
public sealed override void CalculateLayoutInputVertical() { }
|
||||
/// <inheritdoc />
|
||||
public sealed override void SetLayoutHorizontal() { SetChildrenAlongAxis(0); }
|
||||
/// <inheritdoc />
|
||||
public sealed override void SetLayoutVertical() { SetChildrenAlongAxis(1); }
|
||||
|
||||
private float GetSlidePosition(float groupHeight, float dockHeight) {
|
||||
@@ -68,6 +98,11 @@ namespace Cryville.Common.Unity.UI {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the length of the first child element along the axis.
|
||||
/// </summary>
|
||||
/// <param name="groupSize">The size of the layout group.</param>
|
||||
/// <returns></returns>
|
||||
protected abstract float GetDockElementSize(Vector2 groupSize);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user