private void PlayNextCard(int player) { if (selectedCard != null) { int index = TripleTriadCardLib.SelectedGridPosition(); if (index >= 0 && TripleTriadGame.PlayedCards[index] == null) { selectedGrid.Position = TripleTriadCardLib.GameBoardPos[index]; if (!_SceneEntities.Contains(selectedGrid)) { _SceneEntities.Add(selectedGrid); } if (Global.MouseManager.IsLeftMouseButtonClicked()) { PlaceSelectedCard(index, player); _SceneEntities.Remove(selectedGrid); //ChangePlayersTurn(); } } else { _SceneEntities.Remove(selectedGrid); } if (Global.MouseManager.IsRightMouseButtonClicked()) { selectedCard = null; _SceneEntities.Remove(selectedGrid); Global.SFXManager.Cancel.Play(); } } }
/// <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 Global.Game = this; Global.Content = Content; Global.Graphics = graphics; Global.SpriteBatch = spriteBatch; Global.MouseManager.Cursor.LoadContent("Cursor"); Global.Windowskin.LoadContent("Window"); Global.Windowskin.ChangeWindowColor(-34, 0, 68, 200); Global.SFXManager.Initialize(); Global.ScreenWidth = 640; Global.ScreenHeight = 480; TripleTriadCardLib.Initialize(); Global.SceneManager.CurrentScene = new Scene_Rule(); //Song BGM = Content.Load<Song>("15 - Shuffle or Boogie"); //MediaPlayer.IsRepeating = true; //MediaPlayer.Play(BGM); //SoundEffect BGM = Content.Load<SoundEffect>("Audio/15 - Shuffle or Boogie"); //SoundEffectInstance BGMInstance = BGM.CreateInstance(); //BGMInstance.IsLooped = true; //BGMInstance.Play(); }
public void LoadContent(string path, string info) { string[] tokens = info.Split('\t'); _Level = int.Parse(tokens[0]); _Name = tokens[1]; _Type = tokens[2]; for (int i = 0; i < 4; ++i) { if (tokens[i + 3] == "A") { _CardValue[i] = 10; } else { _CardValue[i] = int.Parse(tokens[i + 3]); } } _Element = TripleTriadCardLib.GetElementByName(tokens[7]); _PlayerNumber = 1; base.LoadContent(path + _Name); //RenderTarget2D renderTarget = new RenderTarget2D(Global.Graphics.GraphicsDevice, // _Texture.Width, _Texture.Height); //Global.Graphics.GraphicsDevice.SetRenderTarget(renderTarget); //Global.Graphics.GraphicsDevice.Clear(Color.Transparent); //Global.SpriteBatch.Begin(); //Global.SpriteBatch.Draw(_Texture, _Position + _Center * _Scale, _Rectangle, _TintColor.A == 0 ? Color.Transparent : _TintColor, _Rotation, _Center, _Scale, SpriteEffects.None, _Depth); //if (_Element != TripleTriadCardLib.Element.None) // Global.SpriteBatch.Draw(TripleTriadCardLib.Elements, _Position + new Vector2(40, 4), TripleTriadCardLib.ElementRect[(int)_Element - 1], _TintColor, 0, Vector2.Zero, _Scale, SpriteEffects.None, _Depth + 0.002f); //DrawCardValues(); //Global.SpriteBatch.End(); //Global.Graphics.GraphicsDevice.SetRenderTarget(null); //_Texture = renderTarget; }