コード例 #1
0
        // offsetはLocalPositionに足されるので注意
        public void Add(
            DebugUiControl child,
            float offsetX = 0f,
            float offsetY = 0f,
            AlignX alignX = AlignX.Left,
            AlignY alignY = AlignY.Top)
        {
            float x = 0f;

            switch (alignX)
            {
            case AlignX.Center: x = (this.width - child.width) * 0.5f; break;

            case AlignX.Right: x = this.width - child.width; break;
            }
            float y = 0f;

            switch (alignY)
            {
            case AlignY.Center: y = (this.height - child.height) * 0.5f; break;

            case AlignY.Bottom: y = (this.height - child.height); break;
            }
            child.SetLocalPosition(
                child.localLeftX + offsetX + x,
                child.localTopY + offsetY + y);
            AddChildAsTail(child);
        }
コード例 #2
0
 // offsetはLocalPositionに足されるので注意
 public virtual void AddChild(
     DebugUiControl child,
     float offsetX = 0f,
     float offsetY = 0f)
 {
     child.SetLocalPosition(
         child.localLeftX + offsetX,
         child.localTopY + offsetY);
     LinkChildToTail(child);
     child._parent = this;
 }