Esempio n. 1
0
        public GamePlayScreen(Game1 game)
        {
            this.game = game;

            random = new Random();

            cakeTexture = game.Content.Load<Texture2D>("Cake");

            player = new Sprite();
            player.Texture = game.Content.Load<Texture2D>("Face");

            // Zoekt het midden op beiden de y op
            int screenCenterY = game.GraphicsDevice.Viewport.Height / 2;
            player.Position = new Vector2(
                10,                                             // x- as
                (screenCenterY) - (player.Texture.Height / 2)); // y-as
            // Player mond is collision met cake
            player.SetRelativeBoundingBox(20, 74, player.Texture.Width - 40, 20);

            // Score
            hud = new HUD();
            hud.Font = game.Content.Load<SpriteFont>("Arial");

            soundEffect = game.Content.Load<SoundEffect>("bite");
            song = game.Content.Load<Song>("yes");
            MediaPlayer.IsRepeating = true;
            MediaPlayer.Play(song);
        }
		public EntryRefWithCommonPropertiesContract(Song entry, ContentLanguagePreference languagePreference)
			: base(entry, languagePreference) {

			ArtistString = entry.ArtistString[languagePreference];
			EntryTypeName = SongTypeNames.ResourceManager.GetString(entry.SongType.ToString());

		}
Esempio n. 3
0
        protected override void LoadContent()
        {
            this.font = content.Load<SpriteFont>("ConsoleFont");

            this.placeHolder = content.Load<Texture2D>("Instructions");
            this.spriteTexture = content.Load<Texture2D>("SpriteMarker");
            this.roundMusic = content.Load<Song>("music_game");
            this.waitMusic = content.Load<Song>("music_waiting_loop");

            NewHigh = content.Load<SoundEffect>("new_highscore");
            EndRound = content.Load<SoundEffect>("game_end");

            timeInstructionsStayAround = 10;

            MediaPlayer.Play(roundMusic);
            MediaPlayer.Volume = .3f;
            MediaPlayer.IsRepeating = true;          

            this.FirstRoundStartHasStarted = this.firstRoundOver = false;
            this.HasStartedRound = false;

            this.highScore = 0;

            if (!Lanko_And_Glub.utility.ShowInstructions)
                this.instructionsColor = new Color(0, 0, 0, 0);
            else
                this.instructionsColor = Color.White;

            this.scale = 0;

            this.fontScale = 1f;
            this.fontColor = timerColor = Color.White;

            base.LoadContent();
        }
Esempio n. 4
0
 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;
     }
 }
Esempio n. 5
0
        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);
        }
        public void Convert(string inputFileName, string outputFileName)
        {
            var deser = new XmlSerializer(typeof(ZpeSong));
            ZpeSong zigSong;
            using (FileStream stream = new FileStream(inputFileName, FileMode.Open))
            {
                zigSong = (ZpeSong)deser.Deserialize(stream);
            }

            if (zigSong.PueVersion != 46)
                throw new Exception("Incompatable version of Ziggy Pro Editor XML");
            
            var guitarTrack = GetTrack(zigSong);
            if (guitarTrack == null)
            {
                throw new Exception("Couldn't find a guitar track");
            }

            var rsSong = new Song();
            AddSongMetadata(rsSong, zigSong);
            AddEbeats(rsSong, zigSong);
            AddNotes(rsSong, zigSong);

            using (FileStream stream = new FileStream(outputFileName, FileMode.Create))
            {
                rsSong.Serialize(stream, true);
            }
        }
Esempio n. 7
0
 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");
 }
 public void LoadContent(ContentManager content)
 {
     GUITexture = content.Load<Texture2D>(assetName);
     GUIRect = new Rectangle(0, 0, GUITexture.Width, GUITexture.Height);
     MusiqueMain = content.Load<Song>(@"Sons\Musiques\MusiqueTest");
     MusiqueMenu = content.Load<Song>(@"Sons\Musiques\Musique_Menu_Test");
 }
Esempio n. 9
0
        /// <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;
        }
Esempio n. 10
0
 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);
 }
Esempio n. 11
0
		/// <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)
					});
				}
			}
		}
Esempio n. 12
0
		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;
				}
			}
		}
Esempio n. 13
0
        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");
        }
Esempio n. 14
0
 //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;
 }
 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;
 }
Esempio n. 16
0
        public override void LoadContent(ContentManager Content)
        {
            bgtex.SetTexture(Content.Load<Texture2D>("Images/Menu/bg"));
            tieTextFont = Content.Load<SpriteFont>("Fonts/Badaboom");

            tieSong = Content.Load<Song>("Music/tie");
        }
Esempio n. 17
0
        // 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();
        }
        public View(GraphicsDeviceManager a_manager, ContentManager a_contentLoader)
        {
            //this is needed to draw sprites
            m_spriteBatch = new SpriteBatch(a_manager.GraphicsDevice);

            //Load content
            m_tileTexture = a_contentLoader.Load<Texture2D>("FinalTiles5");
            m_playerTexture = a_contentLoader.Load<Texture2D>("WalkingSquare");
            m_playerTextureLeft = a_contentLoader.Load<Texture2D>("player2left");
            m_enemyTexture = a_contentLoader.Load<Texture2D>("Enemy2");

            m_smokeTexture = a_contentLoader.Load<Texture2D>("smoke1");
            m_backgroundTexture = a_contentLoader.Load<Texture2D>("LimboFinal");

            m_jumpSound = a_contentLoader.Load<SoundEffect>("14");
            m_pointSound = a_contentLoader.Load<SoundEffect>("7");
               m_deathSound = a_contentLoader.Load<SoundEffect>("8");

            m_textfont = a_contentLoader.Load<SpriteFont>("Font");

            Moonchild =a_contentLoader.Load<Song>("3");

            MediaPlayer.IsRepeating = true;
            MediaPlayer.Volume = 0.3f;
            SoundEffect.MasterVolume = 0.6f;

            if (!songstart)
            {
                MediaPlayer.Play(Moonchild);

                songstart = true;

            }
        }
        /// <summary>
        /// Initializes all the audio content.
        /// </summary>
        /// <param name="Content">The ContentManager to use</param>
        public static void Initialize(ContentManager Content)
        {
            try
            {
                // Songs
                GameplayMusic = Content.Load<Song>("audio/GameplayMusic");
                GameplayMusic2 = Content.Load<Song>("audio/GameplayMusic2");
                GameplayMusic3 = Content.Load<Song>("audio/GameplayMusic3");
                TitleMusic = Content.Load<Song>("audio/TitleMusic");
                VictoryMusic = Content.Load<Song>("audio/VictoryMusic");

                // Sound Effects
                Soldier_Attack = Content.Load<SoundEffect>("audio/Soldier_Attack");
                Soldier_Dying = Content.Load<SoundEffect>("audio/Soldier_Dying");
                Worker_Dying = Content.Load<SoundEffect>("audio/Worker_Dying");
                Worker_Attack = Content.Load<SoundEffect>("audio/Worker_Attack");
                Zombie_Dying = Content.Load<SoundEffect>("audio/Zombie_Dying");
                Zombie_Attack = Content.Load<SoundEffect>("audio/Zombie_Attack");
            }
            catch (Exception e)
            {
                audioReady = false;
            }

            MediaPlayer.Volume = 0.50f;
            MediaPlayer.IsRepeating = true;
            play("music", "title");
        }
Esempio n. 20
0
        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;
                }
            }
        }
Esempio n. 21
0
        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();
        }
Esempio n. 22
0
 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;
 }
Esempio n. 23
0
 //Constructor
 public SoundManager()
 {
     playerShootSound = null;
     explodeSound = null;
     playerHit = null;
     bgm1 = null;
 }
        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));
        }
Esempio n. 25
0
 public SongViewModel(Song song)
     : base(song)
 {
     this.song = song;
     TypeImage = "\xE189";
     InitLogo(string.Format("{0}.art", song.AlbumId));
 }
Esempio n. 26
0
        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);
        }
Esempio n. 27
0
        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();
        }
Esempio n. 28
0
 //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");
 }
Esempio n. 29
0
 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");
 }
Esempio n. 30
0
        public VictoryState(UrbanRace game)
            : base(game)
        {
            this.type = Type.VICTORY;
            this.background = null;
            this.record = null;
            this.button = null;
            this.pressedButton = null;
            this.selectedButton = null;
            this.ledFont = null;
            this.retroFont = null;

            // Audio
            optionOver = null;
            optionSelected = null;
            song = null;

            retryButtonPos = new Vector2(Settings.getOpt("victoryRetryButtonX"), Settings.getOpt("victoryRetryButtonY"));
            retryTextPos = new Vector2(Settings.getOpt("victoryRetryTextX"), Settings.getOpt("victoryRetryTextY"));
            menuButtonPos = new Vector2(Settings.getOpt("victoryMenuButtonX"), Settings.getOpt("victoryMenuButtonY"));
            menuTextPos = new Vector2(Settings.getOpt("victoryMenuTextX"), Settings.getOpt("victoryMenuTextY"));
            recordPanelPos = new Vector2(Settings.getOpt("victoryRecordPanelX"), Settings.getOpt("victoryRecordPanelY"));
            recordTextPos = new Vector2(Settings.getOpt("victoryRecordTextX"), Settings.getOpt("victoryRecordTextY"));
            recordNumberPos = new Vector2(Settings.getOpt("victoryRecordNumberX"), Settings.getOpt("victoryRecordNumberY"));

            this.spriteBatch = new SpriteBatch(game.GraphicsDevice);
        }
Esempio n. 31
0
 // Use this for initialization
 void Start()
 {
     Song = Song.GetCurrentSong();
     StartCoroutine(UpdateTiming());
 }
Esempio n. 32
0
 public void UpdateSong(int id, Song song)
 {
     Playlist[id] = song;
 }
Esempio n. 33
0
 public Song CreateSong(Song song)
 {
     Playlist.Append(song);
     return(song);
 }
Esempio n. 34
0
 public XmlScoreWriter(Song pSong, PlayingMode pPlayingMode, SortedList <GuitarScoreNote, GuitarScoreNote> pScoreNotes)
 {
     Construct(pSong.Author, pSong.Name, pPlayingMode, pScoreNotes.Values.ToList());
 }
Esempio n. 35
0
        public Gamestate(Texture2D gun_light, Texture2D shadow, Texture2D[] tele_anim, Action exit, SoundEffect footstep1, SoundEffect footstep2, SoundEffect footstep3, SoundEffect ka_ching, Song gunshop_song, Texture2D gunshop_img, Texture2D gunshop_bg, Song intro_music, Texture2D menu_bg, Texture2D settings, Song gunready, SoundEffect gunfire1, SoundEffect gunfire2,
                         SoundEffect mp7a1_sound, Texture2D fire1, Texture2D fire2, Texture2D ammobox, Texture2D[] punchanim, Texture2D[] enemy_punchanim,
                         Texture2D chrtr, Texture2D chrtrw1, Texture2D chrtrw2, Texture2D enemy_chrtr, Texture2D enemy_chrtrw1, Texture2D enemy_chrtrw2, Texture2D fiftyblack, Texture2D whitep,
                         Texture2D pistol_gun_img, Texture2D rifle_gun_img, Texture2D hands_gun_img, Texture2D lantern, Texture2D pistol_icon,
                         Texture2D rifle_icon, Texture2D hands_icon, Texture2D background1, Texture2D background2, Texture2D background3,
                         Texture2D background4, Texture2D background5, Texture2D background6, Texture2D background7, Texture2D background8,
                         Texture2D background9, Texture2D fence, Texture2D licht, Texture2D analogarea_img, Texture2D analogstick_img,
                         Texture2D button_A, Texture2D button_B, Texture2D button_X, Texture2D mp7a1_icon, Texture2D mp7a1_gun, Texture2D big_enemy, Texture2D big_enemy_walk1, Texture2D big_enemy_Walk2,
                         Texture2D bg2_1, Texture2D bg2_1_prop, Texture2D bg2_2, Texture2D bg2_3, Texture2D bg2_4)
        {
            this.GameHeight = Game1.GameHeight;
            this.GameWidth  = Game1.GameWidth;

            this.StartScreen    = new List <GuiElement>();
            this.BackgroundList = new List <GuiElement>();
            this.MidList        = new List <GuiElement>();
            this.ForegroundList = new List <GuiElement>();
            this.UiList         = new List <GuiElement>();
            this.enemylist      = new List <Enemy>();
            this.big_enemylist  = new List <Big_Enemy>();
            MainList            = new List <List <GuiElement> >();
            MainList.Add(BackgroundList);
            MainList.Add(MidList);
            MainList.Add(ForegroundList);
            MainList.Add(UiList);

            this.paused         = false;
            this.gamestarted    = false;
            this.gunshop_active = false;
            this.game_over      = false;

            this.Walkanim    = new Texture2D[4];
            this.Walkanim[0] = chrtr;
            this.Walkanim[1] = chrtrw1;
            this.Walkanim[2] = chrtr;
            this.Walkanim[3] = chrtrw2;

            this.enemy_Walkanim    = new Texture2D[4];
            this.enemy_Walkanim[0] = enemy_chrtr;
            this.enemy_Walkanim[1] = enemy_chrtrw1;
            this.enemy_Walkanim[2] = enemy_chrtr;
            this.enemy_Walkanim[3] = enemy_chrtrw2;

            this.big_enemy_Walkanim    = new Texture2D[4];
            this.big_enemy_Walkanim[0] = big_enemy;
            this.big_enemy_Walkanim[1] = big_enemy_walk1;
            this.big_enemy_Walkanim[2] = big_enemy;
            this.big_enemy_Walkanim[3] = big_enemy_Walk2;

            this.Ammobox = ammobox;

            this.mp7a1  = new Gun(gun_light, mp7a1_sound, whitep, 0.4f, 96, mp7a1_gun, mp7a1_icon, fire1, fire2, (int)(GameWidth / 7.407), (int)(GameWidth / 21.052), (int)(GameWidth / 110), 28, 1.67, 3, 7);
            this.pistol = new Gun(gun_light, gunfire2, whitep, 1, 99, pistol_gun_img, pistol_icon, fire1, fire2, (int)(GameWidth / 7.407), (int)(GameWidth / 21.052), (int)(GameWidth / 110), 42.105, 2, 3, 25);
            this.rifle  = new Gun(gun_light, gunfire1, whitep, 0.8f, 98, rifle_gun_img, rifle_icon, fire1, fire2, (int)(GameWidth / 7.407), (int)(GameWidth / 21.052), 0, 17.02, 1.3, 3.5, 11);
            this.hands  = new Gun(gun_light, gunfire1, whitep, 0f, 97, hands_gun_img, hands_icon, fire1, fire2, (int)(GameWidth / 7.407), (int)(GameWidth / 21.052), 0, 17.02, 1.3, 3.5, 11);

            this.lantern1 = new Image(121, lantern, (int)(GameWidth / 10), (int)(GameWidth / 25), (int)(GameWidth / 17), (int)(GameWidth / 4.444));
            this.lantern2 = new Image(122, lantern, (int)(GameWidth / 2.285), (int)(GameWidth / 25), (int)(GameWidth / 17), (int)(GameWidth / 4.444));
            this.lantern3 = new Image(123, lantern, (int)(GameWidth / 1.29), (int)(GameWidth / 25), (int)(GameWidth / 17), (int)(GameWidth / 4.444));
            this.lantern4 = new Image(124, lantern, (int)(GameWidth / 3), (int)(GameWidth / 25), (int)(GameWidth / 17), (int)(GameWidth / 4.444));
            this.lantern5 = new Image(125, lantern, (int)(GameWidth / 1.5), (int)(GameWidth / 25), (int)(GameWidth / 17), (int)(GameWidth / 4.444));

            this.light1 = new Light(131, licht, 0, (int)(GameWidth / 25), (int)(GameWidth / 4.04), (int)(GameWidth / 2.72));
            this.light2 = new Light(132, licht, (int)(GameWidth / 2.96), (int)(GameWidth / 25), (int)(GameWidth / 4.04), (int)(GameWidth / 2.72));
            this.light3 = new Light(133, licht, (int)(GameWidth / 1.48), (int)(GameWidth / 25), (int)(GameWidth / 4.04), (int)(GameWidth / 2.72));
            this.light4 = new Light(134, licht, (int)(GameWidth / 4.333), (int)(GameWidth / 25), (int)(GameWidth / 4.04), (int)(GameWidth / 2.72));
            this.light5 = new Light(135, licht, (int)(GameWidth / 1.764), (int)(GameWidth / 25), (int)(GameWidth / 4.04), (int)(GameWidth / 2.72));

            this.gunmanager = new GunManager(104, gunready, fiftyblack, this.hands, this.pistol, this.rifle, this.mp7a1);
            this.BG1        = new Image(1, background1, 0, 0, GameWidth, GameHeight);
            this.BG2        = new Image(1, background2, 0, 0, GameWidth, GameHeight);
            this.BG3        = new Image(1, background3, 0, 0, GameWidth, GameHeight);
            this.BG4        = new Image(1, background4, 0, 0, GameWidth, GameHeight);
            this.BG5        = new Image(1, background5, 0, 0, GameWidth, GameHeight);
            this.BG6        = new Image(1, background6, 0, 0, GameWidth, GameHeight);
            this.BG7        = new Image(1, background7, 0, 0, GameWidth, GameHeight);
            this.BG8        = new Image(1, background8, 0, 0, GameWidth, GameHeight);
            this.BG9        = new Image(1, background9, 0, 0, GameWidth, GameHeight);

            this.BG2_1      = new Image(0, bg2_1, 0, 0, GameWidth, GameHeight);
            this.BG2_1_prop = new Image(0, bg2_1_prop, (int)(Game1.GameWidth / 1.639), (int)(Game1.GameWidth / 10.3), (int)(Game1.GameWidth / 2.564), (int)(Game1.GameWidth / 3.125));
            this.BG2_2      = new Image(0, bg2_2, 0, 0, GameWidth, GameHeight);
            this.BG2_3      = new Image(0, bg2_3, 0, 0, GameWidth, GameHeight);
            this.BG2_4      = new Image(0, bg2_4, 0, 0, GameWidth, GameHeight);

            this.Fence1 = new Image(1, fence, 0, (int)(Game1.GameWidth / 2.857), (int)(Game1.GameWidth / 2), (int)(Game1.GameWidth / 15.686));
            this.Fence2 = new Image(1, fence, (int)(GameWidth / 2), (int)(Game1.GameWidth / 2.857), (int)(Game1.GameWidth / 2), (int)(Game1.GameWidth / 15.686));

            this.analogarea        = new Image(4, analogarea_img, (int)(GameWidth / 80), (int)(GameWidth / 2.6666), (int)(GameWidth / 5.333333), (int)(GameWidth / 5.333333));
            this.analogstick       = new TouchButton(5, analogstick_img, (int)(GameWidth / 13.33333), (int)(GameWidth / 2.2857), (int)(GameWidth / 16), (int)(GameWidth / 16));
            this.player            = new Player(6, shadow, footstep1, footstep2, footstep3, chrtr, this.Walkanim, punchanim, whitep, analogstick, gunmanager, (int)(GameWidth / 16), (int)(GameWidth / 3.2), (int)(GameWidth / 12.5), (int)(GameWidth / 10));
            this.A_Button          = new Button(20, "", button_A, (int)(GameWidth / 1.739), (int)(GameWidth / 2.2), (int)(GameWidth / 12.307), (int)(GameWidth / 12.307), () => { });
            this.B_Button          = new Button(21, "", button_B, (int)(GameWidth / 1.428), (int)(GameWidth / 2.329), (int)(GameWidth / 12.307), (int)(GameWidth / 12.307), () => { player.Attack(); });
            this.X_Button          = new Button(22, "", button_X, (int)(GameWidth / 1.212), (int)(GameWidth / 2.474), (int)(GameWidth / 12.307), (int)(GameWidth / 12.307), () => { player.jumpbool = true; });
            this.moneycheat_button = new Button(0, "add 1000 score", fiftyblack, (int)(GameWidth / 2), (int)(GameWidth / 5.333), (int)(GameWidth / 4), (int)(GameWidth / 16), () => { if (!this.moneycheat_button.active)
                                                                                                                                                                                      {
                                                                                                                                                                                          player.score += 1000;
                                                                                                                                                                                      }
                                                                                                                                                                                      ; });
            this.skipstage_button = new Button(0, "Skip stage", fiftyblack, (int)(GameWidth / 2), (int)(GameWidth / 4), (int)(GameWidth / 4), (int)(GameWidth / 16), () => { if (!this.skipstage_button.active && this.current_level.Next != null)
                                                                                                                                                                             {
                                                                                                                                                                                 this.current_level = this.current_level.NextLevel(); this.current_level.OnEnter();
                                                                                                                                                                             }
                                                                                                                                                                             ; });

            this.enemy1  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.5), (int)(GameWidth / 3.1));
            this.enemy2  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.2), (int)(GameWidth / 3.2));
            this.enemy3  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.5), (int)(GameWidth / 3.3));
            this.enemy4  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.35), (int)(GameWidth / 3.1));
            this.enemy5  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.2), (int)(GameWidth / 3.2));
            this.enemy6  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1), (int)(GameWidth / 3.3));
            this.enemy7  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.5), (int)(GameWidth / 3.2));
            this.enemy8  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.2), (int)(GameWidth / 3.1));
            this.enemy9  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.45), (int)(GameWidth / 3.2));
            this.enemy10 = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.3), (int)(GameWidth / 3.3));
            this.enemy11 = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.2), (int)(GameWidth / 3.1));
            this.enemy12 = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.1), (int)(GameWidth / 3.2));
            this.enemy13 = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.15), (int)(GameWidth / 3.3));

            this.big_enemy1 = new Big_Enemy(0, shadow, big_enemy, whitep, this.big_enemy_Walkanim, (int)(GameWidth / 1.5), (int)(GameWidth / 3.2));
            this.big_enemy2 = new Big_Enemy(0, shadow, big_enemy, whitep, this.big_enemy_Walkanim, (int)(GameWidth / 1.2), (int)(GameWidth / 3.2));
            this.big_enemy3 = new Big_Enemy(0, shadow, big_enemy, whitep, this.big_enemy_Walkanim, (int)(GameWidth / 1.4), (int)(GameWidth / 3.2));
            this.big_enemy4 = new Big_Enemy(0, shadow, big_enemy, whitep, this.big_enemy_Walkanim, (int)(GameWidth / 1.3), (int)(GameWidth / 3.2));

            this.l1_1 = new Level(BG1, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
            },
                                  new List <Big_Enemy> {
            },
                                  () => { this.AddToFront(light1); this.AddToFront(light2); this.AddToFront(light3); },
                                  () => { },
                                  () => { this.AddToBack(lantern1); this.AddToBack(lantern2); this.AddToBack(lantern3); this.AddToBack(gunstore); },
                                  () => {});

            this.l1_2 = new Level(BG2, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
                enemy1
            },
                                  new List <Big_Enemy> {
            },
                                  () => { this.AddToFront(light4); this.AddToFront(light5); },
                                  () => { },
                                  () => { this.AddToBack(lantern4); this.AddToBack(lantern5); },
                                  () => {});

            this.l1_3 = new Level(BG3, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
                enemy2, enemy3
            },
                                  new List <Big_Enemy> {
            },
                                  () => { },
                                  () => { },
                                  () => { },
                                  () => {});

            this.l1_4 = new Level(BG4, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
                enemy4, enemy5, enemy6
            },
                                  new List <Big_Enemy> {
            },
                                  () => { this.AddToFront(Fence2); },
                                  () => { },
                                  () => { this.AddToBack(gunstore); },
                                  () => {});

            this.l1_5 = new Level(BG5, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
            },
                                  new List <Big_Enemy> {
                big_enemy1
            },
                                  () => { this.AddToFront(Fence1); this.AddToFront(Fence2); },
                                  () => { },
                                  () => { },
                                  () => {});

            this.l1_6 = new Level(BG6, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
                enemy7, enemy8, enemy9, enemy10
            },
                                  new List <Big_Enemy> {
            },
                                  () => { this.AddToFront(Fence1); this.AddToFront(Fence2); },
                                  () => { },
                                  () => { },
                                  () => {});

            this.l1_7 = new Level(BG7, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
                enemy11, enemy12
            },
                                  new List <Big_Enemy> {
                big_enemy2
            },
                                  () => { },
                                  () => { },
                                  () => { this.AddToBack(gunstore); },
                                  () => {});

            this.l1_8 = new Level(BG8, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
                enemy13
            },
                                  new List <Big_Enemy> {
                big_enemy3, big_enemy4
            },
                                  () => { },
                                  () => { },
                                  () => { },
                                  () => {});

            this.l1_9 = new Level(BG9, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
            },
                                  new List <Big_Enemy> {
            },
                                  () => { },
                                  () => { },
                                  () => { },
                                  () => { if (this.player.x > (int)(Game1.GameWidth / 2))
                                          {
                                              this.game_over = true;
                                          }
                                  });

            this.l2_1 = new Level(BG2_1, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
            },
                                  new List <Big_Enemy> {
            },
                                  () => { this.AddToFront(this.BG2_1_prop); this.AddToFront(light1); this.AddToFront(light2); },
                                  () => { },
                                  () => { this.AddToBack(lantern1); this.AddToBack(lantern2); },
                                  () => {});

            this.l2_2 = new Level(BG2_2, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
            },
                                  new List <Big_Enemy> {
            },
                                  () => { },
                                  () => { },
                                  () => { },
                                  () => { });

            this.l2_3 = new Level(BG2_3, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
            },
                                  new List <Big_Enemy> {
            },
                                  () => { },
                                  () => { },
                                  () => { },
                                  () => { });

            this.l2_4 = new Level(BG2_4, null, null, BackgroundList, MidList, ForegroundList, UiList, enemylist, big_enemylist,
                                  new List <Enemy> {
            },
                                  new List <Big_Enemy> {
            },
                                  () => { },
                                  () => { },
                                  () => { },
                                  () => { });

            this.current_level = l1_1;

            this.l1_1.Next = l1_2; this.l1_2.Prev = l1_1;
            this.l1_2.Next = l1_3; this.l1_3.Prev = l1_2;
            this.l1_3.Next = l1_4; this.l1_4.Prev = l1_3;
            this.l1_4.Next = l1_5; this.l1_5.Prev = l1_4;
            this.l1_5.Next = l1_6; this.l1_6.Prev = l1_5;
            this.l1_6.Next = l1_7; this.l1_7.Prev = l1_6;
            this.l1_7.Next = l1_8; this.l1_8.Prev = l1_7;
            this.l1_8.Next = l1_9; this.l1_9.Prev = l1_8;

            this.l2_1.Next = l2_2; this.l2_2.Prev = l2_1;
            this.l2_2.Next = l2_3; this.l2_3.Prev = l2_2;
            this.l2_3.Next = l2_4; this.l2_4.Prev = l2_3;



            this.player1score   = new Scorecounter((int)(Game1.GameWidth / 80), (int)(Game1.GameWidth / 16), player);
            this.keyboard       = new VirtKeyBoard(fiftyblack, "enter name", player, () => { this.StartScreen.Add(this.start_button); this.StartScreen.Add(this.name_change); this.StartScreen.Remove(keyboard); });
            this.settingsbutton = new Button(1, "", settings, 0, 0, (int)(GameWidth / 16), (int)(GameWidth / 16), () => { this.paused = true; });
            this.contbg         = new Image(1, fiftyblack, 0, (int)(GameWidth / 16), GameWidth, (int)(GameWidth / 2.105));
            this.Menu_bg        = new Image(1, menu_bg, 0, 0, Game1.GameWidth, Game1.GameHeight);
            this.start_button   = new Button(1, "START", fiftyblack, GameWidth / 2 - (int)(GameWidth / 6.5), GameHeight / 2, (int)(GameWidth / 3.8), (int)(GameWidth / 13), () => { this.gamestarted = true; this.paused = false; this.gunshop_active = false; MediaPlayer.Stop(); });
            this.name_change    = new Button(1, "CHANGE NAME", fiftyblack, GameWidth / 2 - (int)(GameWidth / 6.5), GameHeight / 2 + (int)(GameWidth / 9), (int)(GameWidth / 3.8), (int)(GameWidth / 13), () => { this.StartScreen.Remove(this.start_button); this.StartScreen.Remove(this.name_change); this.StartScreen.Add(keyboard); Thread.Sleep(120); });
            this.gunstore       = new Gunstore(gunshop_img, ka_ching, gunshop_song, fiftyblack, gunshop_bg, mp7a1_gun, rifle_gun_img, pistol_gun_img, whitep, (int)(Game1.GameWidth / 4), (int)(Game1.GameWidth / 8), player, A_Button, () => { this.gunshop_active = true; this.gunmanager.currentgun = this.gunmanager.Gun1; this.player1score.y = (int)(Game1.GameWidth / 1.95); }, () => { this.gunshop_active = false; this.player1score.y = (int)(Game1.GameWidth / 16); });

            this.fps_switch = new ONOFFswitch("Draw FPS", (int)(GameWidth / 16), (int)(GameWidth / 5.333), whitep, analogstick_img);
            this.op2        = new ONOFFswitch("GodMode", (int)(GameWidth / 16), (int)(GameWidth / 4), whitep, analogstick_img);
            this.op3        = new ONOFFswitch("Skip Stage", (int)(GameWidth / 16), (int)(GameWidth / 3.2), whitep, analogstick_img);
            this.op4        = new ONOFFswitch("Option", (int)(GameWidth / 16), (int)(GameWidth / 2.666), whitep, analogstick_img);

            this.retry_button = new Button(1, "Retry", fiftyblack, GameWidth / 2 - (int)(GameWidth / 6.5), GameHeight / 2 + (int)(GameWidth / 12), (int)(GameWidth / 3.8), (int)(GameWidth / 13), () => {
                this.current_level = l1_1;

                this.MidList.Remove(enemy1); this.enemylist.Remove(enemy1);
                this.MidList.Remove(enemy2); this.enemylist.Remove(enemy2);
                this.MidList.Remove(enemy3); this.enemylist.Remove(enemy3);
                this.MidList.Remove(enemy4); this.enemylist.Remove(enemy4);
                this.MidList.Remove(enemy5); this.enemylist.Remove(enemy5);
                this.MidList.Remove(enemy6); this.enemylist.Remove(enemy6);
                this.MidList.Remove(enemy7); this.enemylist.Remove(enemy7);
                this.MidList.Remove(enemy8); this.enemylist.Remove(enemy8);
                this.MidList.Remove(enemy9); this.enemylist.Remove(enemy9);
                this.MidList.Remove(enemy10); this.enemylist.Remove(enemy10);
                this.MidList.Remove(enemy11); this.enemylist.Remove(enemy11);
                this.MidList.Remove(enemy12); this.enemylist.Remove(enemy12);
                this.MidList.Remove(enemy13); this.enemylist.Remove(enemy13);

                this.MidList.Remove(big_enemy1); this.big_enemylist.Remove(big_enemy1);
                this.MidList.Remove(big_enemy2); this.big_enemylist.Remove(big_enemy2);
                this.MidList.Remove(big_enemy3); this.big_enemylist.Remove(big_enemy3);
                this.MidList.Remove(big_enemy4); this.big_enemylist.Remove(big_enemy4);

                this.BackgroundList.RemoveRange(0, BackgroundList.Count);
                this.MidList.RemoveRange(0, MidList.Count);
                this.UiList.RemoveRange(0, UiList.Count);
                this.ForegroundList.RemoveRange(0, ForegroundList.Count);

                this.AddToBack(BG1);
                this.AddToBack(lantern1);
                this.AddToBack(lantern2);
                this.AddToBack(lantern3);
                this.AddToFront(light1);
                this.AddToFront(light2);
                this.AddToFront(light3);
                this.AddToBack(gunstore);
                this.AddToUI(player1score);
                this.AddToUI(analogarea);
                this.AddToUI(analogstick);
                this.AddToMid(player);
                this.AddToUI(A_Button);
                this.AddToUI(B_Button);
                this.AddToUI(X_Button);
                this.AddToMid(gunmanager);
                this.AddToUI(settingsbutton);

                this.enemy1  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.5), (int)(GameWidth / 3.1));
                this.enemy2  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.2), (int)(GameWidth / 3.2));
                this.enemy3  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.5), (int)(GameWidth / 3.3));
                this.enemy4  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.35), (int)(GameWidth / 3.1));
                this.enemy5  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.2), (int)(GameWidth / 3.2));
                this.enemy6  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1), (int)(GameWidth / 3.3));
                this.enemy7  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.5), (int)(GameWidth / 3.2));
                this.enemy8  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.2), (int)(GameWidth / 3.1));
                this.enemy9  = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.45), (int)(GameWidth / 3.2));
                this.enemy10 = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.3), (int)(GameWidth / 3.3));
                this.enemy11 = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.2), (int)(GameWidth / 3.1));
                this.enemy12 = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.1), (int)(GameWidth / 3.2));
                this.enemy13 = new Enemy(0, shadow, enemy_chrtr, whitep, this.enemy_Walkanim, enemy_punchanim, (int)(GameWidth / 1.15), (int)(GameWidth / 3.3));

                this.big_enemy1 = new Big_Enemy(0, shadow, big_enemy, whitep, this.big_enemy_Walkanim, (int)(GameWidth / 1.5), (int)(GameWidth / 3.2));
                this.big_enemy2 = new Big_Enemy(0, shadow, big_enemy, whitep, this.big_enemy_Walkanim, (int)(GameWidth / 1.2), (int)(GameWidth / 3.2));
                this.big_enemy3 = new Big_Enemy(0, shadow, big_enemy, whitep, this.big_enemy_Walkanim, (int)(GameWidth / 1.4), (int)(GameWidth / 3.2));
                this.big_enemy4 = new Big_Enemy(0, shadow, big_enemy, whitep, this.big_enemy_Walkanim, (int)(GameWidth / 1.3), (int)(GameWidth / 3.2));

                this.player.x      = (int)(Game1.GameWidth / 40);
                this.player.score  = 500;
                this.player.health = 100;

                this.gunmanager.gunlist.RemoveAll(gun => gun == gun);
                this.gunmanager.gunlist.Add(this.gunmanager.Gun1);
                this.gunmanager.currentgun = this.gunmanager.Gun1;

                this.endscreen.reset();
                this.gamestarted = false;
                this.game_over   = false;
            });
            this.next_level  = new Button(1, "Next Level", fiftyblack, GameWidth / 2 - (int)(GameWidth / 6.5), GameHeight / 2 + (int)(GameWidth / 12), (int)(GameWidth / 3.8), (int)(GameWidth / 13), () => { });
            this.exit_button = new Button(1, "Exit Game", fiftyblack, GameWidth / 2 - (int)(GameWidth / 6.5), GameHeight / 2 + (int)(GameWidth / 6), (int)(GameWidth / 3.8), (int)(GameWidth / 13), () => { exit(); });
            this.endscreen   = new GameOver(player, exit_button, next_level, fiftyblack, tele_anim, () => { this.player.x = (int)(Game1.GameWidth / 8); this.player.y = (int)(Game1.GameHeight / 2); this.game_over = false; this.current_level = l2_1; this.current_level.OnEnter(); });
            this.cont        = new Button(1, "BACK", fiftyblack, (int)(GameWidth / 80), (int)(GameWidth / 13.333), (int)(GameWidth / 4.444), (int)(GameWidth / 16), () => { this.paused = false; });
            this.Intro_Music = intro_music;


            this.StartScreen.Add(Menu_bg);
            this.StartScreen.Add(start_button);
            this.StartScreen.Add(name_change);

            this.current_level.OnEnter();
            this.AddToUI(player1score);
            this.AddToUI(analogarea);
            this.AddToUI(analogstick);
            this.AddToMid(player);
            this.AddToUI(A_Button);
            this.AddToUI(B_Button);
            this.AddToUI(X_Button);
            this.AddToUI(settingsbutton);
        }
Esempio n. 36
0
 public IEnumerable <Song> Put([FromBody] Song value)
 {
     songRepo.Update(value);
     return(songRepo.GetAll());
 }
 public void AddMusic(Song song)
 {
     this.song = song;
 }
Esempio n. 38
0
 public Task <RadioStation> CreateRadioStation(Song song)
 {
     return(CreateRadioStation(song, song.Name));
 }
    public void UpdateIni()
    {
        Song song = editor.currentSong;

        song.iniProperties = SongIniFunctions.SongIniFromString(customIniSettings.text);
    }
Esempio n. 40
0
        protected async Task <RadioStation> CreateRadioStation(Song song, string name)
        {
            var provider = ApiManager.Shared.GetMusicProvider <GoogleMusicProvider>(ServiceType.Google);

            var track =
                await
                Database.Main.TablesAsync <Track>()
                .Where(x => x.SongId == song.Id && x.ServiceType == ServiceType.Google)
                .FirstOrDefaultAsync();

            if (track != null)
            {
                return(await provider.CreateRadioStation(name, track));
            }

            track =
                await
                Database.Main.TablesAsync <TempTrack>()
                .Where(x => x.SongId == song.Id && x.ServiceType == ServiceType.Google)
                .FirstOrDefaultAsync();

            if (track != null)
            {
                return(await provider.CreateRadioStation(name, track));
            }

            var albumId =
                await
                Database.Main.TablesAsync <AlbumIds>()
                .Where(x => x.AlbumId == song.AlbumId && x.ServiceType == ServiceType.Google)
                .FirstOrDefaultAsync();

            if (albumId != null)
            {
                return(await provider.CreateRadioStation(name, albumId));
            }

            albumId =
                await
                Database.Main.TablesAsync <TempAlbumIds>()
                .Where(x => x.AlbumId == song.AlbumId && x.ServiceType == ServiceType.Google)
                .FirstOrDefaultAsync();

            if (albumId != null)
            {
                return(await provider.CreateRadioStation(name, albumId));
            }

            var artist =
                await
                Database.Main.TablesAsync <ArtistIds>()
                .Where(x => x.ArtistId == song.ArtistId && x.ServiceType == ServiceType.Google)
                .FirstOrDefaultAsync();

            if (artist != null)
            {
                return(await provider.CreateRadioStation(name, artist));
            }

            artist =
                await
                Database.Main.TablesAsync <TempArtistIds>()
                .Where(x => x.ArtistId == song.ArtistId && x.ServiceType == ServiceType.Google)
                .FirstOrDefaultAsync();

            if (artist != null)
            {
                return(await provider.CreateRadioStation(name, artist));
            }

            return(null);
        }
Esempio n. 41
0
    static string CheckForErrorsMoonscraper(Song song, float songLength, ref bool hasErrors)
    {
        bool          hasErrorsLocal = false;
        StringBuilder sb             = new StringBuilder();

        sb.AppendLine("Moonscraper validation report: ");

        // Check if any objects have exceeded the max length
        {
            uint tick = song.TimeToTick(songLength, song.resolution);

            // Song objects
            {
                // Synctrack
                {
                    int index, length;
                    SongObjectHelper.GetRange(song.syncTrack, tick, uint.MaxValue, out index, out length);

                    for (int i = index; i < length; ++i)
                    {
                        hasErrorsLocal |= true;

                        SyncTrack st = song.syncTrack[i];

                        sb.AppendFormat("\tFound synctrack object beyond the length of the song-\n");
                        sb.AppendFormat("\t\tType = {0}, position = {1}\n", st.GetType(), st.tick);
                    }
                }

                // Events
                {
                    int index, length;
                    SongObjectHelper.GetRange(song.eventsAndSections, tick, uint.MaxValue, out index, out length);

                    for (int i = index; i < length; ++i)
                    {
                        hasErrorsLocal |= true;

                        Event eventObject = song.eventsAndSections[i];

                        sb.AppendFormat("\tFound event object beyond the length of the song-\n");
                        sb.AppendFormat("\t\tType = {0}, position = {1}\n", eventObject.GetType(), eventObject.tick);
                    }
                }
            }

            // Chart objects
            foreach (Song.Instrument instrument in EnumX <Song.Instrument> .Values)
            {
                if (instrument == Song.Instrument.Unrecognised)
                {
                    continue;
                }

                foreach (Song.Difficulty difficulty in EnumX <Song.Difficulty> .Values)
                {
                    Chart chart = song.GetChart(instrument, difficulty);

                    int index, length;
                    SongObjectHelper.GetRange(chart.chartObjects, tick, uint.MaxValue, out index, out length);

                    for (int i = index; i < length; ++i)
                    {
                        hasErrorsLocal |= true;

                        ChartObject co = chart.chartObjects[i];

                        sb.AppendFormat("\tFound chart object beyond the length of the song-\n");
                        sb.AppendFormat("\t\tType = {0}, position = {1}\n", co.GetType(), co.tick);
                    }
                }
            }
        }

        if (!hasErrorsLocal)
        {
            sb.AppendLine("\tNo errors detected");
        }

        hasErrors |= hasErrorsLocal;

        return(sb.ToString());
    }
        public ActionScene(Game game) : base(game)
        {
            Game1 g = (Game1)game;

            this.spriteBatch = g.spriteBatch;

            // Code by Nathan Saccon (start)

            #region Background
            // Background
            Background background = new Background(g, spriteBatch);
            Components.Add(background);
            // Song
            Song song = g.Content.Load <Song>("Sounds/backgroundSong");

            MediaPlayer.Volume = 0.2f;
            MediaPlayer.Play(song);
            #endregion

            #region Doors

            //Doors
            Texture2D greenDoorTexture = g.Content.Load <Texture2D>("Images/greenDoor");
            Door      greenDoor        = new Door(g, spriteBatch, greenDoorTexture, new Rectangle(509, 525, 20, 107), Color.Green);
            Components.Add(greenDoor);

            Texture2D redDoorTexture = g.Content.Load <Texture2D>("Images/redDoor");
            Door      redDoor        = new Door(g, spriteBatch, redDoorTexture, new Rectangle(383, 383, 126, 20), Color.Red);
            Components.Add(redDoor);

            Texture2D blueDoorTexture = g.Content.Load <Texture2D>("Images/blueDoor");
            Door      blueDoor        = new Door(g, spriteBatch, blueDoorTexture, new Rectangle(162, 180, 111, 20), Color.Blue);
            Components.Add(blueDoor);


            List <Door> allDoors = new List <Door>();
            allDoors.Add(blueDoor);
            allDoors.Add(redDoor);
            allDoors.Add(greenDoor);

            #endregion

            #region Keys

            // Keys
            Texture2D greenKeyTexture = g.Content.Load <Texture2D>("Images/greenKey");
            Key       greenKey        = new Key(g, spriteBatch, greenKeyTexture, new Rectangle(40, 600, Key.WIDTH, Key.HEIGHT), Color.Green);
            Components.Add(greenKey);

            Texture2D redKeyTexture = g.Content.Load <Texture2D>("Images/redKey");
            Key       redKey        = new Key(g, spriteBatch, redKeyTexture, new Rectangle(320, 2, Key.WIDTH, Key.HEIGHT), Color.Red);
            Components.Add(redKey);

            Texture2D blueKeyTexture = g.Content.Load <Texture2D>("Images/blueKey");
            Key       blueKey        = new Key(g, spriteBatch, blueKeyTexture, new Rectangle(162, 2, Key.WIDTH, Key.HEIGHT), Color.Blue);
            Components.Add(blueKey);

            List <Key> allKeys = new List <Key>();
            allKeys.Add(blueKey);
            allKeys.Add(redKey);
            allKeys.Add(greenKey);

            #endregion

            #region Gun

            Gun gun = new Gun(g, spriteBatch, new Rectangle(17, 221, 54, 30));
            Components.Add(gun);

            #endregion

            #region Enemy

            Enemy enemy = new Enemy(g, spriteBatch, new Rectangle(70, 434, 45, 55), EnemyType.STILL, (float)Math.PI / 2f);
            Components.Add(enemy);

            Enemy enemyTwo = new Enemy(g, spriteBatch, new Rectangle(728, 32, 45, 55), EnemyType.WALKER, (float)Math.PI);
            Components.Add(enemyTwo);

            #endregion

            #region Player
            Player player = new Player(g, spriteBatch, background.rigidBodies, allDoors, allKeys);
            Components.Add(player);
            #endregion

            #region HUD

            Texture2D deathScreen   = game.Content.Load <Texture2D>("Images/deathScreen");
            Texture2D levelComplete = game.Content.Load <Texture2D>("Images/levelComplete");

            HUD overlay = new HUD(g, spriteBatch, player, deathScreen, levelComplete);
            Components.Add(overlay);
            #endregion

            // (end)
        }
Esempio n. 43
0
        public T Load <T>(string assetName)
        {
            string originalAssetName = assetName;
            object result            = null;

            if (this.graphicsDeviceService == null)
            {
                this.graphicsDeviceService = serviceProvider.GetService(typeof(IGraphicsDeviceService)) as IGraphicsDeviceService;
                if (this.graphicsDeviceService == null)
                {
                    throw new InvalidOperationException("No Graphics Device Service");
                }
            }

            if (string.IsNullOrEmpty(assetName))
            {
                throw new ArgumentException("assetname");
            }

            if (!string.IsNullOrEmpty(_rootDirectory))
            {
                assetName = _rootDirectory + Path.DirectorySeparatorChar + assetName;
            }

            // Check for windows-style directory separator character
            assetName = assetName.Replace('\\', Path.DirectorySeparatorChar);

            // Get the real file name
            if ((typeof(T) == typeof(Curve)))
            {
                assetName = CurveReader.Normalize(assetName);
            }
            else if ((typeof(T) == typeof(Texture2D)))
            {
                assetName = Texture2DReader.Normalize(assetName);
            }
            if ((typeof(T) == typeof(SpriteFont)))
            {
                assetName = SpriteFontReader.Normalize(assetName);
            }
            if ((typeof(T) == typeof(Song)))
            {
                assetName = SongReader.Normalize(assetName);
            }
            if ((typeof(T) == typeof(SoundEffect)))
            {
                assetName = SoundEffectReader.Normalize(assetName);
            }
            if ((typeof(T) == typeof(Video)))
            {
                assetName = Video.Normalize(assetName);
            }
            if ((typeof(T) == typeof(Effect)))
            {
                assetName = Effect.Normalize(assetName);
            }

            if (string.IsNullOrEmpty(assetName))
            {
                throw new ContentLoadException("Could not load " + originalAssetName + " asset!");
            }

            if (!Path.HasExtension(assetName))
            {
                assetName = string.Format("{0}.xnb", assetName);
            }

            if (Path.GetExtension(assetName).ToUpper() == ".XNB")
            {
                // Load a XNB file
                FileStream   stream    = new FileStream(assetName, FileMode.Open, FileAccess.Read, FileShare.Read);
                BinaryReader xnbReader = new BinaryReader(stream);

                // The first 4 bytes should be the "XNB" header. i use that to detect an invalid file
                byte[] headerBuffer = new byte[3];
                xnbReader.Read(headerBuffer, 0, 3);

                string headerString = Encoding.UTF8.GetString(headerBuffer, 0, 3);

                byte platform = xnbReader.ReadByte();

                if (string.Compare(headerString, "XNB") != 0 ||
                    !(platform == 'w' || platform == 'x' || platform == 'm'))
                {
                    throw new ContentLoadException("Asset does not appear to be a valid XNB file. Did you process your content for Windows?");
                }

                ushort version         = xnbReader.ReadUInt16();
                int    graphicsProfile = version & 0x7f00;
                version &= 0x80ff;

                bool compressed = false;
                if (version == 0x8005 || version == 0x8004)
                {
                    compressed = true;
                }
                else if (version != 5 && version != 4)
                {
                    throw new ContentLoadException("Invalid XNB version");
                }

                // The next int32 is the length of the XNB file
                int xnbLength = xnbReader.ReadInt32();

                ContentReader reader;
                if (compressed)
                {
                    //decompress the xnb
                    //thanks to ShinAli (https://bitbucket.org/alisci01/xnbdecompressor)
                    int compressedSize   = xnbLength - 14;
                    int decompressedSize = xnbReader.ReadInt32();
                    int newFileSize      = decompressedSize + 10;

                    MemoryStream decompressedStream = new MemoryStream(decompressedSize);

                    LzxDecoder dec          = new LzxDecoder(16);
                    int        decodedBytes = 0;
                    int        pos          = 0;

                    while (pos < compressedSize)
                    {
                        // let's seek to the correct position
                        stream.Seek(pos + 14, SeekOrigin.Begin);
                        int hi         = stream.ReadByte();
                        int lo         = stream.ReadByte();
                        int block_size = (hi << 8) | lo;
                        int frame_size = 0x8000;
                        if (hi == 0xFF)
                        {
                            hi         = lo;
                            lo         = (byte)stream.ReadByte();
                            frame_size = (hi << 8) | lo;
                            hi         = (byte)stream.ReadByte();
                            lo         = (byte)stream.ReadByte();
                            block_size = (hi << 8) | lo;
                            pos       += 5;
                        }
                        else
                        {
                            pos += 2;
                        }

                        if (block_size == 0 || frame_size == 0)
                        {
                            break;
                        }

                        int lzxRet = dec.Decompress(stream, block_size, decompressedStream, frame_size);
                        pos          += block_size;
                        decodedBytes += frame_size;
                    }

                    if (decompressedStream.Position != decompressedSize)
                    {
                        throw new ContentLoadException("Decompression of " + originalAssetName + "failed. " +
                                                       " Try decompressing with nativeDecompressXnb first.");
                    }

                    decompressedStream.Seek(0, SeekOrigin.Begin);
                    reader = new ContentReader(this, decompressedStream, this.graphicsDeviceService.GraphicsDevice);
                }
                else
                {
                    reader = new ContentReader(this, stream, this.graphicsDeviceService.GraphicsDevice);
                }

                ContentTypeReaderManager typeManager = new ContentTypeReaderManager(reader);
                reader.TypeReaders = typeManager.LoadAssetReaders(reader);
                foreach (ContentTypeReader r in reader.TypeReaders)
                {
                    r.Initialize(typeManager);
                }
                // we need to read a byte here for things to work out, not sure why
                reader.ReadByte();

                // Get the 1-based index of the typereader we should use to start decoding with
                int index = reader.ReadByte();
                ContentTypeReader contentReader = reader.TypeReaders[index - 1];
                result = reader.ReadObject <T>(contentReader);

                reader.Close();
                stream.Close();
            }
            else
            {
                if ((typeof(T) == typeof(Texture2D)))
                {
                    result = Texture2D.FromFile(graphicsDeviceService.GraphicsDevice, assetName);
                }
                if ((typeof(T) == typeof(SpriteFont)))
                {
                    //result = new SpriteFont(Texture2D.FromFile(graphicsDeviceService.GraphicsDevice,assetName), null, null, null, 0, 0.0f, null, null);
                    throw new NotImplementedException();
                }
                if ((typeof(T) == typeof(Song)))
                {
                    result = new Song(assetName);
                }
                if ((typeof(T) == typeof(SoundEffect)))
                {
                    result = new SoundEffect(assetName);
                }
                if ((typeof(T) == typeof(Video)))
                {
                    result = new Video(assetName);
                }
                if ((typeof(T) == typeof(Effect)))
                {
                    result = new Effect(graphicsDeviceService.GraphicsDevice, assetName);
                }
            }

            if (result == null)
            {
                throw new ContentLoadException("Could not load " + originalAssetName + " asset!");
            }

            return((T)result);
        }
Esempio n. 44
0
 public GameState(string name, Song song)
 {
     Name = name;
     Song = song;
 }
Esempio n. 45
0
 public void delete(Song t)
 {
     songGoogleDao.delete(t);
 }
Esempio n. 46
0
        public bool InsertSong(Song song, bool replace = false)
        {
            int affected = this.database.InsertObject <Song>(song, replace ? InsertType.Replace : InsertType.InsertOrIgnore);

            return(affected > 0);
        }
Esempio n. 47
0
 private void ReturnFile(Edit e)
 {
     Response.Clear();
     Response.ContentType = "text/plain";
     Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.sm", Song.GetSong(e.SongID).Title));
     byte[] data = File.ReadAllBytes(Server.MapPath(string.Format("/sims/{0}.sm", e.ID)));
     Response.OutputStream.Write(data, 0, data.Length);
     Response.Flush();
     Response.Close();
 }
Esempio n. 48
0
 public Song update(int id, Song t)
 {
     return(songGoogleDao.update(id, t));
 }
 public static void PlaySong(Song thisSong, bool looping = true, float volumeMod = 1f)
 {
     MediaPlayer.Volume      = masterVolume * musicVolume * volumeMod;
     MediaPlayer.IsRepeating = looping;
     MediaPlayer.Play(thisSong);
 }
Esempio n. 50
0
 public void create(Song t)
 {
     songGoogleDao.create(t);
 }
Esempio n. 51
0
 public static void SelectedSong(Song song)
 {
     songName = song;
 }
Esempio n. 52
0
        /// <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);
            Services.AddService(spriteBatch);
            Services.AddService(Content.Load <Texture2D>(@"Tiles/tank tiles 64 x 64"));

            // Tile References to be drawn on the Map corresponding to the entries in the defined
            // Tile Map
            // "free", "pavement", "ground", "blue", "home", "grass" "end"
            TileRefs.Add(new TileRef(4, 2, 0));
            TileRefs.Add(new TileRef(3, 3, 1));
            TileRefs.Add(new TileRef(6, 3, 2));
            TileRefs.Add(new TileRef(6, 2, 3));
            TileRefs.Add(new TileRef(0, 2, 4));
            TileRefs.Add(new TileRef(0, 1, 5));
            TileRefs.Add(new TileRef(0, 4, 6));
            // Names fo the Tiles

            new SimpleTileLayer(this, backTileNames, tileMap, TileRefs, tileWidth, tileHeight);
            List <Tile> found = SimpleTileLayer.getNamedTiles("home");

            new SimpleTileLayer(this, backTileNames, tileMap, TileRefs, tileWidth, tileHeight);
            List <Tile> foundSentry = SimpleTileLayer.getNamedTiles(backTileNames[(int)TileType.GREENBOX]);

            Services.AddService(new TilePlayer(this, new Vector2((int)TileType.HOME), new List <TileRef>()
            {
                new TileRef(15, 2, 0),
                new TileRef(15, 3, 0),
                new TileRef(15, 4, 0),
                new TileRef(15, 5, 0),
                new TileRef(15, 6, 0),
                new TileRef(15, 7, 0),
                new TileRef(15, 8, 0),
            }, 64, 64, 0f));
            SetColliders(TileType.GREENBOX);
            SetColliders(TileType.BLUEBOX);

            TilePlayer tilePlayer = Services.GetService <TilePlayer>();

            tilePlayer.AddHealthBar(new HealthBar(tilePlayer.Game, tilePlayer.PixelPosition));

            player = (TilePlayer)Services.GetService(typeof(TilePlayer));

            Projectile playerProjectile = new Projectile(this, new List <TileRef>()
            {
                new TileRef(8, 0, 0)
            },

                                                         new AnimateSheetSprite(this, player.PixelPosition, new List <TileRef>()
            {
                new TileRef(0, 0, 0),
                new TileRef(1, 0, 1),
                new TileRef(2, 0, 2)
            }, 64, 64, 0), player.PixelPosition, 1);

            player.LoadProjectile(playerProjectile);


            for (int i = 0; i < foundSentry.Count; i++)
            {
                sentryTurret = new Sentry(this, new Vector2(foundSentry[i].X * tileWidth, foundSentry[i].Y * tileHeight), new List <TileRef>()
                {
                    new TileRef(20, 2, 0),
                    new TileRef(20, 3, 0),
                    new TileRef(20, 4, 0),
                    new TileRef(20, 5, 0),
                    new TileRef(20, 6, 0),
                    new TileRef(20, 6, 0),
                    new TileRef(20, 8, 0),
                }, 64, 64, 0);
                sentryList.Add(sentryTurret);
            }

            for (int i = 0; i < sentryList.Count; i++)
            {
                Projectile projectile = new Projectile(this, new List <TileRef>()
                {
                    new TileRef(8, 0, 0)
                },
                                                       new AnimateSheetSprite(this, sentryList[i].PixelPosition, new List <TileRef>()
                {
                    new TileRef(0, 0, 0),
                    new TileRef(1, 0, 1),
                    new TileRef(2, 0, 2)
                }, 64, 64, 0), sentryList[i].PixelPosition, 1);

                sentryList[i].LoadProjectile(projectile);
                sentryList[i].Health = 20;
            }


            // TODO: use this.Content to load your game content here

            //Background
            backgroundMusic = Content.Load <Song>(@"Audio/bckGroundMusic");
            MediaPlayer.Play(backgroundMusic);
            MediaPlayer.Volume      = 0.4f;
            MediaPlayer.IsRepeating = true;

            //Sound FX
            sfx[0] = Content.Load <SoundEffect>(@"Audio/Explosion 2"); //Player Shot
            sfx[1] = Content.Load <SoundEffect>(@"Audio/Beep");        //Sentry Shot
            sfx[2] = Content.Load <SoundEffect>(@"Audio/Explosion");   //Projectile Explosion
            sfx[3] = Content.Load <SoundEffect>(@"Audio/Ching");       //Victory
            sfx[4] = Content.Load <SoundEffect>(@"Audio/Error");       //Fail

            //Screens
            victory  = Content.Load <Texture2D>(@"Images/Victory");
            gameOver = Content.Load <Texture2D>(@"Images/GameOver");
        }
        public void Read(Song song, Stream stream)
        {
            if (song == null)
            {
                throw new ArgumentNullException("song");
            }

            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            var doc = XDocument.Load(stream);

            if (doc.Root.Name != "song")
            {
                throw new SongFormatException("File is not a valid OpenSong song.");
            }

            var root = doc.Root;

            song.Title     = root.Elements("title").Single().Value;
            song.Copyright = root.Elements("author").Any() ? root.Elements("author").Single().Value : String.Empty;
            if (root.Elements("copyright").Any())
            {
                var copyright = root.Element("copyright").Value;
                if (!copyright.StartsWith("©") && !copyright.StartsWith("(c)"))
                {
                    copyright = "© " + copyright;
                }
                song.Copyright = String.IsNullOrEmpty(song.Copyright) ? copyright : song.Copyright + "\n" + copyright;
            }

            song.Category   = root.Elements("theme").Any() ? root.Element("theme").Value : String.Empty;
            song.CcliNumber = root.Elements("ccli").Any() ? int.Parse(root.Element("ccli").Value) : (int?)null;
            var lines = root.Elements("lyrics").Single().Value.Split('\n');

            string           partKey          = null;
            LineGroup        currentLineGroup = null;
            List <LineGroup> partLineGroups   = null;

            for (int l = 0; l < lines.Length; l++)
            {
                var line = lines[l];

                if (line.StartsWith("["))                 // next part (or group of parts)
                {
                    if (partKey != null)
                    {
                        FinishPart(song, partKey, partLineGroups, currentLineGroup);
                    }

                    var i = line.IndexOf("]");
                    if (i < 0)
                    {
                        throw new SongFormatException("File is not a valid OpenSong song: Invalid part declaration.");
                    }

                    partKey          = line.Substring(1, i - 1).Trim();
                    partLineGroups   = new List <LineGroup>();
                    currentLineGroup = null;
                }
                else                 // not the start of a new part
                {
                    if (line.Trim() == String.Empty || line[0] == ';' || line.StartsWith("---"))
                    {
                        // ignore empty line, comments, '---' breaks (whatever they mean)
                        continue;
                    }

                    if (partKey == null)                     // no part has been started -> create an anonymous one
                    {
                        partKey        = "Unnamed";
                        partLineGroups = new List <LineGroup>();
                    }

                    if (line[0] == '.')
                    {
                        // chord line -> always start new line group and set chords property
                        if (currentLineGroup != null)
                        {
                            partLineGroups.Add(currentLineGroup);
                        }

                        currentLineGroup = new LineGroup {
                            Chords = line.Substring(1)
                        };
                    }
                    else if (line[0] == ' ')
                    {
                        // lyrics line -> set lyrics to current LineGroup
                        if (currentLineGroup == null || currentLineGroup.Lines.Count == 0)
                        {
                            if (currentLineGroup == null)
                            {
                                currentLineGroup = new LineGroup();
                            }
                            currentLineGroup.Lines.Add(new Line {
                                Text = line.Substring(1)
                            });
                            partLineGroups.Add(currentLineGroup);
                            currentLineGroup = null;
                        }
                        else
                        {
                            throw new SongFormatException("File is not a valid OpenSong song: Expected verse number.");
                        }
                    }
                    else if (char.IsDigit(line[0]))
                    {
                        int vnum = int.Parse(line[0].ToString());

                        if (currentLineGroup == null)
                        {
                            currentLineGroup = new LineGroup();
                        }
                        else if (currentLineGroup.Lines.Count > 0 && vnum <= currentLineGroup.Lines.Last().Number)
                        {
                            partLineGroups.Add(currentLineGroup);
                            currentLineGroup = new LineGroup();
                        }

                        currentLineGroup.Lines.Add(new Line {
                            Text = line.Substring(1), Number = vnum
                        });
                    }
                    else
                    {
                        throw new SongFormatException("File is not a valid OpenSong song: Expected one of ' ', '.', ';' , '[0-9]'");
                    }
                }
            }

            if (partKey != null)
            {
                FinishPart(song, partKey, partLineGroups, currentLineGroup);
            }

            // parse order
            if (root.Elements("presentation").Any() && root.Elements("presentation").Single().Value.Trim() != String.Empty)
            {
                var val   = root.Elements("presentation").Single().Value.Trim();
                var split = wordRegex.Matches(val).Cast <Match>();
                song.SetOrder(split.Select(m => GetPartName(m.Value)), ignoreMissing: true);
            }
            else
            {
                // if no order is specified, add each part once in order
                foreach (SongPart part in song.Parts)
                {
                    song.AddPartToOrder(part);
                }
            }
        }
Esempio n. 54
0
 /// <summary>
 /// Sets the level's song
 /// </summary>
 /// <param name="song">The song to set</param>
 /// <param name="song2">The trimmed song to set</param>
 public void setSongs(Song song, Song song2)
 {
     this.song  = song;
     this.song2 = song2;
 }
Esempio n. 55
0
 public void Remove(Song song)
 {
     Playlist.Remove(song);
 }
Esempio n. 56
0
        /// <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);

            // Load menu items
            // Menu design thanks to: https://youtu.be/54L_w0PiRa8

            // Source: http://pixshark.com/cool-black-backgrounds-for-powerpoint.htm
            // Title: black history
            menuBackground = Content.Load <Texture2D>("menu\\background");


            // All text buttons generated on cooltext.com
            // Baskerville font

            btnPlay = new cButton(Content.Load <Texture2D>("menu\\play"), graphics.GraphicsDevice);
            btnPlay.setPosition(new Vector2(350, 250));

            btnOptions = new cButton(Content.Load <Texture2D>("menu\\options"), graphics.GraphicsDevice);
            btnOptions.setPosition(new Vector2(350, 350));

            btnExit = new cButton(Content.Load <Texture2D>("menu\\exit"), graphics.GraphicsDevice);
            btnExit.setPosition(new Vector2(350, 450));

            // Dashboard items

            blackRectangleTexture = new Texture2D(graphics.GraphicsDevice, 1, 1);
            blackRectangleTexture.SetData(new[] { Color.Navy });
            blackRectangle = new Rectangle(0, GameConstants.WINDOW_HEIGHT - GameConstants.DASHBOARD_HEIGHT,
                                           GameConstants.DASHBOARD_WIDTH, GameConstants.DASHBOARD_HEIGHT);

            // Load fonts

            arialFont = Content.Load <SpriteFont>("fonts\\Arial20");

            // Load sounds

            keyPressSound    = Content.Load <SoundEffect>("sounds\\keypress");
            wordSuccessSound = Content.Load <SoundEffect>("sounds\\wordsuccess");
            lifeLostSound    = Content.Load <SoundEffect>("sounds\\lifelost");
            // Source: http://freesound.org/people/Autistic%20Lucario/sounds/142608/
            errorSound = Content.Load <SoundEffect>("sounds\\error");
            // Source: http://www.freesfx.co.uk/download/?type=mp3&id=9630
            wordDeleteSound = Content.Load <SoundEffect>("sounds\\worddelete");
            // Source also freesfx
            letterDeleteSound = Content.Load <SoundEffect>("sounds\\deleteletter");
            // Source: http://www.freesound.org/people/themusicalnomad/sounds/253886/
            gameOverSound = Content.Load <SoundEffect>("sounds\\gameover");


            // Load and play game music

            gameMusic = Content.Load <Song>("sounds\\shiningstar");

            // Load letter textures
            List <Texture2D> textureList;

            for (char c = 'a'; c <= 'z'; c++)
            {
                textureList = new List <Texture2D>(10);
                textureList.Add(Content.Load <Texture2D>("letters\\64\\" + c + "_black"));
                textureList.Add(Content.Load <Texture2D>("letters\\64\\" + c + "_blue"));
                textureList.Add(Content.Load <Texture2D>("letters\\64\\" + c + "_dg"));
                textureList.Add(Content.Load <Texture2D>("letters\\64\\" + c + "_gold"));
                textureList.Add(Content.Load <Texture2D>("letters\\64\\" + c + "_grey"));
                textureList.Add(Content.Load <Texture2D>("letters\\64\\" + c + "_lg"));
                textureList.Add(Content.Load <Texture2D>("letters\\64\\" + c + "_orange"));
                textureList.Add(Content.Load <Texture2D>("letters\\64\\" + c + "_pink"));
                textureList.Add(Content.Load <Texture2D>("letters\\64\\" + c + "_red"));
                textureList.Add(Content.Load <Texture2D>("letters\\64\\" + c + "_violet"));

                letterDictionary.Add(c, textureList);
                textureList = null;
            }
            // Set the letter width
            letterWidth = letterDictionary['a'][0].Width;

            // Load lives texture

            appleTexture = Content.Load <Texture2D>("apple");

            // Add three lives to list

            livesList.Add(appleTexture);
            // livesList.Add(appleTexture);
            // livesList.Add(appleTexture);

            // Load word list

            string lineOfText;

            using (var stream = TitleContainer.OpenStream("words.txt"))
            {
                using (var reader = new StreamReader(stream))
                {
                    while ((lineOfText = reader.ReadLine()) != null)
                    {
                        // Remove all periods from words
                        if (lineOfText.Trim().Contains('.'))
                        {
                            lineOfText.Replace(".", "");
                        }
                        // Check if duplicates exist in the list that's being loaded
                        lineOfText = lineOfText.ToLower().Trim();
                        if (wordDictionary.ContainsKey(lineOfText))
                        {
                            // Don't add again
                        }
                        else
                        {
                            wordDictionary.Add(lineOfText.ToLower().Trim(), false);
                        }
                    }
                }
            }

            currentWord = GetRandomLetterCombo();
            stringToList(currentWord);

            // Play game music

            MediaPlayer.Play(gameMusic);
        }
Esempio n. 57
0
 public void AddSongToQueue(Song song)
 {
     Lala.API.Instance.CurrentUser.Queue.Add(song);
     QueueModified(this, new EventArgs());
 }
        private void FinishPart(Song song, string key, List <LineGroup> lineGroups, LineGroup lastLineGroup)
        {
            if (lastLineGroup != null)
            {
                lineGroups.Add(lastLineGroup);
            }

            if (lineGroups.Count == 0)
            {
                throw new SongFormatException("File is not a valid OpenSong song: Empty part");
            }

            foreach (var lg in lineGroups)
            {
                if (lg.Lines.Count == 0)
                {
                    lg.Lines.Add(new Line {
                        Text = ""
                    });
                }
            }

            var noNumbers = !lineGroups[0].Lines[0].Number.HasValue;

            if (noNumbers && lineGroups.Any(lg => lg.Lines.Any(l => l.Number.HasValue)))
            {
                throw new SongFormatException("File is not a valid OpenSong song: Found mixed numbered and unnumbered lines.");
            }

            int maxVerseNumber;

            if (noNumbers)
            {
                maxVerseNumber = 1;
            }
            else
            {
                maxVerseNumber = lineGroups.Max(lg => lg.Lines.Max(l => l.Number.Value));
            }

            for (int i = 1; i <= maxVerseNumber; i++)
            {
                if (!noNumbers && !lineGroups.Any(lg => lg.Lines.Any(l => l.Number == i)))
                {
                    continue;
                }

                string name;
                if (noNumbers)
                {
                    name = GetPartName(key);
                }
                else
                {
                    name = GetPartName(key + i.ToString());
                }

                var part  = new SongPart(song, name);
                var slide = new SongSlide(song);
                slide.Text = String.Join("\n", lineGroups.
                                         Where(lg => lg.Lines.Any(l => noNumbers || l.Number == i)).
                                         Select(lg => PrepareLine(lg.Lines.Where(l => noNumbers || l.Number == i).Single().Text, lg.Chords)));
                part.AddSlide(slide);

                // apply slide breaks
                int ind;
                while ((ind = slide.Text.IndexOf("||")) >= 0)
                {
                    slide.Text = slide.Text.Remove(ind, 2);
                    part.SplitSlide(slide, ind);
                }

                // apply line breaks
                foreach (var s in part.Slides)
                {
                    s.Text = s.Text.Replace("|", "\n");
                }

                song.AddPart(part);
            }
        }
Esempio n. 59
0
        public override void LoadContent(ContentManager Content)
        {
            base.LoadContent(Content);
            #region LoadText
            //JESUS IS LORD <<< GRAPHICS >>> LOAD RESPECTIVE SPRITE FONTS FOR RESPECTIVE TEXT DISPLAY ON SCREEN JESUS IS LORD!
            if (font == null)
            {
                font = content.Load <SpriteFont>("content/Font1");
            }
            if (font2 == null)
            {
                font2 = content.Load <SpriteFont>("content/Font2");
            }
            #endregion

            backwardscode.LoadContent(Content);
            // JESUS IS LORD <<< CONTROL >>> INITIALIZE A BUNCH OF ARRAYS FOR USE WITH LOADING TEXTURES THROUGH FOR LOOP JESUS IS LORD
            #region ARRAYS OF TEXTURES GAME 18
            //   goku = new Texture2D[2];
            //  superman = new Texture2D[2];
            #endregion
            hitsound       = Content.Load <SoundEffect>("tokensuccess");
            leapcollisionb = new Rectangle(0, 0, 64, 64);
            backwards.LoadContent(Content);
            #region JESUS IS LORD GAME 18 LOADING TEXTURES IN ARRAYS JESUS IS LORD!
            computervirus    = Content.Load <Texture2D>("backgrounds/computervirus");
            infectedcomputer = Content.Load <Texture2D>("backgrounds/infectedcomputer");

            /*
             * // JESUS IS LORD <<< GRAPHICS >>> LOAD SPRITES INTO ARRAYS superman and goku JESUS IS LORD!
             * for (int i = 0; i <= 2; i++)
             * {
             *  if (i == 0)
             *      goku[i] = Content.Load<Texture2D>("characters/goku");
             *  else if (i == 1)
             *      goku[i] = Content.Load<Texture2D>("characters/goku1");
             *
             * }
             *
             * for (int x = 0; x <= 2; x++)
             * {
             *  if (x == 0)
             *      superman[x] = Content.Load<Texture2D>("characters/superman");
             *  else if (x == 1)
             *      superman[x] = Content.Load<Texture2D>("characters/superman1");
             *
             * }
             *
             *
             * gokuRect = new Rectangle(0, 160, 130, 246);
             * supermanRect = new Rectangle(300, 10, 818, 614);
             *
             */

            #endregion
            scrollingbackgroundbottom.LoadContent(Content);
            scrollingbackgroundtop.LoadContent(Content);
            forward.LoadContent(Content);
            kungfusantaclaus = Content.Load <Texture2D>("backgrounds/kungfusantaclaus");
            #region JESUS IS LORD LOADING BACKGROUND JESUS IS LORD

            /*fingertextures[0] = Content.Load<Texture2D>("fingers/finger1");
             * fingertextures[1] = Content.Load<Texture2D>("fingers/finger2");
             * fingertextures[2] = Content.Load<Texture2D>("fingers/finger3");
             * fingertextures[3] = Content.Load<Texture2D>("fingers/finger4");
             * fingertextures[4] = Content.Load<Texture2D>("fingers/finger5"); */
            //  wronghands = Content.Load<Texture2D>("backgrounds/WRONGHANDS");
            background     = Content.Load <Texture2D>("backgrounds/TitleScreen");
            backgroundRect = new Rectangle(0, 0, 800, 600);

            #endregion

            deepestmasterofcode = Content.Load <Texture2D>("backgrounds/deepestmaster");
            #region JESUS IS LORD <<< SOUND >>> SONGS AND SOUND EFFECTS FOR GAME

            backgroundMusic = Content.Load <Song>("ResumeGamePlayState/bgmusic01");

            //  MediaPlayer.Volume = 0.2f;
            MediaPlayer.Play(backgroundMusic);

            // slice = Content.Load<SoundEffect>("sound/slice");
            // explosion = Content.Load<SoundEffect>("sound/explosion");
            // beatUp = Content.Load<SoundEffect>("sound/beatup");
            #endregion

            #region EFFECTS JESUS IS LORD!

            // JESUS IS LORD << DRAWS EFFECTS AND LIGHTNING AND SUCH JESUS IS LORD!@
            //    blueLight = Content.Load<Texture2D>("effects/JESUSISLORDbluelight");
            //   redLight = Content.Load<Texture2D>("effects/JESUSISLORDredlight");

            //  redRect = new Rectangle(0, 200, 132, 132);
            //   blueRect = new Rectangle(650, 200, 132, 132);
            #endregion

            //  virusvideo = Content.Load<Video>("videos/viruscountdown");
            //   virusplayer.Play(virusvideo);
        }
Esempio n. 60
0
 public void Add(Song song)
 {
     Playlist.Add(song);
 }