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

C# Song类代码示例

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

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



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

示例1: SongGenerator

 public void SongGenerator()
 {
     Song blow = Content.Load<Song>("Blow");
     Song built = Content.Load<Song>("Built To Fall");
     Song divide = Content.Load<Song>("New Divide");
     Song paranoid = Content.Load<Song>("Paranoid");
     Song thnks = Content.Load<Song>("Thnks");
     switch (random.Next(5))
     {
         case 1:
             song = blow;
             break;
         case 2:
             song = built;
             break;
         case 3:
             song = divide;
             break;
         case 4:
             song = paranoid;
             break;
         default:
             song = thnks;
             break;
     }
 }
开发者ID:Supercarlijn,项目名称:Tetris,代码行数:26,代码来源:TetrisGame.cs


示例2: GameWin

 public GameWin(Game1 game1, GraphicsDeviceManager graphics, ContentManager Content)
 {
     rectangle = new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
     game1.IsMouseVisible = true;
     MediaPlayer.Volume = vol;
     songMenu = Content.Load<Song>("Menu//songMenu");
 }
开发者ID:akaisuisei,项目名称:umea-rana2,代码行数:7,代码来源:GameWin.cs


示例3: InfoWindow

        public InfoWindow(Song song, Window w)
            : base("", w, DialogFlags.DestroyWithParent)
        {
            this.HasSeparator = false;

            Glade.XML glade_xml = new Glade.XML (null, "InfoWindow.glade", "info_contents", null);
            glade_xml.Autoconnect (this);
            this.VBox.Add (info_contents);

            cover_image = new MagicCoverImage ();
            cover_image_container.Add (cover_image);
            cover_image.Visible = true;

            // Gdk.Pixbuf cover = new Gdk.Pixbuf (null, "unknown-cover.png", 66, 66);
            // cover_image.ChangePixbuf (cover);

            user_name_label = new UrlLabel ();
            user_name_label.UrlActivated += new UrlActivatedHandler (OnUrlActivated);
            user_name_container.Add (user_name_label);
            user_name_label.SetAlignment ((float) 0.0, (float) 0.5);
            user_name_label.Visible = true;

            real_name_label = new UrlLabel ();
            real_name_label.UrlActivated += new UrlActivatedHandler (OnUrlActivated);
            real_name_container.Add (real_name_label);
            real_name_label.SetAlignment ((float) 0.0, (float) 0.5);
            real_name_label.Visible = true;

            this.AddButton ("gtk-close", ResponseType.Close);

            SetSong (song);
        }
开发者ID:GNOME,项目名称:last-exit,代码行数:32,代码来源:InfoWindow.cs


示例4: LoadContent

		/// <summary>
		/// LoadContent will be called once per game and is the place to load
		/// all of your content.
		/// </summary>
		protected override void LoadContent ()
		{
			// Create a new SpriteBatch, which can be used to draw textures.
			spriteBatch = new SpriteBatch (GraphicsDevice);

			//TODO: use this.Content to load your game content here
			monkey = Content.Load<Texture2D> ("monkey");
			background = Content.Load <Texture2D> ("background");
			logo = Content.Load<Texture2D> ("logo");
			font = Content.Load<SpriteFont> ("font");
			hit = Content.Load<SoundEffect> ("hit");
			title = Content.Load<Song> ("title");
			Microsoft.Xna.Framework.Media.MediaPlayer.IsRepeating = true;
			Microsoft.Xna.Framework.Media.MediaPlayer.Play (title);

			var viewport = graphics.GraphicsDevice.Viewport;
			var padding = (viewport.Width / 100);
			var gridWidth = (viewport.Width - (padding * 5)) / 4;
			var gridHeight = gridWidth;

			for (int y = padding; y < gridHeight*5; y+=gridHeight+padding) {
				for (int x = padding; x < viewport.Width-gridWidth; x+=gridWidth+padding) {
					grid.Add (new GridCell () {
						DisplayRectangle = new Rectangle (x, y, gridWidth, gridHeight)
					});
				}
			}
		}
开发者ID:infinitespace-studios,项目名称:Monkey.Tap,代码行数:32,代码来源:Game1.cs


示例5: SongEventArgs

        /// <summary>
        /// Initializes a new instance of the <see cref="SongEventArgs"/> class.
        /// </summary>
        /// <param name="song">The song that has been found.</param>
        /// <exception cref="ArgumentNullException"><c>song</c> is null.</exception>
        public SongEventArgs(Song song)
        {
            if (song == null)
                throw new ArgumentNullException(Reflector.GetMemberName(() => song));

            this.Song = song;
        }
开发者ID:gazwinter,项目名称:Espera,代码行数:12,代码来源:SongEventArgs.cs


示例6: Search

 public async Task<SearchResult> Search(string key)
 {
     key = key.Trim();
     var res = new SearchResult
     {
         Items = new List<IMusic>(),
         Keyword = key,
         SearchType = EnumSearchType.url,
         Page = 1,
     };
     var url = string.Format(search_url, Uri.EscapeDataString(key));
     var response = await NetAccess.DownloadStringAsync(url);
     var json = response.ToDynamicObject();
     if (json.song.Count > 0)
         foreach (var obj in json.song)
         {
             var s = new Song
             {
                 Id = "b" + MusicHelper.Get(obj, "songid"),
                 ArtistName = MusicHelper.Get(obj, "artistname"),
                 AlbumName = "",
                 Name = MusicHelper.Get(obj, "songname"),
                 WriteId3 = false,
             };
             res.Items.Add(s);
             s.UrlMp3 =await getDownloadUrl(s.Id.Substring(1));
         }
     return res;
 }
开发者ID:3ricguo,项目名称:xiami_downloader,代码行数:29,代码来源:BaiduSearchProvider.cs


示例7: ArmyManagment

        public ArmyManagment(ContentManager content, List<Piece> rArmy, List<Piece> bArmy)
        {
            //this.avatar = avatar;
            //army = avatar.getArmy();
            //gold = avatar.getGold();
            this.rArmy = rArmy;
            this.bArmy = bArmy;

            rGold = 300;
            bGold = 300;

            isRedTurn = true;
            startBattle = false;
            inBuyState = true;
            title = "Purchase units: Player 1";
            commands = "Key #      Class    (cost)\n";
            commands += "1       - Pikeman (15)\n";
            commands += "2       - Swordsman (25)\n";
            commands += "3       - Knight (40)\n";
            commands += "4       - Archer (25)\n";
            commands += "5       - Nomad (30)\n";

            //load
            SongBattle = content.Load<Song>("Music/Battle");
            infoFont = content.Load<SpriteFont>("selectFont");
            titleFont = content.Load<SpriteFont>("playerFont");
            background = content.Load<Texture2D>("TerrainSprites/background");

            pikeman = content.Load<Texture2D>("UnitSprites/pike manRED");
            swordsman = content.Load<Texture2D>("UnitSprites/sword manRed");
            knight = content.Load<Texture2D>("UnitSprites/KnightRed");
            archer = content.Load<Texture2D>("UnitSprites/archerr");
            nomad = content.Load<Texture2D>("UnitSprites/horse archerRed");
        }
开发者ID:Risab,项目名称:dawn-of-conquest,代码行数:34,代码来源:ArmyManagment.cs


示例8: LoadContent

 //Load method
 public void LoadContent(ContentManager content)
 {
     playerShootSound = content.Load<SoundEffect>("Sounds/playershoot");
     explodeSound = content.Load<SoundEffect>("Sounds/explode");
     playerHit = content.Load<SoundEffect>("Sounds/playerhit");
     bgm1 = content.Load<Song>("Sounds/bgm1");
 }
开发者ID:suntinwong,项目名称:Space_Shooter,代码行数:8,代码来源:SoundManager.cs


示例9: DoIt

        public void DoIt()
        {
            var subPlayer1 = Substitute.For<ISongPlayer>();
            var subPlayer2 = Substitute.For<ISongPlayer>();
            var subPlayer3 = Substitute.For<ISongPlayer>();

            var song = new Song
            {
                Provider = "SubProvider#1"
            };

            subPlayer1.CanPlay(Arg.Is(song)).Returns(true);

            var player = new AggregateSongPlayer();
            player.Players.Add(subPlayer1);
            player.Players.Add(subPlayer2);
            player.Players.Add(subPlayer3);

            var receivedBuffering = false;
            player.Buffering += (sender, args) => receivedBuffering = true;

            subPlayer1.Buffering += Raise.EventWith(player, new ValueProgressEventArgs<int>(1, 100));

            Assert.True(receivedBuffering);
            Assert.True(player.CanPlay(song));
        }
开发者ID:torshy,项目名称:TRock.Music,代码行数:26,代码来源:AggregateSongPlayerTest.cs


示例10: SongViewModel

 public SongViewModel(Song song)
     : base(song)
 {
     this.song = song;
     TypeImage = "\xE189";
     InitLogo(string.Format("{0}.art", song.AlbumId));
 }
开发者ID:akakoori,项目名称:xiami_downloader,代码行数:7,代码来源:SongViewModel.cs


示例11: LoadContent

        protected override void LoadContent()
        {
            _gamePlaySong = Content.Load<Song>("Sounds\\battle");
            _menuSong = Content.Load<Song>("Sounds\\menu_song2");
            _dead = Content.Load<Song>("Sounds\\defeat");
            MediaPlayer.IsRepeating = true;
            MediaPlayer.Play(_menuSong);
            _menuClickSelected = Content.Load<SoundEffect>("Sounds\\button-25");
            _spriteBatch = new SpriteBatch(GraphicsDevice);
            _gameIsOn = false;
            SetScreenSize();

            _gameOverScreen = new GameOverScreen(this, _spriteBatch, Content.Load<SpriteFont>("menufont"), Content.Load<Texture2D>("gameover_screen"));
            Components.Add(_gameOverScreen);
            _gameOverScreen.Hide();

            _startScreen = new StartScreen(this, _spriteBatch, Content.Load<SpriteFont>("menufont"), Content.Load<Texture2D>("splash_screen"));
            Components.Add(_startScreen);
            _startScreen.Hide();
            
            _actionScreen = new ActionScreen(this, _spriteBatch, Content.Load<Texture2D>("Levels\\level1_background"));
            Components.Add(_actionScreen);
            _actionScreen.Hide();

            //_activeScreen = _gameOverScreen;
            //_gameOverScreen.SetScoreText();

            _activeScreen = _startScreen;
            _activeScreen.Show();
        }
开发者ID:jonasroslin,项目名称:Stixter.Plexi,代码行数:30,代码来源:PlexiGame.cs


示例12: Create

        public IHttpActionResult Create(SongModel song)
        {
            if (!this.ModelState.IsValid)
            {
                return BadRequest(this.ModelState);
            }

            if (this.data.Artists.All().FirstOrDefault(a => a.ArtistId == song.ArtistId) == null)
            {
                return BadRequest("The song can not be added to this artist, because the artist with id: " + song.SongId + " does not exists.");
            }

            var newSong = new Song()
            {
                Title = song.Title,
                Year = song.Year,
                Producer = song.Producer,
                ArtistId = song.ArtistId
            };

            this.data.Songs.Add(newSong);
            this.data.SaveChanges();

            song.SongId = newSong.SongId;
            return Ok(song);
        }
开发者ID:jesusico83,项目名称:Telerik,代码行数:26,代码来源:SongsController.cs


示例13: LoadContent

 public static void LoadContent(ContentManager Content)
 {
     ingame = Content.Load<Song>("Songs/Ambiance_ingame");
     pause = Content.Load<Song>("Songs/Ambiance_Pause");
     menu = Content.Load<Song>("Songs/Ambiance");
     jump = Content.Load<SoundEffect>("Songs/Jump");
 }
开发者ID:Greflop,项目名称:Caspher,代码行数:7,代码来源:SoundManager.cs


示例14: Battle

        // constructor
        public Battle(Game game, Texture2D bgTex, Song battleSong, Player p, Enemy e, bool run)
            : base(game)
        {
            StateManager.PushState(new LevelState(game, p));

            play = p;
            en = e;
            font = game.Content.Load<SpriteFont>("battle-font");
            tMenu = new TextMenu(font, choices);
            combatColor = new Texture2D(game.GraphicsDevice, 1, 1);
            combatColor.SetData<Color>(new Color[] { new Color(Color.Black, 150) });
            transparent = true;
            rgen = new Random();

            try
            {
                if (battleSong != null)
                {
                    MediaPlayer.Play(battleSong);
                    MediaPlayer.Volume = .5f;
                    MediaPlayer.IsRepeating = true;
                }
            }
            catch (Exception)
            {
            }

            canRun = run;

            backgroundTexture = bgTex;
            hasRun = false;
            currentItemCount = play.Items.Count;
            calculateSpeed();
        }
开发者ID:Daminvar,项目名称:CastleEscape,代码行数:35,代码来源:Battle.cs


示例15: GenerateSong

 public static CellState[,] GenerateSong(Automatone automatone, Random random, MusicTheory theory)
 {
     InputParameters.Instance.Tempo = (ushort)(theory.MIN_TEMPO + InputParameters.Instance.SongSpeed * (theory.MAX_TEMPO - theory.MIN_TEMPO));
     InputParameters.Instance.TimeSignatureN = (int)(2 + random.NextDouble() / 4 * (13 - 2));
     InputParameters.Instance.TimeSignatureD = (int)Math.Pow(2, (int)(1 + random.NextDouble() * 2));
     Song s = new Song(theory, random);
     NoteThread thread = new NoteThread(s.Notes, InputParameters.Instance.TimeSignature);
     int gridWidth = s.MeasureCount * s.MeasureLength;
     CellState[,] grid = new CellState[Automatone.PIANO_SIZE,gridWidth];
     foreach (List<Note> nts in s.Notes)
     {
         foreach (Note n in nts)
         {
             grid[n.GetOctave() * MusicTheory.OCTAVE_SIZE + n.GetNoteName().ChromaticIndex - Automatone.LOWEST_NOTE_CHROMATIC_NUMBER, (int)Math.Min(n.GetStartMeasure() * s.MeasureLength + n.GetStartBeat() * Automatone.SUBBEATS_PER_WHOLE_NOTE, gridWidth - 1)] = CellState.START;
             for (int i = 1; i < n.GetRemainingDuration() * Automatone.SUBBEATS_PER_WHOLE_NOTE; i++)
             {
                 if (grid[n.GetOctave() * MusicTheory.OCTAVE_SIZE + n.GetNoteName().ChromaticIndex - Automatone.LOWEST_NOTE_CHROMATIC_NUMBER, (int)Math.Min(n.GetStartMeasure() * s.MeasureLength + n.GetStartBeat() * Automatone.SUBBEATS_PER_WHOLE_NOTE + i, gridWidth - 1)] == CellState.SILENT)
                 {
                     grid[n.GetOctave() * MusicTheory.OCTAVE_SIZE + n.GetNoteName().ChromaticIndex - Automatone.LOWEST_NOTE_CHROMATIC_NUMBER, (int)Math.Min(n.GetStartMeasure() * s.MeasureLength + n.GetStartBeat() * Automatone.SUBBEATS_PER_WHOLE_NOTE + i, gridWidth - 1)] = CellState.HOLD;
                 }
             }
         }
     }
     automatone.MeasureLength = s.MeasureLength;
     return grid;
 }
开发者ID:verngutz,项目名称:Automatone,代码行数:26,代码来源:SongGenerator.cs


示例16: CreateSong1

 //Factory method that is used to create the test song that we will be usign for testing purposes
 public static Song CreateSong1()
 {
     Song retVal = new Song();
     retVal.Notes.Clear();
     retVal.Notes.Add(new Note(18, 5.333f, 2.33f));
     retVal.Notes.Add(new Note(8, 8f, 2.33f));
     retVal.Notes.Add(new Note(14, 10.66f, 2.33f));
     retVal.Notes.Add(new Note(12, 13.33f, 2.33f));
     retVal.Notes.Add(new Note(4, 16f, 2.33f));
     retVal.Notes.Add(new Note(8, 18.66f, 2.33f));
     retVal.Notes.Add(new Note(18, 21.33f, 2.33f));
     retVal.Notes.Add(new Note(14, 24f, 2.33f));
     retVal.Notes.Add(new Note(8, 26.66f, 2.33f));
     retVal.Notes.Add(new Note(18, 29.33f, 2.33f));
     retVal.Notes.Add(new Note(10, 32f, 2.33f));
     retVal.Notes.Add(new Note(4, 34.66f, 2.33f));
     retVal.Notes.Add(new Note(18, 37.33f, 2.33f));
     retVal.Notes.Add(new Note(14, 40f, 2.0f));
     retVal.Notes.Add(new Note(24, 42.33f, 2.33f));
     retVal.Notes.Add(new Note(18, 45.33f, 2.33f));
     retVal.Notes.Add(new Note(22, 48f, 2.33f));
     retVal.Notes.Add(new Note(16, 50.66f, 2.33f));
     retVal.Notes.Add(new Note(4, 53.33f, 2.33f));
     retVal.Notes.Add(new Note(10, 56f, 2.33f));
     retVal.Notes.Add(new Note(16, 58.66f, 2.33f));
     retVal.Notes.Add(new Note(18, 61.33f, 2.33f));
     retVal.Notes.Add(new Note(14, 64f, 2.33f));
     retVal.Notes.Add(new Note(8, 66.66f, 2.33f));
     retVal.Notes.Sort();
     retVal.BPM = 80;
     retVal._curNoteOffsetIndex = 0;
     return retVal;
 }
开发者ID:jakeingit,项目名称:GGJ2015,代码行数:34,代码来源:Song.cs


示例17: EnumerateSongs

		private IEnumerable<Song> EnumerateSongs(string path)
		{
			var musicFiles = Directory.GetFiles(path, "*.mp3", SearchOption.AllDirectories);
			foreach (var musicFile in musicFiles)
			{
				using (var mp3 = new Mp3File(musicFile))
				{
					var title = string.Empty;
					var artist = string.Empty;
					var duration = TimeSpan.Zero;
					try
					{
						duration = mp3.Audio?.Duration ?? TimeSpan.Zero;
						var tag = mp3.GetTag(Id3TagFamily.FileStartTag);
						title = tag?.Title?.Value ?? string.Empty;
						artist = tag?.Artists?.Value ?? string.Empty;
					}
					catch (Exception)
					{
						Trace.WriteLine($"Error reading ID3 tag for: {musicFile}");
					}
					
					var songFileLen = (int)new FileInfo(musicFile).Length;
					var song = new Song(0, title, musicFile, artist, duration, File.GetLastWriteTime(musicFile),
						songFileLen);
					yield return song;
				}
			}
		}
开发者ID:jairov4,项目名称:Ownfy,代码行数:29,代码来源:MusicIndexer.cs


示例18: OnNavigatedTo

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            MediaLibrary library = new MediaLibrary();
            if (NavigationContext.QueryString.ContainsKey(playSongKey))
            {
                // Start über Hub-Verlauf
                // playingSong direkt übernehmen und starten
                string songName = NavigationContext.QueryString[playSongKey];
                playingSong = library.Songs.FirstOrDefault(s => s.Name == songName);
                isFromHubHistory = true;
            }
            else if (MediaPlayer.State == MediaState.Playing)
            {
                // Aktuellen Song übernehmen
                playingSong = MediaPlayer.Queue.ActiveSong;
            }
            else
            {
                // Zufälligen Song auswählen
                Random r = new Random();
                int songsCount = library.Songs.Count;
                if (songsCount > 0)
                {
                    playingSong = library.Songs[r.Next(songsCount)];
                }
                else
                {
                    SongName.Text = "Keine Songs gefunden";
                    Play.IsEnabled = false;
                }
            }
        }
开发者ID:GregOnNet,项目名称:WP8BookSamples,代码行数:34,代码来源:MainPage.xaml.cs


示例19: Level

 public Level(Texture2D playermove, Texture2D portal, Song music)
 {
     this.music = music;
     this.portal = portal;
     this.playermove = playermove;
     particleSystem = new ParticleSystem(GameContent.hitparticle, 0f, .1f, Color.Red, new Vector2(-2, 2), new Vector2(-2, 2), new TimeSpan(0, 0, 0, 0, 500), 1f, 2f, 1f, 1f, new Vector2(150, 30), new TimeSpan(1000, 0, 1, 0, 0), true, .00015f);
 }
开发者ID:plumppuffyproductions,项目名称:Legend,代码行数:7,代码来源:Level.cs


示例20: GameManager

        public GameManager(Game game, int level)
        {
            mGame = game;

            mPlayer1 = new Character(game, new Pointf(400, 200), new Size(32, 32), new Velocity(), PlayerIndex.One);
            mPlayer2 = new Character(game, new Pointf(350, 200), new Size(32, 32), new Velocity(), PlayerIndex.Two);
            mBoss = null;
            mLevel = level;
            switch (level)
            {
                case 1:
                    mMap = MapBuilder.BuildLevel1(mGame, new Size(game.Window.ClientBounds.Width, game.Window.ClientBounds.Height - Hud.HUD_HEIGHT), ref mPlayer1);
                    mPlayer1.mPosition = new Pointf(MapHelper.GetPointForColumnAndLevel(0.5f, 1));
                    mPlayer2.mPosition = new Pointf(MapHelper.GetPointForColumnAndLevel(0.5f, 1));
                    mBackgroundSong = mGame.Content.Load<Song>("music/Electrolyte - New Mission");
                    break;
                case 2:
                    mMap = MapBuilder.BuildSolo(mGame, new Size(game.Window.ClientBounds.Width, game.Window.ClientBounds.Height - Hud.HUD_HEIGHT), ref mPlayer1);
                    mPlayer1.mPosition = new Pointf(MapHelper.GetPointForColumnAndLevel(0.5f, 1));
                    mPlayer2.mPosition = new Pointf(MapHelper.GetPointForColumnAndLevel(MapHelper.GetLastColumn()-1.5f, 1));
                    mBackgroundSong = mGame.Content.Load<Song>("music/Electrolyte - Plus vs Minus");
                    break;
                case 3:
                    mMap = MapBuilder.BuildBossLevel(mGame, new Size(game.Window.ClientBounds.Width, game.Window.ClientBounds.Height - Hud.HUD_HEIGHT), ref mPlayer1);
                    mBoss = new Character(game, new Pointf(350, MapHelper.GetPlatformYAtLevel(1.5f)), new Size(64, 64), new Velocity(), PlayerIndex.Three);
                    mBackgroundSong = mGame.Content.Load<Song>("music/Electrolyte - Volt");
                    break;
            }

            mHud = new Hud(new Pointf(0, game.Window.ClientBounds.Height - Hud.HUD_HEIGHT), mGame, level);

            mIsPlayingSound = false;
            mGangnamSound = game.Content.Load<SoundEffect>("newgangnam");
            mGangnamInstance = mGangnamSound.CreateInstance();
        }
开发者ID:chrisdaher,项目名称:Electrolyte,代码行数:35,代码来源:GameManager.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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