Пример #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();
    }
Пример #2
0
    private void DessinerInterfacesSauvegarde()
    {
        GUILayout.Label("Sauvegardes");

        GUILayout.Space(5);

        GUILayout.BeginHorizontal();

        GUILayoutOption[] txtFieldOptions = new GUILayoutOption[2] {
            GUILayout.MaxWidth(150), GUILayout.MinHeight(20)
        };
        nomMappeSauvegarde = GUILayout.TextField(nomMappeSauvegarde, txtFieldOptions);

        GUILayoutOption[] optionsSave = new GUILayoutOption[2] {
            GUILayout.MaxWidth(150), GUILayout.MinHeight(20)
        };
        if (GUILayout.Button("Sauvegarder Mappe", optionsSave))
        {
            if (nomMappeSauvegarde == "")
            {
                if (EditorUtility.DisplayDialog("Manque le nom", "Rentre un nom pour ta mappe !", "Oui Léo..."))
                {
                    if (EditorUtility.DisplayDialog(":3", "C'est bien mon grand ^^ !", "Ouai ouai... TG..."))
                    {
                    }
                }
            }
            else if (MappeSysteme.CheckerMappeExiste(nomMappeSauvegarde))
            {
                if (EditorUtility.DisplayDialog("La mappe existe déjà", "La mappe existe déjà, tu veux écraser la sauvegarde ?", "Oui", "Non"))
                {
                    MappeSysteme.SauvergarderMappe(nomMappeSauvegarde, true);
                }
            }
            else
            {
                MappeSysteme.SauvergarderMappe(nomMappeSauvegarde, false);
            }
            nomMappeSauvegarde = "NomSauvergarde";
        }
        GUILayout.EndHorizontal();

        GUILayout.Space(5);

        List <string> listeMappes = MappeSysteme.RecuprererNomMappes();

        for (int i = 0; i < listeMappes.Count; i++)
        {
            CreerIntefaceSauvegarde(listeMappes[i]);
        }
    }