GFramework/docs/zh-CN/abstractions/game-abstractions.md
GeWuYou 6cc0ddf7f9 docs: 更新文档中的代码示例和链接引用
- 修复 IEventHandler 接口中的参数关键字冲突
- 修正场景管理器接口中的泛型约束拼写错误
- 本地化核心抽象文档链接为中文标题
- 更新事件系统文档中的接口链接路径
- 修复扩展方法文档中的上下文感知链接
- 调整日志系统文档中的接口链接路径
- 重构架构概述中的代码示例和设计原则
- 统一 Godot 设置模块中的代码块格式
- 优化音频和图形设置的代码示例
2026-02-11 14:49:34 +08:00

114 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Game Abstractions
> GFramework.Game.Abstractions 游戏模块抽象接口定义
## 概述
GFramework.Game.Abstractions 包含了游戏特定功能的抽象接口,这些接口定义了游戏开发中的通用契约。
## 存档接口
### ISaveSystem
存档系统接口:
```csharp
public interface ISaveSystem
{
void Save(string slotId, SaveData data);
SaveData Load(string slotId);
bool HasSave(string slotId);
void Delete(string slotId);
List<SaveSlotInfo> GetAllSaveSlots();
}
```
### ISaveData
存档数据接口:
```csharp
public interface ISaveData
{
int Version { get; }
DateTime Timestamp { get; }
void Validate();
}
```
## 设置接口
### IGameSettings
游戏设置接口:
```csharp
public interface IGameSettings
{
AudioSettings Audio { get; }
GraphicsSettings Graphics { get; }
InputSettings Input { get; }
void Save();
void Load();
void ResetToDefaults();
}
```
## 场景管理接口
### ISceneManager
场景管理器接口:
```csharp
public interface ISceneManager
{
void SwitchScene<TScene>() where TScene : IScene;
Task SwitchSceneAsync<TScene>() where TScene : IScene;
void PushScene<TScene>() where TScene : IScene;
void PopScene();
IScene CurrentScene { get; }
}
```
### IScene
场景接口:
```csharp
public interface IScene
{
void OnEnter();
void OnExit();
void OnUpdate(float delta);
}
```
## 资源管理接口
### IAssetManager
资源管理器接口:
```csharp
public interface IAssetManager
{
T Load<T>(string path) where T : Resource;
void Preload<T>(string path) where T : Resource;
void Unload(string path);
bool IsLoaded(string path);
}
```
---
**相关文档**
- [Game 概述](../game)
- [核心抽象](./core-abstractions)
- [存档系统](../game/storage)
- [场景管理](../game/scene-management)