Exemple #1
0
        public static void fetchSplash()
        {
            SplashApi.FetchSplash().Then(splash => {
                if (splash == null)
                {
                    deleteSplashFile();
                    return;
                }

                if (!isExistSplash())
                {
                    fetchImage(splash);
                }
                else
                {
                    var oldInfo = JsonConvert.DeserializeObject <Splash>(PlayerPrefs.GetString(SplashInfoKey));
                    if (oldInfo.id == splash.id && oldInfo.image == splash.image)
                    {
                        return;
                    }

                    deleteSplashFile();
                    fetchImage(splash);
                }
            });
        }
Exemple #2
0
 static void fetchImage(Splash splash)
 {
     SplashApi.FetchSplashImage(CImageUtils.SplashImageUrl(splash.image)).Then(imageBytes => {
         File.WriteAllBytes(PATH + splash.image.GetHashCode(), imageBytes);
         var splashInfo = JsonConvert.SerializeObject(splash);
         PlayerPrefs.SetString(SplashInfoKey, splashInfo);
     });
 }
        static void fetchImage(Splash splash)
        {
            var imageWidth = Math.Ceiling(Window.instance.physicalSize.width);

            SplashApi.FetchSplashImage($"{splash.image}.{imageWidth}x0x1.jpg").Then(imageBytes => {
                File.WriteAllBytes(PATH + splash.image.GetHashCode(), imageBytes);
                var splashInfo = JsonConvert.SerializeObject(splash);
                PlayerPrefs.SetString(SPLASHINFOKEY, splashInfo);
            });
        }