GeWuYou fb14d7122c docs(style): 更新文档中的命名空间导入格式
- 将所有小写的命名空间导入更正为首字母大写格式
- 统一 GFramework 框架的命名空间引用规范
- 修复 core、ecs、godot 等模块的命名空间导入错误
- 标准化文档示例代码中的 using 语句格式
- 确保所有文档中的命名空间引用保持一致性
- 更新 global using 语句以匹配正确的命名空间格式
2026-03-10 07:18:49 +08:00

58 lines
1.7 KiB
C#
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.

namespace GFramework.Game.Abstractions.Setting.Data;
/// <summary>
/// 图形设置类,用于管理游戏的图形相关配置
/// </summary>
public class GraphicsSettings : ISettingsData
{
/// <summary>
/// 获取或设置是否启用全屏模式
/// </summary>
public bool Fullscreen { get; set; }
/// <summary>
/// 获取或设置屏幕分辨率宽度
/// </summary>
public int ResolutionWidth { get; set; } = 1920;
/// <summary>
/// 获取或设置屏幕分辨率高度
/// </summary>
public int ResolutionHeight { get; set; } = 1080;
/// <summary>
/// 重置图形设置为默认值
/// </summary>
public void Reset()
{
Fullscreen = false;
ResolutionWidth = 1920;
ResolutionHeight = 1080;
}
/// <summary>
/// 获取或设置设置数据的版本号
/// </summary>
public int Version { get; private set; } = 1;
/// <summary>
/// 获取设置数据最后修改的时间
/// </summary>
public DateTime LastModified { get; } = DateTime.UtcNow;
/// <summary>
/// 从指定的数据源加载图形设置
/// </summary>
/// <param name="source">要从中加载设置的源数据对象</param>
public void LoadFrom(ISettingsData source)
{
// 检查源数据是否为GraphicsSettings类型如果不是则直接返回
if (source is not GraphicsSettings settings) return;
// 将源设置中的属性值复制到当前对象
Fullscreen = settings.Fullscreen;
ResolutionWidth = settings.ResolutionWidth;
ResolutionHeight = settings.ResolutionHeight;
Version = settings.Version;
}
}