mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 19:03:29 +08:00
- 优化 CommandCoroutineExtensions 中的代码格式和异常处理逻辑 - 简化 WaitForEvent 和 WaitForEventWithTimeout 中的EventData属性实现 - 调整 EventListenerScope 中的EventData属性访问器 - 重构 ControlExtensions 中 TakeIf 和 TakeUnless 方法的实现 - 优化 FunctionExtensions 中 Repeat 和 Partial 方法的代码结构 - 调整 PipeExtensions 和其他扩展类的文档注释格式 - 修改测试代码中的协程迭代和事件注册相关实现 - 优化 DataRepository 中的异步操作实现方式 = [release ci]
58 lines
1.7 KiB
C#
58 lines
1.7 KiB
C#
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.Now;
|
||
|
||
/// <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;
|
||
}
|
||
} |