Wes xx gpu test
This commit is contained in:
committed by
Jerome Coudron
parent
1cceb3cb89
commit
1f5b855f61
@@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SettingsScreen : MonoBehaviour
|
||||
{
|
||||
@@ -8,11 +9,44 @@ public class SettingsScreen : MonoBehaviour
|
||||
/// </summary>
|
||||
public PlayableDirector directorEnterFromMainMenu;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the 'hardware acceleration' toggle option
|
||||
/// </summary>
|
||||
public Toggle useGPUOption;
|
||||
|
||||
/// <summary>
|
||||
/// Start is called before the first frame update
|
||||
/// </summary>
|
||||
void Start()
|
||||
{
|
||||
useGPUOption.onValueChanged.AddListener(ToggleGPU);
|
||||
UpdateSettings();
|
||||
directorEnterFromMainMenu.Play();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the display of the user preferences
|
||||
/// </summary>
|
||||
private void UpdateSettings()
|
||||
{
|
||||
var pdc = PersistentDataController.GetInstance();
|
||||
useGPUOption.isOn = pdc.IsUsingGPU();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Toggle 'hardware acceleration' option
|
||||
/// </summary>
|
||||
private void ToggleGPU(bool state)
|
||||
{
|
||||
PersistentDataController.GetInstance().SetGPUUsage(state);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restore the user preferences to their default values
|
||||
/// </summary>
|
||||
public void RestoreSettings()
|
||||
{
|
||||
PersistentDataController.GetInstance().RestoreSettings();
|
||||
UpdateSettings();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user