gewuyou ff553977e3 chore(license): 补齐 Apache-2.0 文件头治理
- 新增许可证文件头检查与修复脚本

- 补充维护者手动修复 PR 工作流和 CI 校验

- 更新贡献指南中的文件头说明

- 补齐仓库维护源码和配置文件的许可证声明
2026-05-03 19:39:49 +08:00

61 lines
1.8 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.

// Copyright (c) 2025-2026 GeWuYou
// SPDX-License-Identifier: Apache-2.0
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;
}
}