Ejemplo n.º 1
0
        protected override void drawInspectorGUI()
        {
            if (_sceneCameraPreview == null)
            {
                _sceneCameraPreview = new SceneCameraPreview();
            }

            if (zoneControlStyle == null)
            {
                zoneControlStyle = new ListControlStyle();
                zoneControlStyle.addButtonContent.text = "添加一波刷怪";
            }

            SerializedProperty list = serializedObject.FindProperty("list");

            EditorGUILayout.PropertyField(serializedObject.FindProperty("fileName"));
            showElements(list, zoneCreateHandle, zoneControlStyle, zoomItemAddBackHandle);

            _list.DoLayoutList();


            EditorGUILayout.Separator();

            drawExportUI();
        }
Ejemplo n.º 2
0
        protected override void drawInspectorGUI()
        {
            if (itemControlStyle == null)
            {
                itemControlStyle = new ListControlStyle();
                itemControlStyle.addButtonContent.text = "添加一点";
            }

            EditorGUILayout.PropertyField(serializedObject.FindProperty("key"));

            SerializedProperty list = serializedObject.FindProperty("list");

            showElements(list, itemCreateHandle, itemControlStyle);

            if (list.arraySize > 1)
            {
                if (GUILayout.Button("类型排序", EditorStyles.miniButton))
                {
                    mTarget.list.Sort((x, y) =>
                    {
                        return((int)y.type - (int)x.type);
                    });
                }
            }
            EditorGUILayout.Separator();
            ShowPreview = GUILayout.Toggle(ShowPreview, "showPreview");
            drawExportUI("NpcCFG");
        }
Ejemplo n.º 3
0
        private void waveCreateHandle(SerializedProperty list, SerializedProperty item, int index)
        {
            if (monsterControlStyle == null)
            {
                monsterControlStyle = new ListControlStyle();
                monsterControlStyle.addButtonContent.text = "添加一只怪";
            }
            if (waveIndex == index)
            {
                EditorGUILayout.BeginVertical(headStyle.box2);
            }
            else
            {
                EditorGUILayout.BeginVertical("box");
            }
            EditorGUILayout.BeginHorizontal();

            EditorGUI.indentLevel++;
            EditorGUI.BeginChangeCheck();
            bool b = EditorGUILayout.Foldout(waveIndex == index, "Wave " + (index + 1));

            if (EditorGUI.EndChangeCheck())
            {
                if (b)
                {
                    waveIndex    = index;
                    monsterIndex = 0;
                }
                else if (waveIndex == index)
                {
                    waveIndex = -1;
                }
            }

            b &= showButtons(list, index, waveControlStyle);
            EditorGUILayout.EndHorizontal();

            if (waveIndex == index)
            {
                EditorGUILayout.PropertyField(item.FindPropertyRelative("trigType"));
                EditorGUILayout.PropertyField(item.FindPropertyRelative("enterType"));
                EditorGUILayout.PropertyField(item.FindPropertyRelative("enterPath"));

                SerializedProperty slotsProperty = item.FindPropertyRelative("list");
                showElements(slotsProperty, monsterCreateHandle, monsterControlStyle);
                SerializedProperty repeatProperty = item.FindPropertyRelative("repeat");
                EditorGUILayout.PropertyField(repeatProperty);
                if (repeatProperty.intValue > 0)
                {
                    EditorGUILayout.PropertyField(item.FindPropertyRelative("repeatDelayTime"));
                }
            }
            EditorGUI.indentLevel--;
            EditorGUILayout.EndVertical();
        }
Ejemplo n.º 4
0
        protected bool showButtons(SerializedProperty list, int index, ListControlStyle style = null, Action <SerializedProperty> resetCreateItemAction = null)
        {
            if (style == null)
            {
                style = DefaultControlStyle;
            }
            if (GUILayout.Button(style.moveDownButtonContent, EditorStyles.miniButtonLeft, style.miniButtonWidth))
            {
                if (index < list.arraySize - 1)
                {
                    list.MoveArrayElement(index, index + 1);

                    return(false);
                }
            }
            if (GUILayout.Button(style.moveUpButtonContent, EditorStyles.miniButtonMid, style.miniButtonWidth))
            {
                if (index > 0)
                {
                    list.MoveArrayElement(index, index - 1);

                    return(false);
                }
            }

            if (GUILayout.Button(style.duplicateButtonContent, EditorStyles.miniButtonMid, style.miniButtonWidth))
            {
                list.InsertArrayElementAtIndex(index);
                if (resetCreateItemAction != null)
                {
                    resetCreateItemAction(list.GetArrayElementAtIndex(index));
                }
                return(false);
            }
            if (GUILayout.Button(style.deleteButtonContent, EditorStyles.miniButtonRight, style.miniButtonWidth))
            {
                int oldSize = list.arraySize;
                list.DeleteArrayElementAtIndex(index);
                if (list.arraySize == oldSize)
                {
                    list.DeleteArrayElementAtIndex(index);
                }
                return(false);
            }

            return(true);
        }
Ejemplo n.º 5
0
        private void zoneCreateHandle(SerializedProperty list, SerializedProperty item, int index)
        {
            bool b = false;

            if (waveControlStyle == null)
            {
                waveControlStyle = new ListControlStyle();
                waveControlStyle.addButtonContent.text = "添加一波刷怪";
            }

            if (zoomIndex == index)
            {
                GUILayout.BeginVertical(headStyle.box);
            }

            SerializedProperty rectProperty = item.FindPropertyRelative("rect");

            if (rectProperty.rectValue.size == Vector2.zero)
            {
                rectProperty.rectValue = new Rect(Vector2.zero, Vector2.one * 3);
                serializedObject.ApplyModifiedProperties();
            }

            using (new EditorGUILayout.HorizontalScope())
            {
                b = Header(item, "Zone " + (index + 1), index, rectProperty.rectValue);

                b &= showButtons(list, index, zoneControlStyle, zoomItemAddBackHandle);
            }
            if (b)
            {
                EditorGUILayout.PropertyField(rectProperty, GUIContent.none);
                EditorGUILayout.PropertyField(item.FindPropertyRelative("enterType"));
                EditorGUILayout.PropertyField(item.FindPropertyRelative("enterPath"));

                EditorGUILayout.PropertyField(item.FindPropertyRelative("exitType"));
                EditorGUILayout.PropertyField(item.FindPropertyRelative("exitPath"));

                SerializedProperty slotsProperty = item.FindPropertyRelative("list");
                showElements(slotsProperty, waveCreateHandle, zoneControlStyle);
            }

            if (zoomIndex == index)
            {
                GUILayout.EndVertical();
            }
        }
Ejemplo n.º 6
0
        protected override void drawInspectorGUI()
        {
            if (zoneControlStyle == null)
            {
                zoneControlStyle = new ListControlStyle();
                zoneControlStyle.addButtonContent.text = "添加一组";
            }

            SerializedProperty list = serializedObject.FindProperty("list");

            EditorGUILayout.PropertyField(serializedObject.FindProperty("fileName"));
            showElements(list, zoneCreateHandle, zoneControlStyle);

            EditorGUILayout.Separator();
            ShowPreview = GUILayout.Toggle(ShowPreview, "showPreview");
            drawExportUI("TeamSpawersCFG");
        }
Ejemplo n.º 7
0
 public virtual void showElements(SerializedProperty list, Action <SerializedProperty, SerializedProperty, int> itemGuiCreateHandle = null, ListControlStyle style = null, Action <SerializedProperty> itemAddHandle = null)
 {
     if (style == null)
     {
         style = DefaultControlStyle;
     }
     if (list.arraySize > 0)
     {
         EditorGUILayout.Space();
     }
     for (int i = 0; i < list.arraySize; i++)
     {
         SerializedProperty item = list.GetArrayElementAtIndex(i);
         if (itemGuiCreateHandle != null)
         {
             itemGuiCreateHandle(list, item, i);
         }
         else
         {
             EditorGUILayout.BeginHorizontal();
             EditorGUILayout.PropertyField(item);
             showButtons(list, i, style);
             EditorGUILayout.EndHorizontal();
         }
     }
     if (list.arraySize == 0 && GUILayout.Button(style.addButtonContent, style.addButtonWidth))
     {
         list.arraySize += 1;
         if (itemAddHandle != null)
         {
             SerializedProperty item = list.GetArrayElementAtIndex(list.arraySize - 1);
             itemAddHandle(item);
         }
     }
 }