Exemple #1
0
    IEnumerator StartRecoding()
    {
        isShareVideo   = true;
        uiCanvas.alpha = 0;
        RecordManager.Instance.ShowCanvas(true);
        isRec = true;

        yield return(new WaitForSeconds(0.01f));

#if UNITY_ANDROID
        if (SceneManager.GetActiveScene().name == "wikiSLAM")
        {
            WikiSLAMController.Instance.SetGridState(false);
        }



        AndroidJavaClass  jc   = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        AndroidJavaObject jo   = jc.GetStatic <AndroidJavaObject>("currentActivity");
        string            date = System.DateTime.Now.ToString("hh-mm-ss_dd_MM_yyyy");

        date          = date.Replace("-", "");
        date          = date.Replace("_", "");
        movieSavePath = "/sdcard/" + date + ".mp4";
        jo.Call("startCaptureRecode", movieSavePath);
#elif UNITY_IOS || UNITY_IPHONE
        ShareREC.startRecoring();
#endif
    }
Exemple #2
0
    void onStopped()
    {
        started = false;

        // 停止录制后启动分享视频 (show sharing page after the recorder is stopped)
        ShareREC.SetText("Angry Rebot");
        ShareREC.AddCustomAttr("score", "5000");
        ShareREC.AddCustomAttr("name", "ShareREC Developer");
        ShareREC.AddCustomAttr("brand", "hehe!");
        ShareREC.AddCustomAttr("level", "10");
        // 添加返回操作(add callback to handle returning operations)
        ShareREC.OnReturnFromShareHandler  = OnReturned;
        ShareREC.OnPlatformSelectedHandler = OnPlatformSelected;


        ShareREC.AddCustomPlatform("CustomPlatform");
        if (share)
        {
            ShareREC.ShowShare();
        }
        else
        {
            ShareREC.ShowLastVideo();
        }
    }
    void Start()
    {
        RECBar recBar = ShareREC.GetRECBar(this);

        if (recBar != null)
        {
            ShareREC.OnRecorderStoppedHandler = onStopped;
            recBar.ShowRecBar();
        }
    }
Exemple #4
0
 void OnApplicationPause(bool pauseStatus)
 {
     if (pauseStatus)
     {
         ShareREC.PauseRecorder();
     }
     else
     {
         ShareREC.ResumeRecorder();
     }
 }
Exemple #5
0
    IEnumerator waitForEndRec()
    {
        yield return(new WaitForSeconds(0.5f));

        if (DataManager._isRec)
        {
            ShareREC.stopRecording(new FinishedRecordEvent((Exception ex) => {
            }));
            DataManager._isRec = false;
        }
    }
 void onStopped()
 {
     // 停止录制后启动分享视频 (show sharing page after the recorder is stopped)
     ShareREC.SetText("Angry Rebot");
     ShareREC.AddCustomAttr("score", "5000");
     ShareREC.AddCustomAttr("name", "ShareREC Developer");
     ShareREC.AddCustomAttr("brand", "hehe!");
     ShareREC.AddCustomAttr("level", "10");
     // 添加返回操作(add callback to handle returning operations)
     ShareREC.OnReturnFromShareHandler = OnReturned;
     ShareREC.ShowShare();
 }
Exemple #7
0
    /// <summary>
    /// get the audio data real time
    /// </summary>
    /// <param name="buffer">Buffer.</param>
    public void GetAudioBuffer(String buffer)
    {
        //Debug.LogError (" ===================== GetAudioBuffer buffer unity >>>" + buffer);
        sbyte[] bb        = HexByteConvert.HexStringToByteArray(buffer);
        byte[]  audiodata = HexByteConvert.convert(bb);

        //do with audiodata something ...

        //Debug.LogError (" ===================== OfferSample GetAudioBuffer bb length >>>" + bb.Length);
        ShareREC.OfferSample(audiodata, 0, audiodata.Length);
        //Debug.LogError (" ===================== OfferSample end classictext ");
    }
Exemple #8
0
    // Use this for initialization
    void Start()
    {
        //offset = transform.position - _player.transform.position;
        offsetX = transform.position.x - _player.transform.position.x;

        //gameObject.GetComponent<Camera> ().orthographicSize = Screen.height / 100.0f / 2.0f * Screen.width / 100.0f / 2.0f / 3.75f;
        _iscalled = false;

        CallNextBackGround(transform.position.x - 20.48f);

        ShareREC.registerApp("1bd5d128e1a4d");

//		ssdk = gameObject.GetComponent<ShareSDK>();
//		ssdk.authHandler = OnAuthResultHandler;
//		ssdk.shareHandler = OnShareResultHandler;
//		ssdk.showUserHandler = OnGetUserInfoResultHandler;
//		ssdk.getFriendsHandler = OnGetFriendsResultHandler;
//		ssdk.followFriendHandler = OnFollowFriendResultHandler;
    }
 public void Stop()
 {
     if (ShareREC.IsAvailable())
     {
         UIManager.Instance.SetVisible(UIName.UISceneRecord, false);
         IsCount = false;
         //停止录制
         ShareREC.OnRecorderStoppedHandler = onStopped;
         ShareREC.StopRecorder();
         //ShareREC.SetVisible(false);
         //if (Time.time - _time >= 4)
         //{
         //    ShareREC.OnRecorderStoppedHandler = onStopped;
         //    ShareREC.StopRecorder();
         //    ShareREC.SetVisible(false);
         //}
         //录制分享
     }
 }
    /*
     * void recordFinishedHandler(Exception ex)
     * {
     *
     *      if (isDeleteVideoIniOS) {
     *              DeleteVideoIniOS ();
     *      } else {
     *              string videoPath = ShareREC.lastRecordingPath ();
     *              if (videoPath != null) {
     *                      string dirPath = Path.Combine (Application.persistentDataPath,"ScreenCaps");
     *                      FileInfo file = new FileInfo (videoPath);
     *                      string realVideoPath = Path.Combine (dirPath, file.Name);
     *                      File.Move (videoPath, realVideoPath);
     *
     *                      Utility.PrepareForSendMessage ("StopScreenCap", "0",realVideoPath,true);
     *
     *              }
     *      }
     *
     * }
     *
     * void DeleteVideoIniOS()
     * {
     *
     *      Utility.LogPrint ("--------start delete file");
     *
     *      string videoPath = ShareREC.lastRecordingPath ();
     *      Utility.LogPrint ("--------"+videoPath);
     *
     *      if (File.Exists (videoPath)) {
     *              File.Delete (videoPath);
     *              Utility.LogPrint ("--------delete file");
     *      } else {
     *              Utility.LogPrint ("++++++++++"+videoPath);
     *      }
     *      isDeleteVideoIniOS = false;
     *
     * }
     */
        #endif

        #if UNITY_ANDROID
    void StopRecorderEnd()
    {
        if (!isDeleteVideo)
        {
            long[] videoArr  = ShareREC.ListLocalVideos();
            string videoPath = ShareREC.GetLocalVideoPath(videoArr [videoArr.Length - 1]);

            Utility.PrepareForSendMessage("StopScreenCap", "0", videoPath, true);
        }
        else            //delete video

        {
            long[] videoArrID = ShareREC.ListLocalVideos();
            if (videoArrID.Length >= 1)
            {
                ShareREC.DeleteLocalVideo(videoArrID[videoArrID.Length - 1]);
            }
            isDeleteVideo = false;
        }
    }
Exemple #11
0
    void onRecBarAction(string action)
    {
        int iAction = -1;

        if (!Int32.TryParse(action, out iAction))
        {
            return;
        }

        switch (iAction)
        {
        case RECBAR_PROFILE: {
            // 打开个人中心 (show user profile page)
            ShareREC.ShowProfile();
        } break;

        case RECBAR_START: {
            if (ShareREC.IsAvailable())
            {
                // 设置启动监听(add recorder started listener)
                ShareREC.OnRecorderStartedHandler = onStarted;
                // 启动录制 (start recording)
                ShareREC.StartRecorder();
            }
        } break;

        case RECBAR_STOP: {
            // 设置停止监听 (add recorder stopped listener)
            ShareREC.OnRecorderStoppedHandler = onStopped;
            // 停止录制 (stop recording)
            ShareREC.StopRecorder();
        } break;

        case RECBAR_VIDEOCENTER: {
            // 添加返回操作(add callback to handle returning operations)
            ShareREC.OnReturnFromVideoCenterHandler = OnReturned;
            // 打开视频中心 (show video center)
            ShareREC.ShowVideoCenter();
        } break;
        }
    }
    void OnGUI()
    {
        if (ShareREC.IsAvailable())
        {
            GUI.skin.box.fontSize    = fontSize;
            GUI.skin.button.fontSize = fontSize;
            GUI.Box(panel, "ShareREC Test");

            if (started)
            {
                if (GUI.Button(btnStop, "Stop"))
                {
                    // 设置停止监听 (add recorder stopped listener)
                    ShareREC.OnRecorderStoppedHandler = onStopped;
                    // 停止录制 (stop recording)
                    ShareREC.StopRecorder();
                }
            }
            else
            {
                if (GUI.Button(btnStart, "Start"))
                {
                    // 设置启动监听(add recorder started listener)
                    ShareREC.OnRecorderStartedHandler = onStarted;
                    // 启动录制 (start recording)
                    ShareREC.StartRecorder();
                }
                else if (GUI.Button(btnProfile, "Profile"))
                {
                    // 添加返回操作(add callback to handle returning operations)
                    ShareREC.OnReturnFromProfileHandler = OnReturned;
                    ShareREC.OnPlatformSelectedHandler  = OnPlatformSelected;
                    ShareREC.AddCustomPlatform("CustomPlatform");
                    // 打开个人中心 (show user profile page)
                    ShareREC.ShowProfile();
                }
            }
        }
    }
Exemple #13
0
 void Start()
 {
     if (_bType == GameSceneButtonType.B_REC)
     {
         if (DataManager._isRec)
         {
             Debug.Log("Start Record");
             GetComponent <Image> ().sprite = _recOn;
             //
             ShareREC.setSyncAudioComment(true);
             ShareREC.startRecoring();
         }
         else
         {
             Debug.Log("End Record");
             GetComponent <Image> ().sprite = _recOff;
             //
             FinishedRecordEvent evt = new FinishedRecordEvent((Exception ex) => {});
             ShareREC.stopRecording(evt);
         }
     }
 }
Exemple #14
0
    public void stopRecoding()
    {
        uiCanvas.alpha = 1;
        RecordManager.Instance.ShowCanvas(false);
        Debug.Log("Rec::::::::::::::Stop");

        isRec = false;
        YiyouStaticDataManager.Instance.OnSilenceGameObject(0f);
#if UNITY_ANDROID
        if (SceneManager.GetActiveScene().name == "wikiSLAM")
        {
            WikiSLAMController.Instance.SetGridState(true);
        }

        AndroidJavaClass  jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        AndroidJavaObject jo = jc.GetStatic <AndroidJavaObject>("currentActivity");
        jo.Call("stopCaptureRecoding");

        OnShowRecord(movieSavePath);
#elif UNITY_IOS || UNITY_IPHONE
        FinishedRecordEvent evt = new FinishedRecordEvent(recordFinishedHandler);
        ShareREC.stopRecording(evt);
#endif
    }
Exemple #15
0
 void recordFinishedHandler(Exception ex)
 {
     uiCanvas.alpha = 1;
     isRec          = false;
     ShareREC.playLastRecording();
 }
Exemple #16
0
    void OnGUI()
    {
        if (ShareREC.IsAvailable())
        //if (false)
        {
            GUI.skin.box.fontSize    = fontSize;
            GUI.skin.button.fontSize = fontSize;
            GUI.Box(panel, "ShareREC Test");

            if (started)
            {
                if (GUI.Button(btnStop, "Stop Share"))
                {
                    share = true;
                    // 设置停止监听 (add recorder stopped listener)
                    ShareREC.OnRecorderStoppedHandler = onStopped;
                    // 停止录制 (stop recording)
                    ShareREC.StopRecorder();
                }
                else if (GUI.Button(btnStopPreview, "Stop Preview"))
                {
                    share = false;
                    // 设置停止监听 (add recorder stopped listener)
                    ShareREC.OnRecorderStoppedHandler = onStopped;
                    // 停止录制 (stop recording)
                    ShareREC.StopRecorder();
                }
            }
            else
            {
                if (GUI.Button(btnStart, "Start"))
                {
                    // 设置启动监听(add recorder started listener)
                    ShareREC.OnRecorderStartedHandler = onStarted;

                    //===get the audio data real time======
                    //Camera camera = GetComponent<Camera>();
                    //ShareREC.PrepareSoundCopying (1, 44100, 2048,camera.name);
                    //======================================

                    //启用监听分享的操作,对完成,取消,出错的事件回调
                    ShareREC.setShareActionEnable();
                    //启用要分享需要先上传,强制上传才可以
                    ShareREC.setShareAfterUpload();
                    //用于绑定的事件
                    ShareREC.OnShareCancelHandler   = onShareCancel;
                    ShareREC.OnShareCompleteHandler = onShareComplete;
                    ShareREC.OnShareErrorHandler    = onShareError;

                    ShareREC.StartRecorder();
                }
                else if (GUI.Button(btnProfile, "Profile"))
                {
                    // 添加返回操作(add callback to handle returning operations)
                    ShareREC.OnReturnFromProfileHandler = OnReturned;
                    ShareREC.OnPlatformSelectedHandler  = OnPlatformSelected;
                    ShareREC.AddCustomPlatform("CustomPlatform");
                    // 打开个人中心 (show user profile page)
                    ShareREC.ShowProfile();
                }
                else if (GUI.Button(btnShowLocalVideos, "LocalVideos"))
                {
                    ShareREC.ShowLocalVideos();
                }
            }
        }
    }
Exemple #17
0
 //停止录屏时需要做的事情
 private void onStopped()
 {
     ShareREC.ListLocalVideos();
 }
    public void clickCallBack()
    {
        GetComponent <AudioSource> ().Play();
        switch (_bType)
        {
        case GameSceneButtonType.B_HOME:
        {
            if (DataManager._isRec)
            {
                                #if UNITY_IPHONE
                ShareREC.stopRecording(new FinishedRecordEvent((Exception ex) => {
                    }));
                                #endif
                DataManager._isRec = false;
            }
            SceneManager.LoadScene("StartScene");
        }
        break;

        case GameSceneButtonType.B_PAUSE:
        {
            Debug.Log("Pause");
            Debug.Log("Call Mask and resume Button");

            DataManager._isPause = true;
            _Player.OnPauseClicked();
//				for (int i = 0; i < _pauseList.Count; ++i) {
//					_pauseList[i].OnPauseClicked ();
//				}
            callPauseMask(true);
        }
        break;

        case GameSceneButtonType.B_RESUME:
        {
            Debug.Log("Resume");
            DataManager._isPause = false;
            _Player.OnResumeClicked();
//				for (int i = 0; i < _pauseList.Count; ++i) {
//					_pauseList[i].OnResumeClicked ();
            //				}
            callPauseMask(false);
        }
        break;

        case GameSceneButtonType.B_RESET:
        {
            if (DataManager._isRec)
            {
                                        #if UNITY_IPHONE
                ShareREC.stopRecording(new FinishedRecordEvent((Exception ex) => {
                    }));
                                        #endif
                DataManager._isRec = false;
            }
            SceneManager.LoadScene("StartScene");
        }
        break;

        case GameSceneButtonType.B_NEXT:
        {
            Debug.Log("Call next stage");
            if (DataManager._currentStage >= 3)
            {
                SceneManager.LoadScene("StartScene");
            }
            else
            {
                DataManager._currentStage += 1;
                SceneManager.LoadScene("GameScene_1");
            }
        }
        break;

        case GameSceneButtonType.B_REC:
        {
//				DataManager._isRec = !DataManager._isRec;
//				DataManager._didRec = true;
//				if (DataManager._isRec) {
//					Debug.Log ("Start Record");
//					GetComponent<Image> ().sprite = _recOn;
//					//
//					ShareREC.setSyncAudioComment(true);
//					ShareREC.startRecoring();
//				} else {
//					Debug.Log ("End Record");
//					GetComponent<Image> ().sprite = _recOff;
//					//
//					FinishedRecordEvent evt = new FinishedRecordEvent((Exception ex)=>{});
//					ShareREC.stopRecording(evt);
//				}
        }
        break;
        }
    }
Exemple #19
0
    public void OnClickCallBack()
    {
        GetComponent <AudioSource> ().Play();
        switch (_extraButtonType)
        {
        case ExtraButtonType.EBT_HELP:
        {
            Debug.Log("call help layer");
            _mask.gameObject.SetActive(true);
        }
        break;

        case ExtraButtonType.EBT_LIKE:
        {
            Debug.Log("call like api");
                                #if UNITY_IPHONE
            Hashtable userData = new Hashtable();
            //ShareREC.editLastingRecording ("我天籁般的的叫声,是时候让你们听到了!", userData, null);
            ShareREC.openSocial("我天籁般的的叫声,是时候让你们听到了!", userData, SocialPageType.Share, null);
                                #endif
        }
        break;

        case ExtraButtonType.EBT_MUSIC:
        {
            Debug.Log("call music on/off");
//				JsonData jd = LoadJson.LoadSavedUserInfo ();
//				int music = (int)(jd["Music"]);
//				if (music == 1) {
//					//PlayerPrefs.SetInt ("Music", 0);
//					jd["Music"] = new JsonData(0);
//					GetComponent<Image> ().sprite = _musicOff;
//				} else {
//					//PlayerPrefs.SetInt ("Music", 1);
//					jd["Music"] = new JsonData(1);
//					GetComponent<Image> ().sprite = _musicOn;
//				}
//				//PlayerPrefs.Save ();
//				LoadJson.SaveUserInfo(jd);
        }
        break;

        case ExtraButtonType.EBT_RANK:
        {
            Debug.Log("call rank layer");
            _mask.gameObject.SetActive(true);
        }
        break;

        case ExtraButtonType.EBT_SHARE:
        {
                                #if UNITY_IPHONE
            Debug.Log("call share api");
            Hashtable userData = new Hashtable();
            ShareREC.openSocial("我天籁般的的叫声,是时候让你们听到了!", userData, SocialPageType.Share, null);
                                #endif
        }
        break;

        case ExtraButtonType.EBT_WX:
        {
            Debug.Log("call weixin api");
            _mask.gameObject.SetActive(true);
        }
        break;

        case ExtraButtonType.EBT_GAMESHARE:
        {
            Debug.Log("call url share api");
            string shareTitle = "这游戏有毒,我已中毒至深,尖叫根本停不下来!";
            string shareDesc  = "与全世界一起尖叫!谁才是声控之王?是你吗?";

            string shareTitleEn = "This game is poisonous and i have been poisoned deeply! I can't stop playing and screaming!";
            string shareDescEn  = "Scream with people around the world! Who is the king of voice control? Is that you?";

            string shareSite = "尖叫鸟";
            string shareUrl  = "https://api.shaojishiduo.com/GameScream/share?s=" + PlayerPrefs.GetString("ShareID");
            string shareImg  = "http://liteapp-1252384896.costj.myqcloud.com/scream/images/bird_icon_256.png";

            ShareContent content = new ShareContent();
            content.SetText(shareDesc);
            content.SetImageUrl(shareImg);
            content.SetTitle(shareTitle);
            content.SetTitleUrl(shareUrl);
            content.SetSite(shareSite);
            content.SetSiteUrl(shareUrl);
            content.SetUrl(shareUrl);
            content.SetComment(shareDesc);
            content.SetShareType(ContentType.Webpage);

            //不同平台分享不同内容
            //				ShareContent customizeShareParams = new ShareContent();
            //				customizeShareParams.SetText(shareDesc);
            //				customizeShareParams.SetImageUrl(shareImg);
            //				customizeShareParams.SetShareType(ContentType.Webpage);
            //				customizeShareParams.SetObjectID("SinaID");
            //				content.SetShareContentCustomize(PlatformType.SinaWeibo, customizeShareParams);

            //Instagram
            //				ShareContent sInstagram = new ShareContent();
            //				sInstagram.SetText(shareDesc);
            //				sInstagram.SetImageUrl(shareImg);
            //				sInstagram.SetShareType(ContentType.Image);
            //				content.SetShareContentCustomize(PlatformType.Instagram, sInstagram);

            //fbfb
            ShareContent sFacebook = new ShareContent();
            sFacebook.SetText(shareTitleEn);
            sFacebook.SetTitle(shareDescEn);
            sFacebook.SetImageUrl(shareImg);
            sFacebook.SetShareType(ContentType.Webpage);
            content.SetShareContentCustomize(PlatformType.Facebook, sFacebook);

            //Twitter
            ShareContent sTwitter = new ShareContent();
            sTwitter.SetText(shareDescEn + " Download:" + shareUrl);
            sTwitter.SetImageUrl(shareImg);
            sTwitter.SetUrl(shareUrl);
            sTwitter.SetShareType(ContentType.Auto);
            content.SetShareContentCustomize(PlatformType.Twitter, sTwitter);

            PlatformType[] pfs = { PlatformType.WeChat,   PlatformType.WeChatMoments,
                                   PlatformType.Facebook,
                                   PlatformType.QQ,       PlatformType.QZone, PlatformType.Twitter };

            //通过分享菜单分享
            ssdk.ShowPlatformList(pfs, content, 100, 100);
        }
        break;

        case ExtraButtonType.EBT_MONEYINFO:
        {
            Debug.Log("Money Info Mask");
            _mask.gameObject.SetActive(true);
        }
        break;

        case ExtraButtonType.EBT_SETTING:
        {
            Debug.Log("Setting Mask");
            _mask.gameObject.SetActive(true);
        }
        break;

        case ExtraButtonType.EBT_REBIRTH:
        {
            Debug.Log("Rebirth");
            if (PlayerPrefs.GetInt("Money") > 0)
            {
//					Dictionary<string,string> dic = new Dictionary<string,string> ();
//					dic.Add ("amount", "1");
//					JsonData jd = NetUtil.RequestMsg (NetUtil.MsgConsumeMoney, dic);
                ssdk.gameObject.GetComponent <PlayerManager>().ConsumeMoney(1);
                ssdk.gameObject.GetComponent <CameraMove> ().RebirthPlayer();
                DataManager._waitForRebirth = false;
                DataManager._isUsedRebirth  = true;
                _mask.gameObject.SetActive(false);
            }
            else
            {
                Debug.Log("playerprefs not enough money");
                Debug.Log("Show Get money mask");
//					DataManager._waitOperate = true;
//					transform.parent.gameObject.GetComponent<RebirthMask> ()._lessMoneyTip.gameObject.SetActive (true);
                gameObject.GetComponentInParent <RebirthMask>().setLessMoneyTipMask(true);
            }
        }
        break;

        case ExtraButtonType.EBT_APPSCORE:
        {
            Debug.Log("Link to AppStore");
                                #if UNITY_IPHONE || UNITY_EDITOR
            //Debug.Log ("aaaaaaaaaaa");
            const string APP_ID = "1211127073";                    //1211127073
            var          url    = string.Format(
                "https://itunes.apple.com/app/viewContentsUserReviews/id{0}",
                APP_ID);                        //itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=
            Application.OpenURL(url);
                                #endif
        }
        break;

        case ExtraButtonType.EBT_SKIN:
        {
            _mask.gameObject.SetActive(true);
        }
        break;
        }
    }