How seal367/wust_java_online works
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.