1
0
mirror of https://github.com/xiaopeng12138/MaiDXR.git synced 2024-12-14 10:32:50 +01:00
MaiDXR/Assets/Scripts/Configurations/TouchSettingManager.cs

52 lines
1.3 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class TouchSettingManager : MonoBehaviour
{
TMP_Dropdown Dropdown;
void Start()
{
Dropdown = GetComponent<TMP_Dropdown>();
GetTouchFPS();
}
void GetTouchFPS()
{
if (JsonConfig.HasKey("TouchFPS"))
Dropdown.value = JsonConfig.GetInt("TouchFPS");
SetTouchFPS();
}
public void SetTouchFPS()
{
switch (Dropdown.value)
{
case 0:
Time.fixedDeltaTime = 1 / 30;
break;
case 1:
Time.fixedDeltaTime = 1 / 60;
break;
case 2:
Time.fixedDeltaTime = 1 / 90;
break;
case 3:
Time.fixedDeltaTime = 1 / 120;
break;
case 4:
Time.fixedDeltaTime = 1 / 140;
break;
case 5:
Time.fixedDeltaTime = 1 / 160;
break;
case 6:
Time.fixedDeltaTime = 1 / 180;
break;
case 7:
Time.fixedDeltaTime = 1 / 200;
break;
}
JsonConfig.SetInt("TouchFPS", Dropdown.value);
}
}