public void RegGO(OneCard.CardInfo card, OneCard.Player who) { if (!Only_two) { if (who.ID == 0) { Objs.Add(new GameObject(new Sprite(new Texture("Cards/Back.png")) { Scale = new Vector2f(0.3f, 0.3f), Position = new Vector2f(600 + 30 * who.x_margin, -100 + who.y_margin) }, card, who)); who.x_margin += 1; } else if (who.ID == 1) { Objs.Add(new GameObject(new Sprite(new Texture("Cards/Back.png")) { Scale = new Vector2f(0.3f, 0.3f), Position = new Vector2f(1600, 210 + 10 * who.y_margin), Rotation = 90 }, card, who)); who.y_margin += 1; } else if (who.ID == 2) { Objs.Add(new GameObject(new Sprite(new Texture(FileDB[card])) { Scale = new Vector2f(0.3f, 0.3f), Position = new Vector2f(600 + 30 * who.x_margin, 600) }, card, who)); who.x_margin += 1; } else if (who.ID == 3) { Objs.Add(new GameObject(new Sprite(new Texture("Cards/Back.png")) { Scale = new Vector2f(0.3f, 0.3f), Position = new Vector2f(100, 210 + 10 * who.y_margin), Rotation = 90 }, card, who)); who.y_margin += 1; } } else { if (who.ID == 0) { Objs.Add(new GameObject(new Sprite(new Texture("Cards/Back.png")) { Scale = new Vector2f(0.3f, 0.3f), Position = new Vector2f(600 + 30 * who.x_margin, -100 + who.y_margin) }, card, who)); who.x_margin += 1; } else if (who.ID == 1) { Objs.Add(new GameObject(new Sprite(new Texture(FileDB[card])) { Scale = new Vector2f(0.3f, 0.3f), Position = new Vector2f(600 + 30 * who.x_margin, 600) }, card, who)); who.x_margin += 1; } } }
public void DelGO(OneCard.CardInfo card, OneCard.Player who) { int index = -1; for (int i = 0; i < Objs.Count; i++) { if (Objs[i].card == card) { index = i; } if (index != -1 && i > index && Objs[i].who == who) { if (who.Horizon) { Objs[i].sprite.Position = new Vector2f(Objs[i].sprite.Position.X - 30, Objs[i].sprite.Position.Y); } else { Objs[i].sprite.Position = new Vector2f(Objs[i].sprite.Position.X, Objs[i].sprite.Position.Y - 10); } index = i; } } Update_Trash(card); if (who.Horizon) { who.x_margin = (int)(Objs[index].sprite.Position.X - 600) / 30; who.x_margin += 1; } else { who.y_margin = (int)(Objs[index].sprite.Position.Y - 210) / 30; who.y_margin += 1; } Objs.RemoveAll(o => o.card == card); }
public void Bankrupt(OneCard.Player who) { Objs.RemoveAll(o => o.who == who); }
public GameObject(Sprite textrue, OneCard.CardInfo card, OneCard.Player who) { this.sprite = textrue; this.card = card; this.who = who; }