This commit is contained in:
CortexCore
2024-11-03 16:38:17 +08:00
parent 056e2cada5
commit 4ba741408d
4693 changed files with 2445 additions and 5443 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using AYellowpaper.SerializedCollections;
using UnityEngine;
@@ -9,11 +10,19 @@ namespace BITKit
public class SetTargetFrameRate : MonoBehaviour
{
[SerializeField] private SerializedDictionary<string, int> frameRateDictionary;
[SerializeField] private int startFrameRate;
[SerializeField] private SerializedDictionary<RuntimePlatform, bool> maxFrameRate;
private int currentFrameRate;
private void Start()
{
currentFrameRate = Application.targetFrameRate;
if(maxFrameRate.TryGetValue(Application.platform,out var max))
{
if (max)
{
var maxRate = Screen.resolutions.Max(x => x.refreshRateRatio.value);
Application.targetFrameRate = currentFrameRate = (int)maxRate;
}
}
}
public void SetFrameRate(string key)
{