当前位置: 首页>>代码示例>>C#>>正文


C# Song类代码示例

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


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


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