Пример #1
0
        public void ShotResult(ShotResult shotResult)
        {
            int  x      = shotResult.getCoordinates().X;
            int  y      = shotResult.getCoordinates().Y;
            bool result = shotResult.isHit();

            if (result)
            {
                ships[x, y].State = Ship.ShipState.HIT;
            }
            else
            {
                ships[x, y].State = Ship.ShipState.MISSED;
            }
        }
Пример #2
0
        public static String ToXMLString(ShotResult shotResult)
        {
            String result = "<shotResult isNull=\"";
            if (shotResult == null)
                result += "true\"";
            else
            {
                result += "false\"";
                result += " isHit=\"" + (shotResult.isHit() ? "true" : "false") + "\"";
                result += " isSunk=\"" + (shotResult.isSunk() ? "true" : "false") + "\"";
                result += " isGameEnded=\"" + (shotResult.isGameEnded() ? "true" : "false") + "\"";
                result += " matrix=\"";
                result += ((shotResult.getMatrix() == null) ? "null" : Global.boolArrayToString(shotResult.getMatrix())) + "\"";
            }

            result += ">" + Coordinates.ToXMLString(shotResult.getCoordinates()) + "</shotResult>";
            return result;
        }
Пример #3
0
        public static String ToXMLString(ShotResult shotResult)
        {
            String result = "<shotResult isNull=\"";

            if (shotResult == null)
            {
                result += "true\"";
            }
            else
            {
                result += "false\"";
                result += " isHit=\"" + (shotResult.isHit() ? "true" : "false") + "\"";
                result += " isSunk=\"" + (shotResult.isSunk() ? "true" : "false") + "\"";
                result += " isGameEnded=\"" + (shotResult.isGameEnded() ? "true" : "false") + "\"";
                result += " matrix=\"";
                result += ((shotResult.getMatrix() == null) ? "null" : Global.boolArrayToString(shotResult.getMatrix())) + "\"";
            }

            result += ">" + Coordinates.ToXMLString(shotResult.getCoordinates()) + "</shotResult>";
            return(result);
        }
Пример #4
0
        public void ShotResult(ShotResult shotResult)
        {
            int x = shotResult.getCoordinates().X;
            int y = shotResult.getCoordinates().Y;
            bool result = shotResult.isHit();

            if (result)
                ships[x, y].State = Ship.ShipState.HIT;
            else
                ships[x, y].State = Ship.ShipState.MISSED;
        }