本文整理汇总了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;
}
}
示例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");
}
示例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);
}
示例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)
});
}
}
}
示例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;
}
示例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;
}
示例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");
}
示例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");
}
示例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));
}
示例10: SongViewModel
public SongViewModel(Song song)
: base(song)
{
this.song = song;
TypeImage = "\xE189";
InitLogo(string.Format("{0}.art", song.AlbumId));
}
示例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();
}
示例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);
}
示例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");
}
示例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();
}
示例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;
}