예제 #1
0
    void OnGUI()
    {
        #region Settings
        EditorGUILayout.Separator();

        // Continuous mode toggle
        spawner.continuous = EditorGUILayout.BeginToggleGroup("Continuous", spawner.continuous);

        // Prefab's rate for placing objects
        EditorGUILayout.LabelField("Fill Rate");
        spawner.fillRate = EditorGUILayout.Slider(spawner.fillRate, 0.01f, 0.5f);
        EditorGUILayout.EndToggleGroup();

        EditorGUILayout.Separator();
        #endregion

        #region Prefabs Selection Menu
        int gridWidth = (int)position.width / 140;
        prefabWindow.DrawGUI(gridWidth);

        EditorGUILayout.Separator();
        #endregion

        #region Save/Load Buttons
        EditorGUILayout.BeginHorizontal();

        if (GUILayout.Button("Save Slots..."))
        {
            SaveSlotsWindow.ShowWindow();
        }

        if (GUILayout.Button("Load Slots..."))
        {
            string file = EditorUtility.OpenFilePanel("Load Slots File", slotsSaveFilePath, "json");
            if (file.Length > 0)
            {
                LoadFromJson(new StreamReader(file));
            }
        }

        EditorGUILayout.EndHorizontal();
        #endregion
    }
예제 #2
0
    public static void ShowWindow()
    {
        SaveSlotsWindow window = GetWindow <SaveSlotsWindow>(true, "Save Slots", true);

        window.position = new Rect(Screen.width / 2, Screen.height / 2, 290, 10);
    }