1
This commit is contained in:
@@ -25,6 +25,8 @@ namespace BITKit.UX.Settings
|
||||
private void Start()
|
||||
{
|
||||
UXUtils.Inject(this);
|
||||
|
||||
|
||||
|
||||
_resolutionDropdown.choices = Screen.resolutions.Select(x => x.ToString()).ToList();
|
||||
_resolutionDropdown.SetValueWithoutNotify(Screen.currentResolution.ToString());
|
||||
@@ -54,7 +56,14 @@ namespace BITKit.UX.Settings
|
||||
Data.RemoveListender<string>(Constant.Environment.mat_setvideomode, OnResolutionChanged);
|
||||
Data.RemoveListender<bool>(Constant.Environment.fullscreen,OnFullScreenChanged);
|
||||
Data.RemoveListender<float>(Constant.Environment.sensitivity,OnSensitivityChanged);
|
||||
|
||||
PlayerPrefs.Save();
|
||||
});
|
||||
|
||||
if(PlayerPrefs.HasKey(Constant.Environment.fullscreen))
|
||||
Data.Set(Constant.Environment.fullscreen, PlayerPrefs.GetInt(Constant.Environment.fullscreen) == 1);
|
||||
if(PlayerPrefs.HasKey(Constant.Environment.sensitivity))
|
||||
Data.Set(Constant.Environment.sensitivity, PlayerPrefs.GetFloat(Constant.Environment.sensitivity));
|
||||
}
|
||||
|
||||
private async void OnSensitivityChanged(float obj)
|
||||
@@ -63,6 +72,8 @@ namespace BITKit.UX.Settings
|
||||
|
||||
PlayerConfig.Singleton.Sensitivity = obj;
|
||||
_sensitivitySlider.SetValueWithoutNotify(obj);
|
||||
|
||||
PlayerPrefs.SetFloat(Constant.Environment.sensitivity,obj);
|
||||
}
|
||||
|
||||
private async void OnFullScreenChanged(bool obj)
|
||||
@@ -86,6 +97,7 @@ namespace BITKit.UX.Settings
|
||||
#else
|
||||
Screen.fullScreen = obj;
|
||||
#endif
|
||||
PlayerPrefs.SetInt(Constant.Environment.fullscreen, obj ? 1 : 0);
|
||||
}
|
||||
private async void OnResolutionChanged(string newResolution)
|
||||
{
|
||||
@@ -95,6 +107,7 @@ namespace BITKit.UX.Settings
|
||||
var resolution = Screen.resolutions.Single(x => x.ToString() == newResolution);
|
||||
|
||||
Screen.SetResolution(resolution.width,resolution.height,Data.Get<bool>(Constant.Environment.fullscreen));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user