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

C# MusicPlayer类代码示例

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

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



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

示例1: Start

	// Use this for initialization
	void Start () {
		musicPlayer = GameObject.FindObjectOfType<MusicPlayer>();

		if ( musicPlayer ) {
			volumeSlider.value = musicPlayer.GetVolume();
		}
	}
开发者ID:dustinbrink,项目名称:unity,代码行数:8,代码来源:OptionsController.cs


示例2: PlayTrack

        public void PlayTrack(Track track)
        {
            var path = Path.Combine (NSBundle.MainBundle.ResourcePath, "testsound.mp3");
            var data = System.IO.File.ReadAllBytes (path);
            var url = NSUrl.FromFilename (path);
            var status = MusicPlayerStatus.Success;
            player = MusicPlayer.Create (out status);
            player.MusicSequence = new MusicSequence ();
            player.MusicSequence.LoadFile (url, MusicSequenceFileTypeID.Any);
            player.Start ();
            /*AppDelegate.Player = AVAudioPlayer.FromUrl (url);
            AppDelegate.Player.NumberOfLoops = 1;

            var res = AppDelegate.Player.PrepareToPlay ();
            //player.AddPeriodicTimeObserver (CoreMedia,CMTime.FromSeconds (1, 1), );

            var r = AppDelegate.Player.Play ();
            AppDelegate.Player.DecoderError += (sender, e) => {
                var a = 3;
            };
            AppDelegate.Player.FinishedPlaying += (sender, e) => {
                var a = 4;
            };
            AppDelegate.Player.BeginInterruption += (sender, e) => {
                var a = 5;
            };
            AppDelegate.Player.EndInterruption += (sender, e) => {
                var a = 6;
            };
            */
        }
开发者ID:Grawl,项目名称:hubbl,代码行数:31,代码来源:iOSPlayerBackend.cs


示例3: Start

	// Use this for initialization
	void Start () {
		// get all the objects we'll need for the cutscene 
		riftParticles = GameObject.Find ("RiftParticles").GetComponent<ParticleSystem>();

		mus = GameObject.Find ("BGM").GetComponent<MusicPlayer>();

		playSound(Rain, true);
	}
开发者ID:metanymie,项目名称:jga,代码行数:9,代码来源:S610Puppeteer.cs


示例4: Start

	// Use this for initialization
	void Start () {
		// get all the objects we'll need for the cutscene 
		LMFB = GameObject.Find ("LMFB");
		Daria = GameObject.Find ("Daria");
		mus = GameObject.Find ("BGM").GetComponent<MusicPlayer>();
		bc = GetComponent<BattleController>();

	}
开发者ID:metanymie,项目名称:jga,代码行数:9,代码来源:S606Puppeteer.cs


示例5: Start

	// Use this for initialization
	void Start () {
		// get all the objects we'll need for the cutscene 
		ChefTony = GameObject.Find ("Chef Tony");
		James = GameObject.Find ("James");

		mus = GameObject.Find ("BGM").GetComponent<MusicPlayer>();

		startTimer();
	}
开发者ID:metanymie,项目名称:jga,代码行数:10,代码来源:S605Puppeteer.cs


示例6: Start

	// Use this for initialization
	void Start () {
		musicPlayer = GameObject.FindObjectOfType<MusicPlayer>();

		if ( musicPlayer ) {
			volumeSlider.value = musicPlayer.GetVolume();
		}

		difficultySlider.value = PlayerPrefsManager.GetDifficulty();
	}
开发者ID:dustinbrink,项目名称:unity,代码行数:10,代码来源:OptionsController.cs


示例7: Start

	// Use this for initialization
	void Start () {
		mp = GameObject.Find("BGM").GetComponent<MusicPlayer>();
		bc = GameObject.Find ("Scripts").GetComponent<BattleController>();

		chefTony = GameObject.Find ("Chef Tony");
		ff = GameObject.Find ("Father Flanagan");
		os = GameObject.Find ("Orphan Shield");
		shoes = GameObject.Find ("ShoesTie");
	}
开发者ID:metanymie,项目名称:jga,代码行数:10,代码来源:S301Puppeteer.cs


示例8: Awake

 void Awake () {
     if (instance != null) {
         Destroy(gameObject);
         Debug.Log("Duplicate MusicPlayer self-destructing!");
     } else {
         instance = this;
         GameObject.DontDestroyOnLoad(gameObject);
     }
 }
开发者ID:ukmeth0d,项目名称:Unity-BlockBreaker,代码行数:9,代码来源:MusicPlayer.cs


示例9: Awake

 // Use this for initialization
 void Awake()
 {
     clock = GameObject.Find("Clock").GetComponent<ClockManager>();
     hourToggle = GameObject.Find("Toggle").GetComponent<Toggle>();
     volSlider = GameObject.Find("Slider").GetComponent<Slider>();
     if(volSlider != null)
         volSlider.onValueChanged.AddListener(ChangeVolume);
     mplayer = GameObject.Find("PersistentDataObject").GetComponent<MusicPlayer>();
     LoadPrefs();
 }
开发者ID:Game-Dev-Bros,项目名称:1GAM-HOBBY,代码行数:11,代码来源:OptionsScript.cs


示例10: Start

 // Use this for initialization
 void Start()
 {
     string gradeString = "";
     p = FindObjectOfType<MusicPlayer>();
     foreach (string s in p.letterGrades)
     {
         gradeString += s + "\n";
     }
     GetComponent<TextMesh>().text = gradeString;
 }
开发者ID:BluShine,项目名称:FoundBigfootage,代码行数:11,代码来源:Grader.cs


示例11: DefaultForm

        /// <summary>
        /// Constructor
        /// </summary>
        public DefaultForm()
        {
            InitializeComponent();

            music = new MusicPlayer();
            random = new Random();

            labelShowing = false;
            iconShowing = false;
        }
开发者ID:SimonBerggren,项目名称:Assignment1,代码行数:13,代码来源:Form1.cs


示例12: Awake

    void Awake()
    {

        if (instance == null)
        {
            instance = this;

        }
        else if (instance != this)
        {
            if (dontDestroy)
            {
                Destroy(gameObject);
            }
            else
            {
                Destroy(instance);
                instance = this;
                initialized = false;
            }

        }
        
        if (dontDestroy)
        {
            DontDestroyOnLoad(gameObject);
        }

    }
开发者ID:ForsakenGS,项目名称:LostKids,代码行数:29,代码来源:MusicPlayer.cs


示例13: Awake

	void Awake () {
		// singleton example code
		if (instance != null && instance != this) {
			//if there is already a music player active
			//just tell *it* to play our song, and then self-destruct

			if((playAtStart && !OnlyPlayIfNoMusicPlaying) ||
			   (playAtStart && OnlyPlayIfNoMusicPlaying && !instance.audio.isPlaying)) {
					instance.PlayMusic(this.music, this.loop);
			} else {
				instance.music = this.music;
			}

			Destroy(this.gameObject);
			return;
		} else {
			instance = this;
		}

		DontDestroyOnLoad(this.gameObject);

		soundSource = gameObject.AddComponent<AudioSource>();
		soundSource.loop = loop;

		if(playAtStart)
			PlayMusic (music, loop);
	}
开发者ID:metanymie,项目名称:jga,代码行数:27,代码来源:MusicPlayer.cs


示例14: Start

    // Use this for initialization
    void Start()
    {
        script = this;
        DontDestroyOnLoad(this.gameObject);

        if (!this.GetComponent<AudioSource>()) this.gameObject.AddComponent<AudioSource>();
        this.audio.loop = true;
    }
开发者ID:joeytsao,项目名称:Game_JIC,代码行数:9,代码来源:MusicPlayer.cs


示例15: Start

 // Use this for initialization
 void Start()
 {
     if (instance != null) {
         Destroy (gameObject);
     }else{
         instance = this;
     }
 }
开发者ID:PaulyWallie,项目名称:PaulyBall,代码行数:9,代码来源:MusicPlayer.cs


示例16: Awake

	// Use this for initialization
	void Awake(){
		if (instance != null) {
			Destroy (gameObject);
		} else {
			instance = this;
			GameObject.DontDestroyOnLoad (gameObject);
		}
	}
开发者ID:srsuttiratana,项目名称:LaserDefender,代码行数:9,代码来源:MusicPlayer.cs


示例17: Start

 void Start()
 {
     if (instance != null && instance != this) {
         Destroy (gameObject);
     } else {
         instance = this;
         GameObject.DontDestroyOnLoad(gameObject);
     }
 }
开发者ID:FlorinVasileNechita,项目名称:UnityCourseLaserDefender,代码行数:9,代码来源:MusicPlayer.cs


示例18: Awake

	void Awake () {
		if ( instance != null ) {
			Destroy( gameObject );
			// Debug.Log( "Destroy music player" );
		} else {
			instance = this;
			GameObject.DontDestroyOnLoad( gameObject );
		}
	}
开发者ID:dustinbrink,项目名称:unity,代码行数:9,代码来源:MusicPlayer.cs


示例19: Awake

 void Awake()
 {
     if(Self){
         DestroyImmediate(this.gameObject);
     } else {
         Self = this;
         GameObject.DontDestroyOnLoad(this.gameObject);
     }
 }
开发者ID:Unnecro,项目名称:Unity-Breakanoid,代码行数:9,代码来源:MusicPlayer.cs


示例20: Awake

 // Use this for initialization
 void Awake()
 {
     if(instance != null){ // If an instance of the game object already exists, then destroy.
         Destroy (gameObject);
     }else {//if(!Timer.gameStarted){
         instance = this; // instance = this is an instance of the global variable.
         GameObject.DontDestroyOnLoad(gameObject);
     }
 }
开发者ID:uzochukwueddie,项目名称:2D-Car-Racer,代码行数:10,代码来源:MusicPlayer.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# MutableObjectState类代码示例发布时间:2022-05-24
下一篇:
C# MusicName类代码示例发布时间: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