10-27 那笔把表的根定成 XericLibrary,但 58 处 AddComponentMenu、4 处 CreateAssetMenu 和若干 MenuItem/ContextMenu 还各自写着 "Xeric UI Vessel/…"、"Xeric/XChart/…" 三套 旧字面量;那批转换一直停在工程里没提交。本笔只收这 46 个"除注册属性外没有别的改动" 的文件,路径出处从此只在表里一处。 工作区里另外 3 个文件(XericImage 的角偏移、IVisibility 接口、XericInfiniteVesselBase 的 region/注释)混着功能改动,不在本笔;Editor/OverrideUI/XericImageEditor.cs 与 Runtime/OverrideUI/XericImageDeform.cs 两个未入库新文件也不在。
80 lines
2.4 KiB
C#
80 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Pool;
|
|
using UnityEngine.UI;
|
|
using XericLibrary.Runtime.MacroLibrary;
|
|
using XericUI.Core;
|
|
|
|
namespace XericUI.OverrideLayout
|
|
{
|
|
[AddComponentMenu(XericRegistrationPaths.Layout + "/Xeric Horizontal Layout Group", 10)]
|
|
/// <summary>
|
|
/// Layout child layout elements below each other.
|
|
/// </summary>
|
|
public class XericHorizontalLayoutGroup: XericHorizontalOrVerticalLayoutGroup
|
|
{
|
|
protected XericHorizontalLayoutGroup()
|
|
{}
|
|
|
|
/// <summary>
|
|
/// Called by the layout system. Also see ILayoutElement
|
|
/// </summary>
|
|
public override void CalculateLayoutInputHorizontal()
|
|
{
|
|
rectChildren.Clear();
|
|
var toIgnoreList = ListPool<Component>.Get();
|
|
for (int i = 0; i < rectTransform.childCount; i++)
|
|
{
|
|
var rect = rectTransform.GetChild(i) as RectTransform;
|
|
if (rect == null || CanSkipLayout(rect))
|
|
continue;
|
|
|
|
rect.GetComponents(typeof(ILayoutIgnorer), toIgnoreList);
|
|
|
|
if (toIgnoreList.Count == 0)
|
|
{
|
|
rectChildren.Add(rect);
|
|
continue;
|
|
}
|
|
|
|
for (int j = 0; j < toIgnoreList.Count; j++)
|
|
{
|
|
var ignorer = (ILayoutIgnorer)toIgnoreList[j];
|
|
if (!ignorer.ignoreLayout)
|
|
{
|
|
rectChildren.Add(rect);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
ListPool<Component>.Release(toIgnoreList);
|
|
m_Tracker.Clear();
|
|
CalcAlongAxis(0, false);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Called by the layout system. Also see ILayoutElement
|
|
/// </summary>
|
|
public override void CalculateLayoutInputVertical()
|
|
{
|
|
CalcAlongAxis(1, false);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Called by the layout system. Also see ILayoutElement
|
|
/// </summary>
|
|
public override void SetLayoutHorizontal()
|
|
{
|
|
SetChildrenAlongAxis(0, false);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Called by the layout system. Also see ILayoutElement
|
|
/// </summary>
|
|
public override void SetLayoutVertical()
|
|
{
|
|
SetChildrenAlongAxis(1, false);
|
|
}
|
|
}
|
|
} |