GetSectionRect() публичный Метод

public GetSectionRect ( string sectionId, Rect initial ) : Rect
sectionId string
initial UnityEngine.Rect
Результат UnityEngine.Rect
Пример #1
0
        public void SimpleHorizontalLayout()
        {
            fiHorizontalLayout horizontal = new fiHorizontalLayout() {
                { "1", 10, new fiLayoutHeight(10) },
                { "2", new fiLayoutHeight(10) },
                { "3", 20, new fiLayoutHeight(20) }
            };

            Assert.AreEqual(20, horizontal.Height);

            var initialRect = new Rect(0, 0, 100, 100);
            Assert.AreEqual(new Rect(0, 0, 10, 10), horizontal.GetSectionRect("1", initialRect));
            Assert.AreEqual(new Rect(10, 0, 100 - 10 - 20, 10), horizontal.GetSectionRect("2", initialRect));
            Assert.AreEqual(new Rect(80, 0, 20, 20), horizontal.GetSectionRect("3", initialRect));
        }
Пример #2
0
        public void CenterLayout()
        {
            var centered = new fiCenterVertical(new fiLayoutHeight("1", 20));
            Assert.AreEqual(20, centered.Height);
            Assert.AreEqual(new Rect(0, 40, 100, 20), centered.GetSectionRect("1", new Rect(0, 0, 100, 100)));

            var horizontalContainer = new fiHorizontalLayout() {
                { 30, centered }
            };
            Assert.AreEqual(20, horizontalContainer.Height);
            Assert.AreEqual(new Rect(0, 40, 30, 20), horizontalContainer.GetSectionRect("1", new Rect(0, 0, 100, 100)));

            var verticalContainer = new fiVerticalLayout() {
                { centered }
            };
            Assert.AreEqual(20, verticalContainer.Height);
            Assert.AreEqual(new Rect(0, 40, 100, 20), verticalContainer.GetSectionRect("1", new Rect(0, 0, 100, 100)));
        }