예제 #1
0
        void ShowItemPrefabDataList(LoopListView listView)
        {
            EditorGUILayout.PropertyField(mItemPrefabDataList, mItemPrefabListContent);
            if (mItemPrefabDataList.isExpanded == false)
            {
                return;
            }
            EditorGUI.indentLevel += 1;
            if (GUILayout.Button("Add New"))
            {
                mItemPrefabDataList.InsertArrayElementAtIndex(mItemPrefabDataList.arraySize);
                if (mItemPrefabDataList.arraySize > 0)
                {
                    SerializedProperty itemData    = mItemPrefabDataList.GetArrayElementAtIndex(mItemPrefabDataList.arraySize - 1);
                    SerializedProperty mItemPrefab = itemData.FindPropertyRelative("mItemPrefab");
                    mItemPrefab.objectReferenceValue = null;
                }
            }
            int removeIndex = -1;

            EditorGUILayout.PropertyField(mItemPrefabDataList.FindPropertyRelative("Array.size"));
            for (int i = 0; i < mItemPrefabDataList.arraySize; i++)
            {
                SerializedProperty itemData            = mItemPrefabDataList.GetArrayElementAtIndex(i);
                SerializedProperty mInitCreateCount    = itemData.FindPropertyRelative("mInitCreateCount");
                SerializedProperty mItemPrefab         = itemData.FindPropertyRelative("mItemPrefab");
                SerializedProperty mItemPrefabPadding  = itemData.FindPropertyRelative("mPadding");
                SerializedProperty mItemStartPosOffset = itemData.FindPropertyRelative("mStartPosOffset");
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(itemData);
                if (GUILayout.Button("Remove"))
                {
                    removeIndex = i;
                }
                EditorGUILayout.EndHorizontal();
                if (itemData.isExpanded == false)
                {
                    continue;
                }
                mItemPrefab.objectReferenceValue = EditorGUILayout.ObjectField("ItemPrefab", mItemPrefab.objectReferenceValue, typeof(GameObject), true);
                mItemPrefabPadding.floatValue    = EditorGUILayout.FloatField("ItemPadding", mItemPrefabPadding.floatValue);
                if (listView.ArrangeType == ListItemArrangeType.TopToBottom || listView.ArrangeType == ListItemArrangeType.BottomToTop)
                {
                    mItemStartPosOffset.floatValue = EditorGUILayout.FloatField("XPosOffset", mItemStartPosOffset.floatValue);
                }
                else
                {
                    mItemStartPosOffset.floatValue = EditorGUILayout.FloatField("YPosOffset", mItemStartPosOffset.floatValue);
                }
                mInitCreateCount.intValue = EditorGUILayout.IntField("InitCreateCount", mInitCreateCount.intValue);
                EditorGUILayout.Space();
                EditorGUILayout.Space();
            }
            if (removeIndex >= 0)
            {
                mItemPrefabDataList.DeleteArrayElementAtIndex(removeIndex);
            }
            EditorGUI.indentLevel -= 1;
        }
예제 #2
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            LoopListView tListView = serializedObject.targetObject as LoopListView;

            if (tListView == null)
            {
                return;
            }
            ShowItemPrefabDataList(tListView);
            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(mSupportScrollBar, mSupportScrollBarContent);
            EditorGUILayout.PropertyField(mItemSnapEnable, mItemSnapEnableContent);
            if (mItemSnapEnable.boolValue == true)
            {
                EditorGUILayout.PropertyField(mItemSnapPivot, mItemSnapPivotContent);
                EditorGUILayout.PropertyField(mViewPortSnapPivot, mViewPortSnapPivotContent);
            }
            EditorGUILayout.PropertyField(mArrangeType, mArrangeTypeGuiContent);

            serializedObject.ApplyModifiedProperties();
        }
예제 #3
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            LoopListView tListView = serializedObject.targetObject as LoopListView;

            if (tListView == null)
            {
                return;
            }
            EditorGUILayout.PropertyField(mItemPrefab, mItemPrefabGuiContent);
            EditorGUILayout.PropertyField(mItemSize, mItemSizeGuiContent);
            if (tListView.ArrangeType == ListItemArrangeType.BottomToTop || tListView.ArrangeType == ListItemArrangeType.TopToBottom)
            {
                EditorGUILayout.PropertyField(mItemCountPerGroup, mItemCountPerGroupGuiContent1);
            }
            else
            {
                EditorGUILayout.PropertyField(mItemCountPerGroup, mItemCountPerGroupGuiContent2);
            }
            EditorGUILayout.PropertyField(mPadding, mPaddingGuiContent);
            EditorGUILayout.PropertyField(mArrangeType, mArrangeTypeGuiContent);

            serializedObject.ApplyModifiedProperties();
        }