Beispiel #1
0
    public void StopRecording(int playerID)
    {
        return;



        if (playerID == 0)
        {
            recordedClip1 = Gif.StopRecording(recorder[playerID]);
            if (recordedClip1 == null)
            {
                return;
            }
        }
        else
        {
            recordedClip2 = Gif.StopRecording(recorder[playerID]);
            if (recordedClip2 == null)
            {
                return;
            }
        }



        //
        OpenPlaybackPanel(playerID);
    }
Beispiel #2
0
        public static AnimatedClipProxy CreateClipProxy(AnimatedClip clip)
        {
            var proxy = CreateInstance <AnimatedClipProxy>();

            proxy.clip = clip;
            return(proxy);
        }
        IEnumerator CRProcessGameOverMedia(float delay)
        {
            if (delay > 0)
            {
                yield return(new WaitForSeconds(delay));
            }

            if (recorder != null)
            {
                RecordedClip = recorder.Stop();
            }


#if UNITY_ANDROID
            if (PremiumFeaturesManager.Instance.enablePremiumFeatures && !disableSharing && (sharedImageFormat == SharedImageType.PNG || sharedImageFormat == SharedImageType.Both))
            {
                if (tempRT != null)
                {
                    RenderTextureToScreenshot(tempRT);
                    RenderTexture.ReleaseTemporary(tempRT);
                    tempRT = null;
                }
                else
                {
                    Debug.Log("Something wrong happened: no render texture was captured. Please check.");
                }
            }
            #endif
        }
        // This callback is called once the GIF exporting has completed.
        // It receives the filepath of the generated image.
        void OnGifExportCompleted(AnimatedClip clip, string path)
        {
            progressText.text = "DONE";

            isExportingGif  = false;
            exportedGifPath = path;

            #if UNITY_EDITOR
            bool shouldUpload = UnityEditor.EditorUtility.DisplayDialog("Export Completed", "A GIF file has been created. Do you want to upload it to Giphy?", "Yes", "No");
            if (shouldUpload)
            {
                UploadGIFToGiphy();
            }
            #else
            NativeUI.AlertPopup popup = NativeUI.ShowTwoButtonAlert("Export Completed", "A GIF file has been created. Do you want to upload it to Giphy?", "Yes", "No");
            if (popup != null)
            {
                popup.OnComplete += (int buttonId) =>
                {
                    if (buttonId == 0)
                    {
                        UploadGIFToGiphy();
                    }
                };
            }
            #endif
        }
Beispiel #5
0
        void CaptureandStopRecordImmediately()
        {
#if EASY_MOBILE
            if (recorder != null)
            {
                RecordedClip = recorder.Stop();
            }
#endif
            RenderTexture tempRT = RenderTexture.GetTemporary(Screen.width, Screen.height, 24);
            Camera.main.targetTexture = tempRT;
            Camera.main.Render();
            Camera.main.targetTexture = null;
            RenderTexture.active      = tempRT;

            if (CapturedScreenshot == null)
            {
                CapturedScreenshot = new Texture2D(tempRT.width, tempRT.height, TextureFormat.RGB24, false);
            }

            CapturedScreenshot.ReadPixels(new Rect(0, 0, tempRT.width, tempRT.height), 0, 0);
            CapturedScreenshot.Apply();

            RenderTexture.active = null;
            RenderTexture.ReleaseTemporary(tempRT);
        }
 public void StopRecording()
 {
     recordedClip = Gif.StopRecording(recorder);
     startRecordingButton.SetActive(true);
     stopRecordingButton.SetActive(false);
     recordingMark.SetActive(false);
 }
Beispiel #7
0
        void GameManager_GameStateChanged(GameState newState, GameState oldState)
        {
#if EASY_MOBILE
            if (newState == GameState.Playing)
            {
                if (PremiumFeaturesManager.Instance.enablePremiumFeatures && !disableSharing && (sharedImageFormat == SharedImageType.GIF || sharedImageFormat == SharedImageType.Both))
                {
                    if (RecordedClip != null)
                    {
                        RecordedClip.Dispose();
                    }

                    recorder = Camera.main.GetComponent <Recorder>();

                    if (recorder == null)
                    {
                        recorder = Camera.main.gameObject.AddComponent <Recorder>();
                        recorder.Setup(gifAutoHeight, gifWidth, gifHeight, gifFps, Mathf.RoundToInt(gifLength));
                    }

                    recorder.Record();
                }
            }
            else if (newState == GameState.GameOver)
            {
                if (recorder != null)
                {
                    RecordedClip = recorder.Stop();
                }
            }
#endif
        }
Beispiel #8
0
 // This callback is called once the GIF exporting has completed.
 // It receives the filepath of the generated image.
 void OnGifExportCompleted(AnimatedClip clip, string path)
 {
     gifPath        = path;
     isExportingGif = false;
     UploadGIFToGiphy(gifPath);
     ShowGifUploadingProgress(0);
 }
Beispiel #9
0
        public void ResetAniClip()
        {
#if EASY_MOBILE
            giphyUrl = null;
            AnimClip = null;
            gifPath  = null;
#endif
        }
Beispiel #10
0
        IEnumerator CRStopRecording(float delay = 0)
        {
            yield return(new WaitForSeconds(delay));

            if (recorder != null)
            {
                RecordedClip = recorder.Stop();
            }
        }
Beispiel #11
0
        void OnDestroy()
        {
#if EASY_MOBILE
            if (RecordedClip != null)
            {
                RecordedClip.Dispose();
                RecordedClip = null;
            }
#endif
        }
Beispiel #12
0
    public void SetUpShareUI()
    {
        if (!ScreenshotSharer.Instance.disableSharing)
        {
            Texture2D texture = ScreenshotSharer.Instance.CapturedScreenshot;
            shareUIController.ImgTex = texture;

#if EASY_MOBILE
            AnimatedClip clip = ScreenshotSharer.Instance.RecordedClip;
            shareUIController.AnimClip = clip;
#endif
        }
    }
Beispiel #13
0
        IEnumerator CR_ActiveShareUI()
        {
            yield return(new WaitForSeconds(0.6f));

#if EASY_MOBILE
            AnimatedClip clip = ScreenshotSharer.Instance.RecordedClip;
            shareUIController.AnimClip = clip;
#endif
            Texture2D texture = ScreenshotSharer.Instance.CapturedScreenshot;
            shareUIController.ImgTex = texture;
            yield return(new WaitForSeconds(0.01f));

            shareUI.SetActive(true);
        }
Beispiel #14
0
    public void ShowShareUI()
    {
        if (!ScreenshotSharer.Instance.disableSharing)
        {
            Texture2D texture = ScreenshotSharer.Instance.CapturedScreenshot;
            shareUIController.ImgTex = texture;

            #if EASY_MOBILE_PRO
            AnimatedClip clip = ScreenshotSharer.Instance.RecordedClip;
            shareUIController.AnimClip = clip;
            #endif

            shareUI.SetActive(true);
        }
    }
Beispiel #15
0
        public override void OnEnter()
        {
            if (clip.Value != null)
            {
                var clipProxy = (AnimatedClipProxy)clip.Value;

                if (clipProxy.clip != null)
                {
                    AnimatedClip animClip = clipProxy.clip;
                    width.Value   = animClip.Width;
                    height.Value  = animClip.Height;
                    fps.Value     = animClip.FramePerSecond;
                    length.Value  = animClip.Length;
                    frames.Values = animClip.Frames;
                }
            }

            Finish();
        }
Beispiel #16
0
        public void ShowDemoGifFirstFrame()
        {
            decodedClipPlayer.gameObject.SetActive(true);

            if (string.IsNullOrEmpty(demoGifFilePath))
            {
                Debug.LogError("Couldn't file demo GIF file in persistentDataPath. Filepath: " + demoGifFilePath);
                return;
            }

            Gif.DecodeGif(demoGifFilePath, 1, decodeThreadPriority, clip =>
            {
                if (clip != null)
                {
                    decodedClip = clip;
                    clip.SetFilterMode(FilterMode.Point);
                    Gif.PlayClip(decodedClipPlayer, decodedClip);
                }
                else
                {
                    Debug.LogError("Error decoding GIF: received null AnimatedClip object.");
                }
            });
        }
Beispiel #17
0
 private void <PlayDemoGif> m__0(AnimatedClip clip)
 {
 }
 // This callback is called repeatedly during the GIF exporting process.
 // It receives a progress value ranging from 0 to 1.
 void OnGifExportProgress(AnimatedClip clip, float progress)
 {
     activityText.text = "GENERATING GIF...";
     progressText.text = string.Format("{0:P0}", progress);
 }
Beispiel #19
0
        IEnumerator CRStopRecord()
        {
            yield return(new WaitForSeconds(0.9f));

            RecordedClip = recorder.Stop();
        }
Beispiel #20
0
 private void OnGifExportCompleted(AnimatedClip clip, string path)
 {
 }
Beispiel #21
0
 private void <ShowDemoGifFirstFrame> m__1(AnimatedClip clip)
 {
 }
Beispiel #22
0
 // This callback is called repeatedly during the GIF exporting process.
 // It receives a progress value ranging from 0 to 1.
 void OnGifExportProgress(AnimatedClip clip, float progress)
 {
     ShowGifExportingProgress(progress);
 }
Beispiel #23
0
 void ExportProgressCallback(AnimatedClip animatedClipCallback, float p)
 {
     progress.Value = p;
     Fsm.Event(eventTarget, exportingEvent);
 }
Beispiel #24
0
 void ExportCompletedCallback(AnimatedClip animatedClipCallback, string filepath)
 {
     gifFilePath.Value = filepath;
     Fsm.Event(eventTarget, exportCompletedEvent);
     Finish();
 }
Beispiel #25
0
 private void OnGifExportProgress(AnimatedClip clip, float progress)
 {
 }