public void Start(Action onJoinCallback, Action onBackCallback) { _onJoinedRoom = onJoinCallback; _onBack = onBackCallback; _selectedRoomIndex = -1; _networkManager = Singleton.instance.networkManager; viewFactory.CreateAsync <MultiplayerLobbyView>("GameSetup/MultiplayerLobbyView", (popup) => { view = _lobbyView = popup as MultiplayerLobbyView; _lobbyView._joinButton.onClick.AddListener(onJoinButton); _lobbyView._backButton.onClick.AddListener(onBackButton); _lobbyView._createButton.onClick.AddListener(onCreateButton); _roomListView = _lobbyView._listScrollRect; _roomListView.itemRendererFactory = itemRendererFactory; _roomListView.onSelectedItem += onRoomClicked; _roomListView.dataProvider = _getRoomDataProvider(); _networkManager.onReceivedRoomListUpdate += onReceivedRoomListUpdate; _networkManager.onJoinedRoom += onJoinedRoom; }); }
private void DrawDefaultScrollRect() { EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Content")); ListScrollRect listScrollRect = target as ListScrollRect; SerializedProperty horizontalProperty = serializedObject.FindProperty("m_Horizontal"); SerializedProperty verticalProperty = serializedObject.FindProperty("m_Vertical"); if (listScrollRect.ScrollDir == ListScrollRect.ScrollDirection.Horizontal) { horizontalProperty.boolValue = true; } if (listScrollRect.ScrollDir == ListScrollRect.ScrollDirection.Vertical) { verticalProperty.boolValue = true; } GUI.enabled = (listScrollRect.ScrollDir != ListScrollRect.ScrollDirection.Horizontal); EditorGUILayout.PropertyField(horizontalProperty); GUI.enabled = (listScrollRect.ScrollDir != ListScrollRect.ScrollDirection.Vertical); EditorGUILayout.PropertyField(verticalProperty); GUI.enabled = true; EditorGUI.indentLevel = 1; EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Elasticity")); EditorGUI.indentLevel = 0; EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Inertia")); EditorGUI.indentLevel = 1; EditorGUILayout.PropertyField(serializedObject.FindProperty("m_DecelerationRate")); EditorGUI.indentLevel = 0; EditorGUILayout.PropertyField(serializedObject.FindProperty("m_ScrollSensitivity")); EditorGUILayout.Space(); EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Viewport")); EditorGUILayout.PropertyField(serializedObject.FindProperty("m_HorizontalScrollbar")); EditorGUI.indentLevel = 1; EditorGUILayout.PropertyField(serializedObject.FindProperty("m_HorizontalScrollbarVisibility"), new GUIContent("Visibility")); EditorGUILayout.PropertyField(serializedObject.FindProperty("m_HorizontalScrollbarSpacing"), new GUIContent("Spacing")); EditorGUI.indentLevel = 0; EditorGUILayout.PropertyField(serializedObject.FindProperty("m_VerticalScrollbar")); EditorGUI.indentLevel = 1; EditorGUILayout.PropertyField(serializedObject.FindProperty("m_VerticalScrollbarVisibility"), new GUIContent("Visibility")); EditorGUILayout.PropertyField(serializedObject.FindProperty("m_VerticalScrollbarSpacing"), new GUIContent("Spacing")); EditorGUI.indentLevel = 0; EditorGUILayout.Space(); EditorGUILayout.PropertyField(serializedObject.FindProperty("m_OnValueChanged")); }
//private void DrawContentFillerInterface() //{ // SerializedProperty contentFillerInterfaceProperty = serializedObject.FindProperty("contentFillerInterface"); // GameObject contentFillerInterface = contentFillerInterfaceProperty.objectReferenceValue as GameObject; // EditorGUILayout.PropertyField(contentFillerInterfaceProperty, new GUIContent("Content Filler Interface", "The GameObject that has the component that implements the IContentFiller interface.")); // if (contentFillerInterface != null && contentFillerInterface.GetComponent(typeof(IContentFiller)) == null) // { // EditorGUILayout.HelpBox("GameObject does not have an attached component that implements the IContentFiller interface.", MessageType.Error); // } //} private void DrawPadding() { ListScrollRect listScrollRect = target as ListScrollRect; SerializedProperty paddingProperty = serializedObject.FindProperty("padding"); SerializedProperty editorShowPadding = serializedObject.FindProperty("editorShowPadding"); editorShowPadding.boolValue = EditorGUILayout.Foldout(editorShowPadding.boolValue, new GUIContent("Padding", "The padding that will be used in the list.")); if (editorShowPadding.boolValue) { EditorGUI.indentLevel++; int start = (listScrollRect.ScrollDir == ListScrollRect.ScrollDirection.Vertical) ? 2 : 0; int end = (listScrollRect.ScrollDir == ListScrollRect.ScrollDirection.Vertical) ? 4 : 2; for (int i = start; i < end; i++) { paddingProperty.GetArrayElementAtIndex(i).floatValue = EditorGUILayout.FloatField(paddingLabels[i], paddingProperty.GetArrayElementAtIndex(i).floatValue); } EditorGUI.indentLevel--; } }
public void Setup(ListScrollRect listScrollRect) { this.listScrollRect = listScrollRect; SetScrollDirection(listScrollRect.ScrollDir); }