예제 #1
0
    public static void GetScreenShot(Action <Sprite> sprite)
    {
        DebugMode.Log(" GetScreenShot");

        string path = "file://" + screenshotPath;

#if UNITY_EDITOR
        path = "file:///" + screenshotPath;
#endif
        instance.StartCoroutine(FileExtend.DOLoadSprite(path, sprite));
    }
    public IEnumerator LoadGameData()
    {
        yield return(DataManager.DoLoad());

        while (userData == null)
        {
            DebugMode.Log("Load game data...");
            yield return(null);
        }

        yield return(FirebaseHelper.DoCheckStatus(null, true));

        if (userData.VersionInstall == 0)
        {
            userData.VersionInstall = UIManager.BundleVersion;
        }
        userData.VersionCurrent = UIManager.BundleVersion;


        GameStateManager.LoadMain(null);

        while ((int)(DateTime.Now - startLoadTime).TotalSeconds < waitTimeForLoadAd)
        {
            yield return(null);
        }

        if (gameConfig.suggestUpdateVersion > userData.VersionCurrent)
        {
            ForeUpdate();
        }
        else
        {
            splashScreen?.Hide();
            mainScreen.Show(null, () =>
            {
                GameStateManager.Idle(null);
            });
        }

        int loadGameIn = (int)(DateTime.Now - startLoadTime).TotalSeconds;

        Debug.Log("loadGameIn: " + loadGameIn + "s");
    }
예제 #3
0
    public static IEnumerator DOSaveScreenShot(Action <bool> onDone = null, bool destroyOnDone = false)
    {
        if (screenshotTexture)
        {
            // We should only read the screen buffer after rendering is complete
            yield return(new WaitForEndOfFrame());

            try
            {
                //// Create a texture the size of the screen, RGB24 format
                //int width = Screen.width;
                //int height = Screen.height;
                //screenshotTexture.ReadPixels(new Rect(0, 0, width, height), 0, 0);
                //screenshotTexture.Apply();

                // Encode texture into PNG
                byte[] bytes = screenshotTexture.EncodeToPNG();
                // Write to a file in the project folder
                File.WriteAllBytes(screenshotPath, bytes);

                DebugMode.Log("DOSaveScreenShot: " + screenshotPath);

                if (destroyOnDone)
                {
                    Destroy(screenshotTexture);
                }

                onDone?.Invoke(true);
            }
            catch (Exception ex)
            {
                Debug.LogException(ex);
                onDone?.Invoke(false);
            }
        }
    }
예제 #4
0
 public static void Share(string title, string shareSubject, string shareMessage, string filePath = "", string fileType = "image/png", string shareUrl = "")
 {
     DebugMode.Log("No sharing set up for this platform.");
 }