Esempio n. 1
0
 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);
        }
Esempio n. 5
0
 public static int GetInt(PrefsInfo info)
 {
     return(PlayerPrefs.GetInt(info.ToString(), 0));
 }
Esempio n. 6
0
 public static void Save(PrefsInfo info, string value)
 {
     PlayerPrefs.SetString(info.ToString(), value);
     PlayerPrefs.Save();
 }
Esempio n. 7
0
 public static void Save(PrefsInfo info, int value)
 {
     PlayerPrefs.SetInt(info.ToString(), value);
     PlayerPrefs.Save();
 }
Esempio n. 8
0
 public static string GetString(PrefsInfo info)
 {
     return(PlayerPrefs.GetString(info.ToString(), string.Empty));
 }
Esempio n. 9
0
    public static bool GetBool(PrefsInfo info)
    {
        int value = PlayerPrefs.GetInt(info.ToString(), 0);

        return(value > 0);
    }