Example #1
0
 private void LoadLastEditorState()
 {
     m_IsInEditSquareMode     = EditorPrefs.GetBool(nameof(m_IsInEditSquareMode));
     m_CurrentEditSquareState = (SquareState)EditorPrefs.GetInt(nameof(m_CurrentEditSquareState));
     m_CurrentSquareBrush     = (SquareBrush)EditorPrefs.GetInt(nameof(m_CurrentSquareBrush));
     m_IsInEditEdgeMode       = EditorPrefs.GetBool(nameof(m_IsInEditEdgeMode));
     m_IsAddOrRemoveEdge      = EditorPrefs.GetBool(nameof(m_IsAddOrRemoveEdge));
 }
Example #2
0
    public override void OnInspectorGUI()
    {
        GUILayout.Label("============ MAP EDITOR =============", EditorStyles.boldLabel);
        // Affichage Bouton Initialize Map And Generate.
        if (GUILayout.Button("Initialize Map Randomly"))
        {
            m_CurrentMapTarget.InitializeMapRandomly();
            SetObjectDirty(m_CurrentMapTarget);
        }

        // Affichage Bouton de Reset de la map.
        if (GUILayout.Button("Initialize Empty Map"))
        {
            m_CurrentMapTarget.InitiliazeEmptyMap();
            SetObjectDirty(m_CurrentMapTarget);
        }

        GUILayout.Space(10);
        m_ShowMapView = GUILayout.Toggle(m_ShowMapView, "Show View");
        if (m_CurrentMapTarget.navContainer != null)
        {
            m_CurrentMapTarget.navContainer.SetActive(m_ShowMapView);
        }

        GUILayout.Label("EDIT SQUARE", EditorStyles.boldLabel);
        m_IsInEditSquareMode = GUILayout.Toggle(m_IsInEditSquareMode, "Edit Square Mode");
        if (m_IsInEditSquareMode)
        {
            m_IsInEditEdgeMode = false;

            // Affichage pop up d'edition du state d'un square de la map
            m_CurrentEditSquareState = (SquareState)EditorGUILayout.EnumPopup(m_CurrentEditSquareState);

            // Affichage pop up brush
            m_CurrentSquareBrush = (SquareBrush)EditorGUILayout.EnumPopup(m_CurrentSquareBrush);
            GUILayout.Label("Brush orientation 'R' : " + m_CurrentBrushOrientation);
        }

        GUILayout.Label("EDIT EDGE", EditorStyles.boldLabel);
        m_IsInEditEdgeMode = GUILayout.Toggle(m_IsInEditEdgeMode, "Edit Edge Mode");
        if (m_IsInEditEdgeMode)
        {
            m_IsInEditSquareMode = false;
            m_IsAddOrRemoveEdge  = GUILayout.Toggle(m_IsAddOrRemoveEdge, m_IsAddOrRemoveEdge ? "Add Edge" : "Remove Edge");
        }

        GUILayout.Label("============ MAP PROPERTIES =============", EditorStyles.boldLabel);
        base.OnInspectorGUI();
    }