public void TestCalculateLayoutInputHorizontal() { HorizontalLayoutGroup layoutGroup = m_PrefabRoot.GetComponentInChildren <HorizontalLayoutGroup>(); layoutGroup.CalculateLayoutInputHorizontal(); layoutGroup.SetLayoutHorizontal(); layoutGroup.CalculateLayoutInputVertical(); layoutGroup.SetLayoutVertical(); Assert.AreEqual(48, layoutGroup.minWidth); Assert.AreEqual(318, layoutGroup.preferredWidth); Assert.AreEqual(1, layoutGroup.flexibleWidth); }
private static int SetLayoutVertical(IntPtr L) { int result; try { ToLua.CheckArgsCount(L, 1); HorizontalLayoutGroup horizontalLayoutGroup = (HorizontalLayoutGroup)ToLua.CheckObject(L, 1, typeof(HorizontalLayoutGroup)); horizontalLayoutGroup.SetLayoutVertical(); result = 0; } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }
public static int SetLayoutVertical(IntPtr l) { int result; try { HorizontalLayoutGroup horizontalLayoutGroup = (HorizontalLayoutGroup)LuaObject.checkSelf(l); horizontalLayoutGroup.SetLayoutVertical(); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public void ChangeBtnSize() { btnName = EventSystem.current.currentSelectedGameObject.name; int m = int.Parse(btnName.Split('n')[1]); for (int k = 0; k < btnNum; k++) { if (m == k) { btnTr[k].localScale = new Vector3(1.3f, 1.3f, 1f); } else { btnTr[k].localScale = new Vector3(1.0f, 1.0f, 1.0f); } } vlg.SetLayoutVertical(); }
private void ForceLayoutGroupUpdates() { HorizontalLayoutGroup inputLayout = inputsLayout.GetComponentInChildren<HorizontalLayoutGroup>(); inputLayout.CalculateLayoutInputHorizontal(); inputLayout.CalculateLayoutInputVertical(); inputLayout.SetLayoutHorizontal(); inputLayout.SetLayoutVertical(); HorizontalLayoutGroup outputLayout = outputsLayout.GetComponentInChildren<HorizontalLayoutGroup>(); outputLayout.CalculateLayoutInputHorizontal(); outputLayout.CalculateLayoutInputVertical(); outputLayout.SetLayoutHorizontal(); outputLayout.SetLayoutVertical(); HorizontalLayoutGroup deviceLayout = hackingDeviceLayout.GetComponent<HorizontalLayoutGroup>(); deviceLayout.CalculateLayoutInputHorizontal(); deviceLayout.CalculateLayoutInputVertical(); deviceLayout.SetLayoutHorizontal(); deviceLayout.SetLayoutVertical(); }
public void TestCalculateLayoutHorizontal() { var parentGO = m_PrefabRoot.transform.GetChild(0).GetChild(0); var element1GO = parentGO.GetChild(0); var element1Trans = element1GO.GetComponent <RectTransform>(); var element2GO = parentGO.GetChild(1); var element2Trans = element2GO.GetComponent <RectTransform>(); var element3GO = parentGO.GetChild(2); var element3Trans = element3GO.GetComponent <RectTransform>(); HorizontalLayoutGroup layoutGroup = m_PrefabRoot.GetComponentInChildren <HorizontalLayoutGroup>(); layoutGroup.CalculateLayoutInputHorizontal(); layoutGroup.SetLayoutHorizontal(); layoutGroup.CalculateLayoutInputVertical(); layoutGroup.SetLayoutVertical(); Assert.AreEqual(13.6f, element1Trans.anchoredPosition.x, 0.1f); Assert.AreEqual(31.3f, element2Trans.anchoredPosition.x, 0.1f); Assert.AreEqual(66.6f, element3Trans.anchoredPosition.x, 0.1f); }