Пример #1
0
            public void OnGUI()
            {
                onGuiCount++;
                using (new EditorHelper.Horizontal()) {
                    using (new EditorHelper.Vertical()) {
                        // using (new EditorHelper.Box(Config.showSpawnerMode, 0))
                        {
                            using (new EditorHelper.Indent(Config.showSpawnerMode ? -1 : -2))
                                using (new EditorHelper.Horizontal())
                                {
                                    enabled = EditorGUILayout.Toggle(enabled, GUILayout.ExpandWidth(false), GUILayout.Width(30));

                                    bool existed = Config.challengePresetFold.ContainsKey(this);
                                    if (!existed)
                                    {
                                        Config.challengePresetFold[this] = true;
                                    }

                                    bool     foldout = Config.challengePresetFold[this];
                                    GUIStyle gs      = new GUIStyle(EditorStyles.foldout);
                                    gs.fontStyle = FontStyle.Bold;
                                    GUIStyleState normal = new GUIStyleState();
                                    normal.textColor = new Color(20 / 255f, 225 / 255f, 226 / 255f, 1);
                                    gs.normal        = normal;
                                    gs.focused       = normal;
                                    gs.hover         = normal;
                                    gs.active        = normal;
                                    gs.onActive      = normal;
                                    gs.onFocused     = normal;
                                    gs.onHover       = normal;
                                    gs.onNormal      = normal;

                                    foldout = GUILayout.Toggle(
                                        foldout, $"Preset #{order}", gs,
                                        GUILayout.ExpandWidth(false), GUILayout.Width(140)
                                        );

                                    if (Config.challengePresetFold[this] != foldout)
                                    {
                                        Config.ResetCacheRectData();
                                    }
                                    Config.challengePresetFold[this] = foldout;
                                    if (!foldout)
                                    {
                                        return;
                                    }

                                    // EditorGUILayout.LabelField($"Preset #{order}", GUILayout.ExpandWidth(false), GUILayout.Width(120));
                                    IsRemoved = GUILayout.Button("Remove", GUILayout.ExpandWidth(false), GUILayout.Width(70));
                                }

                            path     = new EditorHelper.ScriptableObjectDrawer <ChallengePresetAsset, ChallengePresetEditor>().DrawFromPathString("Asset", path);
                            delay    = EditorGUILayout.FloatField("Spawn at(s)", delay);
                            count    = EditorGUILayout.IntField("Spawn Count", count);
                            interval = EditorGUILayout.FloatField("Spawn Interval", interval);

                            delay    = Mathf.Max(0, delay);
                            count    = Mathf.Max(1, count);
                            interval = Mathf.Max(0, interval);

                            Spawn.DrawTrackers(trackers, ref foldTracker);
                        }
                    }

                    DrawIconOfCharacterOfSpawner();
                }
            }