public static void Save(PrefsInfo info, bool value) { if (value) { PlayerPrefs.SetInt(info.ToString(), 1); } else { PlayerPrefs.SetInt(info.ToString(), 0); } PlayerPrefs.Save(); }
private async Task ExecuteCommandAsync(Command command, int percentValue = 0) { var prefsInfo = new PrefsInfo(Prefs); if (prefsInfo.IsReady) { try { var url = FormatCommandResource(prefsInfo.Host, prefsInfo.Port, command, percentValue.Clamp(0, 100)); await HttpComm.Request() .WithContentType(HttpContentType.Html) .WithMethod(HttpMethod.Get) .WithUrl(url) .ExecuteAsync(); } catch (Exception) { } } }
private async Task <byte[]> GetSnapshotAsync() { var prefsInfo = new PrefsInfo(Prefs); if (prefsInfo.IsReady) { try { var url = FormatUrl(UrlSnapshotFormat, prefsInfo.Host, prefsInfo.Port); return(await HttpComm.Request() .WithContentType(HttpContentType.Jpeg) .WithMethod(HttpMethod.Get) .WithUrl(url) .GetResponseBytesAsync()); } catch (Exception) { return(null); } } return(null); }
private async Task <PlayerExecutionData> GetVariablesAsync() { var prefsInfo = new PrefsInfo(Prefs); if (prefsInfo.IsReady) { try { var url = FormatUrl(UrlVariablesFormat, prefsInfo.Host, prefsInfo.Port); var html = await HttpComm.Request() .WithContentType(HttpContentType.Html) .WithMethod(HttpMethod.Get) .WithUrl(url) .GetResponseStringAsync(); return(PlayerExecutionData.FromHtml(html)); } catch (Exception) { return(null); } } return(null); }
public static int GetInt(PrefsInfo info) { return(PlayerPrefs.GetInt(info.ToString(), 0)); }
public static void Save(PrefsInfo info, string value) { PlayerPrefs.SetString(info.ToString(), value); PlayerPrefs.Save(); }
public static void Save(PrefsInfo info, int value) { PlayerPrefs.SetInt(info.ToString(), value); PlayerPrefs.Save(); }
public static string GetString(PrefsInfo info) { return(PlayerPrefs.GetString(info.ToString(), string.Empty)); }
public static bool GetBool(PrefsInfo info) { int value = PlayerPrefs.GetInt(info.ToString(), 0); return(value > 0); }