private void DeckPictureBoxPaint(object sender, PaintEventArgs e) { GraphicContext.DrawCombSet(Game.TabGame.CombSet, e); GraphicContext.DrawDeckStatus(Game.TabGame.CellsTrancadas, Game.TabGame.CombSet, e); for (int x = 0; x == 10; x++) { for (int y = 0; y == 10; y++) { if (Game.TabGame.CombSituacao[x, y] == 1) { GraphicContext.DrawColoredCell(x, y, Game.Jogador1.CorEsc, e); } else { if (Game.TabGame.CombSituacao[x, y] == 2) { GraphicContext.DrawColoredCell(x, y, Game.Jogador2.CorEsc, e); } else { GraphicContext.DrawInnerFrameCell(x, y, Game.Jogador2.CorEsc, e); } } } } }
private void DeckPictureBoxMouseMove(object sender, MouseEventArgs e) { // Existe algum comboio selecionado? if (CombSelec != -1) { // O Jogador está a selecionar alguma célula do tabuleiro? if (GraphicContext.GetCoorX(this, DeckPictureBox) != -1 && GraphicContext.GetCoorY(this, DeckPictureBox) != -1) { // O rato mexeu-se? if (GraphicContext.GetCell(GraphicContext.GetCoorX(this, DeckPictureBox)) != mouseCellX || GraphicContext.GetCell(GraphicContext.GetCoorY(this, DeckPictureBox)) != mouseCellY) { // Reescreva as informações da célula do mouse. mouseCellX = GraphicContext.GetCell(GraphicContext.GetCoorX(this, DeckPictureBox)); mouseCellY = GraphicContext.GetCell(GraphicContext.GetCoorY(this, DeckPictureBox)); // Redesenha o Tabuleiro DeckPictureBox.Refresh(); // Mostra a cor do comboio selecionado no Tabuleiro for (int i = 0; i < ComboioTabuleiro.CombTamanho[CombSelec]; i++) { //O comboio desenhado não atravessa os limites do tabuleiro if (mouseCellX + i <= 9) { GraphicContext.DrawInnerFrameCell(mouseCellX + i, mouseCellY, CombSelec, this, DeckPictureBox); } else { break; } } } } else { // Fora dos limites do tabuleiro if (mouseCellX != -1 || mouseCellY != -1) { mouseCellX = -1; mouseCellY = -1; // Redesenha o Tabuleiro DeckPictureBox.Refresh(); } } } }
private void DeckPictureBoxMouseMove(object sender, MouseEventArgs e) { // Are we on the grid of the first deck? if (GraphicContext.GetCoorX(this, DeckPictureBox) != -1 && GraphicContext.GetCoorY(this, DeckPictureBox) != -1) { // Have the cell selected by mouse changed? if (GraphicContext.GetCell(GraphicContext.GetCoorX(this, DeckPictureBox)) != mouseCellX || GraphicContext.GetCell(GraphicContext.GetCoorY(this, DeckPictureBox)) != mouseCellY) { // Update the cell selected by mouse. mouseCellX = GraphicContext.GetCell(GraphicContext.GetCoorX(this, DeckPictureBox)); mouseCellY = GraphicContext.GetCell(GraphicContext.GetCoorY(this, DeckPictureBox)); // Repaint the first deck. DeckPictureBox.Refresh(); // Draw the outer frame of the selected cell. if (Game.SwitchJogador) { GraphicContext.DrawOuterFrameCell(mouseCellX, mouseCellY, Game.Jogador1.CorEsc, this, DeckPictureBox); } else { GraphicContext.DrawOuterFrameCell(mouseCellX, mouseCellY, Game.Jogador2.CorEsc, this, DeckPictureBox); } } } else { // Unselect the cell in the first deck. mouseCellX = -1; mouseCellY = -1; // Repaint the first deck. DeckPictureBox.Refresh(); } }
private void DeckPictureBoxPaint(object sender, PaintEventArgs e) { GraphicContext.DrawCombSet(Game.TabGame.CombSet, e); }