# diogosabec/dev-in-blocks architecture

> Architecture diagram of the GitHub repository diogosabec/dev-in-blocks, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/diogosabec/dev-in-blocks
- Repository: https://github.com/diogosabec/dev-in-blocks

## Overview

##### Main Components
- Game Scenes – Represent the different game scenes (e.g., MainMenu, Tutorial, Atividade 1-6, SelecionarAtividade) as separate components that handle various gameplay aspects.
- Game Logic & Scripts – Include a component or a set of components for the C# scripts located in Assets/Scripts. These control behaviors (e.g., AdicionarBlocos, Gerenciamento, ExecutarPrograma) and the assembly of the visual programming blocks.
- Visual Programming Blocks – Detail the “Blocos” that the game uses to visually represent programming constructs (conditions, loops, math operations, etc.). These are implemented as prefabs in Assets/Objetos/Blocos and have specific interactions.
- Editor Extensions – Acknowledge the customization for the Unity editor (found in Assets/Editor and Assets/PlayerPrefsEditor). This represents tools that improve development workflows by managing PlayerPrefs and providing dialog extensions.
- Plugins & External Tools – Mark plugins such as the “AnotherFileBrowser” plugin (Assets/Plugins/AnotherFileBrowser) that the project integrates for file management.
- Text & UI Assets – Represent external UI support like TextMesh Pro, which assists in rendering text cleanly and attractively.

##### Relationships and Data Flow
- That the Unity Engine core loads Scenes, which in turn instantiate prefabs (visual programming blocks) and execute Game Logic.
- Link Plugins to the game’s UI or file management layers, showing data flow from user interactions to the file browser components.

##### Architectural Patterns & Design Choices
- MVC-like Separation: Illustrate a separation between the user interface (Scenes, prefabs, and UI libraries like TextMesh Pro) and the underlying game logic (C# scripts, controllers like GerenciarLoja and GerenciarTutorial).
- Modular Editor Enhancements: Show that editor-specific tools (located in Assets/Editor and PlayerPrefsEditor) act as a distinct module, used during development and for debugging purposes.
- Reusability via Prefabs: Emphasize that visual programming components are built as reusable prefabs, promoting a composition-over-inheritance approach typical in Unity projects.
- Data Persistence: Highlight the use of PlayerPrefs (and its custom editor scripts) as the mechanism for storing user or configuration data.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Runtime Layer
    subgraph "Runtime Layer"
        UECore["Unity Engine Core"]:::runtime
        GS["Game Scenes"]:::runtime
        GL["Game Logic & Scripts"]:::runtime
        VPB["Visual Programming Blocks"]:::runtime
        TU["Text & UI Assets"]:::runtime
        PL["Plugins & External Tools"]:::runtime
    end

    %% Development/Editor Layer
    subgraph "Development/Editor Layer"
        EE["Editor Extensions"]:::editor
        PPE["PlayerPrefs Editor"]:::editor
        PPS["PlayerPrefs Storage"]:::editor
    end

    %% Relationships in Runtime Layer
    UECore -->|"loads"| GS
    GS -->|"triggers"| GL
    GL -->|"instantiates"| VPB
    GL -->|"updates"| TU
    TU -->|"triggers"| PL

    %% Relationships in Development/Editor Layer
    EE -->|"configures"| PPS
    PPE -->|"manages"| PPS

    %% Click Events for Component Mapping
    click GS "https://github.com/diogosabec/dev-in-blocks/tree/main/Assets/Scenes"
    click GL "https://github.com/diogosabec/dev-in-blocks/tree/main/Assets/Scripts"
    click VPB "https://github.com/diogosabec/dev-in-blocks/tree/main/Assets/Objetos/Blocos"
    click TU "https://github.com/diogosabec/dev-in-blocks/tree/main/Assets/TextMesh Pro"
    click PL "https://github.com/diogosabec/dev-in-blocks/tree/main/Assets/Plugins/AnotherFileBrowser"
    click EE "https://github.com/diogosabec/dev-in-blocks/tree/main/Assets/Editor"
    click PPE "https://github.com/diogosabec/dev-in-blocks/tree/main/Assets/PlayerPrefsEditor"

    %% Style Definitions
    classDef runtime fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef editor fill:#90EE90,stroke:#000,stroke-width:2px;
```
