Пример #1
0
    private void CreerIntefaceSauvegarde(string nomMappe)
    {
        GUILayout.BeginHorizontal();
        GUILayout.Label(nomMappe);


        GUI.backgroundColor = new Color(0.3f, 0.8f, 0.3f);
        GUILayoutOption[] optionsCharge = new GUILayoutOption[2] {
            GUILayout.Width(80), GUILayout.Height(20)
        };
        if (GUILayout.Button("CHARGER", optionsCharge))
        {
            MappeSysteme.Mappe mappe;

            if (EditorUtility.DisplayDialog("Chargement", "T'es bien sûr d'avoir sauvegarder ta mappe avant d'en charger une autre ?", "Ouaip !", "ah merde, non !"))
            {
                if (MappeSysteme.CheckerMappeExiste(nomMappe))
                {
                    MappeSysteme.ChargerMappe(nomMappe);
                    mappe = MappeSysteme.CreerMappe(nomMappe);

                    colonnes = mappe.colonnes;
                    lignes   = mappe.lignes;
                }
                else
                {
                    EditorUtility.DisplayDialog("Erruer", "La mappe n'a pas été trouvée. Elle n'existe peut-être pas, ou le nom n'est pas le bon", "hum...");
                }
            }
        }



        GUI.backgroundColor = new Color(0.8f, 0.3f, 0.3f);
        GUILayoutOption[] optionsSuppr = new GUILayoutOption[2] {
            GUILayout.Width(80), GUILayout.Height(20)
        };
        if (GUILayout.Button("SUPPRIMER", optionsSuppr))
        {
            if (EditorUtility.DisplayDialog("Suppression", "Tu veux vraiment supprimer cette mappe ?", "Oui oui", "ah merde, non !"))
            {
                if (MappeSysteme.CheckerMappeExiste(nomMappe))
                {
                    MappeSysteme.SupprimerMappe(nomMappe);
                }
                else
                {
                    Debug.LogError("La mappe n'a pas été trouvée. Elle n'existe peut-être pas, ou le nom n'est pas le bon");
                }
            }
        }
        GUILayout.Space(230);

        GUILayout.EndHorizontal();
    }