• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# PlayState类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中PlayState的典型用法代码示例。如果您正苦于以下问题:C# PlayState类的具体用法?C# PlayState怎么用?C# PlayState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PlayState类属于命名空间,在下文中一共展示了PlayState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: PlayFile

        public void PlayFile(string path)
        {
            try
            {
                if (!File.Exists(path))
                {
                    if (PlayFinishedEvent != null)
                    {
                        PlayFinishedEvent(this, EventArgs.Empty);
                    }
                }
                if (image != null)
                    image.Dispose();
                image = new Bitmap(path);
                state = PlayState.Running;
                tickcount = 0;
                Refresh();
            }
            catch (Exception exp)
            {

                if (PlayFinishedEvent != null)
                {
                    PlayFinishedEvent(this, EventArgs.Empty);
                }

            }
        }
开发者ID:siqiaochen,项目名称:ContentManager,代码行数:28,代码来源:UserControlImageSurface.cs


示例2: WaveSoundPlayer

        public WaveSoundPlayer(WaveFile w, bool loop)
        {
            ac = new AudioContext ();

            bufferlist = new List<int> (NUM_BUFFERS);
            bufferlist.AddRange (AL.GenBuffers (NUM_BUFFERS));

            source = AL.GenSource ();
            this._PlayState = PlayState.NotLoaded;

            wfile = w;
            bufferlist.ForEach (x => {
                byte[] buf = new byte[BUFFER_SIZE];
                buf = wfile.DataBinary.ReadBytes(BUFFER_SIZE);
                AL.BufferData(x,wfile.SoundFormat,buf,buf.Length,wfile.SampleRate);
            });

            AL.SourceQueueBuffers (source, NUM_BUFFERS, bufferlist.ToArray ());
            if (loop)
                AL.Source (source, ALSourceb.Looping, true);

            System.Diagnostics.Debug.WriteLine (AL.GetSourceState(source).ToString());

            this._PlayState = PlayState.Stopped;
        }
开发者ID:Carrot031,项目名称:EasyOpenAL,代码行数:25,代码来源:WaveSoundPlayer.cs


示例3: OnPlayStateChanged

        /// <summary>
        ///     Called when the playstate changes, except for the Error state (see OnError)
        /// </summary>
        /// <param name="player">The BackgroundAudioPlayer</param>
        /// <param name="track">The track playing at the time the playstate changed</param>
        /// <param name="playState">The new playstate of the player</param>
        /// <remarks>
        ///     Play State changes cannot be cancelled. They are raised even if the application
        ///     caused the state change itself, assuming the application has opted-in to the callback.
        ///     Notable playstate events:
        ///     (a) TrackEnded: invoked when the player has no current track. The agent can set the next track.
        ///     (b) TrackReady: an audio track has been set and it is now ready for playack.
        ///     Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
        /// </remarks>
        protected override void OnPlayStateChanged(BackgroundAudioPlayer player, AudioTrack track, PlayState playState)
        {
            Debug.WriteLine("OnPlayStateChanged() playState " + playState);

            switch (playState)
            {
                case PlayState.TrackEnded:
                    player.Track = GetPreviousTrack();
                    break;
                case PlayState.TrackReady:
                    player.Play();
                    break;
                case PlayState.Shutdown:
                    // TODO: Handle the shutdown state here (e.g. save state)
                    break;
                case PlayState.Unknown:
                    break;
                case PlayState.Stopped:
                    break;
                case PlayState.Paused:
                    break;
                case PlayState.Playing:
                    break;
                case PlayState.BufferingStarted:
                    break;
                case PlayState.BufferingStopped:
                    break;
                case PlayState.Rewinding:
                    break;
                case PlayState.FastForwarding:
                    break;
            }

            NotifyComplete();
        }
开发者ID:henricj,项目名称:HttpClientBackgroundAudio,代码行数:49,代码来源:AudioPlayer.cs


示例4: VideoService

        public VideoService(
            Rectangle viewFinder,
            MediaElement player
            )
        {
            // Initial State
            _State = PlayState.Paused;
            _CanRecord = false;

            _Record = new SwitchableCommand(OnRecord);
            _Play = new SwitchableCommand(OnPlay);
            _Stop = new SwitchableCommand(OnPause);

            _ViewFinder = viewFinder;

            _Player = player;
            _Player.MediaEnded += MediaEnded;

            _CaptureSource = new CaptureSource();
            _CaptureSource.CaptureFailed += CaptureFailed;

            _FileSink = new FileSink();
            _Brush = new VideoBrush();

            _HasRecording = new BehaviorSubject<bool>(false);
        }
开发者ID:SNSB,项目名称:DiversityMobile,代码行数:26,代码来源:VideoService.cs


示例5: OnPlayStateChanged

        /// <summary>
        /// playstate 更改时调用,但 Error 状态除外(参见 OnError)
        /// </summary>
        /// <param name="player">BackgroundAudioPlayer</param>
        /// <param name="track">在 playstate 更改时播放的曲目</param>
        /// <param name="playState">播放机的新 playstate </param>
        /// <remarks>
        /// 无法取消播放状态更改。即使应用程序
        /// 导致状态自行更改也会提出这些更改,假定应用程序已经选择了回调。
        ///
        /// 值得注意的 playstate 事件:
        /// (a) TrackEnded: 播放器没有当前曲目时激活。代理可设置下一曲目。
        /// (b) TrackReady: 音轨已设置完毕,现在可以播放。
        ///
        /// 只在代理请求完成之后调用一次 NotifyComplete(),包括异步回调。
        /// </remarks>
        protected override void OnPlayStateChanged(BackgroundAudioPlayer player, AudioTrack track, PlayState playState)
        {
            switch (playState)
            {
                case PlayState.TrackEnded:
                    //player.Track = GetPreviousTrack();
                    //player.Track = GetNextTrack();
                    PlayNextTrack(player);
                    break;
                case PlayState.TrackReady:
                    player.Play();
                    break;
                case PlayState.Shutdown:
                    // TODO: 在此处理关机状态(例如保存状态)
                    break;
                case PlayState.Unknown:
                    break;
                case PlayState.Stopped:
                    break;
                case PlayState.Paused:
                    break;
                case PlayState.Playing:
                    break;
                case PlayState.BufferingStarted:
                    break;
                case PlayState.BufferingStopped:
                    break;
                case PlayState.Rewinding:
                    break;
                case PlayState.FastForwarding:
                    break;
            }

            NotifyComplete();
        }
开发者ID:vicalloy,项目名称:lb.ting,代码行数:51,代码来源:AudioPlayer.cs


示例6: OnPlayStateChanged

        /// <summary>
        /// Called when the playstate changes, except for the Error state (see OnError)
        /// </summary>
        /// <param name="player">The BackgroundAudioPlayer</param>
        /// <param name="track">The track playing at the time the playstate changed</param>
        /// <param name="playState">The new playstate of the player</param>
        /// <remarks>
        /// Play State changes cannot be cancelled. They are raised even if the application
        /// caused the state change itself, assuming the application has opted-in to the callback.
        /// 
        /// Notable playstate events: 
        /// (a) TrackEnded: invoked when the player has no current track. The agent can set the next track.
        /// (b) TrackReady: an audio track has been set and it is now ready for playack.
        /// 
        /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
        /// </remarks>
        protected override void OnPlayStateChanged(BackgroundAudioPlayer player, AudioTrack track, PlayState playState)
        {
            switch (playState)
            {
                case PlayState.TrackEnded:
                    player.Track = GetNextTrack();
                    break;
                case PlayState.TrackReady:
                    player.Play();
                    break;
                case PlayState.Shutdown:
                    // TODO: Handle the shutdown state here (e.g. save state)
                    break;
                case PlayState.Unknown:
                    break;
                case PlayState.Stopped:
                    _playlistHelper.SetAllTracksToNotPlayingAndSave();
                    break;
                case PlayState.Paused:
                    break;
                case PlayState.Playing:
                    break;
                case PlayState.BufferingStarted:
                    break;
                case PlayState.BufferingStopped:
                    break;
                case PlayState.Rewinding:
                    break;
                case PlayState.FastForwarding:
                    break;
            }

            NotifyComplete();
        }
开发者ID:EchoDemon,项目名称:MediaBrowser.WindowsPhone,代码行数:50,代码来源:AudioPlayer.cs


示例7: Start

 void Start()
 {
     CameraScript.LoadData();
     State = PlayState.menu;
     //LUCE A SECONDA DELLA PIATTAFORMA
     if (Application.platform == RuntimePlatform.WP8Player
           #if UNITY_IPHONE
         || iPhone.generation == iPhoneGeneration.iPodTouch4Gen || iPhone.generation == iPhoneGeneration.iPodTouch3Gen ||
        iPhone.generation == iPhoneGeneration.iPodTouch2Gen || iPhone.generation == iPhoneGeneration.iPodTouch1Gen ||
        iPhone.generation == iPhoneGeneration.iPhone3GS || iPhone.generation == iPhoneGeneration.iPhone4 ||
        iPhone.generation == iPhoneGeneration.iPad2Gen || iPhone.generation == iPhoneGeneration.iPad1Gen
         #endif
         )
     {
         pglight.SetActive(false);
         wplight.SetActive(true);
     }
     else
     {
         wplight.SetActive(true);
         wplight.light.range=6f;
         pglight.SetActive(true);
     }
     GameCredits = 0;
 }
开发者ID:EmanueleGrassi,项目名称:Man-in-the-cave,代码行数:25,代码来源:PlayScript.cs


示例8: MovieScreen

        public MovieScreen()
        {
            InitializeComponent();

            movie_timer = new Timer();
            movie_timer.Tick += new EventHandler(movie_timer_Tick);
            play_state = PlayState.Close;
        }
开发者ID:qiuwch,项目名称:MotionSeg,代码行数:8,代码来源:MovieScreen.cs


示例9: Run

        public void Run()
        {
            // Start previewing video data
            int hr = this.mediaControl.Run();
            DsError.ThrowExceptionForHR(hr);

            // Remember current state
            this.currentState = PlayState.Running;
        }
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:9,代码来源:VideoSource.cs


示例10: Initialize

        public override void Initialize()
        {
            base.Initialize();

            playState = PlayState.running;
            spelObjektLista.Clear();
            gubbe = game.Player1;
            gubbe.Initialize(this);
            spelObjektLista.Add(gubbe);
        }
开发者ID:Jakob37,项目名称:JDGAME,代码行数:10,代码来源:LevelState.cs


示例11: OnPlayStateChanged

 protected override void OnPlayStateChanged(BackgroundAudioPlayer player, AudioTrack track, PlayState playState)
 {
     switch (playState)
     {
         case PlayState.TrackReady:
             player.Play();
             break;
     }
     NotifyComplete();
 }
开发者ID:OlivierRiberi,项目名称:3NET-SimpleRadio,代码行数:10,代码来源:AudioPlayer.cs


示例12: LevelState

        public LevelState(Game1 game, Sprite spriteSheet)
            : base(game)
        {
            this.spriteSheet = spriteSheet;
            font = game.Content.Load<SpriteFont>("vanligFont");
            random1 = new Random();

            Sprite tile = new Sprite(game.Content.Load<Texture2D>("Tiles/MudTile"));
            backgroundSprite = new BackgroundSprite(game.Window.ClientBounds.Width, game.Window.ClientBounds.Height, tile);

            playState = PlayState.running;
        }
开发者ID:Jakob37,项目名称:JDGAME,代码行数:12,代码来源:LevelState.cs


示例13: OnPlayStateChanged

        /// <summary>
        /// Called when the playstate changes, except for the Error state (see OnError)
        /// </summary>
        /// <param name="player">The BackgroundAudioPlayer</param>
        /// <param name="track">The track playing at the time the playstate changed</param>
        /// <param name="playState">The new playstate of the player</param>
        /// <remarks>
        /// Play State changes cannot be cancelled. They are raised even if the application
        /// caused the state change itself, assuming the application has opted-in to the callback.
        ///
        /// Notable playstate events:
        /// (a) TrackEnded: invoked when the player has no current track. The agent can set the next track.
        /// (b) TrackReady: an audio track has been set and it is now ready for playack.
        ///
        /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
        /// </remarks>
        protected override void OnPlayStateChanged(BackgroundAudioPlayer player, AudioTrack track, PlayState playState)
        {
            switch (playState)
            {
                case PlayState.TrackEnded:
                    //player.Track = GetPreviousTrack();
                    player.Track = null;
                    break;
                case PlayState.TrackReady:
                    player.Play();
                    connectedEvent.Set();

                    if (track != null && track.Tag != null)
                    {
                        var data = track.Tag.ToString().Split('$');
                        var url = data[data.Length - 1];
                        var title = data[1];
                        var type = data[2];

                        //#region from http://stackoverflow.com/questions/7159900/detect-application-launch-from-universal-volume-control
                        //MediaHistoryItem nowPlaying = new MediaHistoryItem();
                        //nowPlaying.Title = title;
                        //nowPlaying.PlayerContext.Add("station", title);
                        //MediaHistory.Instance.NowPlaying = nowPlaying;
                        //#endregion
                    }
                    break;
                case PlayState.Shutdown:
                    // TODO: Handle the shutdown state here (e.g. save state)
                    break;
                case PlayState.Unknown:
                    break;
                case PlayState.Stopped:
                    break;
                case PlayState.Paused:
                    break;
                case PlayState.Playing:
                    break;
                case PlayState.BufferingStarted:
                    break;
                case PlayState.BufferingStopped:
                    break;
                case PlayState.Rewinding:
                    break;
                case PlayState.FastForwarding:
                    break;
            }

            NotifyComplete();
        }
开发者ID:Amrykid,项目名称:Hanasu,代码行数:66,代码来源:AudioPlayer.cs


示例14: OnPlayStateChanged

        /// <summary>
        /// Called when the playstate changes, except for the Error state (see OnError)
        /// </summary>
        /// <param name="player">The BackgroundAudioPlayer</param>
        /// <param name="track">The track playing at the time the playstate changed</param>
        /// <param name="playState">The new playstate of the player</param>
        /// <remarks>
        /// Play State changes cannot be cancelled. They are raised even if the application
        /// caused the state change itself, assuming the application has opted-in to the callback.
        /// 
        /// Notable playstate events: 
        /// (a) TrackEnded: invoked when the player has no current track. The agent can set the next track.
        /// (b) TrackReady: an audio track has been set and it is now ready for playack.
        /// 
        /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
        /// </remarks>
        protected override void OnPlayStateChanged(BackgroundAudioPlayer player, AudioTrack track, PlayState playState)
        {
            switch (playState)
            {
                case PlayState.TrackReady:
                    // Wiedergabe wurde in PlayTrack() bereits festgelegt
                    player.Play();
                    break;
                case PlayState.TrackEnded:
                    PlayNextTrack(player);
                    break;
            }

            NotifyComplete();
        }
开发者ID:GregOnNet,项目名称:WP8BookSamples,代码行数:31,代码来源:AudioPlayer.cs


示例15: Metronome

 public Metronome()
 {
     mTempo = 100;
     mBeatsPerBar = 4;
     mMillisecondsBetweenBeats = 60000f / mTempo;
     mStopAfter = 100;
     mIncreaseAfter = 16;
     mIncreaseBy = 10;
     mIncreaseUpTo = 200;
     mTickCounter = 0;
     mPlayState = PlayState.Stopped;
     mPlayTimer = TimeSpan.Zero;
     mUpperTempoLimit = 500;
     mSpeedTemplates = new List<SpeedTemplate>();
     mRudiments = new List<Rudiment>();
 }
开发者ID:flackbash,项目名称:Drumtronome,代码行数:16,代码来源:Metronome.cs


示例16: Play

    public override bool Play(string strFile)
    {
      m_iVolume = 100;
      m_bNotifyPlaying = true;
      m_state = PlayState.Init;
      m_strCurrentFile = strFile;

      VideoRendererStatistics.VideoState = VideoRendererStatistics.State.VideoPresent;
      Log.Info("AudioPlayerVMR7.play {0}", strFile);
      lock (typeof (AudioPlayerVMR7))
      {
        CloseInterfaces();
        if (!GetInterfaces())
        {
          m_strCurrentFile = "";
          return false;
        }
        int hr = mediaEvt.SetNotifyWindow(GUIGraphicsContext.ActiveForm, WM_GRAPHNOTIFY, IntPtr.Zero);
        if (hr < 0)
        {
          m_strCurrentFile = "";
          CloseInterfaces();
          return false;
        }

        GetFrameStepInterface();

        _rotEntry = new DsROTEntry((IFilterGraph)graphBuilder);


        hr = mediaCtrl.Run();
        if (hr < 0)
        {
          m_strCurrentFile = "";
          CloseInterfaces();
          return false;
        }
        //        mediaPos.put_CurrentPosition(4*60);
        GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYBACK_STARTED, 0, 0, 0, 0, 0, null);
        msg.Label = strFile;
        GUIWindowManager.SendThreadMessage(msg);
      }
      m_state = PlayState.Playing;
      return true;
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:45,代码来源:AudioPlayerVMR.cs


示例17: OnPlayStateChanged

        protected override void OnPlayStateChanged(BackgroundAudioPlayer player, AudioTrack track, PlayState playState)
        {
            switch (playState)
            {
                case PlayState.TrackEnded:
                    player.Close();
                    break;

                case PlayState.TrackReady:
                    player.Volume = 1.0;
                    player.Play();
                    break;

                case PlayState.Shutdown:
                    // TODO: Handle the shutdown state here (e.g. save state)
                    break;

                case PlayState.Unknown:
                    break;

                case PlayState.Stopped:
                    break;

                case PlayState.Paused:
                    break;

                case PlayState.Playing:
                    break;

                case PlayState.BufferingStarted:
                    break;

                case PlayState.BufferingStopped:
                    break;

                case PlayState.Rewinding:
                    break;

                case PlayState.FastForwarding:
                    break;
            }

            NotifyComplete();
        }
开发者ID:juhariis,项目名称:Windows-Phone-Starter-Kit-for-Podcasts,代码行数:44,代码来源:AudioPlayer.cs


示例18: OnPlayStateChanged

        /// <summary>
        /// Called when the playstate changes, except for the Error state (see OnError)
        /// </summary>
        /// <param name="player">The BackgroundAudioPlayer</param>
        /// <param name="track">The track playing at the time the playstate changed</param>
        /// <param name="playState">The new playstate of the player</param>
        /// <remarks>
        /// Play State changes cannot be cancelled. They are raised even if the application
        /// caused the state change itself, assuming the application has opted-in to the callback.
        /// 
        /// Notable playstate events: 
        /// (a) TrackEnded: invoked when the player has no current track. The agent can set the next track.
        /// (b) TrackReady: an audio track has been set and it is now ready for playack.
        /// 
        /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
        /// </remarks>
        protected override void OnPlayStateChanged(BackgroundAudioPlayer player, AudioTrack track, PlayState playState)
        {
            switch (playState)
            {
                case PlayState.TrackEnded:
                    //player.Track = GetPreviousTrack();
                    if (currentTrack < playlist.Count - 1)
                    {
                        currentTrack += 1;
                        player.Track = playlist[currentTrack];
                    }
                    else
                    {
                        player.Track = null;
                    }
                    break;
                case PlayState.TrackReady:
                    player.Play();
                    break;
                case PlayState.Shutdown:
                    // TODO: Handle the shutdown state here (e.g. save state)
                    break;
                case PlayState.Unknown:
                    break;
                case PlayState.Stopped:
                    break;
                case PlayState.Paused:
                    break;
                case PlayState.Playing:
                    break;
                case PlayState.BufferingStarted:
                    break;
                case PlayState.BufferingStopped:
                    break;
                case PlayState.Rewinding:
                    break;
                case PlayState.FastForwarding:
                    break;
            }

            NotifyComplete();
        }
开发者ID:dinesh2043,项目名称:Audiobook,代码行数:58,代码来源:AudioPlayer.cs


示例19: Update

	// Update is called once per frame
	void Update () {
		if ( Input.GetButtonDown( "Menu" ) ) {
			ToggleMainMenu();
		}

		if ( currentState == GameState.Playing ) {
			gameTime += Time.deltaTime;
			zombieTime += Time.deltaTime;

			//spawn zombies 
			if ( zombieTime > zombieSpawnRate ) {
				zombieTime = 0.0f;
				//zombieSpawner.RandomSpawn();
			}
			

			// update playing state
			switch ( currentPlayState ) {
				case PlayState.Start:
					if ( gameTime > requestTime ) {
						player.radio.RadioRequest();
						currentPlayState = PlayState.Request;
					}
					break;
				case PlayState.Request:
					if ( gameTime > inboundTime ) {
						player.radio.RadioInbound();
						currentPlayState = PlayState.Inbound;
					}
					break;
				case PlayState.Inbound:
					if ( gameTime > landedTime ) {
						player.radio.RadioLanded();
						currentPlayState = PlayState.Landed;
					}
					break;
				case PlayState.Landed:
					break;
			}
		}
	}
开发者ID:dustinbrink,项目名称:unity,代码行数:42,代码来源:GameController.cs


示例20: CompareValue

    public void CompareValue(int numberCounted)
    {
        gameState = PlayState.Validate;

        if (numberCounted == HouseBehaviour.Instance.In)
        {
            ShowPanels.Instance.HideAll();
            ShowPanels.Instance.ShowWin();
        }

        else
        {
            ShowPanels.Instance.HideAll();
            ShowPanels.Instance.ShowLose();
            solution.text = HouseBehaviour.Instance.In.ToString();

        }
        foreach (GameObject guests in CharacterGenerator.Instance.ListedGuest)
        {
            guests.tag = "Out";
            guests.SetActive(true);
        }
    }
开发者ID:azerty53,项目名称:Count_Game,代码行数:23,代码来源:GameManager.cs



注:本文中的PlayState类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PlayableItem类代码示例发布时间:2022-05-24
下一篇:
C# PlayMode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap