1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//! Save/Load plugin for ISSUN
//!
//! This plugin provides comprehensive save/load functionality for games built with ISSUN.
//! It supports multiple save formats, auto-save functionality, and customizable hooks
//! for game-specific save/load behavior.
//!
//! # Quick Start
//!
//! ```ignore
//! use issun::builder::GameBuilder;
//! use issun::plugin::save_load::SaveLoadPlugin;
//!
//! let game = GameBuilder::new()
//! .with_plugin(SaveLoadPlugin::new())
//! .build()
//! .await?;
//! ```
//!
//! # Features
//!
//! - **Multiple Save Formats**: JSON and RON format support
//! - **Auto-Save**: Configurable automatic saving at intervals or checkpoints
//! - **Hook System**: Customize save/load behavior with custom hooks
//! - **File Management**: List, delete, and inspect save files
//! - **Error Handling**: Comprehensive error reporting and recovery
//! - **Metadata Support**: Rich save file metadata including timestamps and versions
//!
//! # Save Operations
//!
//! The plugin supports several types of save operations through events:
//! - Manual saves triggered by player action
//! - Auto-saves triggered by time intervals or game events
//! - Quick saves and checkpoint saves
//!
//! # Load Operations
//!
//! Load operations include:
//! - Loading specific save slots
//! - Continue from last save
//! - Save file validation and error recovery
//!
//! # Custom Formats
//!
//! You can extend the plugin to support additional save formats by implementing
//! the `SaveRepository` trait and registering it with the plugin.
//!
//! # Hook Customization
//!
//! Implement the `SaveLoadHook` trait to add custom behavior:
//! - Data validation and preprocessing
//! - Cloud backup integration
//! - Save file compression or encryption
//! - Progress tracking and achievements
//! - Custom error handling
//!
//! # Example Usage
//!
//! ```ignore
//! use issun::plugin::save_load::{
//! SaveLoadPlugin, SaveLoadConfig, SaveFormat,
//! SaveGameRequested, LoadGameRequested, AutoSaveRequested
//! };
//! use issun::event::EventBus;
//! use std::path::PathBuf;
//!
//! // Configure the plugin
//! let config = SaveLoadConfig {
//! save_directory: PathBuf::from("my_game_saves"),
//! format: SaveFormat::Ron,
//! enable_auto_save: true,
//! auto_save_interval: 300, // 5 minutes
//! };
//!
//! let game = GameBuilder::new()
//! .with_plugin(
//! SaveLoadPlugin::new()
//! .with_config(config)
//! )
//! .build()
//! .await?;
//!
//! // Later in your game logic...
//! let event_bus = /* get event bus from context */;
//!
//! // Save the game
//! let save_event = SaveGameRequested {
//! slot: "player_save_1".to_string(),
//! label: Some("Level 5 Complete".to_string()),
//! };
//! event_bus.publish(save_event).await?;
//!
//! // Load the game
//! let load_event = LoadGameRequested {
//! slot: "player_save_1".to_string(),
//! };
//! event_bus.publish(load_event).await?;
//!
//! // Trigger auto-save
//! let auto_save_event = AutoSaveRequested {
//! reason: Some("checkpoint".to_string()),
//! };
//! event_bus.publish(auto_save_event).await?;
//! ```
// Re-export public API
pub use *;
pub use ;
pub use ;
pub use SaveLoadSystem;