Inheritance: MonoBehaviour
Ejemplo n.º 1
0
 public static void Share()
 {
     if (Everyplay.IsSupported())
     {
         Everyplay.ShowSharingModal();
     }
 }
Ejemplo n.º 2
0
    void OnTriggerEnter2D(Collider2D col)
    {
        //tag
        if (col.gameObject.tag == "Lazer")
        {
            anim.SetTrigger("died");

            GetComponent <Rigidbody2D>().isKinematic = true;
            GetComponent <Collider2D>().enabled      = false;

            endmenu.SetActive(true);
            ingamedisplay.SetActive(false);
            buttonup.SetActive(false);
            buttondown.SetActive(false);

            GetComponent <AudioSource>().PlayOneShot(died, 3.0F);

            int totalcans = 5;

            UnityAnalytics.CustomEvent("gameOver", new Dictionary <string, object>
            {
                { "totalcan", totalcans },
            });

            Everyplay.StopRecording();
            //Everyplay.SetMetadata("score", score);
            //Everyplay.PlayLastRecording();
        }
    }
Ejemplo n.º 3
0
 void OnGUI()
 {
     if (recordingPermissionGranted)
     {
         if (GUI.Button(new Rect(Screen.width - 10 - 158, 10, 158, 48), Everyplay.FaceCamIsSessionRunning() ? "Stop FaceCam session" : "Start FaceCam session"))
         {
             if (Everyplay.FaceCamIsSessionRunning())
             {
                 Everyplay.FaceCamStopSession();
             }
             else
             {
                 Everyplay.FaceCamStartSession();
             }
             #if UNITY_EDITOR
             Debug.Log("Everyplay FaceCam is not available in the Unity editor. Please compile and run on a device.");
             #endif
         }
     }
     else
     {
         if (GUI.Button(new Rect(Screen.width - 10 - 158, 10, 158, 48), "Request REC permission"))
         {
             Everyplay.FaceCamRequestRecordingPermission();
             #if UNITY_EDITOR
             Debug.Log("Everyplay FaceCam is not available in the Unity editor. Please compile and run on a device.");
             #endif
         }
     }
 }
Ejemplo n.º 4
0
    public void FaceCamToggle()
    {
        DebugLog("Face Cam Toggle!");

        if (Everyplay.FaceCamIsRecordingPermissionGranted())
        {
            isFaceCameOn = !isFaceCameOn;

            if (isFaceCameOn)
            {
                if (!Everyplay.FaceCamIsSessionRunning())
                {
                    Everyplay.FaceCamStartSession();
                    Everyplay.FaceCamSetAudioOnly(true);                      //added
                }
            }
            else
            {
                if (Everyplay.FaceCamIsSessionRunning())
                {
                    Everyplay.FaceCamStopSession();
                }
            }
        }
        else         //For the first time in the game we want to turn on the camera
        {
            Everyplay.FaceCamRequestRecordingPermission();
            startFaceCamWhenPermissionGranted = true;
        }
    }
Ejemplo n.º 5
0
 void OnPreRender()
 {
     #pragma warning disable 612,618
     if (readyForRecording)
     {
         #if EVERYPLAY_NATIVE_PLUGIN
         if (renderEventPtr != IntPtr.Zero)
         {
             if (isMetalDevice || isAndroidDevice)
             {
                 #if EVERYPLAY_NATIVE_PLUGIN_USE_PTR
                 GL.IssuePluginEvent(renderEventPtr, EPSR);
                 #else
                 GL.IssuePluginEvent(EPSR);
                 #endif
             }
             else
             {
                 Everyplay.SnapshotRenderbuffer();
             }
         }
         #else
         Everyplay.SnapshotRenderbuffer();
         #endif
     }
     #pragma warning restore 612,618
 }
Ejemplo n.º 6
0
    public void OnStopRecordingEvent()
    {
        text.text = "stop recording ";
        Everyplay.SetMetadata("level", "FunnyCamera!");

        ShowLastVideo();
    }
Ejemplo n.º 7
0
 public void faceCamSetAudioOnly(bool val)
 {
     #if BROADCAST_USE_EVERYPLAY
     Everyplay.FaceCamSetAudioOnly(val);
     #else
     #endif
 }
Ejemplo n.º 8
0
 public void facecamStop()
 {
     #if BROADCAST_USE_EVERYPLAY
     Everyplay.FaceCamStopSession();
     #else
     #endif
 }
Ejemplo n.º 9
0
        /// <summary>
        /// 用于录屏操作开始的触发器
        /// </summary>
        /// <param name="isrecording"></param>
        public void Dooperation(bool isrecording)
        {
            if (!isinited)
            {
                return;
            }

            if (!issupported && !isrecording)
            {
                Uimanager.Getinstance().Showtips("当前硬件设备不支持该功能");
                return;
            }

            if (isrecording)
            {
                Debug.Log("停止录制" + isstarted);

                Everyplay.StopRecording();
            }
            else
            {
                Debug.Log("开始录制" + isstarted);
                if (isrecording)
                {
                    return;
                }
                Everyplay.StartRecording();
            }
        }
Ejemplo n.º 10
0
        // Game End
        private void GameEnd()
        {
            HUDController.s_Instance.SetHudEnabled(false);
            DisableTankControl();
            m_GameIsFinished = true;
            if (m_EndGameModal != null)
            {
                m_EndGameModal.Show();
            }

            if (Everyplay.IsRecording())
            {
                int tankIndex = s_Tanks.IndexOf(m_LocalPlayer);
                if (tankIndex >= 0)
                {
                    Everyplay.SetMetadata("final_position", tankIndex + 1);
                }
                Everyplay.StopRecording();
            }



            LazyLoadLoadingPanel();
            m_LoadingScreen.transform.SetAsLastSibling();
        }
Ejemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     Everyplay.StartRecording();
     //#if UNITY_EDITOR
     //Debug.Log("The video recording is not available in the Unity editor. Please compile and run on a device.");
     //#endif
 }
 //para a gravaçao
 public void Parar()
 {
     if (Everyplay.IsRecording())
     {
         Everyplay.StopRecording();
     }
 }
Ejemplo n.º 13
0
    IEnumerator Wait()
    {
        yield return(new WaitForSeconds(1.0f));

        Everyplay.SetMetadata("score", GameManager.Score.Value);
        Everyplay.StopRecording();
    }
Ejemplo n.º 14
0
 public void faceCamSetTargetTextureWidth(int val)
 {
     #if BROADCAST_USE_EVERYPLAY
     Everyplay.FaceCamSetTargetTextureWidth(val);
     #else
     #endif
 }
Ejemplo n.º 15
0
 public void faceCamSetMonitorAudioLevels(bool val)
 {
     #if BROADCAST_USE_EVERYPLAY
     Everyplay.FaceCamSetMonitorAudioLevels(val);
     #else
     #endif
 }
Ejemplo n.º 16
0
    public void startRecording()
    {
        if (!IsSupported() || !IsRecordingSupported())
        {
            return;
        }

        if (!IsRecording())
        {
            SetMaxRecordingMinutesLength(10);

            SetMetadata("about", Locos.Get(LocoKeys.social_everyplay_game_explore_message));
            SetMetadata("game", Locos.Get(LocoKeys.app_display_name));
            SetMetadata("level", Locos.Get(LocoKeys.game_type_arcade));
            SetMetadata("level_name", Locos.Get(LocoKeys.game_type_arcade_mode));

            if (FPSDisplay.isUnder25FPS)
            {
                SetLowMemoryDevice(true);
            }

            #if BROADCAST_USE_EVERYPLAY
            Everyplay.StartRecording();
            #endif

            BroadcastRecordingStart();
        }
    }
Ejemplo n.º 17
0
 public void faceCamSetPreviewBorderColor(float r, float g, float b, float a)
 {
     #if BROADCAST_USE_EVERYPLAY
     Everyplay.FaceCamSetPreviewBorderColor(r, g, b, a);
     #else
     #endif
 }
    IEnumerator InitializeEveryplay()
    {
        yield return(0);

        Everyplay.Initialize();
        Destroy(gameObject);
    }
Ejemplo n.º 19
0
 public void faceCamSetPreviewOrigin(Everyplay.FaceCamPreviewOrigin val)
 {
     #if BROADCAST_USE_EVERYPLAY
     Everyplay.FaceCamSetPreviewOrigin(val);
     #else
     #endif
 }
 public void SetThumbnail(Texture texture)
 {
     if (isEnable)
     {
         Everyplay.SetThumbnailTargetTexture((Texture2D)texture);
     }
 }
Ejemplo n.º 21
0
 public void faceCamSetPreviewPositionY(int val)
 {
     #if BROADCAST_USE_EVERYPLAY
     Everyplay.FaceCamSetPreviewPositionY(val);
     #else
     #endif
 }
Ejemplo n.º 22
0
    private void FaceCamToggle()
    {
        if (faceCamPermissionGranted)
        {
            faceCamToggleButton.toggled = !faceCamToggleButton.toggled;

            if (faceCamToggleButton.toggled)
            {
                if (!Everyplay.FaceCamIsSessionRunning())
                {
                    Everyplay.FaceCamStartSession();
                }
            }
            else
            {
                if (Everyplay.FaceCamIsSessionRunning())
                {
                    Everyplay.FaceCamStopSession();
                }
            }
        }
        else
        {
            Everyplay.FaceCamRequestRecordingPermission();
            startFaceCamWhenPermissionGranted = true;
        }
    }
Ejemplo n.º 23
0
 public void faceCamSetPreviewScaleRetina(bool val)
 {
     #if BROADCAST_USE_EVERYPLAY
     Everyplay.FaceCamSetPreviewScaleRetina(val);
     #else
     #endif
 }
Ejemplo n.º 24
0
        private void RpcGameEnd()
        {
            HUDController.s_Instance.SetHudEnabled(false);
            DisableTankControl();
            m_GameIsFinished = true;
            if (m_EndGameModal != null)
            {
                m_EndGameModal.Show();
            }

            if (Everyplay.IsRecording())
            {
                int tankIndex = s_Tanks.IndexOf(m_LocalPlayer);
                if (tankIndex >= 0)
                {
                    Everyplay.SetMetadata("final_position", tankIndex + 1);
                }
                Everyplay.StopRecording();
            }

            // Tell menu UI that we'll be returning to the lobby scene
            MainMenuUI.s_ReturnPage = MenuPage.Lobby;

            LazyLoadLoadingPanel();
            m_LoadingScreen.transform.SetAsLastSibling();
        }
Ejemplo n.º 25
0
 public void faceCamSetPreviewSideWidth(int val)
 {
     #if BROADCAST_USE_EVERYPLAY
     Everyplay.FaceCamSetPreviewSideWidth(val);
     #else
     #endif
 }
Ejemplo n.º 26
0
 void Start()
 {
     if (Everyplay.IsSupported())
     {
         Everyplay.StartRecording();
     }
 }
Ejemplo n.º 27
0
 public void faceCamSetPreviewVisible(bool val)
 {
     #if BROADCAST_USE_EVERYPLAY
     Everyplay.FaceCamSetPreviewVisible(val);
     #else
     #endif
 }
    void OnDestroy()
    {
        Everyplay.ReadyForRecording -= OnReadyForRecording;

        if (initialized)
        {
            // Set Everyplay not to render to a texture anymore and remove event handlers
            Everyplay.SetThumbnailTargetTexture(null);
            Everyplay.RecordingStarted      -= OnRecordingStarted;
            Everyplay.ThumbnailTextureReady -= OnThumbnailReady;

            // Destroy thumbnail textures
            foreach (Texture2D texture in thumbnailTextures)
            {
                if (texture != null)
                {
                    Destroy(texture);
                }
            }

            thumbnailTextures = null;

            initialized = false;
        }
    }
Ejemplo n.º 29
0
    public void StopScreenCap(string jsonstr)
    {
                #if UNITY_ANDROID
//		//ShareREC.OnRecorderStoppedHandler 这里可以监听停止录制之后可以干的事情,开始录制也一样
//		ShareREC.OnRecorderStoppedHandler = StopRecorderEnd;//不能在这个函数中回传路径给移动端,因为视频可能还没有合成成功,要监听事件之后成功后再传
//		//这里记得加判断,如果jsonstr有值,说明要删除视频
//		if(jsonstr.Length>=1)
//			isDeleteVideo = true;
//		ShareREC.StopRecorder ();
        Everyplay.RecordingStopped += EveryPlayStopREC;
        Everyplay.StopRecording();
                #endif

                #if UNITY_IPHONE
///		if(jsonstr.Length >=1)
//		{
//			isDeleteVideoIniOS = true;
//		}
//		FinishedRecordEvent evt = new FinishedRecordEvent(recordFinishedHandler);
///		ShareREC.stopRecording(evt);

        //ShareRECIOS.stopRecording(evt);
        Everyplay.StopRecording();
        Everyplay.RecordingStopped += EveryPlayStopREC;
                #endif
    }
Ejemplo n.º 30
0
    void OnPreRender()
    {
#if EVERYPLAY_NATIVE_PLUGIN
        GL.IssuePluginEvent(EPSR);
#else
        Everyplay.SnapshotRenderbuffer();
#endif
    }
Ejemplo n.º 31
0
 public static void FaceCamSetPreviewOrigin(Everyplay.FaceCamPreviewOrigin origin)
 {
     if (EveryplayInstance != null)
     {
         #if EVERYPLAY_BINDINGS_ENABLED
         EveryplayFaceCamSetPreviewOrigin((int) origin);
         #endif
     }
 }
Ejemplo n.º 32
0
 public static void FaceCamSetRecordingMode(Everyplay.FaceCamRecordingMode mode)
 {
     if (EveryplayInstance != null && hasMethods == true)
     {
         #if EVERYPLAY_FACECAM_BINDINGS_ENABLED
         EveryplayFaceCamSetRecordingMode((int)mode);
         #endif
     }
 }
Ejemplo n.º 33
0
	void OnApplicationQuit() {
		RemoveAllEvents();
		appIsClosing = true;
		sharedInstance = null;
	}
Ejemplo n.º 34
0
    // Monobehaviour methods

    void OnApplicationQuit()
    {
        if (currentThumbnailTargetTexture != null)
        {
            SetThumbnailTargetTexture(null);
            currentThumbnailTargetTexture = null;
        }
        RemoveAllEventHandlers();
        appIsClosing = true;
        everyplayInstance = null;
    }
Ejemplo n.º 35
0
 public static void FaceCamSetPreviewOrigin(Everyplay.FaceCamPreviewOrigin origin)
 {
     if (EveryplayInstance != null && hasMethods == true)
     {
         #if EVERYPLAY_FACECAM_BINDINGS_ENABLED
         EveryplayFaceCamSetPreviewOrigin((int) origin);
         #endif
     }
 }
Ejemplo n.º 36
0
 public static void LoadThumbnailFromFilePath(string filePath, Everyplay.ThumbnailLoadReadyDelegate readyDelegate, Everyplay.ThumbnailLoadFailedDelegate failedDelegate)
 {
     if(EveryplayInstance != null) {
         #if ((UNITY_IPHONE && EVERYPLAY_IPHONE) || (UNITY_ANDROID && EVERYPLAY_ANDROID)) && !UNITY_EDITOR
         EveryplayInstance.AsyncLoadThumbnailFromFilePath(filePath, readyDelegate, failedDelegate);
         #endif
     }
 }
Ejemplo n.º 37
0
 public static void MakeRequest(string method, string url, Dictionary<string, object> data, Everyplay.RequestReadyDelegate readyDelegate, Everyplay.RequestFailedDelegate failedDelegate)
 {
     if(EveryplayInstance != null) {
         EveryplayInstance.AsyncMakeRequest(method, url, data, readyDelegate, failedDelegate);
     }
 }
Ejemplo n.º 38
0
 public void FaceCamSetPreviewOrigin(Everyplay.FaceCamPreviewOrigin origin)
 {
     Everyplay.FaceCamSetPreviewOrigin(origin);
 }
Ejemplo n.º 39
0
 public static void FaceCamSetPreviewOrigin(Everyplay.FaceCamPreviewOrigin origin)
 {
     if(EveryplayInstance != null) {
         #if ((UNITY_IPHONE && EVERYPLAY_IPHONE) || (UNITY_ANDROID && EVERYPLAY_ANDROID)) && !UNITY_EDITOR
         EveryplayFaceCamSetPreviewOrigin((int)origin);
         #endif
     }
 }
Ejemplo n.º 40
0
 public void MakeRequest(string method, string url, Dictionary<string, object> data, Everyplay.RequestReadyDelegate readyDelegate, Everyplay.RequestFailedDelegate failedDelegate)
 {
     Everyplay.MakeRequest(method, url, data, readyDelegate, failedDelegate);
 }
Ejemplo n.º 41
0
 public void LoadThumbnailFromFilePath(string filePath, Everyplay.ThumbnailLoadReadyDelegate readyDelegate, Everyplay.ThumbnailLoadFailedDelegate failedDelegate)
 {
     Everyplay.LoadThumbnailFromFilePath(filePath, readyDelegate, failedDelegate);
 }
Ejemplo n.º 42
0
    // Private instance methods

    private void AsyncLoadThumbnailFromFilePath(string filePath, Everyplay.ThumbnailLoadReadyDelegate readyDelegateMethod, Everyplay.ThumbnailLoadFailedDelegate failedDelegateMethod)
    {
        if(filePath != null) {
            StartCoroutine(LoadThumbnailEnumerator(filePath, readyDelegateMethod, failedDelegateMethod));
        }
        else {
            failedDelegateMethod("Everyplay error: Thumbnail is not ready.");
        }
    }
Ejemplo n.º 43
0
    // Monobehaviour methods

    void OnApplicationQuit()
    {
        RemoveAllEventHandlers();
        appIsClosing = true;
        everyplayInstance = null;
    }
Ejemplo n.º 44
0
    private IEnumerator MakeRequestEnumerator(string method, string url, Dictionary<string, object> data, Everyplay.RequestReadyDelegate readyDelegate, Everyplay.RequestFailedDelegate failedDelegate)
    {
        if(data == null) {
            data = new Dictionary<string, object>();
        }

        if(url.IndexOf("http") != 0) {
            if(url.IndexOf("/") != 0) {
                url = "/" + url;
            }

            url = "https://api.everyplay.com" + url;
        }

        method = method.ToLower();

#if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3
        Hashtable headers = new Hashtable();
#else
        Dictionary<string, string> headers = new Dictionary<string, string>();
#endif

        string accessToken = AccessToken();
        if(accessToken != null) {
            headers["Authorization"] = "Bearer " + accessToken;
        }
        else {
            if(url.IndexOf("client_id") == -1) {
                if(url.IndexOf("?") == -1) {
                    url += "?";
                }
                else {
                    url += "&";
                }
                url += "client_id=" + clientId;
            }
        }

        data.Add("_method", method);

        string dataString = Json.Serialize(data);
        byte[] dataArray = System.Text.Encoding.UTF8.GetBytes(dataString);

        headers["Accept"] = "application/json";
        headers["Content-Type"] = "application/json";
        headers["Data-Type"] = "json";
        headers["Content-Length"] = dataArray.Length.ToString();

        WWW www = new WWW(url, dataArray, headers);

        yield return www;

        if(!string.IsNullOrEmpty(www.error) && failedDelegate != null) {
            failedDelegate("Everyplay error: " + www.error);
        }
        else if(string.IsNullOrEmpty(www.error) && readyDelegate != null) {
            readyDelegate(www.text);
        }
    }
Ejemplo n.º 45
0
 private void AsyncMakeRequest(string method, string url, Dictionary<string, object> data, Everyplay.RequestReadyDelegate readyDelegate, Everyplay.RequestFailedDelegate failedDelegate)
 {
     StartCoroutine(MakeRequestEnumerator(method, url, data, readyDelegate, failedDelegate));
 }
Ejemplo n.º 46
0
    private IEnumerator LoadThumbnailEnumerator(string fileName, Everyplay.ThumbnailLoadReadyDelegate readyDelegateMethod, Everyplay.ThumbnailLoadFailedDelegate failedDelegateMethod)
    {
        WWW www = new WWW("file://" + fileName);

        yield return www;

        if(!string.IsNullOrEmpty(www.error)) {
            failedDelegateMethod("Everyplay error: " + www.error);
        }
        else {
            if(www.texture) {
                readyDelegateMethod(www.texture);
            }
            else {
                failedDelegateMethod("Everyplay error: Loading thumbnail failed.");
            }
        }
    }