protected override IFixedLayout GetLayout() { RectTransform widgetTransformProto = m_widgetPrefab.transform as RectTransform; WidgetSize originalSize = widgetTransformProto.GetSize(); if (m_elementSize.widthMode != WidgetSize.ResizeMode.Value) { m_elementSize.width = originalSize.width; } if (m_elementSize.heightMode != WidgetSize.ResizeMode.Value) { m_elementSize.height = originalSize.height; } IFixedLayout layout = (IFixedLayout)Activator.CreateInstance(m_layoutClass.ReferencedClassType); layout.WidgetSize = m_elementSize; layout.SetContentAreaSize(base.ScrollArea); return(layout); }
public static void SetSize(this RectTransform p_transform, WidgetSize p_size) { switch (p_size.widthMode) { case WidgetSize.ResizeMode.Stretch: p_transform.StretchHorizontal(); break; case WidgetSize.ResizeMode.Value: p_transform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, p_size.width); break; } switch (p_size.heightMode) { case WidgetSize.ResizeMode.Stretch: p_transform.StretchVertical(); break; case WidgetSize.ResizeMode.Value: p_transform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, p_size.height); break; } }
public FixedVerticalLayout(WidgetSize p_widgetSize) { this.WidgetSize = p_widgetSize; }
public FixedGridLayout(WidgetSize p_widgetSize, Vector2 p_scrollAreaSize) { this.WidgetSize = p_widgetSize; this.SetContentAreaSize(p_scrollAreaSize); }