您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
33 行
733 B
33 行
733 B
using System.Linq;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace GameOptionsUtility
|
|
{
|
|
[RequireComponent(typeof(Toggle))]
|
|
public class ToggleVSync : MonoBehaviour
|
|
{
|
|
private void OnEnable()
|
|
{
|
|
GetComponent<Toggle>().onValueChanged.AddListener(UpdateOptions);
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
GetComponent<Toggle>().onValueChanged.RemoveListener(UpdateOptions);
|
|
}
|
|
|
|
public void InitializeEntries()
|
|
{
|
|
GetComponent<Toggle>().isOn = GameOptions.graphics.vSync;
|
|
}
|
|
|
|
void UpdateOptions(bool value)
|
|
{
|
|
GameOptions.graphics.vSync = value;
|
|
}
|
|
}
|
|
|
|
}
|
|
|