GFramework/docs/zh-CN/abstractions/game-abstractions.md
GeWuYou 317eddca9b docs(sidebar): 更新侧边栏导航结构并移除API参考页面
- 调整Core模块导航链接结构,从overview页面改为根路径
- 重构Core模块侧边栏,将原有的6个主要类别扩展为15个详细分类
- 精简Game模块侧边栏,保留场景管理和游戏设置两个主要功能
- 更新Godot集成模块侧边栏,新增协程、信号、存储等功能分类
- 修改源码生成器模块命名,将枚举扩展重命名为枚举生成器
- 新增抽象接口侧边栏,包含Core和Game抽象接口文档
- 调整教程模块顺序,新增入门教程和Godot集成教程分类
- 移除独立的API参考导航项,将其整合到相应模块中
- 修正生成器API文档链接路径错误问题
2026-02-11 12:52:14 +08:00

1.9 KiB
Raw Blame History

Game Abstractions

GFramework.Game.Abstractions 游戏模块抽象接口定义

概述

GFramework.Game.Abstractions 包含了游戏特定功能的抽象接口,这些接口定义了游戏开发中的通用契约。

存档接口

ISaveSystem

存档系统接口:

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

存档数据接口:

public interface ISaveData
{
    int Version { get; }
    DateTime Timestamp { get; }
    void Validate();
}

设置接口

IGameSettings

游戏设置接口:

public interface IGameSettings
{
    AudioSettings Audio { get; }
    GraphicsSettings Graphics { get; }
    InputSettings Input { get; }
    
    void Save();
    void Load();
    void ResetToDefaults();
}

场景管理接口

ISceneManager

场景管理器接口:

public interface ISceneManager
{
    void SwitchScene<TScene>() where TScene : IScene;
    Task SwitchSceneAsync<TScene>() where TScnee : IScene;
    
    void PushScene<TScene>() where TScene : IScene;
    void PopScene();
    
    IScene CurrentScene { get; }
}

IScene

场景接口:

public interface IScene
{
    void OnEnter();
    void OnExit();
    void OnUpdate(float delta);
}

资源管理接口

IAssetManager

资源管理器接口:

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);
}

相关文档