# seal367/wust_java_online architecture

> Architecture diagram of the GitHub repository seal367/wust_java_online, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/seal367/wust_java_online
- Repository: https://github.com/seal367/wust_java_online

## Overview

##### Project Type and Purpose
- Type: Standalone desktop application (JavaFX)
- Purpose: A Snake game with an extended skill system and roguelike features, packaged via Maven.

##### Main Architectural Components
a. Application Launcher
- SnakeGameWSAD.java / SimpleSnakeGame.java (entry-point classes)
b. UI Layer (View + Controller – MVC)
- FXML Views (src/main/resources/fxml/*)
- CSS Stylesheets (src/main/resources/css/*)
- Controllers (src/main/java/com/example/javafx3/ui/*)
c. Game Logic Layer (Model + Manager)
- Domain Models (SkillCard, SkillEffect, Point, Rarity, EffectType)
- Managers (GameState, SkillManager)
d. Test Suite
- GameOverTest.java, SkillSystemTest.java
e. Build & Packaging
- Maven (pom.xml, mvnw, .mvn/wrapper)

##### Relationships & Data Flow
1. User launches the application via Main class → JavaFX Application Thread starts.
2. FXML loader reads a .fxml file, applies corresponding CSS, instantiates Controller.
- Example: skill-menu.fxml → SkillMenuController
3. Controller handles user input (keyboard events: W/A/S/D, SPACE, P) and UI events (button clicks).
4. Controller invokes methods on GameState and SkillManager to update the game model.
5. Game loop (inside SimpleSnakeGame or SnakeGameWSAD) polls GameState, updates snake position, checks collisions and skill effects.
6. Updated model data is pushed back to the UI—Controllers refresh the view via JavaFX bindings or manual DOM updates.
7. Test classes validate GameOver conditions and Skill System logic independently.

##### Architectural Patterns & Principles
- MVC:
- Model: com.example.javafx3.model.* + com.example.javafx3.manager.*
- View: FXML + CSS (resources)
- Controller: com.example.javafx3.ui.*
- Layered Separation:
- Presentation (JavaFX FXML/CSS)
- Application Logic (Controllers, Managers)
- Domain Model (SkillCard, SkillEffect, etc.)
- Dependency Management via Maven.

##### Essential Elements Checklist
- Each rectangle/component is clearly labeled.
- Annotations for key classes and methods to capture architectural details.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Application Launcher
    subgraph "Application Launcher"
        direction TB
        SS["SimpleSnakeGame"]:::launcher
        SG["SnakeGameWSAD"]:::launcher
        FL["FXML Loader"]:::frontend
        SS -->|"loads FXML"| FL
        SG -->|"loads FXML"| FL
    end

    %% UI Layer
    subgraph "UI Layer (View + Controller)"
        direction TB
        subgraph "FXML Views"
            direction TB
            GOF["game-over.fxml"]:::frontend
            SCF["skill-card.fxml"]:::frontend
            SMF["skill-menu.fxml"]:::frontend
            SDF["skill-detail.fxml"]:::frontend
        end
        subgraph "CSS Stylesheets"
            direction TB
            GOCSS["game-over.css"]:::frontend
            GS["game-styles.css"]:::frontend
            SUICSS["skill-ui.css"]:::frontend
            SDCSS["skill-detail.css"]:::frontend
        end
        subgraph "Controllers"
            direction TB
            GOC["GameOverController"]:::frontend
            SSMC["SimpleSkillMenuController"]:::frontend
            SCC["SkillCardController"]:::frontend
            SDC["SkillDetailController"]:::frontend
            SMC["SkillMenuController"]:::frontend
            SNS["SkillNotificationSystem"]:::frontend
        end
        FL -->|"instantiates"| GOC
        FL -->|"instantiates"| SSMC
        FL -->|"instantiates"| SCC
        FL -->|"instantiates"| SDC
        FL -->|"instantiates"| SMC
        FL -->|"instantiates"| SNS
    end

    %% Game Logic Layer
    subgraph "Game Logic Layer (Model + Managers)"
        direction TB
        subgraph "Domain Models"
            direction TB
            SC["SkillCard"]:::logic
            SE["SkillEffect"]:::logic
            PT["Point"]:::logic
            RAR["Rarity"]:::logic
            ET["EffectType"]:::logic
        end
        subgraph "Managers"
            direction TB
            GS["GameState"]:::logic
            SM["SkillManager"]:::logic
        end
        %% Controllers invoke managers
        GOC -->|"calls updateState() on"| GS
        SSMC -->|"calls updateSkill() on"| SM
        SCC -->|"queries"| SM
        SDC -->|"queries"| SM
        SMC -->|"calls newSkill() on"| SM
        SNS -->|"listens to"| GS
        %% Game Loop
        SS -->|"game loop polls"| GS
        SG -->|"game loop polls"| GS
        GS -->|"updates model"| SC
        GS -->|"updates model"| SE
        GS -->|"updates model"| PT
    end

    %% Resources
    subgraph "Resources"
        direction TB
        FL -->|"loads from"| GOF
        FL -->|"loads from"| SCF
        FL -->|"loads from"| SMF
        FL -->|"loads from"| SDF
        FL -->|"applies"| GOCSS
        FL -->|"applies"| GS
        FL -->|"applies"| SUICSS
        FL -->|"applies"| SDCSS
    end

    %% Build & Test
    subgraph "Build & Packaging"
        direction TB
        POM["pom.xml"]:::build
        MVW["mvnw / mvnw.cmd"]:::build
        MWR[".mvn/wrapper"]:::build
    end

    subgraph "Test Suite"
        direction TB
        GOT["GameOverTest"]:::build
        SST["SkillSystemTest"]:::build
        GOT -->|"tests"| GS
        SST -->|"tests"| SM
    end

    %% Classes
    classDef launcher fill:#FFA500,stroke:#333,stroke-width:1px
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef logic fill:#90EE90,stroke:#333,stroke-width:1px
    classDef build fill:#D3D3D3,stroke:#333,stroke-width:1px

    %% Click Events
    click SS "https://github.com/seal367/wust_java_online/blob/main/src/main/java/com/example/javafx3/SimpleSnakeGame.java"
    click SG "https://github.com/seal367/wust_java_online/blob/main/src/main/java/com/example/javafx3/SnakeGameWSAD.java"
    click GOF "https://github.com/seal367/wust_java_online/blob/main/src/main/resources/com/example/javafx3/fxml/game-over.fxml"
    click SCF "https://github.com/seal367/wust_java_online/blob/main/src/main/resources/com/example/javafx3/fxml/skill-card.fxml"
    click SMF "https://github.com/seal367/wust_java_online/blob/main/src/main/resources/com/example/javafx3/fxml/skill-menu.fxml"
    click SDF "https://github.com/seal367/wust_java_online/blob/main/src/main/resources/fxml/skill-detail.fxml"
    click GOCSS "https://github.com/seal367/wust_java_online/blob/main/src/main/resources/com/example/javafx3/css/game-over.css"
    click GS "https://github.com/seal367/wust_java_online/blob/main/src/main/resources/com/example/javafx3/css/game-styles.css"
    click SUICSS "https://github.com/seal367/wust_java_online/blob/main/src/main/resources/com/example/javafx3/css/skill-ui.css"
    click SDCSS "https://github.com/seal367/wust_java_online/blob/main/src/main/resources/css/skill-detail.css"
    click GOC "https://github.com/seal367/wust_java_online/blob/main/src/main/java/com/example/javafx3/ui/GameOverController.java"
    click SSMC "https://github.com/seal367/wust_java_online/blob/main/src/main/java/com/example/javafx3/ui/SimpleSkillMenuController.java"
    click SCC "https://github.com/seal367/wust_java_online/blob/main/src/main/java/com/example/javafx3/ui/SkillCardController.java"
    click SDC "https://github.com/seal367/wust_java_online/blob/main/src/main/java/com/example/javafx3/ui/SkillDetailController.java"
    click SMC "https://github.com/seal367/wust_java_online/blob/main/src/main/java/com/example/javafx3/ui/SkillMenuController.java"
    click SNS "https://github.com/seal367/wust_java_online/blob/main/src/main/java/com/example/javafx3/ui/SkillNotificationSystem.java"
    click SC "https://github.com/seal367/wust_java_online/blob/main/src/main/java/com/example/javafx3/model/SkillCard.java"
    click SE "https://github.com/seal367/wust_java_online/blob/main/src/main/java/com/example/javafx3/model/SkillEffect.java"
    click PT "https://github.com/seal367/wust_java_online/blob/main/src/main/java/com/example/javafx3/Point/Point.java"
    click RAR "https://github.com/seal367/wust_java_online/blob/main/src/main/java/com/example/javafx3/Rarity.java"
    click ET "https://github.com/seal367/wust_java_online/blob/main/src/main/java/com/example/javafx3/EffectType.java"
    click GS "https://github.com/seal367/wust_java_online/blob/main/src/main/java/com/example/javafx3/manager/GameState.java"
    click SM "https://github.com/seal367/wust_java_online/blob/main/src/main/java/com/example/javafx3/manager/SkillManager.java"
    click GOT "https://github.com/seal367/wust_java_online/blob/main/src/main/java/com/example/javafx3/GameOverTest.java"
    click SST "https://github.com/seal367/wust_java_online/blob/main/src/main/java/com/example/javafx3/SkillSystemTest.java"
    click POM "https://github.com/seal367/wust_java_online/blob/main/pom.xml"
    click MVW "https://github.com/seal367/wust_java_online/tree/main/mvnw"
    click MWR "https://github.com/seal367/wust_java_online/tree/main/.mvn/wrapper"
```
