public void ReDo() { ClickableToRemove = new List <IClickable>(); Clickable.ForEach(p => { if (p is Card || p is CardSlot) { ClickableToRemove.Add(p); } }); ClickableToRemove.ForEach(p => Clickable.Remove(p)); grid.RemoveChildren(); slots = new List <CardSlot>(); for (int row = 0; row < 3; row++) { for (int column = 0; column < 5; column++) { CardSlot c = new CardSlot(CardWidth, CardHeight, Game1.self.GraphicsDevice, Gui); grid.AddChild(c, row, column); c.clickEvent += CardSlotClick; slots.Add(c); Clickable.Add(c); } } var autoEvent = new AutoResetEvent(false); time = 0; timer = new Timer(timerStart, autoEvent, 0, 1000); grid.UpdateP(); }
public void Draw(GameTime gameTime) { if (false) { Clickable.ForEach(p => { var z = (GuiElement)p; z.Draw(Game1.self.spriteBatch); }); } else { layout.Draw(Game1.self.spriteBatch); } }
public void SetSlots(bool clicked) { Clickable.ForEach(p => { if (p is CardSlot) { CardSlot c = (CardSlot)p; if (CurrentCard != null && LineDifference(c.line, CurrentCard.line) == 1) { if (c.Active) { c.CardClicked = clicked; } } } }); }
public void setState(GameState state) { defendingShips = new List <Ship>(); move = new Move(); var shortAlly = state.YourGameBoard.Board[Line.SHORT].ToList(); var medAlly = state.YourGameBoard.Board[Line.MEDIUM].ToList(); var longAlly = state.YourGameBoard.Board[Line.LONG].ToList(); var shortEnemy = state.EnemyGameBoard.Board[Line.SHORT].ToList(); var medEnemy = state.EnemyGameBoard.Board[Line.MEDIUM].ToList(); var longEnemy = state.EnemyGameBoard.Board[Line.LONG].ToList(); yourGrid.RemoveChildren(); enemyGrid.RemoveChildren(); List <IClickable> toRemove = new List <IClickable>(); Clickable.ForEach(p => { if (p is Card || p is CardSlot) { toRemove.Add(p); } }); foreach (var clickable in toRemove) { Clickable.Remove(clickable); } CardsToRow(shortAlly, Line.SHORT, true); CardsToRow(medAlly, Line.MEDIUM, true); CardsToRow(longAlly, Line.LONG, true); shortAlly.ForEach(p => defendingShips.Add(p)); medAlly.ForEach(p => defendingShips.Add(p)); longAlly.ForEach(p => defendingShips.Add(p)); CardsToRow(shortEnemy, Line.SHORT, false); CardsToRow(medEnemy, Line.MEDIUM, false); CardsToRow(longEnemy, Line.LONG, false); SetClickables(true); }
public override void UpdateClickables() { /*if (Game1.self.FocusedElement == null) * { * Clickable.ForEach(p => * { * if (p is Card) * { * Card c = (Card)p; * c.Status = Card.status.clear; * } * }); * }*/ Clickable.ForEach(p => { if (p is Card) { Card c = (Card)p; c.Update(); } }); }