public override void OnInspectorGUI() { base.OnInspectorGUI(); // viewport size EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(m_c_viewportSize, m_labelWidth); // size EditorGUI.BeginDisabledGroup(m_scrollList.isAutoSize); Vector2 viewportSize = m_viewportSize.vector2Value; int vpw = EditorGUILayout.IntField((int)viewportSize.x, m_halfWidth); int vph = EditorGUILayout.IntField((int)viewportSize.y); if (!m_scrollList.isAutoSize) { m_scrollList.SetViewportSize((uint)(vpw < 0 ? 0 : vpw), (uint)(vph < 0 ? 0 : vph)); } MarkSceneDirty(vpw != viewportSize.x || vph != viewportSize.y); EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); // direction EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(m_c_direction, m_labelWidth); bool isVertical = m_scrollList.isVertical; bool isH = GUILayout.Toggle(!isVertical, m_c_horizontal, m_halfWidth); bool isV = GUILayout.Toggle(isVertical, m_c_vertical); if (isVertical) { if (isH) { m_scrollList.isVertical = false; MarkSceneDirty(); } } else { if (isV) { m_scrollList.isVertical = true; MarkSceneDirty(); } } EditorGUILayout.EndHorizontal(); serializedObject.ApplyModifiedProperties(); }
static int SetViewportSize(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); ShibaInu.ScrollList obj = (ShibaInu.ScrollList)ToLua.CheckObject<ShibaInu.ScrollList>(L, 1); uint arg0 = (uint)LuaDLL.luaL_checknumber(L, 2); uint arg1 = (uint)LuaDLL.luaL_checknumber(L, 3); obj.SetViewportSize(arg0, arg1); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } }