示例#1
0
        public PreviewPlayControlModel2(MPlaylistSettings mplaylistSettings /*, IEventAggregator eventAggregator*/)
        {
            //eventAggregator.GetEvent<PubSubEvent<IPlayableItem>>().Subscribe(Preview);

            _player = new PreviewPlayer(mplaylistSettings);

            _player.Opened        += Player_Opened;
            _player.Closed        += Player_Closed;
            _player.StatusChanged += Player_StatusChanged;

            _playCommand  = new DelegateCommand(Play, CanPlay);
            _pauseCommand = new DelegateCommand(Pause, CanPause);
            _stopCommand  = new DelegateCommand(Stop, CanStop);

            _setInCommand  = new DelegateCommand(SetIn, CanSetIn);
            _setOutCommand = new DelegateCommand(SetOut, CanSetOut);

            _goInCommand  = new DelegateCommand(GoIn, CanGoIn);
            _goOutCommand = new DelegateCommand(GoOut, CanGoOut);

            _nextFrameCommand     = new DelegateCommand(GoNextFrame, CanGoNextFrame);
            _previousFrameCommand = new DelegateCommand(GoPreviousFrame, CanGoPreviousFrame);

            _applyCommand     = new DelegateCommand(Apply, CanApply);
            _resetRateCommand = new DelegateCommand(ResetRate, CanResetRate);
        }
示例#2
0
        /// <summary>
        /// 预览桌面
        /// </summary>
        private void PreviewDesktop()
        {
            if (PreviewPlayer.IsRunning)
            {
                PreviewPlayer.SignalToStop();
                PreviewPlayer.WaitForStop();
            }
            Rectangle screenArea = Rectangle.Empty;

            screenArea = Rectangle.Union(screenArea, System.Windows.Forms.Screen.PrimaryScreen.Bounds);
            var streamVideo = new ScreenCaptureStream(screenArea);
            //当前屏幕的宽高比
            var index1 = Math.Round((screenArea.Width * 1.0 / screenArea.Height * 1.0), 2);
            var width  = Convert.ToInt32(Math.Round(CameraStackpanel.Width));
            var height = Convert.ToInt32(Math.Round(CameraStackpanel.Height));
            //预览播放器的宽高比
            var index2 = Math.Round((width * 1.0 / height * 1.0), 2);

            if (index1 > index2)
            {
                PreviewPlayer.Width  = width;
                PreviewPlayer.Height = CommonHelper.GetHeight(screenArea.Width, screenArea.Height, width);
            }
            else
            {
                PreviewPlayer.Width  = CommonHelper.GetWidth(screenArea.Width, screenArea.Height, height);
                PreviewPlayer.Height = height;
            }
            PreviewPlayer.VideoSource = streamVideo;
            PreviewPlayer.Start();
        }
示例#3
0
    IEnumerator CreateAsync(Action <PreviewPlayer> _callBack)
    {
        if (isDummy_ == false)
        {
            GameSys.LogError("You can only start create preview player in dummy: " + actorInfo.ServerInstanceID);
            yield break;
        }
        //
        isDownloading_ = true;                          //判断是否正在下载,防止重复创建

        PreviewPlayer pp = null;

        //PlayerRendererCtrl myRendererCtrl = null;
        //bool faild = false;
        pendingDownload = Create(actorInfo, delegate(PreviewPlayer _pp, EResult _result)
        {
            if (_result != EResult.Success)
            {
                //faild = true;
                return;
            }
            if (mutualExclusion)
            {
                GameCenter.previewManager.EndDownLoadTask(pendingDownload);
            }
            pp = _pp;
            pp.transform.localScale *= actorInfo.PreviewScale;
            pendingDownload          = null;
            if (pp.inited)
            {
                pendingDownload = null;
                isDownloading_  = false;
                if (_callBack != null)
                {
                    _callBack(pp);
                }
            }
        });
        if (mutualExclusion)
        {
            GameCenter.previewManager.PushDownLoadTask(pendingDownload);
        }
        GameCenter.previewManager.PushDownLoadTask(pendingDownload);
        //while (pp == null || pp.inited == false)
        //{
        //    if (faild) yield break;
        //    Debug.Log("1111");
        //    yield return new WaitForFixedUpdate();
        //}

        //pendingDownload = null;
        //isDownloading_ = false;
        //Debug.Log("3333333");
        //if (_callBack != null)
        //{
        //    Debug.Log("44444444");
        //    _callBack(pp);
        //}
    }
示例#4
0
 /// <summary>
 /// 非经过我同意禁用本接口  by吴江
 /// </summary>
 /// <param name="_info"></param>
 /// <param name="_callBack"></param>
 /// <returns></returns>
 public bool TryPreviewSinglePlayer(PlayerBaseInfo _info, System.Action <PreviewPlayer> _callBack)
 {
     if (_info != null)
     {
         PreviewPlayer pp = PreviewPlayer.CreateDummy(_info);
         pp.mutualExclusion = false;
         pp.StartAsyncCreate(_callBack);
         return(true);
     }
     return(false);
 }
示例#5
0
 /// <summary>
 /// 为对话框做玩家预览 by吴江
 /// </summary>
 /// <param name="_info">玩家数据</param>
 /// <param name="_showLabel">展示UI</param>
 /// <param name="_randIdle">是否做随机动作</param>
 /// <returns></returns>
 public bool TryPreviewSinglePlayerForDialog(PlayerBaseInfo _info, UITexture _showLabel, PlayerAnimFSM.EventType _type = ActorAnimFSM.EventType.Idle)
 {
     curShowLabel    = _showLabel;
     playerPosConfig = true;
     CancelAllDownLoad();
     if (_info != null)
     {
         PreviewPlayer pp = PreviewPlayer.CreateDummy(_info, null);
         pp.needRandID = _type;
         pp.StartAsyncCreate(CreatePlayerCallBack);
         return(true);
     }
     return(false);
 }
示例#6
0
    //Dictionary<EquipSlot, EquipmentInfo> nowShowEqList = new Dictionary<EquipSlot, EquipmentInfo>();

    public static PreviewPlayer CreateDummy(PlayerBaseInfo _info, Dictionary <EquipSlot, EquipmentInfo> _tryShowList = null)
    {
        GameObject newGO = new GameObject("Dummy Preview[" + _info.ServerInstanceID + "]");

        newGO.AddComponent <ActorMoveFSM>();
        PreviewPlayer pP = newGO.AddComponent <PreviewPlayer>();

        pP.actorInfo         = _info;
        pP.id                = _info.ServerInstanceID;
        pP.isDummy_          = true;
        pP.tryShowEquipments = _tryShowList;
        pP.typeID            = ObjectType.PreviewPlayer;
        return(pP);
    }
示例#7
0
 /// <summary>
 /// 预览玩家 by吴江
 /// </summary>
 /// <param name="_info">玩家数据</param>
 /// <param name="_showLabel">展示ui</param>
 /// <param name="_showCosmetic">是否展示时装</param>
 /// <returns></returns>
 public bool TryPreviewSinglePlayer(PlayerBaseInfo _info, UITexture _showLabel, bool _showCosmetic)
 {
     curShowLabel    = _showLabel;
     playerPosConfig = true;
     CancelAllDownLoad();
     if (_info != null)
     {
         PreviewPlayer pp = PreviewPlayer.CreateDummy(_info, null);
         pp.mutualExclusion = false;
         pp.showCosmetic    = _showCosmetic;
         pp.StartAsyncCreate(CreatePlayerCallBack);
         return(true);
     }
     return(false);
 }
示例#8
0
 /// <summary>
 /// 预览玩家 by吴江
 /// </summary>
 /// <param name="_info">玩家数据</param>
 /// <param name="_showLabel">展示ui</param>
 /// <param name="_tryShowEqList">试穿的装备列表</param>
 /// <param name="_randIdle">是否做随机动作</param>
 /// <returns></returns>
 public bool TryPreviewSinglePlayer(PlayerBaseInfo _info, UITexture _showLabel, Dictionary <EquipSlot, EquipmentInfo> _tryShowEqList = null, PlayerAnimFSM.EventType _type = ActorAnimFSM.EventType.Idle)
 {
     curShowLabel    = _showLabel;
     playerPosConfig = true;
     CancelAllDownLoad();
     if (_info != null)
     {
         PreviewPlayer pp = PreviewPlayer.CreateDummy(_info, _tryShowEqList);
         pp.mutualExclusion = false;
         pp.needRandID      = _type;
         pp.StartAsyncCreate(CreatePlayerCallBack);
         return(true);
     }
     return(false);
 }
示例#9
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            var dlg = new CloseWindow();

            dlg.Owner = this;
            if (dlg.ShowDialog() == true)
            {
                if (PreviewPlayer.IsRunning)
                {
                    PreviewPlayer.SignalToStop();
                    PreviewPlayer.WaitForStop();
                }
                Environment.Exit(0);
            }
        }
示例#10
0
 //
 //清理模型
 public void ClearModel()
 {
     currentPlayerGroupAngles = new Vector3(0, 0, 0);
     if (previewCamera != null && previewCamera.transform.childCount > 0)
     {
         Transform tsf = previewCamera.transform.FindChild("CtrlObj");
         if (tsf != null)
         {
             for (int i = 0; i < tsf.childCount; i++)
             {
                 UnityEngine.Object.Destroy(tsf.GetChild(i).gameObject);
             }
         }
         previewCharacter = null;
     }
 }
示例#11
0
        /// <summary>
        /// 预览摄像头
        /// </summary>
        private void PreviewCamera()
        {
            if (PreviewPlayer.IsRunning)
            {
                PreviewPlayer.SignalToStop();
                PreviewPlayer.WaitForStop();
            }
            var camera = VideoHelper.GetCameraInfo(cameraName);

            if (camera != null)
            {
                cameraResolutionIndex  = VideoHelper.GetCameraResolutionIndex();
                camera.VideoResolution = camera.VideoCapabilities[cameraResolutionIndex];
                //当前摄像头分辨率的宽高比
                var index1 = Math.Round((camera.VideoResolution.FrameSize.Width * 1.0 / camera.VideoResolution.FrameSize.Height * 1.0), 2);
                var width  = Convert.ToInt32(Math.Round(CameraStackpanel.Width));
                var height = Convert.ToInt32(Math.Round(CameraStackpanel.Height));
                //预览播放器的宽高比
                var index2 = Math.Round((width * 1.0 / height * 1.0), 2);

                if (index1 > index2)
                {
                    PreviewPlayer.Width  = width;
                    PreviewPlayer.Height = CommonHelper.GetHeight(camera.VideoResolution.FrameSize.Width,
                                                                  camera.VideoResolution.FrameSize.Height, width);
                }
                else
                {
                    PreviewPlayer.Width  = CommonHelper.GetWidth(camera.VideoResolution.FrameSize.Width, camera.VideoResolution.FrameSize.Height, height);
                    PreviewPlayer.Height = height;
                }
                PreviewPlayer.VideoSource = camera;
                PreviewPlayer.Start();
            }
            else
            {
                MessageBox.Show("错误的摄像头设置", "提示");
            }
        }
示例#12
0
    public void CreatePlayerCallBack(PreviewPlayer _player)
    {
        //防止有之前延迟的模型加载,再次清理
        ClearModel();
        previewCharacter = _player;
        GameObject parent = playerPosConfig ? GetModelTransform(_player.PreviewPos, _player.PreviewRotation) : GetModelTransform(Vector3.zero, Vector3.zero);

        if (null != parent)
        {
            previewCharacter.transform.parent        = parent.transform;
            previewCharacter.transform.localPosition = new Vector3(0, -(previewCharacter.Height / 2f - 0.25f), 0);
        }
        previewCharacter.FaceToNoLerp(180);
        UIDragObjectRotate3D _UIDragObjectRotate3D = curShowLabel.gameObject.GetComponent <UIDragObjectRotate3D>();

        if (_UIDragObjectRotate3D == null)
        {
            _UIDragObjectRotate3D = curShowLabel.gameObject.AddComponent <UIDragObjectRotate3D>();
        }
        _UIDragObjectRotate3D.target = _player;
        _UIDragObjectRotate3D.ResetPosition();
        BindRenderAndUI(curShowLabel);
    }
 // Use this for initialization
 void Start()
 {
     audioSource = gameObject.GetComponent <AudioSource>();
     songPlayer  = gameObject.GetComponent <PreviewPlayer>();
 }
示例#14
0
        private static void loadNewMode(OsuMode newMode)
        {
            //Create the actual mode
            GameMode mode = null;

            switch (newMode)
            {
            case OsuMode.MainMenu:
                mode = new MainMenu();
                break;

            case OsuMode.SongSelect:
                mode = new SongSelectMode();
                break;

            case OsuMode.Results:
                mode = new Results();
                break;

#if MONO
            case OsuMode.PlayTest:
                mode = new PlayTest();
                break;
#endif
            case OsuMode.Play:
                if (CurrentOsuMode == OsuMode.VideoPreview)
                {
                    mode = new PreviewPlayer();
                }
                else
                {
                    mode = new Player();
                }
                break;

            case OsuMode.Store:
#if iOS
                mode = new StoreModeIphone();
#else
                mode = new StoreMode();
#endif
                break;

            case OsuMode.Options:
                mode = new Options();
                break;

            case OsuMode.Tutorial:
                mode = new Tutorial();
                break;

            case OsuMode.Credits:
                mode = new Credits();
                break;

            case OsuMode.VideoPreview:
                mode = new VideoPreview();
                break;

            case OsuMode.Empty:
                mode = new Empty();
                break;

#if MONO
            case OsuMode.PositioningTest:
                mode = new PositioningTest();
                break;
#endif
            }

            PendingMode = mode;
        }