Exemplo n.º 1
0
 private void drawHistory <T>(IReadOnlyList <T[]> history, HistoryDelegate <T> historyDelegate, Graphics g)
 {
     for (int turn = history.Count - 1; turn >= 0; turn--)
     {
         if (history[turn] != null)
         {
             for (int i = 0; i < history[turn].Length; i++)
             {
                 historyDelegate.Invoke(history[turn][i], g, turn);
             }
         }
     }
 }
Exemplo n.º 2
0
        public Render(ITurnDataModel dataModel, System.Windows.Forms.PictureBox pictureBox, IDrawer drawer)
        {
            this.PICTURE_BOX = pictureBox;
            this.DRAWER      = drawer;

            registerMoreDrawer(drawer);

            this.dataModel     = dataModel;
            pictureBox.Resize += (sender, args) => drawTurn();

            BULLET_DELEGATE = (bullet, g, turn) => DRAWER.DrawExplodedBullet(bullet, g, turn);
            MINE_DELEGATE   = (mine, g, turn) => DRAWER.DrawExplodedMine(mine, g, turn);
            REPAIR_DELEGATE = (repair, g, turn) => DRAWER.DrawRepair(repair, g, turn);
            SCAN_DELEGATE   = (scan, g, turn) => DRAWER.DrawScan(scan, g, turn);
        }
Exemplo n.º 3
0
 internal ClientState()
 {
     this.Server = String.Empty;
     this.Port = String.Empty;
     this.Nickname = String.Empty;
     this.Password = String.Empty;
     this.ControlChat = null;
     this.Clipboard = null;
     this.Video = null;
     this.ClipboardPort = null;
     this.VideoPort = null;
     this.Transmitting = false;
     this.WorkEnd = false;
     this.wChatClipboard = null;
     this.wVideo = null;
     this.Clipper = null;
     this.Reader = null;
     this.Watcher = null;
     this.dDisconnect = null;
     this.dUpdateHistory = null;
     this.dSendClipboard = null;
     this.dUpdateVideo = null;
 }
Exemplo n.º 4
0
 internal ServerState()
 {
     this.PortNumber = String.Empty;
     this.Password = String.Empty;
     this.MainPort = null;
     this.Clients = new Dictionary<String, TaskInfo>();
     this.wChatClipboard = null;
     this.Transmitting = false;
     this.WorkEnd = false;
     this.VideoOn = false;
     this.SelectingArea = false;
     this.StreamingSem = null;
     this.Spawner = null;
     this.Transfer = null;
     this.Streamer = null;
     this.Area = new Rectangle(0,0,0,0);
     this.hWnd = IntPtr.Zero;
     this.dUpdateHistory = null;
     this.dUpdateClipboard = null;
     this.dSendClipboard = null;
     this.PreviousBMP = null;
     this.CurrentBMP = null;
     this.SelectedWindowOffsetX = 0;
     this.SelectedWindowOffsetY = 0;
 }
Exemplo n.º 5
0
        /// <summary>
        /// Do a move that was initiated by the user
        /// </summary>
        /// <param name="FromX">X coordinate</param>
        /// <param name="FromY">Y coordinate</param>
        /// <param name="ToX">X coordinate</param>
        /// <param name="ToY">Y coordinate</param>
        public void UserMove(int FromX, int FromY, int ToX, int ToY)
        {
            Move m = new Move(FromX, FromY, ToX, ToY, "");
            if (_MoveChecker.IsLegalMove(m))
            {
                HistoryDelegate hd = new HistoryDelegate(_ChessInterface.AddToHistory);
                _Board.DoCastling(m);
                _Board.UpdateCastlingStatus(m);
                _Board.ApplyMove(m);
                _ChessProtocol.SendMove(m.ToString());
                string Line = "You: " + Coordinate.IndexToChess(FromX, FromY) + " > " + Coordinate.IndexToChess(ToX, ToY);

                ChangeColor();

                _ChessInterface.Invoke(hd, new object[] { Line });
                _ChessInterface.DrawPieces();
            }
            //else
            //    throw new ChessException("Illegal move!");
        }
Exemplo n.º 6
0
        /// <summary>
        /// Execute a move that was initiated by a peer
        /// </summary>
        /// <param name="m">Remote opponent sends a move</param>
        public void PeerMove(Move m)
        {
            HistoryDelegate hd = new HistoryDelegate(_ChessInterface.AddToHistory);
            string Line = "Opponent: " + Coordinate.IndexToChess(m.From.X, m.From.Y) + " > " + Coordinate.IndexToChess(m.To.X, m.To.Y);
            _Board.DoCastling(m);
            _Board.UpdateCastlingStatus(m);
            _Board.ApplyMove(m);

            ChangeColor();

            _ChessInterface.Invoke(hd, new object[] { Line });
            _ChessInterface.DrawPieces();
        }