您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
27 行
1.1 KiB
27 行
1.1 KiB
using GameplayIngredients;
|
|
using GameplayIngredients.Actions;
|
|
using UnityEngine;
|
|
using UnityEngine.Rendering.HighDefinition;
|
|
|
|
public class SetResolutionAction : ActionBase
|
|
{
|
|
public string ResolutionXSaveName = "Resolution.X";
|
|
public string ResolutionYSaveName = "Resolution.Y";
|
|
public string ResolutionFullScreenSaveName = "Resolution.FullScreen";
|
|
public string ResolutionAASaveName = "Rendering.AntiAliasing";
|
|
|
|
public override void Execute(GameObject instigator = null)
|
|
{
|
|
var gsm = Manager.Get<GameSaveManager>();
|
|
int x = gsm.GetInt(ResolutionXSaveName, GameSaveManager.Location.System);
|
|
int y = gsm.GetInt(ResolutionYSaveName, GameSaveManager.Location.System);
|
|
int fs = gsm.GetInt(ResolutionFullScreenSaveName, GameSaveManager.Location.System);
|
|
int aa = gsm.GetInt(ResolutionAASaveName, GameSaveManager.Location.System);
|
|
|
|
Screen.SetResolution(x, y, (FullScreenMode)fs);
|
|
|
|
var cameraManager = Manager.Get<VirtualCameraManager>();
|
|
var data = cameraManager.GetComponent<HDAdditionalCameraData>();
|
|
data.antialiasing = (HDAdditionalCameraData.AntialiasingMode)aa;
|
|
}
|
|
}
|