A buffer is a linear, finite sequence of elements of a specific
+ * primitive type. Aside from its content, the essential properties of a
+ * buffer are its capacity, limit, and position:
+ *
+ *
+ *
+ *
A buffer's capacity is the number of elements it contains. The
+ * capacity of a buffer is never negative and never changes.
+ *
+ *
A buffer's limit is the index of the first element that should
+ * not be read or written. A buffer's limit is never negative and is never
+ * greater than its capacity.
+ *
+ *
A buffer's position is the index of the next element to be
+ * read or written. A buffer's position is never negative and is never
+ * greater than its limit.
+ *
+ *
+ *
+ *
There is one subclass of this class for each non-boolean primitive type.
+ *
+ *
+ *
Transferring data
+ *
+ *
Each subclass of this class defines two categories of get and
+ * put operations:
+ *
+ *
+ *
+ *
Relative operations read or write one or more elements starting
+ * at the current position and then increment the position by the number of
+ * elements transferred. If the requested transfer exceeds the limit then a
+ * relative get operation throws a {@link BufferUnderflowException}
+ * and a relative put operation throws a {@link
+ * BufferOverflowException}; in either case, no data is transferred.
+ *
+ *
Absolute operations take an explicit element index and do not
+ * affect the position. Absolute get and put operations throw
+ * an {@link IndexOutOfBoundsException} if the index argument exceeds the
+ * limit.
+ *
+ *
+ *
+ *
Data may also, of course, be transferred in to or out of a buffer by the
+ * I/O operations of an appropriate channel, which are always relative to the
+ * current position.
+ *
+ *
+ *
Marking and resetting
+ *
+ *
A buffer's mark is the index to which its position will be reset
+ * when the {@link #reset reset} method is invoked. The mark is not always
+ * defined, but when it is defined it is never negative and is never greater
+ * than the position. If the mark is defined then it is discarded when the
+ * position or the limit is adjusted to a value smaller than the mark. If the
+ * mark is not defined then invoking the {@link #reset reset} method causes an
+ * {@link InvalidMarkException} to be thrown.
+ *
+ *
+ *
Invariants
+ *
+ *
The following invariant holds for the mark, position, limit, and
+ * capacity values:
+ *
+ *
A newly-created buffer always has a position of zero and a mark that is
+ * undefined. The initial limit may be zero, or it may be some other value
+ * that depends upon the type of the buffer and the manner in which it is
+ * constructed. The initial content of a buffer is, in general,
+ * undefined.
+ *
+ *
+ *
Clearing, flipping, and rewinding
+ *
+ *
In addition to methods for accessing the position, limit, and capacity
+ * values and for marking and resetting, this class also defines the following
+ * operations upon buffers:
+ *
+ *
+ *
+ *
{@link #clear} makes a buffer ready for a new sequence of
+ * channel-read or relative put operations: It sets the limit to the
+ * capacity and the position to zero.
+ *
+ *
{@link #flip} makes a buffer ready for a new sequence of
+ * channel-write or relative get operations: It sets the limit to the
+ * current position and then sets the position to zero.
+ *
+ *
{@link #rewind} makes a buffer ready for re-reading the data that
+ * it already contains: It leaves the limit unchanged and sets the position
+ * to zero.
+ *
+ *
+ *
+ *
+ *
Read-only buffers
+ *
+ *
Every buffer is readable, but not every buffer is writable. The
+ * mutation methods of each buffer class are specified as optional
+ * operations that will throw a {@link ReadOnlyBufferException} when
+ * invoked upon a read-only buffer. A read-only buffer does not allow its
+ * content to be changed, but its mark, position, and limit values are mutable.
+ * Whether or not a buffer is read-only may be determined by invoking its
+ * {@link #isReadOnly isReadOnly} method.
+ *
+ *
+ *
Thread safety
+ *
+ *
Buffers are not safe for use by multiple concurrent threads. If a
+ * buffer is to be used by more than one thread then access to the buffer
+ * should be controlled by appropriate synchronization.
+ *
+ *
+ *
Invocation chaining
+ *
+ *
Methods in this class that do not otherwise have a value to return are
+ * specified to return the buffer upon which they are invoked. This allows
+ * method invocations to be chained; for example, the sequence of statements
+ *
+ *
+ *
+ * can be replaced by the single, more compact statement
+ *
+ *
+ * b.flip().position(23).limit(42);
+ *
+ *
+ * @author Mark Reinhold
+ * @author JSR-51 Expert Group
+ * @version 1.35, 06/08/11
+ * @since 1.4
+ */
+
+ ///
+ [RobocodeInternalPermission(SecurityAction.LinkDemand)]
+ public abstract class Buffer
+ {
+ // Invariants: mark <= position <= limit <= capacity
+ private readonly int _capacity;
+ private int _limit;
+ private int _mark = -1;
+ private int _position;
+
+ // Creates a new buffer with the given mark, position, limit, and capacity,
+ // after checking invariants.
+ //
+ protected Buffer(int mark, int pos, int lim, int cap)
+ {
+ // package-private
+ if (cap < 0)
+ throw new ArgumentException();
+ _capacity = cap;
+ limit(lim);
+ position(pos);
+ if (mark >= 0)
+ {
+ if (mark > pos)
+ throw new ArgumentException();
+ _mark = mark;
+ }
+ }
+
+ /*
+ * Returns this buffer's capacity.
+ *
+ * @return The capacity of this buffer
+ */
+ public int capacity()
+ {
+ return _capacity;
+ }
+
+ /*
+ * Returns this buffer's position.
+ *
+ * @return The position of this buffer
+ */
+ public int position()
+ {
+ return _position;
+ }
+
+ /*
+ * Sets this buffer's position. If the mark is defined and larger than the
+ * new position then it is discarded.
+ *
+ * @param newPosition
+ * The new position value; must be non-negative
+ * and no larger than the current limit
+ *
+ * @return This buffer
+ *
+ * @throws ArgumentException
+ * If the preconditions on newPosition do not hold
+ */
+ public Buffer position(int newPosition)
+ {
+ if ((newPosition > _limit) || (newPosition < 0))
+ throw new ArgumentException();
+ _position = newPosition;
+ if (_mark > _position) _mark = -1;
+ return this;
+ }
+
+ /*
+ * Returns this buffer's limit.
+ *
+ * @return The limit of this buffer
+ */
+ public int limit()
+ {
+ return _limit;
+ }
+
+ /*
+ * Sets this buffer's limit. If the position is larger than the new limit
+ * then it is set to the new limit. If the mark is defined and larger than
+ * the new limit then it is discarded.
+ *
+ * @param newLimit
+ * The new limit value; must be non-negative
+ * and no larger than this buffer's capacity
+ *
+ * @return This buffer
+ *
+ * @throws ArgumentException
+ * If the preconditions on newLimit do not hold
+ */
+ public Buffer limit(int newLimit)
+ {
+ if ((newLimit > _capacity) || (newLimit < 0))
+ throw new ArgumentException();
+ _limit = newLimit;
+ if (_position > _limit) _position = _limit;
+ if (_mark > _limit) _mark = -1;
+ return this;
+ }
+
+ /*
+ * Sets this buffer's mark at its position.
+ *
+ * @return This buffer
+ */
+ public Buffer mark()
+ {
+ _mark = _position;
+ return this;
+ }
+
+ /*
+ * Resets this buffer's position to the previously-marked position.
+ *
+ *
Invoking this method neither changes nor discards the mark's
+ * value.
+ *
+ * @return This buffer
+ *
+ * @throws InvalidMarkException
+ * If the mark has not been set
+ */
+ public Buffer reset()
+ {
+ int m = _mark;
+ if (m < 0)
+ throw new InvalidMarkException();
+ _position = m;
+ return this;
+ }
+
+ /*
+ * Clears this buffer. The position is set to zero, the limit is set to
+ * the capacity, and the mark is discarded.
+ *
+ *
Invoke this method before using a sequence of channel-read or
+ * put operations to fill this buffer. For example:
+ *
+ *
+ * buf.clear(); // Prepare buffer for reading
+ * in.read(buf); // Read data
+ *
+ *
This method does not actually erase the data in the buffer, but it
+ * is named as if it did because it will most often be used in situations
+ * in which that might as well be the case.
+ *
+ * @return This buffer
+ */
+ public Buffer clear()
+ {
+ _position = 0;
+ _limit = _capacity;
+ _mark = -1;
+ return this;
+ }
+
+ /*
+ * Flips this buffer. The limit is set to the current position and then
+ * the position is set to zero. If the mark is defined then it is
+ * discarded.
+ *
+ *
After a sequence of channel-read or put operations, invoke
+ * this method to prepare for a sequence of channel-write or relative
+ * get operations. For example:
+ *
+ *
+ * buf.put(magic); // Prepend header
+ * in.read(buf); // Read data into rest of buffer
+ * buf.flip(); // Flip buffer
+ * out.write(buf); // Write header + data to channel
+ *
+ *
This method is often used in conjunction with the {@link
+ * java.nio.ByteBuffer#compact compact} method when transferring data from
+ * one place to another.
+ *
+ * @return This buffer
+ */
+ public Buffer flip()
+ {
+ _limit = _position;
+ _position = 0;
+ _mark = -1;
+ return this;
+ }
+
+ /*
+ * Rewinds this buffer. The position is set to zero and the mark is
+ * discarded.
+ *
+ *
Invoke this method before a sequence of channel-write or get
+ * operations, assuming that the limit has already been set
+ * appropriately. For example:
+ *
+ *
+ * out.write(buf); // Write remaining data
+ * buf.rewind(); // Rewind buffer
+ * buf.get(array); // Copy data into array
+ *
+ * @return This buffer
+ */
+ public Buffer rewind()
+ {
+ _position = 0;
+ _mark = -1;
+ return this;
+ }
+
+ /*
+ * Returns the number of elements between the current position and the
+ * limit.
+ *
+ * @return The number of elements remaining in this buffer
+ */
+ public int remaining()
+ {
+ return _limit - _position;
+ }
+
+ /*
+ * Tells whether there are any elements between the current position and
+ * the limit.
+ *
+ * @return true if, and only if, there is at least one element
+ * remaining in this buffer
+ */
+ public bool hasRemaining()
+ {
+ return _position < _limit;
+ }
+
+ /*
+ * Tells whether or not this buffer is read-only.
+ *
+ * @return true if, and only if, this buffer is read-only
+ */
+ public abstract bool isReadOnly();
+
+
+ // -- Package-private methods for bounds checking, etc. --
+
+ /*
+ * Checks the current position against the limit, throwing a {@link
+ * BufferUnderflowException} if it is not smaller than the limit, and then
+ * increments the position.
+ *
+ * @return The current position value, before it is incremented
+ */
+ internal int nextGetIndex()
+ {
+ // package-private
+ if (_position >= _limit)
+ throw new BufferUnderflowException();
+ return _position++;
+ }
+
+ internal int nextGetIndex(int nb)
+ {
+ // package-private
+ if (_limit - _position < nb)
+ throw new BufferUnderflowException();
+ int p = _position;
+ _position += nb;
+ return p;
+ }
+
+ /*
+ * Checks the current position against the limit, throwing a {@link
+ * BufferOverflowException} if it is not smaller than the limit, and then
+ * increments the position.
+ *
+ * @return The current position value, before it is incremented
+ */
+ internal int nextPutIndex()
+ {
+ // package-private
+ if (_position >= _limit)
+ throw new BufferOverflowException();
+ return _position++;
+ }
+
+ internal int nextPutIndex(int nb)
+ {
+ // package-private
+ if (_limit - _position < nb)
+ throw new BufferOverflowException();
+ int p = _position;
+ _position += nb;
+ return p;
+ }
+
+ /*
+ * Checks the given index against the limit, throwing an {@link
+ * IndexOutOfBoundsException} if it is not smaller than the limit
+ * or is smaller than zero.
+ */
+ internal int checkIndex(int i)
+ {
+ // package-private
+ if ((i < 0) || (i >= _limit))
+ throw new IndexOutOfRangeException();
+ return i;
+ }
+
+ internal int checkIndex(int i, int nb)
+ {
+ // package-private
+ if ((i < 0) || (nb > _limit - i))
+ throw new IndexOutOfRangeException();
+ return i;
+ }
+
+ internal int markValue()
+ {
+ // package-private
+ return _mark;
+ }
+
+ internal void discardMark()
+ {
+ // package-private
+ _mark = -1;
+ }
+
+ internal static void checkBounds(int off, int len, int size)
+ {
+ // package-private
+ if ((off | len | (off + len) | (size - (off + len))) < 0)
+ throw new IndexOutOfRangeException();
+ }
+ }
+#pragma warning restore 1591
+}
+
+// ReSharper restore InconsistentNaming
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/nio/ByteBuffer.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/nio/ByteBuffer.cs
new file mode 100644
index 0000000..761a59f
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/nio/ByteBuffer.cs
@@ -0,0 +1,1604 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+
+
+// This class is based on the source code from Sun's Java 1.5.0 API for java.nio.ByteBuffer, but
+// rewritten for C# and .NET with the purpose to bridge the .NET and Java internals of Robocode.
+
+using System;
+using System.Security.Permissions;
+using System.Text;
+using net.sf.robocode.security;
+
+// ReSharper disable InconsistentNaming
+
+namespace net.sf.robocode.nio
+{
+#pragma warning disable 1591
+#pragma warning disable 1570
+ ///
+ public enum ByteOrder
+ {
+ BIG_ENDIAN,
+ LITTLE_ENDIAN,
+ }
+
+ /*
+ * A byte buffer.
+ *
+ *
This class defines six categories of operations upon
+ * byte buffers:
+ *
+ *
+ *
+ *
Absolute and relative {@link #get() get} and
+ * {@link #put(byte) put} methods that read and write
+ * single bytes;
+ *
+ *
Relative {@link #get(byte[]) bulk get}
+ * methods that transfer contiguous sequences of bytes from this buffer
+ * into an array;
+ *
+ *
Relative {@link #put(byte[]) bulk put}
+ * methods that transfer contiguous sequences of bytes from a
+ * byte array or some other byte
+ * buffer into this buffer;
+ *
+ *
+ *
Absolute and relative {@link #getChar() get}
+ * and {@link #putChar(char) put} methods that read and
+ * write values of other primitive types, translating them to and from
+ * sequences of bytes in a particular byte order;
+ *
+ *
Methods for creating view buffers,
+ * which allow a byte buffer to be viewed as a buffer containing values of
+ * some other primitive type; and
+ *
+ *
+ *
Methods for {@link #compact compacting}, {@link
+ * #duplicate duplicating}, and {@link #slice
+ * slicing} a byte buffer.
+ *
+ *
+ *
+ *
Byte buffers can be created either by {@link #allocate
+ * allocation}, which allocates space for the buffer's
+ *
+ *
+ * content, or by {@link #wrap(byte[]) wrapping} an
+ * existing byte array into a buffer.
+ *
+ *
+ *
+ *
+ *
mapping} a region of a file
+ * directly into memory. An implementation of the Java platform may optionally
+ * support the creation of direct byte buffers from native code via JNI. If an
+ * instance of one of these kinds of buffers refers to an inaccessible region
+ * of memory then an attempt to access that region will not change the buffer's
+ * content and will cause an unspecified exception to be thrown either at the
+ * time of the access or at some later time.
+ *
+ *
Whether a byte buffer is direct or non-direct may be determined by
+ * invoking its {@link #isDirect isDirect} method. This method is provided so
+ * that explicit buffer management can be done in performance-critical code.
+ *
+ *
+ *
+ *
+ *
+ * @param capacity
+ * The new buffer's capacity, in bytes
+ *
+ * @return The new byte buffer
+ *
+ * @throws ArgumentException
+ * If the capacity is a negative integer
+ */
+
+ public static ByteBuffer allocateDirect(int capacity)
+ {
+ if (capacity < 0)
+ throw new ArgumentException();
+ return new HeapByteBuffer(capacity, capacity);
+ }
+
+
+ /*
+ * Allocates a new byte buffer.
+ *
+ *
The new buffer's position will be zero, its limit will be its
+ * capacity, and its mark will be undefined. It will have a {@link #array
+ * backing array}, and its {@link #arrayOffset array
+ * offset} will be zero.
+ *
+ * @param capacity
+ * The new buffer's capacity, in bytes
+ *
+ * @return The new byte buffer
+ *
+ * @throws ArgumentException
+ * If the capacity is a negative integer
+ */
+
+ public static ByteBuffer allocate(int capacity)
+ {
+ if (capacity < 0)
+ throw new ArgumentException();
+ return new HeapByteBuffer(capacity, capacity);
+ }
+
+ /*
+ * Wraps a byte array into a buffer.
+ *
+ *
The new buffer will be backed by the given byte array;
+ * that is, modifications to the buffer will cause the array to be modified
+ * and vice versa. The new buffer's capacity will be
+ * array.length, its position will be offset, its limit
+ * will be offset + length, and its mark will be undefined. Its
+ * {@link #array
backing array} will be the given array, and
+ * its {@link #arrayOffset array offset} will be zero.
+ *
+ * @param array
+ * The array that will back the new buffer
+ *
+ * @param offset
+ * The offset of the subarray to be used; must be non-negative and
+ * no larger than array.length. The new buffer's position
+ * will be set to this value.
+ *
+ * @param length
+ * The length of the subarray to be used;
+ * must be non-negative and no larger than
+ * array.length - offset.
+ * The new buffer's limit will be set to offset + length.
+ *
+ * @return The new byte buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the offset and length
+ * parameters do not hold
+ */
+
+ public static ByteBuffer wrap(byte[] array,
+ int offset, int length)
+ {
+ try
+ {
+ return new HeapByteBuffer(array, offset, length);
+ }
+ catch (ArgumentException)
+ {
+ throw new IndexOutOfRangeException();
+ }
+ }
+
+ /*
+ * Wraps a byte array into a buffer.
+ *
+ *
The new buffer will be backed by the given byte array;
+ * that is, modifications to the buffer will cause the array to be modified
+ * and vice versa. The new buffer's capacity and limit will be
+ * array.length, its position will be zero, and its mark will be
+ * undefined. Its {@link #array backing array} will be the
+ * given array, and its {@link #arrayOffset array offset} will
+ * be zero.
+ *
+ * @param array
+ * The array that will back this buffer
+ *
+ * @return The new byte buffer
+ */
+
+ public static ByteBuffer wrap(byte[] array)
+ {
+ return wrap(array, 0, array.Length);
+ }
+
+
+ /*
+ * Creates a new byte buffer whose content is a shared subsequence of
+ * this buffer's content.
+ *
+ *
The content of the new buffer will start at this buffer's current
+ * position. Changes to this buffer's content will be visible in the new
+ * buffer, and vice versa; the two buffers' position, limit, and mark
+ * values will be independent.
+ *
+ *
The new buffer's position will be zero, its capacity and its limit
+ * will be the number of bytes remaining in this buffer, and its mark
+ * will be undefined. The new buffer will be direct if, and only if, this
+ * buffer is direct, and it will be read-only if, and only if, this buffer
+ * is read-only.
+ *
+ * @return The new byte buffer
+ */
+ public abstract ByteBuffer slice();
+
+ /*
+ * Creates a new byte buffer that shares this buffer's content.
+ *
+ *
The content of the new buffer will be that of this buffer. Changes
+ * to this buffer's content will be visible in the new buffer, and vice
+ * versa; the two buffers' position, limit, and mark values will be
+ * independent.
+ *
+ *
The new buffer's capacity, limit, position, and mark values will be
+ * identical to those of this buffer. The new buffer will be direct if,
+ * and only if, this buffer is direct, and it will be read-only if, and
+ * only if, this buffer is read-only.
+ *
+ * @return The new byte buffer
+ */
+ public abstract ByteBuffer duplicate();
+
+ /*
+ * Creates a new, read-only byte buffer that shares this buffer's
+ * content.
+ *
+ *
The content of the new buffer will be that of this buffer. Changes
+ * to this buffer's content will be visible in the new buffer; the new
+ * buffer itself, however, will be read-only and will not allow the shared
+ * content to be modified. The two buffers' position, limit, and mark
+ * values will be independent.
+ *
+ *
The new buffer's capacity, limit, position, and mark values will be
+ * identical to those of this buffer.
+ *
+ *
If this buffer is itself read-only then this method behaves in
+ * exactly the same way as the {@link #duplicate duplicate} method.
+ *
+ * @return The new, read-only byte buffer
+ */
+ public abstract ByteBuffer asReadOnlyBuffer();
+
+
+ // -- Singleton get/put methods --
+
+ /*
+ * Relative get method. Reads the byte at this buffer's
+ * current position, and then increments the position.
+ *
+ * @return The byte at the buffer's current position
+ *
+ * @throws BufferUnderflowException
+ * If the buffer's current position is not smaller than its limit
+ */
+ public abstract byte get();
+
+ /*
+ * Relative put method (optional operation).
+ *
+ *
Writes the given byte into this buffer at the current
+ * position, and then increments the position.
+ *
+ * @param b
+ * The byte to be written
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If this buffer's current position is not smaller than its limit
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public abstract ByteBuffer put(byte b);
+
+ /*
+ * Absolute get method. Reads the byte at the given
+ * index.
+ *
+ * @param index
+ * The index from which the byte will be read
+ *
+ * @return The byte at the given index
+ *
+ * @throws IndexOutOfBoundsException
+ * If index is negative
+ * or not smaller than the buffer's limit
+ */
+ public abstract byte get(int index);
+
+ /*
+ * Absolute put method (optional operation).
+ *
+ *
Writes the given byte into this buffer at the given
+ * index.
+ *
+ * @param index
+ * The index at which the byte will be written
+ *
+ * @param b
+ * The byte value to be written
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If index is negative
+ * or not smaller than the buffer's limit
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public abstract ByteBuffer put(int index, byte b);
+
+
+ // -- Bulk get operations --
+
+ /*
+ * Relative bulk get method.
+ *
+ *
This method transfers bytes from this buffer into the given
+ * destination array. If there are fewer bytes remaining in the
+ * buffer than are required to satisfy the request, that is, if
+ * length>remaining(), then no
+ * bytes are transferred and a {@link BufferUnderflowException} is
+ * thrown.
+ *
+ *
Otherwise, this method copies length bytes from this
+ * buffer into the given array, starting at the current position of this
+ * buffer and at the given offset in the array. The position of this
+ * buffer is then incremented by length.
+ *
+ *
In other words, an invocation of this method of the form
+ * src.get(dst, off, len) has exactly the same effect as
+ * the loop
+ *
+ *
+ * for (int i = off; i < off + len; i++)
+ * dst[i] = src.get();
+ *
+ * except that it first checks that there are sufficient bytes in
+ * this buffer and it is potentially much more efficient.
+ *
+ * @param dst
+ * The array into which bytes are to be written
+ *
+ * @param offset
+ * The offset within the array of the first byte to be
+ * written; must be non-negative and no larger than
+ * dst.length
+ *
+ * @param length
+ * The maximum number of bytes to be written to the given
+ * array; must be non-negative and no larger than
+ * dst.length - offset
+ *
+ * @return This buffer
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than length bytes
+ * remaining in this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the offset and length
+ * parameters do not hold
+ */
+
+ public virtual ByteBuffer get(byte[] dst, int offset, int length)
+ {
+ checkBounds(offset, length, dst.Length);
+ if (length > remaining())
+ throw new BufferUnderflowException();
+ int end = offset + length;
+ for (int i = offset; i < end; i++)
+ dst[i] = get();
+ return this;
+ }
+
+ /*
+ * Relative bulk get method.
+ *
+ *
This method transfers bytes from this buffer into the given
+ * destination array. An invocation of this method of the form
+ * src.get(a) behaves in exactly the same way as the invocation
+ *
+ *
+ * src.get(a, 0, a.length)
+ *
+ * @return This buffer
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than length bytes
+ * remaining in this buffer
+ */
+
+ public ByteBuffer get(byte[] dst)
+ {
+ return get(dst, 0, dst.Length);
+ }
+
+
+ // -- Bulk put operations --
+
+ /*
+ * Relative bulk put method (optional operation).
+ *
+ *
This method transfers the bytes remaining in the given source
+ * buffer into this buffer. If there are more bytes remaining in the
+ * source buffer than in this buffer, that is, if
+ * src.remaining()>remaining(),
+ * then no bytes are transferred and a {@link
+ * BufferOverflowException} is thrown.
+ *
+ *
Otherwise, this method copies
+ * n = src.remaining() bytes from the given
+ * buffer into this buffer, starting at each buffer's current position.
+ * The positions of both buffers are then incremented by n.
+ *
+ *
In other words, an invocation of this method of the form
+ * dst.put(src) has exactly the same effect as the loop
+ *
+ *
+ * while (src.hasRemaining())
+ * dst.put(src.get());
+ *
+ * except that it first checks that there is sufficient space in this
+ * buffer and it is potentially much more efficient.
+ *
+ * @param src
+ * The source buffer from which bytes are to be read;
+ * must not be this buffer
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ * for the remaining bytes in the source buffer
+ *
+ * @throws ArgumentException
+ * If the source buffer is this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+
+ public virtual ByteBuffer put(ByteBuffer src)
+ {
+ if (src == this)
+ throw new ArgumentException();
+ int n = src.remaining();
+ if (n > remaining())
+ throw new BufferOverflowException();
+ for (int i = 0; i < n; i++)
+ put(src.get());
+ return this;
+ }
+
+ /*
+ * Relative bulk put method (optional operation).
+ *
+ *
This method transfers bytes into this buffer from the given
+ * source array. If there are more bytes to be copied from the array
+ * than remain in this buffer, that is, if
+ * length>remaining(), then no
+ * bytes are transferred and a {@link BufferOverflowException} is
+ * thrown.
+ *
+ *
Otherwise, this method copies length bytes from the
+ * given array into this buffer, starting at the given offset in the array
+ * and at the current position of this buffer. The position of this buffer
+ * is then incremented by length.
+ *
+ *
In other words, an invocation of this method of the form
+ * dst.put(src, off, len) has exactly the same effect as
+ * the loop
+ *
+ *
+ * for (int i = off; i < off + len; i++)
+ * dst.put(a[i]);
+ *
+ * except that it first checks that there is sufficient space in this
+ * buffer and it is potentially much more efficient.
+ *
+ * @param src
+ * The array from which bytes are to be read
+ *
+ * @param offset
+ * The offset within the array of the first byte to be read;
+ * must be non-negative and no larger than array.length
+ *
+ * @param length
+ * The number of bytes to be read from the given array;
+ * must be non-negative and no larger than
+ * array.length - offset
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the offset and length
+ * parameters do not hold
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+
+ public virtual ByteBuffer put(byte[] src, int offset, int length)
+ {
+ checkBounds(offset, length, src.Length);
+ if (length > remaining())
+ throw new BufferOverflowException();
+ int end = offset + length;
+ for (int i = offset; i < end; i++)
+ put(src[i]);
+ return this;
+ }
+
+ /*
+ * Relative bulk put method (optional operation).
+ *
+ *
This method transfers the entire content of the given source
+ * byte array into this buffer. An invocation of this method of the
+ * form dst.put(a) behaves in exactly the same way as the
+ * invocation
+ *
+ *
+ * dst.put(a, 0, a.length)
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+
+ public ByteBuffer put(byte[] src)
+ {
+ return put(src, 0, src.Length);
+ }
+
+
+ // -- Other stuff --
+
+ /*
+ * Tells whether or not this buffer is backed by an accessible byte
+ * array.
+ *
+ *
If this method returns true then the {@link #array() array}
+ * and {@link #arrayOffset() arrayOffset} methods may safely be invoked.
+ *
+ *
+ * @return true if, and only if, this buffer
+ * is backed by an array and is not read-only
+ */
+
+ public bool hasArray()
+ {
+ return (hb != null);
+ }
+
+ /*
+ * Returns the byte array that backs this
+ * buffer (optional operation).
+ *
+ *
Modifications to this buffer's content will cause the returned
+ * array's content to be modified, and vice versa.
+ *
+ *
Invoke the {@link #hasArray hasArray} method before invoking this
+ * method in order to ensure that this buffer has an accessible backing
+ * array.
+ *
+ * @return The array that backs this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is backed by an array but is read-only
+ *
+ * @throws UnsupportedOperationException
+ * If this buffer is not backed by an accessible array
+ */
+
+ public byte[] array()
+ {
+ if (hb == null)
+ throw new NotSupportedException();
+ return hb;
+ }
+
+ /*
+ * Returns the offset within this buffer's backing array of the first
+ * element of the buffer (optional operation).
+ *
+ *
If this buffer is backed by an array then buffer position p
+ * corresponds to array index p + arrayOffset().
+ *
+ *
Invoke the {@link #hasArray hasArray} method before invoking this
+ * method in order to ensure that this buffer has an accessible backing
+ * array.
+ *
+ * @return The offset within this buffer's array
+ * of the first element of the buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is backed by an array but is read-only
+ *
+ * @throws UnsupportedOperationException
+ * If this buffer is not backed by an accessible array
+ */
+
+ public int arrayOffset()
+ {
+ if (hb == null)
+ throw new NotSupportedException();
+ return _offset;
+ }
+
+ /*
+ * Compacts this buffer (optional operation).
+ *
+ *
The bytes between the buffer's current position and its limit,
+ * if any, are copied to the beginning of the buffer. That is, the
+ * byte at index p = position() is copied
+ * to index zero, the byte at index p + 1 is copied
+ * to index one, and so forth until the byte at index
+ * limit() - 1 is copied to index
+ * n = limit() - 1 - p.
+ * The buffer's position is then set to n+1 and its limit is set to
+ * its capacity. The mark, if defined, is discarded.
+ *
+ *
The buffer's position is set to the number of bytes copied,
+ * rather than to zero, so that an invocation of this method can be
+ * followed immediately by an invocation of another relative put
+ * method.
+ *
+
+ *
+ *
Invoke this method after writing data from a buffer in case the
+ * write was incomplete. The following loop, for example, copies bytes
+ * from one channel to another via the buffer buf:
+ *
+ *
+ * buf.clear(); // Prepare buffer for use
+ * for (;;) {
+ * if (in.read(buf) < 0 && !buf.hasRemaining())
+ * break; // No more bytes to transfer
+ * buf.flip();
+ * out.write(buf);
+ * buf.compact(); // In case of partial write
+ * }
+ *
+
+ *
+ * @return This buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public abstract ByteBuffer compact();
+
+ /*
+ * Tells whether or not this byte buffer is direct.
+ *
+ * @return true if, and only if, this buffer is direct
+ */
+ public abstract bool isDirect();
+
+
+ /*
+ * Returns a string summarizing the state of this buffer.
+ *
+ * @return A summary string
+ */
+
+ public String toString()
+ {
+ var sb = new StringBuilder();
+ sb.Append(GetType().Name);
+ sb.Append("[pos=");
+ sb.Append(position());
+ sb.Append(" lim=");
+ sb.Append(limit());
+ sb.Append(" cap=");
+ sb.Append(capacity());
+ sb.Append("]");
+ return sb.ToString();
+ }
+
+
+ /*
+ * Returns the current hash code of this buffer.
+ *
+ *
The hash code of a byte buffer depends only upon its remaining
+ * elements; that is, upon the elements from position() up to, and
+ * including, the element at limit() - 1.
+ *
+ *
Because buffer hash codes are content-dependent, it is inadvisable
+ * to use buffers as keys in hash maps or similar data structures unless it
+ * is known that their contents will not change.
+ *
+ * @return The current hash code of this buffer
+ */
+
+ public int hashCode()
+ {
+ int h = 1;
+ int p = position();
+ for (int i = limit() - 1; i >= p; i--)
+ h = 31*h + get(i);
+ return h;
+ }
+
+ /*
+ * Tells whether or not this buffer is equal to another object.
+ *
+ *
Two byte buffers are equal if, and only if,
+ *
+ *
+ *
+ *
They have the same element type,
+ *
+ *
They have the same number of remaining elements, and
+ *
+ *
+ *
The two sequences of remaining elements, considered
+ * independently of their starting positions, are pointwise equal.
+ *
+ *
+ *
+ *
+ *
A byte buffer is not equal to any other type of object.
+ *
+ * @param ob The object to which this buffer is to be compared
+ *
+ * @return true if, and only if, this buffer is equal to the
+ * given object
+ */
+
+ public bool equals(object ob)
+ {
+ if (!(ob is ByteBuffer))
+ return false;
+ var that = (ByteBuffer) ob;
+ if (remaining() != that.remaining())
+ return false;
+ int p = position();
+ for (int i = limit() - 1, j = that.limit() - 1; i >= p; i--, j--)
+ {
+ byte v1 = get(i);
+ byte v2 = that.get(j);
+ if (v1 != v2)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /*
+ * Compares this buffer to another.
+ *
+ *
Two byte buffers are compared by comparing their sequences of
+ * remaining elements lexicographically, without regard to the starting
+ * position of each sequence within its corresponding buffer.
+ *
+ *
A byte buffer is not comparable to any other type of object.
+ *
+ * @return A negative integer, zero, or a positive integer as this buffer
+ * is less than, equal to, or greater than the given buffer
+ */
+
+ public int compareTo(ByteBuffer that)
+ {
+ int n = position() + Math.Min(remaining(), that.remaining());
+ for (int i = position(), j = that.position(); i < n; i++, j++)
+ {
+ byte v1 = get(i);
+ byte v2 = that.get(j);
+ if (v1 == v2)
+ continue;
+ if (v1 < v2)
+ return -1;
+ return +1;
+ }
+ return remaining() - that.remaining();
+ }
+
+
+ // -- Other char stuff --
+
+
+ // -- Other byte stuff: Access to binary data --
+
+
+ //= (Bits.byteOrder() == ByteOrder.BIG_ENDIAN);
+
+ /*
+ * Retrieves this buffer's byte order.
+ *
+ *
The byte order is used when reading or writing multibyte values, and
+ * when creating buffers that are views of this byte buffer. The order of
+ * a newly-created byte buffer is always {@link ByteOrder#BIG_ENDIAN
+ * BIG_ENDIAN}.
+ *
+ * @return This buffer's byte order
+ */
+
+ public ByteOrder order()
+ {
+ return bigEndian ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN;
+ }
+
+ /*
+ * Modifies this buffer's byte order.
+ *
+ * @param bo
+ * The new byte order,
+ * either {@link ByteOrder#BIG_ENDIAN BIG_ENDIAN}
+ * or {@link ByteOrder#LITTLE_ENDIAN LITTLE_ENDIAN}
+ *
+ * @return This buffer
+ */
+
+ public ByteBuffer order(ByteOrder bo)
+ {
+ bigEndian = (bo == ByteOrder.BIG_ENDIAN);
+ nativeByteOrder =
+ (bigEndian == (!BitConverter.IsLittleEndian));
+ return this;
+ }
+
+ // Unchecked accessors, for use by ByteBufferAs-X-Buffer classes
+ //
+ internal abstract byte _get(int i); // package-private
+ internal abstract void _put(int i, byte b); // package-private
+
+
+ /*
+ * Relative get method for reading a char value.
+ *
+ *
Reads the next two bytes at this buffer's current position,
+ * composing them into a char value according to the current byte order,
+ * and then increments the position by two.
+ *
+ * @return The char value at the buffer's current position
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than two bytes
+ * remaining in this buffer
+ */
+ public abstract char getChar();
+
+ /*
+ * Relative put method for writing a char
+ * value (optional operation).
+ *
+ *
Writes two bytes containing the given char value, in the
+ * current byte order, into this buffer at the current position, and then
+ * increments the position by two.
+ *
+ * @param value
+ * The char value to be written
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there are fewer than two bytes
+ * remaining in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public abstract ByteBuffer putChar(char value);
+
+ /*
+ * Absolute get method for reading a char value.
+ *
+ *
Reads two bytes at the given index, composing them into a
+ * char value according to the current byte order.
+ *
+ * @param index
+ * The index from which the bytes will be read
+ *
+ * @return The char value at the given index
+ *
+ * @throws IndexOutOfBoundsException
+ * If index is negative
+ * or not smaller than the buffer's limit,
+ * minus one
+ */
+ public abstract char getChar(int index);
+
+ /*
+ * Absolute put method for writing a char
+ * value (optional operation).
+ *
+ *
Writes two bytes containing the given char value, in the
+ * current byte order, into this buffer at the given index.
+ *
+ * @param index
+ * The index at which the bytes will be written
+ *
+ * @param value
+ * The char value to be written
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If index is negative
+ * or not smaller than the buffer's limit,
+ * minus one
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public abstract ByteBuffer putChar(int index, char value);
+
+ /*
+ * Creates a view of this byte buffer as a char buffer.
+ *
+ *
The content of the new buffer will start at this buffer's current
+ * position. Changes to this buffer's content will be visible in the new
+ * buffer, and vice versa; the two buffers' position, limit, and mark
+ * values will be independent.
+ *
+ *
The new buffer's position will be zero, its capacity and its limit
+ * will be the number of bytes remaining in this buffer divided by
+ * two, and its mark will be undefined. The new buffer will be direct
+ * if, and only if, this buffer is direct, and it will be read-only if, and
+ * only if, this buffer is read-only.
+ *
+ * @return A new char buffer
+ */
+ public abstract Buffer asCharBuffer();
+
+
+ /*
+ * Relative get method for reading a short value.
+ *
+ *
Reads the next two bytes at this buffer's current position,
+ * composing them into a short value according to the current byte order,
+ * and then increments the position by two.
+ *
+ * @return The short value at the buffer's current position
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than two bytes
+ * remaining in this buffer
+ */
+ public abstract short getShort();
+
+ /*
+ * Relative put method for writing a short
+ * value (optional operation).
+ *
+ *
Writes two bytes containing the given short value, in the
+ * current byte order, into this buffer at the current position, and then
+ * increments the position by two.
+ *
+ * @param value
+ * The short value to be written
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there are fewer than two bytes
+ * remaining in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public abstract ByteBuffer putShort(short value);
+
+ /*
+ * Absolute get method for reading a short value.
+ *
+ *
Reads two bytes at the given index, composing them into a
+ * short value according to the current byte order.
+ *
+ * @param index
+ * The index from which the bytes will be read
+ *
+ * @return The short value at the given index
+ *
+ * @throws IndexOutOfBoundsException
+ * If index is negative
+ * or not smaller than the buffer's limit,
+ * minus one
+ */
+ public abstract short getShort(int index);
+
+ /*
+ * Absolute put method for writing a short
+ * value (optional operation).
+ *
+ *
Writes two bytes containing the given short value, in the
+ * current byte order, into this buffer at the given index.
+ *
+ * @param index
+ * The index at which the bytes will be written
+ *
+ * @param value
+ * The short value to be written
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If index is negative
+ * or not smaller than the buffer's limit,
+ * minus one
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public abstract ByteBuffer putShort(int index, short value);
+
+ /*
+ * Creates a view of this byte buffer as a short buffer.
+ *
+ *
The content of the new buffer will start at this buffer's current
+ * position. Changes to this buffer's content will be visible in the new
+ * buffer, and vice versa; the two buffers' position, limit, and mark
+ * values will be independent.
+ *
+ *
The new buffer's position will be zero, its capacity and its limit
+ * will be the number of bytes remaining in this buffer divided by
+ * two, and its mark will be undefined. The new buffer will be direct
+ * if, and only if, this buffer is direct, and it will be read-only if, and
+ * only if, this buffer is read-only.
+ *
+ * @return A new short buffer
+ */
+ public abstract Buffer asShortBuffer();
+
+
+ /*
+ * Relative get method for reading an int value.
+ *
+ *
Reads the next four bytes at this buffer's current position,
+ * composing them into an int value according to the current byte order,
+ * and then increments the position by four.
+ *
+ * @return The int value at the buffer's current position
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than four bytes
+ * remaining in this buffer
+ */
+ public abstract int getInt();
+
+ /*
+ * Relative put method for writing an int
+ * value (optional operation).
+ *
+ *
Writes four bytes containing the given int value, in the
+ * current byte order, into this buffer at the current position, and then
+ * increments the position by four.
+ *
+ * @param value
+ * The int value to be written
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there are fewer than four bytes
+ * remaining in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public abstract ByteBuffer putInt(int value);
+
+ /*
+ * Absolute get method for reading an int value.
+ *
+ *
Reads four bytes at the given index, composing them into a
+ * int value according to the current byte order.
+ *
+ * @param index
+ * The index from which the bytes will be read
+ *
+ * @return The int value at the given index
+ *
+ * @throws IndexOutOfBoundsException
+ * If index is negative
+ * or not smaller than the buffer's limit,
+ * minus three
+ */
+ public abstract int getInt(int index);
+
+ /*
+ * Absolute put method for writing an int
+ * value (optional operation).
+ *
+ *
Writes four bytes containing the given int value, in the
+ * current byte order, into this buffer at the given index.
+ *
+ * @param index
+ * The index at which the bytes will be written
+ *
+ * @param value
+ * The int value to be written
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If index is negative
+ * or not smaller than the buffer's limit,
+ * minus three
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public abstract ByteBuffer putInt(int index, int value);
+
+ /*
+ * Creates a view of this byte buffer as an int buffer.
+ *
+ *
The content of the new buffer will start at this buffer's current
+ * position. Changes to this buffer's content will be visible in the new
+ * buffer, and vice versa; the two buffers' position, limit, and mark
+ * values will be independent.
+ *
+ *
The new buffer's position will be zero, its capacity and its limit
+ * will be the number of bytes remaining in this buffer divided by
+ * four, and its mark will be undefined. The new buffer will be direct
+ * if, and only if, this buffer is direct, and it will be read-only if, and
+ * only if, this buffer is read-only.
+ *
+ * @return A new int buffer
+ */
+ public abstract Buffer asIntBuffer();
+
+
+ /*
+ * Relative get method for reading a long value.
+ *
+ *
Reads the next eight bytes at this buffer's current position,
+ * composing them into a long value according to the current byte order,
+ * and then increments the position by eight.
+ *
+ * @return The long value at the buffer's current position
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than eight bytes
+ * remaining in this buffer
+ */
+ public abstract long getLong();
+
+ /*
+ * Relative put method for writing a long
+ * value (optional operation).
+ *
+ *
Writes eight bytes containing the given long value, in the
+ * current byte order, into this buffer at the current position, and then
+ * increments the position by eight.
+ *
+ * @param value
+ * The long value to be written
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there are fewer than eight bytes
+ * remaining in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public abstract ByteBuffer putLong(long value);
+
+ /*
+ * Absolute get method for reading a long value.
+ *
+ *
Reads eight bytes at the given index, composing them into a
+ * long value according to the current byte order.
+ *
+ * @param index
+ * The index from which the bytes will be read
+ *
+ * @return The long value at the given index
+ *
+ * @throws IndexOutOfBoundsException
+ * If index is negative
+ * or not smaller than the buffer's limit,
+ * minus seven
+ */
+ public abstract long getLong(int index);
+
+ /*
+ * Absolute put method for writing a long
+ * value (optional operation).
+ *
+ *
Writes eight bytes containing the given long value, in the
+ * current byte order, into this buffer at the given index.
+ *
+ * @param index
+ * The index at which the bytes will be written
+ *
+ * @param value
+ * The long value to be written
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If index is negative
+ * or not smaller than the buffer's limit,
+ * minus seven
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public abstract ByteBuffer putLong(int index, long value);
+
+ /*
+ * Creates a view of this byte buffer as a long buffer.
+ *
+ *
The content of the new buffer will start at this buffer's current
+ * position. Changes to this buffer's content will be visible in the new
+ * buffer, and vice versa; the two buffers' position, limit, and mark
+ * values will be independent.
+ *
+ *
The new buffer's position will be zero, its capacity and its limit
+ * will be the number of bytes remaining in this buffer divided by
+ * eight, and its mark will be undefined. The new buffer will be direct
+ * if, and only if, this buffer is direct, and it will be read-only if, and
+ * only if, this buffer is read-only.
+ *
+ * @return A new long buffer
+ */
+ public abstract Buffer asLongBuffer();
+
+
+ /*
+ * Relative get method for reading a float value.
+ *
+ *
Reads the next four bytes at this buffer's current position,
+ * composing them into a float value according to the current byte order,
+ * and then increments the position by four.
+ *
+ * @return The float value at the buffer's current position
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than four bytes
+ * remaining in this buffer
+ */
+ public abstract float getFloat();
+
+ /*
+ * Relative put method for writing a float
+ * value (optional operation).
+ *
+ *
Writes four bytes containing the given float value, in the
+ * current byte order, into this buffer at the current position, and then
+ * increments the position by four.
+ *
+ * @param value
+ * The float value to be written
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there are fewer than four bytes
+ * remaining in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public abstract ByteBuffer putFloat(float value);
+
+ /*
+ * Absolute get method for reading a float value.
+ *
+ *
Reads four bytes at the given index, composing them into a
+ * float value according to the current byte order.
+ *
+ * @param index
+ * The index from which the bytes will be read
+ *
+ * @return The float value at the given index
+ *
+ * @throws IndexOutOfBoundsException
+ * If index is negative
+ * or not smaller than the buffer's limit,
+ * minus three
+ */
+ public abstract float getFloat(int index);
+
+ /*
+ * Absolute put method for writing a float
+ * value (optional operation).
+ *
+ *
Writes four bytes containing the given float value, in the
+ * current byte order, into this buffer at the given index.
+ *
+ * @param index
+ * The index at which the bytes will be written
+ *
+ * @param value
+ * The float value to be written
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If index is negative
+ * or not smaller than the buffer's limit,
+ * minus three
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public abstract ByteBuffer putFloat(int index, float value);
+
+ /*
+ * Creates a view of this byte buffer as a float buffer.
+ *
+ *
The content of the new buffer will start at this buffer's current
+ * position. Changes to this buffer's content will be visible in the new
+ * buffer, and vice versa; the two buffers' position, limit, and mark
+ * values will be independent.
+ *
+ *
The new buffer's position will be zero, its capacity and its limit
+ * will be the number of bytes remaining in this buffer divided by
+ * four, and its mark will be undefined. The new buffer will be direct
+ * if, and only if, this buffer is direct, and it will be read-only if, and
+ * only if, this buffer is read-only.
+ *
+ * @return A new float buffer
+ */
+ public abstract Buffer asFloatBuffer();
+
+
+ /*
+ * Relative get method for reading a double value.
+ *
+ *
Reads the next eight bytes at this buffer's current position,
+ * composing them into a double value according to the current byte order,
+ * and then increments the position by eight.
+ *
+ * @return The double value at the buffer's current position
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than eight bytes
+ * remaining in this buffer
+ */
+ public abstract double getDouble();
+
+ /*
+ * Relative put method for writing a double
+ * value (optional operation).
+ *
+ *
Writes eight bytes containing the given double value, in the
+ * current byte order, into this buffer at the current position, and then
+ * increments the position by eight.
+ *
+ * @param value
+ * The double value to be written
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there are fewer than eight bytes
+ * remaining in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public abstract ByteBuffer putDouble(double value);
+
+ /*
+ * Absolute get method for reading a double value.
+ *
+ *
Reads eight bytes at the given index, composing them into a
+ * double value according to the current byte order.
+ *
+ * @param index
+ * The index from which the bytes will be read
+ *
+ * @return The double value at the given index
+ *
+ * @throws IndexOutOfBoundsException
+ * If index is negative
+ * or not smaller than the buffer's limit,
+ * minus seven
+ */
+ public abstract double getDouble(int index);
+
+ /*
+ * Absolute put method for writing a double
+ * value (optional operation).
+ *
+ *
Writes eight bytes containing the given double value, in the
+ * current byte order, into this buffer at the given index.
+ *
+ * @param index
+ * The index at which the bytes will be written
+ *
+ * @param value
+ * The double value to be written
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If index is negative
+ * or not smaller than the buffer's limit,
+ * minus seven
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public abstract ByteBuffer putDouble(int index, double value);
+
+ /*
+ * Creates a view of this byte buffer as a double buffer.
+ *
+ *
The content of the new buffer will start at this buffer's current
+ * position. Changes to this buffer's content will be visible in the new
+ * buffer, and vice versa; the two buffers' position, limit, and mark
+ * values will be independent.
+ *
+ *
The new buffer's position will be zero, its capacity and its limit
+ * will be the number of bytes remaining in this buffer divided by
+ * eight, and its mark will be undefined. The new buffer will be direct
+ * if, and only if, this buffer is direct, and it will be read-only if, and
+ * only if, this buffer is read-only.
+ *
+ * @return A new double buffer
+ */
+ public abstract Buffer asDoubleBuffer();
+ }
+#pragma warning restore 1591
+}
+
+// ReSharper restore InconsistentNaming
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/nio/HeapByteBuffer.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/nio/HeapByteBuffer.cs
new file mode 100644
index 0000000..ce2ce1d
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/nio/HeapByteBuffer.cs
@@ -0,0 +1,380 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+
+
+// This class is based on the source code from Sun's Java 1.5.0 API for java.nio.HeapByteBuffer, but
+// rewritten for C# and .NET with the purpose to bridge the .NET and Java internals of Robocode.
+
+using System;
+
+// ReSharper disable InconsistentNaming
+
+namespace net.sf.robocode.nio
+{
+ ///
+ /// A read/write HeapByteBuffer.
+ ///
+ ///
+ internal class HeapByteBuffer : ByteBuffer
+ {
+ internal HeapByteBuffer(int cap, int lim)
+ : base(-1, 0, lim, cap, new byte[cap], 0)
+ {
+ }
+
+ internal HeapByteBuffer(byte[] buf, int off, int len)
+ : base(-1, off, off + len, buf.Length, buf, 0)
+ {
+ }
+
+ protected HeapByteBuffer(byte[] buf,
+ int mark, int pos, int lim, int cap,
+ int off)
+ : base(mark, pos, lim, cap, buf, off)
+ {
+ }
+
+ public override ByteBuffer slice()
+ {
+ return new HeapByteBuffer(hb,
+ -1,
+ 0,
+ remaining(),
+ remaining(),
+ position() + _offset);
+ }
+
+ public override ByteBuffer duplicate()
+ {
+ return new HeapByteBuffer(hb,
+ markValue(),
+ position(),
+ limit(),
+ capacity(),
+ _offset);
+ }
+
+ public override ByteBuffer asReadOnlyBuffer()
+ {
+ throw new NotImplementedException();
+ }
+
+
+ protected int ix(int i)
+ {
+ return i + _offset;
+ }
+
+ public override byte get()
+ {
+ return hb[ix(nextGetIndex())];
+ }
+
+ public override byte get(int i)
+ {
+ return hb[ix(checkIndex(i))];
+ }
+
+ public override ByteBuffer get(byte[] dst, int offset, int length)
+ {
+ checkBounds(offset, length, dst.Length);
+ if (length > remaining())
+ throw new BufferUnderflowException();
+ Array.Copy(hb, ix(position()), dst, offset, length);
+ position(position() + length);
+ return this;
+ }
+
+ public override bool isDirect()
+ {
+ return false;
+ }
+
+
+ public override bool isReadOnly()
+ {
+ return false;
+ }
+
+ public override ByteBuffer put(byte x)
+ {
+ hb[ix(nextPutIndex())] = x;
+ return this;
+ }
+
+ public override ByteBuffer put(int i, byte x)
+ {
+ hb[ix(checkIndex(i))] = x;
+ return this;
+ }
+
+ public override ByteBuffer put(byte[] src, int offset, int length)
+ {
+ checkBounds(offset, length, src.Length);
+ if (length > remaining())
+ throw new BufferOverflowException();
+ Array.Copy(src, offset, hb, ix(position()), length);
+ position(position() + length);
+ return this;
+ }
+
+ public override ByteBuffer put(ByteBuffer src)
+ {
+ if (src is HeapByteBuffer)
+ {
+ if (src == this)
+ throw new ArgumentException();
+ var sb = (HeapByteBuffer) src;
+ int n = sb.remaining();
+ if (n > remaining())
+ throw new BufferOverflowException();
+ Array.Copy(sb.hb, sb.ix(sb.position()),
+ hb, ix(position()), n);
+ sb.position(sb.position() + n);
+ position(position() + n);
+ }
+ else if (src.isDirect())
+ {
+ int n = src.remaining();
+ if (n > remaining())
+ throw new BufferOverflowException();
+ src.get(hb, ix(position()), n);
+ position(position() + n);
+ }
+ else
+ {
+ base.put(src);
+ }
+ return this;
+ }
+
+ public override ByteBuffer compact()
+ {
+ Array.Copy(hb, ix(position()), hb, ix(0), remaining());
+ position(remaining());
+ limit(capacity());
+ discardMark();
+ return this;
+ }
+
+
+ internal override byte _get(int i)
+ {
+ return hb[i];
+ }
+
+ internal override void _put(int i, byte b)
+ {
+ hb[i] = b;
+ }
+
+ public override char getChar()
+ {
+ return BitConverter.ToChar(hb, ix(nextGetIndex(2)));
+ }
+
+ public override char getChar(int i)
+ {
+ return BitConverter.ToChar(hb, ix(checkIndex(i, 2)));
+ }
+
+
+ public override ByteBuffer putChar(char x)
+ {
+ byte[] bytes = BitConverter.GetBytes(x);
+ int index = ix(nextPutIndex(2));
+ Array.Copy(bytes, 0, hb, index, 2);
+ return this;
+ }
+
+ public override ByteBuffer putChar(int i, char x)
+ {
+ byte[] bytes = BitConverter.GetBytes(x);
+ int index = ix(checkIndex(i, 2));
+ Array.Copy(bytes, 0, hb, index, 2);
+ return this;
+ }
+
+ public override Buffer asCharBuffer()
+ {
+ throw new NotImplementedException();
+ }
+
+ public override short getShort()
+ {
+ return BitConverter.ToInt16(hb, ix(nextGetIndex(2)));
+ }
+
+ public override short getShort(int i)
+ {
+ return BitConverter.ToInt16(hb, ix(checkIndex(i, 2)));
+ }
+
+
+ public override ByteBuffer putShort(short x)
+ {
+ byte[] bytes = BitConverter.GetBytes(x);
+ int index = ix(nextPutIndex(2));
+ Array.Copy(bytes, 0, hb, index, 2);
+ return this;
+ }
+
+ public override ByteBuffer putShort(int i, short x)
+ {
+ byte[] bytes = BitConverter.GetBytes(x);
+ int index = ix(checkIndex(i, 2));
+ Array.Copy(bytes, 0, hb, index, 2);
+ return this;
+ }
+
+ public override Buffer asShortBuffer()
+ {
+ throw new NotImplementedException();
+ }
+
+ public override int getInt()
+ {
+ return BitConverter.ToInt32(hb, ix(nextGetIndex(4)));
+ }
+
+ public override int getInt(int i)
+ {
+ return BitConverter.ToInt32(hb, ix(checkIndex(i, 4)));
+ }
+
+
+ public override ByteBuffer putInt(int x)
+ {
+ byte[] bytes = BitConverter.GetBytes(x);
+ int index = ix(nextPutIndex(4));
+ Array.Copy(bytes, 0, hb, index, 4);
+ return this;
+ }
+
+ public override ByteBuffer putInt(int i, int x)
+ {
+ byte[] bytes = BitConverter.GetBytes(x);
+ int index = ix(checkIndex(i, 4));
+ Array.Copy(bytes, 0, hb, index, 4);
+ return this;
+ }
+
+ public override Buffer asIntBuffer()
+ {
+ throw new NotImplementedException();
+ }
+
+
+ // long
+
+
+ public override long getLong()
+ {
+ return BitConverter.ToInt64(hb, ix(nextGetIndex(8)));
+ }
+
+ public override long getLong(int i)
+ {
+ return BitConverter.ToInt64(hb, ix(checkIndex(i, 8)));
+ }
+
+
+ public override ByteBuffer putLong(long x)
+ {
+ byte[] bytes = BitConverter.GetBytes(x);
+ int index = ix(nextPutIndex(8));
+ Array.Copy(bytes, 0, hb, index, 8);
+ return this;
+ }
+
+ public override ByteBuffer putLong(int i, long x)
+ {
+ byte[] bytes = BitConverter.GetBytes(x);
+ int index = ix(checkIndex(i, 8));
+ Array.Copy(bytes, 0, hb, index, 8);
+ return this;
+ }
+
+ public override Buffer asLongBuffer()
+ {
+ throw new NotImplementedException();
+ }
+
+
+ // float
+
+
+ public override float getFloat()
+ {
+ return BitConverter.ToSingle(hb, ix(nextGetIndex(4)));
+ }
+
+ public override float getFloat(int i)
+ {
+ return BitConverter.ToSingle(hb, ix(checkIndex(i, 4)));
+ }
+
+
+ public override ByteBuffer putFloat(float x)
+ {
+ byte[] bytes = BitConverter.GetBytes(x);
+ int index = ix(nextPutIndex(4));
+ Array.Copy(bytes, 0, hb, index, 4);
+ return this;
+ }
+
+ public override ByteBuffer putFloat(int i, float x)
+ {
+ byte[] bytes = BitConverter.GetBytes(x);
+ int index = ix(checkIndex(i, 4));
+ Array.Copy(bytes, 0, hb, index, 4);
+ return this;
+ }
+
+ public override Buffer asFloatBuffer()
+ {
+ throw new NotImplementedException();
+ }
+
+
+ // double
+
+
+ public override double getDouble()
+ {
+ return BitConverter.ToDouble(hb, ix(nextGetIndex(8)));
+ }
+
+ public override double getDouble(int i)
+ {
+ return BitConverter.ToDouble(hb, ix(checkIndex(i, 8)));
+ }
+
+
+ public override ByteBuffer putDouble(double x)
+ {
+ byte[] bytes = BitConverter.GetBytes(x);
+ int index = ix(nextPutIndex(8));
+ Array.Copy(bytes, 0, hb, index, 8);
+ return this;
+ }
+
+ public override ByteBuffer putDouble(int i, double x)
+ {
+ byte[] bytes = BitConverter.GetBytes(x);
+ int index = ix(checkIndex(i, 8));
+ Array.Copy(bytes, 0, hb, index, 8);
+ return this;
+ }
+
+ public override Buffer asDoubleBuffer()
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/nio/InvalidMarkException.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/nio/InvalidMarkException.cs
new file mode 100644
index 0000000..080851e
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/nio/InvalidMarkException.cs
@@ -0,0 +1,116 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+
+
+using System;
+using System.Runtime.Serialization;
+
+namespace net.sf.robocode.nio
+{
+#pragma warning disable 1591
+
+ ///
+ [Serializable]
+ public class InvalidMarkException : Exception
+ {
+ public InvalidMarkException()
+ {
+ }
+
+ public InvalidMarkException(string message)
+ : base(message)
+ {
+ }
+
+ public InvalidMarkException(string message, Exception inner)
+ : base(message, inner)
+ {
+ }
+
+ protected InvalidMarkException(SerializationInfo info,
+ StreamingContext context)
+ : base(info, context)
+ {
+ }
+ }
+
+ ///
+ [Serializable]
+ public class BufferUnderflowException : Exception
+ {
+ public BufferUnderflowException()
+ {
+ }
+
+ public BufferUnderflowException(string message)
+ : base(message)
+ {
+ }
+
+ public BufferUnderflowException(string message, Exception inner)
+ : base(message, inner)
+ {
+ }
+
+ protected BufferUnderflowException(SerializationInfo info,
+ StreamingContext context)
+ : base(info, context)
+ {
+ }
+ }
+
+ ///
+ [Serializable]
+ public class BufferOverflowException : Exception
+ {
+ public BufferOverflowException()
+ {
+ }
+
+ public BufferOverflowException(string message)
+ : base(message)
+ {
+ }
+
+ public BufferOverflowException(string message, Exception inner)
+ : base(message, inner)
+ {
+ }
+
+ protected BufferOverflowException(SerializationInfo info,
+ StreamingContext context)
+ : base(info, context)
+ {
+ }
+ }
+
+ ///
+ [Serializable]
+ public class ReadOnlyBufferException : Exception
+ {
+ public ReadOnlyBufferException()
+ {
+ }
+
+ public ReadOnlyBufferException(string message)
+ : base(message)
+ {
+ }
+
+ public ReadOnlyBufferException(string message, Exception inner)
+ : base(message, inner)
+ {
+ }
+
+ protected ReadOnlyBufferException(SerializationInfo info,
+ StreamingContext context)
+ : base(info, context)
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/peer/IRobotStaticsN.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/peer/IRobotStaticsN.cs
new file mode 100644
index 0000000..b84b044
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/peer/IRobotStaticsN.cs
@@ -0,0 +1,23 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+namespace net.sf.robocode.peer
+{
+#pragma warning disable 1591
+
+ ///
+ public interface IRobotStaticsN
+ {
+ bool IsInteractiveRobot();
+
+ bool IsPaintRobot();
+
+ bool IsAdvancedRobot();
+
+ bool IsTeamRobot();
+ }
+}
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/security/HiddenAccessN.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/security/HiddenAccessN.cs
new file mode 100644
index 0000000..9dd414e
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/security/HiddenAccessN.cs
@@ -0,0 +1,131 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Security.Permissions;
+using net.sf.robocode.io;
+using net.sf.robocode.peer;
+using Robocode;
+using Robocode.RobotInterfaces;
+
+namespace net.sf.robocode.security
+{
+#pragma warning disable 1591
+ ///
+ [RobocodeInternalPermission(SecurityAction.LinkDemand)]
+ public class HiddenAccessN
+ {
+ private static IHiddenEventHelper eventHelper;
+ private static IHiddenBulletHelper bulletHelper;
+ private static IHiddenStatusHelper statusHelper;
+ private static IHiddenRulesHelper rulesHelper;
+ private static bool initialized;
+ public static IHiddenRandomHelper randomHelper;
+
+ public static void init()
+ {
+ if (initialized)
+ {
+ return;
+ }
+ MethodInfo method;
+
+ try
+ {
+ method = typeof (Event).GetMethod("createHiddenHelper", BindingFlags.Static | BindingFlags.NonPublic);
+ eventHelper = (IHiddenEventHelper) method.Invoke(null, null);
+
+ method = typeof (Bullet).GetMethod("createHiddenHelper", BindingFlags.Static | BindingFlags.NonPublic);
+ bulletHelper = (IHiddenBulletHelper) method.Invoke(null, null);
+
+ method = typeof (RobotStatus).GetMethod("createHiddenSerializer",
+ BindingFlags.Static | BindingFlags.NonPublic);
+ statusHelper = (IHiddenStatusHelper) method.Invoke(null, null);
+
+ method = typeof (BattleRules).GetMethod("createHiddenHelper",
+ BindingFlags.Static | BindingFlags.NonPublic);
+ rulesHelper = (IHiddenRulesHelper) method.Invoke(null, null);
+
+ initialized = true;
+ }
+ catch (Exception e)
+ {
+ LoggerN.logError(e);
+ Environment.Exit(-1);
+ }
+ }
+
+ public static bool IsCriticalEvent(Event e)
+ {
+ return eventHelper.IsCriticalEvent(e);
+ }
+
+ public static void SetEventTime(Event e, long newTime)
+ {
+ eventHelper.SetTime(e, newTime);
+ }
+
+ public static void SetEventPriority(Event e, int newPriority)
+ {
+ eventHelper.SetPriority(e, newPriority);
+ }
+
+ public static void Dispatch(Event evnt, IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ eventHelper.Dispatch(evnt, robot, statics, graphics);
+ }
+
+ public static void SetDefaultPriority(Event e)
+ {
+ eventHelper.SetDefaultPriority(e);
+ }
+
+ public static byte GetSerializationType(Event e)
+ {
+ return eventHelper.GetSerializationType(e);
+ }
+
+ // Needed for .NET version
+ public static void UpdateBullets(Event e, Dictionary bullets)
+ {
+ eventHelper.UpdateBullets(e, bullets);
+ }
+
+ public static void Update(Bullet bullet, double x, double y, string victimName, bool isActive)
+ {
+ bulletHelper.update(bullet, x, y, victimName, isActive);
+ }
+
+ public static RobotStatus createStatus(double energy, double x, double y, double bodyHeading, double gunHeading,
+ double radarHeading, double velocity, double bodyTurnRemaining,
+ double radarTurnRemaining, double gunTurnRemaining,
+ double distanceRemaining, double gunHeat, int others, int numSentries,
+ int roundNum, int numRounds, long time)
+ {
+ return statusHelper.createStatus(energy, x, y, bodyHeading, gunHeading, radarHeading, velocity,
+ bodyTurnRemaining, radarTurnRemaining, gunTurnRemaining, distanceRemaining,
+ gunHeat, others, numSentries, roundNum, numRounds, time);
+ }
+
+ public static BattleRules createRules(int battlefieldWidth, int battlefieldHeight, int numRounds, double gunCoolingRate, long inactivityTime,
+ bool hideEnemyNames, int borderSentryRobotAttackRange)
+ {
+ return rulesHelper.createRules(battlefieldWidth, battlefieldHeight, numRounds, gunCoolingRate, inactivityTime, hideEnemyNames, borderSentryRobotAttackRange);
+ }
+
+ public static string GetRobotName()
+ {
+ string name = (string)AppDomain.CurrentDomain.GetData("robotName");
+ return name ?? "";
+ }
+ }
+#pragma warning restore 1591
+}
+
+//happy
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/security/IHiddenBulletHelper.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/security/IHiddenBulletHelper.cs
new file mode 100644
index 0000000..d1eb3cf
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/security/IHiddenBulletHelper.cs
@@ -0,0 +1,20 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using Robocode;
+
+namespace net.sf.robocode.security
+{
+#pragma warning disable 1591
+ ///
+ public interface IHiddenBulletHelper
+ {
+ void update(Bullet bullet, double x, double y, string victimName, bool isActive);
+ }
+}
+
+//happy
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/security/IHiddenEventHelper.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/security/IHiddenEventHelper.cs
new file mode 100644
index 0000000..b485e5b
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/security/IHiddenEventHelper.cs
@@ -0,0 +1,29 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System.Collections.Generic;
+using net.sf.robocode.peer;
+using Robocode;
+using Robocode.RobotInterfaces;
+
+namespace net.sf.robocode.security
+{
+#pragma warning disable 1591
+ ///
+ public interface IHiddenEventHelper
+ {
+ void SetDefaultPriority(Event evnt);
+ void SetPriority(Event evnt, int newPriority);
+ void SetTime(Event evnt, long newTime);
+ bool IsCriticalEvent(Event evnt);
+ void Dispatch(Event evnt, IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics);
+ byte GetSerializationType(Event evnt);
+ void UpdateBullets(Event evnt, Dictionary bullets); // Needed for .NET version
+ }
+}
+
+//happy
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/security/IHiddenRandomHelper.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/security/IHiddenRandomHelper.cs
new file mode 100644
index 0000000..27e8963
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/security/IHiddenRandomHelper.cs
@@ -0,0 +1,20 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+
+
+using System;
+
+namespace net.sf.robocode.security
+{
+#pragma warning disable 1591
+ ///
+ public interface IHiddenRandomHelper
+ {
+ Random GetRandom();
+ }
+}
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/security/IHiddenRulesHelper.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/security/IHiddenRulesHelper.cs
new file mode 100644
index 0000000..447d1db
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/security/IHiddenRulesHelper.cs
@@ -0,0 +1,21 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using Robocode;
+
+namespace net.sf.robocode.security
+{
+#pragma warning disable 1591
+ ///
+ public interface IHiddenRulesHelper
+ {
+ BattleRules createRules(int battlefieldWidth, int battlefieldHeight, int numRounds, double gunCoolingRate, long inactivityTime,
+ bool hideEnemyNames, int borderSentryRobotAttackRange);
+ }
+}
+
+//happy
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/security/IHiddenStatusHelper.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/security/IHiddenStatusHelper.cs
new file mode 100644
index 0000000..db401f3
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/security/IHiddenStatusHelper.cs
@@ -0,0 +1,25 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using Robocode;
+
+namespace net.sf.robocode.security
+{
+#pragma warning disable 1591
+ ///
+ public interface IHiddenStatusHelper
+ {
+ RobotStatus createStatus(double energy, double x, double y, double bodyHeading, double gunHeading,
+ double radarHeading,
+ double velocity, double bodyTurnRemaining, double radarTurnRemaining,
+ double gunTurnRemaining,
+ double distanceRemaining, double gunHeat, int others, int numSentries,
+ int roundNum, int numRounds, long time);
+ }
+}
+
+//happy
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/security/RobocodeInternalPermission.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/security/RobocodeInternalPermission.cs
new file mode 100644
index 0000000..94a8e50
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/security/RobocodeInternalPermission.cs
@@ -0,0 +1,151 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+using System.Text;
+
+namespace net.sf.robocode.security
+{
+#pragma warning disable 1591
+ ///
+ [Serializable]
+ public sealed class RobocodeInternalPermission : CodeAccessPermission, IUnrestrictedPermission
+ {
+ private bool unrestricted;
+
+ public RobocodeInternalPermission(PermissionState state)
+ {
+ unrestricted = state == PermissionState.Unrestricted;
+ }
+
+ #region IUnrestrictedPermission Members
+
+ public bool IsUnrestricted()
+ {
+ return unrestricted;
+ }
+
+ #endregion
+
+ public override IPermission Copy()
+ {
+ //Create a new instance of RobocodeInternalPermission with the current
+ //value of unrestricted.
+ var copy = new RobocodeInternalPermission(PermissionState.None);
+
+ copy.unrestricted = IsUnrestricted();
+ //Return the copy.
+ return copy;
+ }
+
+ public override IPermission Intersect(IPermission target)
+ {
+ //If nothing was passed, return null.
+ if (null == target)
+ {
+ return null;
+ }
+ try
+ {
+ //Create a new instance of RobocodeInternalPermission from the passed object.
+ var PassedPermission = (RobocodeInternalPermission) target;
+
+ //If one class has an unrestricted value of false, then the
+ //intersection will have an unrestricted value of false.
+ //Return the passed class with the unrestricted value of false.
+ if (!PassedPermission.unrestricted)
+ {
+ return target;
+ }
+ //Return a copy of the current class if the passed one has
+ //an unrestricted value of true.
+ return Copy();
+ }
+ //Catch an InvalidCastException.
+ //Throw ArgumentException to notify the user.
+ catch (InvalidCastException)
+ {
+ throw new ArgumentException("Argument_WrongType", GetType().FullName);
+ }
+ }
+
+ public override bool IsSubsetOf(IPermission target)
+ {
+ //If nothing was passed and unrestricted is false,
+ //then return true.
+ if (null == target)
+ {
+ return !unrestricted;
+ }
+ try
+ {
+ //Create a new instance of RobocodeInternalPermission from the passed object.
+ var passedpermission = (RobocodeInternalPermission) target;
+
+ //If unrestricted has the same value in both objects, then
+ //one is the subset of the other.
+ return unrestricted == passedpermission.unrestricted;
+ }
+ //Catch an InvalidCastException.
+ //Throw ArgumentException to notify the user.
+ catch (InvalidCastException)
+ {
+ throw new ArgumentException("Argument_WrongType", GetType().FullName);
+ }
+ }
+
+ public override void FromXml(SecurityElement PassedElement)
+ {
+ //Get the unrestricted value from the XML and initialize
+ //the current instance of unrestricted to that value.
+ string element = PassedElement.Attribute("Unrestricted");
+
+ if (null != element)
+ {
+ unrestricted = Convert.ToBoolean(element);
+ }
+ }
+
+ public override SecurityElement ToXml()
+ {
+ //Encode the current permission to XML using the
+ //SecurityElement class.
+ var element = new SecurityElement("IPermission");
+ Type type = GetType();
+ var AssemblyName = new StringBuilder(type.Assembly.ToString());
+ AssemblyName.Replace('\"', '\'');
+ element.AddAttribute("class", type.FullName + ", " + AssemblyName);
+ element.AddAttribute("version", "1");
+ element.AddAttribute("Unrestricted", unrestricted.ToString());
+ return element;
+ }
+ }
+
+
+ ///
+ [AttributeUsageAttribute(AttributeTargets.All, AllowMultiple = true)]
+ public class RobocodeInternalPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ public RobocodeInternalPermissionAttribute(SecurityAction action)
+ : base(action)
+ {
+ Unrestricted = false;
+ }
+
+ public override IPermission CreatePermission()
+ {
+ return Unrestricted
+ ? new RobocodeInternalPermission(PermissionState.Unrestricted)
+ : new RobocodeInternalPermission(PermissionState.None);
+ }
+ }
+#pragma warning restore 1591
+}
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/serialization/ISerializableHelperN.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/serialization/ISerializableHelperN.cs
new file mode 100644
index 0000000..139d0e9
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/serialization/ISerializableHelperN.cs
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using net.sf.robocode.nio;
+
+namespace net.sf.robocode.serialization
+{
+#pragma warning disable 1591
+ ///
+ public interface ISerializableHelperN
+ {
+ int sizeOf(RbSerializerN serializer, object obj);
+ void serialize(RbSerializerN serializer, ByteBuffer buffer, object obj);
+ object deserialize(RbSerializerN serializer, ByteBuffer buffer);
+ }
+}
+
+//happy
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/serialization/RbSerializerN.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/serialization/RbSerializerN.cs
new file mode 100644
index 0000000..28226d1
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/net/sf/robocode/serialization/RbSerializerN.cs
@@ -0,0 +1,524 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+using System.Security.Permissions;
+using System.Text;
+using net.sf.robocode.io;
+using net.sf.robocode.nio;
+using net.sf.robocode.security;
+using Robocode;
+
+namespace net.sf.robocode.serialization
+{
+#pragma warning disable 1591
+ ///
+ [RobocodeInternalPermission(SecurityAction.LinkDemand)]
+ public sealed class RbSerializerN
+ {
+ private const int byteOrder = -1059135839; //0xC0DEDEA1
+ public static readonly int SIZEOF_TYPEINFO = 1;
+ public static readonly int SIZEOF_BYTE = 1;
+ public static readonly int SIZEOF_BOOL = 1;
+ public static readonly int SIZEOF_CHAR = 2;
+ public static readonly int SIZEOF_INT = 4;
+ public static readonly int SIZEOF_LONG = 8;
+ public static readonly int SIZEOF_DOUBLE = 8;
+
+ public static readonly byte TERMINATOR_TYPE = 0xff;
+ public static readonly byte ExecCommands_TYPE = 1;
+ public static readonly byte BulletCommand_TYPE = 2;
+ public static readonly byte TeamMessage_TYPE = 3;
+ public static readonly byte DebugProperty_TYPE = 4;
+ public static readonly byte ExecResults_TYPE = 5;
+ public static readonly byte RobotStatus_TYPE = 6;
+ public static readonly byte BulletStatus_TYPE = 7;
+ public static readonly byte BattleResults_TYPE = 8;
+ public static readonly byte Bullet_TYPE = 9;
+ public static readonly byte RobotStatics_TYPE = 10;
+
+ public static readonly byte BattleEndedEvent_TYPE = 32;
+ public static readonly byte BulletHitBulletEvent_TYPE = 33;
+ public static readonly byte BulletHitEvent_TYPE = 34;
+ public static readonly byte BulletMissedEvent_TYPE = 35;
+ public static readonly byte DeathEvent_TYPE = 36;
+ public static readonly byte WinEvent_TYPE = 37;
+ public static readonly byte HitWallEvent_TYPE = 38;
+ public static readonly byte RobotDeathEvent_TYPE = 39;
+ public static readonly byte SkippedTurnEvent_TYPE = 40;
+ public static readonly byte ScannedRobotEvent_TYPE = 41;
+ public static readonly byte HitByBulletEvent_TYPE = 42;
+ public static readonly byte HitRobotEvent_TYPE = 43;
+ public static readonly byte KeyPressedEvent_TYPE = 44;
+ public static readonly byte KeyReleasedEvent_TYPE = 45;
+ public static readonly byte KeyTypedEvent_TYPE = 46;
+ public static readonly byte MouseClickedEvent_TYPE = 47;
+ public static readonly byte MouseDraggedEvent_TYPE = 48;
+ public static readonly byte MouseEnteredEvent_TYPE = 49;
+ public static readonly byte MouseExitedEvent_TYPE = 50;
+ public static readonly byte MouseMovedEvent_TYPE = 51;
+ public static readonly byte MousePressedEvent_TYPE = 52;
+ public static readonly byte MouseReleasedEvent_TYPE = 53;
+ public static readonly byte MouseWheelMovedEvent_TYPE = 54;
+ public static readonly byte RoundEndedEvent_TYPE = 55;
+
+ private static readonly ISerializableHelperN[] typeToHelper = new ISerializableHelperN[256];
+ private static readonly Dictionary classToType = new Dictionary();
+ private static readonly Encoding charset;
+
+ private static int currentVersion;
+
+ static RbSerializerN()
+ {
+ charset = Encoding.UTF8; // we will use it as UCS-2
+ register(null, TERMINATOR_TYPE); // reserved for end of (list) element
+ }
+
+ public static void Init(int version)
+ {
+ if (currentVersion == 0)
+ {
+ currentVersion = version;
+ }
+ }
+
+ public ByteBuffer serialize(byte type, object obj)
+ {
+ int length = sizeOf(type, obj);
+
+ // header
+ ByteBuffer buffer = ByteBuffer.allocate(SIZEOF_INT + SIZEOF_INT + SIZEOF_INT + length);
+
+ buffer.putInt(byteOrder);
+ buffer.putInt(currentVersion);
+ buffer.putInt(length);
+
+ // body
+ serialize(buffer, type, obj);
+ if (buffer.remaining() != 0)
+ {
+ throw new IOException("Serialization failed: bad size");
+ }
+ return buffer;
+ }
+
+ public ByteBuffer serializeToBuffer(ByteBuffer buffer, byte type, object obj)
+ {
+ int length = sizeOf(type, obj);
+ buffer.limit(SIZEOF_INT + SIZEOF_INT + SIZEOF_INT + length);
+
+ buffer.putInt(byteOrder);
+ buffer.putInt(currentVersion);
+ buffer.putInt(length);
+
+ // body
+ serialize(buffer, type, obj);
+ if (buffer.remaining() != 0)
+ {
+ throw new IOException("Serialization failed: bad size");
+ }
+ return buffer;
+ }
+
+ public Object deserialize(ByteBuffer buffer)
+ {
+ int bo = buffer.getInt();
+
+ if (bo != byteOrder)
+ {
+ throw new IOException("Different byte order is not supported");
+ }
+
+ int version = buffer.getInt();
+
+ if (version != currentVersion)
+ {
+ throw new IOException("Version of data is not supported. We support only strong match");
+ }
+ int length = buffer.getInt();
+
+ if (length != buffer.remaining())
+ {
+ throw new IOException("Wrong buffer size, " + length + "expected but got " + buffer.remaining());
+ }
+
+ // body
+ Object res = deserializeAny(buffer);
+
+ if (buffer.remaining() != 0)
+ {
+ throw new IOException("Serialization failed");
+ }
+ return res;
+ }
+
+ public void serialize(ByteBuffer buffer, byte type, object obj)
+ {
+ ISerializableHelperN helper = getHelper(type);
+
+ // FOR-DEBUG int expect = sizeOf(type, object) + buffer.position();
+
+ if (obj != null)
+ {
+ buffer.put(type);
+ helper.serialize(this, buffer, obj);
+ }
+ else
+ {
+ buffer.put(TERMINATOR_TYPE);
+ }
+ // FOR-DEBUG if (expect != buffer.position()) {
+ // FOR-DEBUG throw new Exception("Bad size");
+ // FOR-DEBUG }
+ }
+
+ public void serialize(ByteBuffer buffer, string data)
+ {
+ if (data == null)
+ {
+ buffer.putInt(-1);
+ }
+ else
+ {
+ int bytes = charset.GetBytes(data, 0, data.Length, buffer.array(), buffer.position() + 4);
+ buffer.putInt(bytes);
+ buffer.position(buffer.position() + bytes);
+ }
+ }
+
+ public void serialize(ByteBuffer buffer, byte[] data)
+ {
+ if (data == null)
+ {
+ buffer.putInt(-1);
+ }
+ else
+ {
+ buffer.putInt(data.Length);
+ buffer.put(data);
+ }
+ }
+
+ public void serialize(ByteBuffer buffer, int[] data)
+ {
+ if (data == null)
+ {
+ buffer.putInt(-1);
+ }
+ else
+ {
+ buffer.putInt(data.Length);
+ foreach (int aData in data)
+ {
+ buffer.putInt(aData);
+ }
+ }
+ }
+
+ public void serialize(ByteBuffer buffer, char[] data)
+ {
+ if (data == null)
+ {
+ buffer.putInt(-1);
+ }
+ else
+ {
+ buffer.putInt(data.Length);
+ foreach (char aData in data)
+ {
+ buffer.putChar(aData);
+ }
+ }
+ }
+
+ public void serialize(ByteBuffer buffer, double[] data)
+ {
+ if (data == null)
+ {
+ buffer.putInt(-1);
+ }
+ else
+ {
+ buffer.putInt(data.Length);
+ foreach (double aData in data)
+ {
+ buffer.putDouble(aData);
+ }
+ }
+ }
+
+ public void serialize(ByteBuffer buffer, float[] data)
+ {
+ if (data == null)
+ {
+ buffer.putInt(-1);
+ }
+ else
+ {
+ buffer.putInt(data.Length);
+ foreach (float aData in data)
+ {
+ buffer.putFloat(aData);
+ }
+ }
+ }
+
+ public void serialize(ByteBuffer buffer, bool value)
+ {
+ buffer.put((byte) (value ? 1 : 0));
+ }
+
+ public void serialize(ByteBuffer buffer, double value)
+ {
+ buffer.putDouble(value);
+ }
+
+ public void serialize(ByteBuffer buffer, char value)
+ {
+ buffer.putChar(value);
+ }
+
+ public void serialize(ByteBuffer buffer, long value)
+ {
+ buffer.putLong(value);
+ }
+
+ public void serialize(ByteBuffer buffer, int value)
+ {
+ buffer.putInt(value);
+ }
+
+ public void serialize(ByteBuffer buffer, Event evnt)
+ {
+ byte type = HiddenAccessN.GetSerializationType(evnt);
+
+ serialize(buffer, type, evnt);
+ }
+
+ public Object deserializeAny(ByteBuffer buffer)
+ {
+ byte type = buffer.get();
+
+ if (type == TERMINATOR_TYPE)
+ {
+ return null;
+ }
+ return getHelper(type).deserialize(this, buffer);
+ }
+
+ public string deserializeString(ByteBuffer buffer)
+ {
+ int bytes = buffer.getInt();
+
+ if (bytes == -1)
+ {
+ return null;
+ }
+ ByteBuffer slice = buffer.slice();
+
+ slice.limit(bytes);
+ string res;
+
+ try
+ {
+ byte[] array = buffer.array();
+ char[] chars = charset.GetChars(array, buffer.position(), bytes);
+ res = new string(chars);
+ }
+ catch (Exception e)
+ {
+ throw new Exception("Bad character", e);
+ }
+ buffer.position(buffer.position() + bytes);
+ return res;
+ }
+
+ public byte[] deserializeBytes(ByteBuffer buffer)
+ {
+ int len = buffer.getInt();
+
+ if (len == -1)
+ {
+ return null;
+ }
+ var res = new byte[len];
+
+ buffer.get(res);
+ return res;
+ }
+
+ public int[] deserializeints(ByteBuffer buffer)
+ {
+ int len = buffer.getInt();
+
+ if (len == -1)
+ {
+ return null;
+ }
+ var res = new int[len];
+
+ for (int i = 0; i < len; i++)
+ {
+ res[i] = buffer.getInt();
+ }
+ return res;
+ }
+
+ public float[] deserializeFloats(ByteBuffer buffer)
+ {
+ int len = buffer.getInt();
+
+ if (len == -1)
+ {
+ return null;
+ }
+ var res = new float[len];
+
+ for (int i = 0; i < len; i++)
+ {
+ res[i] = buffer.getFloat();
+ }
+ return res;
+ }
+
+ public char[] deserializeChars(ByteBuffer buffer)
+ {
+ int len = buffer.getInt();
+
+ if (len == -1)
+ {
+ return null;
+ }
+ var res = new char[len];
+
+ for (int i = 0; i < len; i++)
+ {
+ res[i] = buffer.getChar();
+ }
+ return res;
+ }
+
+ public double[] deserializeDoubles(ByteBuffer buffer)
+ {
+ int len = buffer.getInt();
+
+ if (len == -1)
+ {
+ return null;
+ }
+ var res = new double[len];
+
+ for (int i = 0; i < len; i++)
+ {
+ res[i] = buffer.getDouble();
+ }
+ return res;
+ }
+
+ public bool deserializeBoolean(ByteBuffer buffer)
+ {
+ return buffer.get() != 0;
+ }
+
+ public char deserializeChar(ByteBuffer buffer)
+ {
+ return buffer.getChar();
+ }
+
+ public int deserializeInt(ByteBuffer buffer)
+ {
+ return buffer.getInt();
+ }
+
+ public long deserializeLong(ByteBuffer buffer)
+ {
+ return buffer.getLong();
+ }
+
+ public float deserializeFloat(ByteBuffer buffer)
+ {
+ return buffer.getFloat();
+ }
+
+ public double deserializeDouble(ByteBuffer buffer)
+ {
+ return buffer.getDouble();
+ }
+
+ public int sizeOf(string data)
+ {
+ return (data == null) ? SIZEOF_INT : SIZEOF_INT + charset.GetByteCount(data);
+ }
+
+ public int sizeOf(byte[] data)
+ {
+ return (data == null) ? SIZEOF_INT : SIZEOF_INT + data.Length;
+ }
+
+ public int sizeOf(byte type, object obj)
+ {
+ return getHelper(type).sizeOf(this, obj);
+ }
+
+ public int sizeOf(Event evnt)
+ {
+ return sizeOf(HiddenAccessN.GetSerializationType(evnt), evnt);
+ }
+
+ private static ISerializableHelperN getHelper(byte type)
+ {
+ ISerializableHelperN helper = typeToHelper[type];
+
+ if (helper == null)
+ {
+ throw new Exception("Unknownd or unsupported data type");
+ }
+ return helper;
+ }
+
+ public static void register(Type realClass, byte type)
+ {
+ try
+ {
+ if (realClass != null)
+ {
+ MethodInfo method = realClass.GetMethod("createHiddenSerializer",
+ BindingFlags.NonPublic | BindingFlags.Static);
+ var helper = (ISerializableHelperN) method.Invoke(null, null);
+
+ typeToHelper[type] = helper;
+ classToType.Add(realClass, type);
+ }
+ }
+ catch (Exception e)
+ {
+ LoggerN.logError(e);
+ }
+ }
+
+ public static ByteBuffer serializeToBuffer(Object src)
+ {
+ var rbs = new RbSerializerN();
+ Byte type = classToType[src.GetType()];
+
+ return rbs.serialize(type, src);
+ }
+
+ public static T deserializeFromBuffer(ByteBuffer buffer)
+ {
+ var rbs = new RbSerializerN();
+ Object res = rbs.deserialize(buffer);
+
+ return (T) res;
+ }
+ }
+}
+
+//happy
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode.dotnet.api.csproj b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode.dotnet.api.csproj
new file mode 100644
index 0000000..c23f971
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode.dotnet.api.csproj
@@ -0,0 +1,164 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {7E0900D3-6E8F-48EB-86DB-AA767AA90B84}
+ Library
+ Properties
+ robocode
+ robocode
+ v3.5
+ 512
+ true
+ ..\..\tools\keys\robocode.snk
+
+
+ 3.5
+
+
+
+ true
+ full
+ false
+ ..\target\
+ ..\target\obj\
+ DEBUG;TRACE
+ prompt
+ 4
+ ..\target\robocode.xml
+
+
+ pdbonly
+ true
+ ..\target\
+ ..\target\obj\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AssemblyInfo.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Code
+
+
+ Code
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ copy "$(TargetPath)" "$(SolutionDir)\robocode.dotnet.host\target"
+ if not exist $(OutDir)\build-sources\generated-sources\META-INF mkdir $(OutDir)\build-sources\generated-sources\META-INF\
+echo [assembly: System.Reflection.AssemblyVersion("1.9.2.4")] > $(OutDir)\build-sources\generated-sources\META-INF\AssemblyInfo.cs
+
+
+
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/AdvancedRobot.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/AdvancedRobot.cs
new file mode 100644
index 0000000..b92ce97
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/AdvancedRobot.cs
@@ -0,0 +1,2226 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Robocode.RobotInterfaces;
+using Robocode.RobotInterfaces.Peer;
+using Robocode.Util;
+
+namespace Robocode
+{
+ ///
+ /// A more advanced type of robot than Robot that allows non-blocking calls,
+ /// custom events, and writes to the filesystem.
+ ///
+ /// If you have not already, you should create a first.
+ ///
+ ///
+ /// Building your first robot
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public abstract class AdvancedRobot : Robot, IAdvancedRobot, IAdvancedEvents
+ {
+ ///
+ /// Returns the distance remaining in the robot's current move measured in
+ /// pixels.
+ ///
+ /// This call returns both positive and negative values. Positive values
+ /// means that the robot is currently moving forwards. Negative values means
+ /// that the robot is currently moving backwards. If the returned value is 0,
+ /// the robot currently stands still.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public double DistanceRemaining
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetDistanceRemaining();
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Returns the angle remaining in the robots's turn, in degrees.
+ ///
+ /// This call returns both positive and negative values.
+ /// Positive values means that the robot is currently turning to the right.
+ /// Negative values means that the robot is currently turning to the left.
+ /// If the returned value is 0, the robot is currently not turning.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public double TurnRemaining
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return Utils.ToDegrees(peer.GetBodyTurnRemaining());
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Returns the angle remaining in the gun's turn, in degrees.
+ ///
+ /// This call returns both positive and negative values.
+ /// Positive values means that the gun is currently turning to the right.
+ /// Negative values means that the gun is currently turning to the left.
+ /// If the returned value is 0, the gun is currently not turning.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public double GunTurnRemaining
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return Utils.ToDegrees(peer.GetGunTurnRemaining());
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Returns the angle remaining in the radar's turn, in degrees.
+ ///
+ /// This call returns both positive and negative values.
+ /// Positive values means that the radar is currently turning to the right.
+ /// Negative values means that the radar is currently turning to the left.
+ /// If the returned value is 0, the radar is currently not turning.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public double RadarTurnRemaining
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return Utils.ToDegrees(peer.GetRadarTurnRemaining());
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Sets the robot to move ahead (forward) by distance measured in
+ /// pixels when the next execution takes place.
+ ///
+ /// This call returns immediately, and will not execute until you
+ /// call or take an action that executes.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where positive values means that the robot is set to move ahead, and negative
+ /// values means that the robot is set to move back. If 0 is given as input, the
+ /// robot will stop its movement, but will have to decelerate till it stands still,
+ /// and will thus not be able to stop its movement immediately, but eventually.
+ ///
+ ///
+ /// The distance to move measured in pixels.
+ /// If distance > 0 the robot is set to move ahead.
+ /// If distance < 0 the robot is set to move back.
+ /// If distance = 0 the robot is set to stop its movement.
+ ///
+ ///
+ ///
+ /// // Set the robot to move 50 pixels ahead
+ /// SetAhead(50);
+ ///
+ /// // Set the robot to move 100 pixels back
+ /// // (overrides the previous order)
+ /// SetAhead(-100);
+ ///
+ /// ...
+ /// // Executes the last SetAhead()
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void SetAhead(double distance)
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).SetMove(distance);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Sets the robot to move back by distance measured in pixels when the next
+ /// execution takes place.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// or take an action that executes.
+ ///
+ /// Note that both positive and negative values can be given as input, where
+ /// positive values means that the robot is set to move back, and negative
+ /// values means that the robot is set to move ahead. If 0 is given as input,
+ /// the robot will stop its movement, but will have to decelerate
+ /// till it stands still, and will thus not be able to stop its movement
+ /// immediately, but eventually.
+ ///
+ ///
+ ///
+ /// // Set the robot to move 50 pixels back
+ /// SetBack(50);
+ ///
+ /// // Set the robot to move 100 pixels ahead
+ /// // (overrides the previous order)
+ /// SetBack(-100);
+ ///
+ /// ...
+ /// // Executes the last SetBack()
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The distance to move measured in pixels.
+ /// If distance > 0 the robot is set to move back.
+ /// If distance < 0 the robot is set to move ahead.
+ /// If distance = 0 the robot is set to stop its movement.
+ ///
+ public void SetBack(double distance)
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).SetMove(-distance);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Sets the robot's body to turn left by degrees when the next execution
+ /// takes place.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// Execute() or take an action that executes.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's body is set to turn right
+ /// instead of left.
+ ///
+ ///
+ ///
+ /// // Set the robot to turn 180 degrees to the left
+ /// SetTurnLeft(180);
+ ///
+ /// // Set the robot to turn 90 degrees to the right instead of left
+ /// // (overrides the previous order)
+ /// SetTurnLeft(-90);
+ ///
+ /// ...
+ /// // Executes the last SetTurnLeft()
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of degrees to turn the robot's body to the left.
+ /// If degrees > 0 the robot is set to turn left.
+ /// If degrees < 0 the robot is set to turn right.
+ /// If degrees = 0 the robot is set to stop turning.
+ ///
+ public void SetTurnLeft(double degrees)
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).SetTurnBody(-Utils.ToRadians(degrees));
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Sets the robot's body to turn right by degrees when the next execution
+ /// takes place.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// Execute() or take an action that executes.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's body is set to turn left
+ /// instead of right.
+ ///
+ ///
+ ///
+ /// // Set the robot to turn 180 degrees to the right
+ /// SetTurnRight(180);
+ ///
+ /// // Set the robot to turn 90 degrees to the left instead of right
+ /// // (overrides the previous order)
+ /// SetTurnRight(-90);
+ ///
+ /// ...
+ /// // Executes the last SetTurnRight()
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of degrees to turn the robot's body to the right.
+ /// If degrees > 0 the robot is set to turn right.
+ /// If degrees < 0 the robot is set to turn left.
+ /// If degrees = 0 the robot is set to stop turning.
+ ///
+ public void SetTurnRight(double degrees)
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).SetTurnBody(Utils.ToRadians(degrees));
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Sets the gun to Fire a bullet when the next execution takes place.
+ /// The bullet will travel in the direction the gun is pointing.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// Execute() or take an action that executes.
+ ///
+ /// The specified bullet power is an amount of energy that will be taken from
+ /// the robot's energy. Hence, the more power you want to spend on the
+ /// bullet, the more energy is taken from your robot.
+ ///
+ /// The bullet will do (4 * power) damage if it hits another robot. If power
+ /// is greater than 1, it will do an additional 2 * (power - 1) damage.
+ /// You will get (3 * power) back if you hit the other robot. You can call
+ /// Rules.GetBulletDamage(double)} for getting the damage that a
+ /// bullet with a specific bullet power will do.
+ ///
+ /// The specified bullet power should be between
+ /// and .
+ ///
+ /// Note that the gun cannot Fire if the gun is overheated, meaning that
+ /// returns a value > 0.
+ ///
+ /// An event is generated when the bullet hits a robot, wall, or another
+ /// bullet.
+ ///
+ ///
+ ///
+ /// // Fire a bullet with maximum power if the gun is ready
+ /// if (GunGeat == 0)
+ /// {
+ /// SetFire(Rules.MAX_BULLET_POWER);
+ /// }
+ /// ...
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of energy given to the bullet, and subtracted from the robot's energy.
+ ///
+ public void SetFire(double power)
+ {
+ if (peer != null)
+ {
+ peer.SetFire(power);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Sets the gun to Fire a bullet when the next execution takes place.
+ /// The bullet will travel in the direction the gun is pointing.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// Execute() or take an action that executes.
+ ///
+ /// The specified bullet power is an amount of energy that will be taken from
+ /// the robot's energy. Hence, the more power you want to spend on the
+ /// bullet, the more energy is taken from your robot.
+ ///
+ /// The bullet will do (4 * power) damage if it hits another robot. If power
+ /// is greater than 1, it will do an additional 2 * (power - 1) damage.
+ /// You will get (3 * power) back if you hit the other robot. You can call
+ /// for getting the damage that a
+ /// bullet with a specific bullet power will do.
+ ///
+ /// The specified bullet power should be between
+ /// and .
+ ///
+ /// Note that the gun cannot Fire if the gun is overheated, meaning that
+ /// returns a value > 0.
+ ///
+ /// An event is generated when the bullet hits a robot
+ /// (), wall (), or another
+ /// bullet ().
+ ///
+ ///
+ ///
+ /// Bullet bullet = null;
+ ///
+ /// // Fire a bullet with maximum power if the gun is ready
+ /// if (GunHeat == 0)
+ /// {
+ /// bullet = SetFireBullet(Rules.MAX_BULLET_POWER);
+ /// }
+ /// ...
+ /// Execute();
+ /// ...
+ /// // Get the velocity of the bullet
+ /// if (bullet != null)
+ /// {
+ /// double bulletVelocity = bullet.Velocity;
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of energy given to the bullet, and subtracted from the robot's
+ /// energy.
+ ///
+ /// Returns a that contains information about the bullet if it
+ /// was actually fired, which can be used for tracking the bullet after it
+ /// has been fired. If the bullet was not fired, null is returned.
+ public Bullet SetFireBullet(double power)
+ {
+ if (peer != null)
+ {
+ return peer.SetFire(power);
+ }
+ UninitializedException();
+ return null;
+ }
+
+ ///
+ /// Registers a custom event to be called when a condition is met.
+ /// When you are finished with your condition or just want to remove it you
+ /// must call .
+ ///
+ ///
+ ///
+ /// // Create the condition for our custom event
+ /// Condition triggerHitCondition = new Condition("triggerhit")
+ /// {
+ /// public bool Test()
+ /// {
+ /// return (Energy <= trigger);
+ /// }
+ /// }
+ ///
+ /// // Add our custom event based on our condition
+ /// AddCustomEvent(triggerHitCondition);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The condition that must be met.
+ /// Throws ArgumentException if the condition parameter has been set to null.
+ ///
+ public void AddCustomEvent(Condition condition)
+ {
+ if (condition == null)
+ {
+ throw new ArgumentException("the condition cannot be null");
+ }
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).AddCustomEvent(condition);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Same as , but alows to define condition as anonymous method.
+ ///
+ public void AddCustomEvent(string name, int priority, ConditionTest test)
+ {
+ AddCustomEvent(new Condition(name, priority, test));
+ }
+
+ ///
+ /// Removes a custom event that was previously added by calling
+ /// .
+ ///
+ ///
+ ///
+ /// // Create the condition for our custom event
+ /// Condition triggerHitCondition = new Condition("triggerhit")
+ /// {
+ /// public bool Test()
+ /// {
+ /// return (Energy <= trigger);
+ /// }
+ /// }
+ ///
+ /// // Add our custom event based on our condition
+ /// AddCustomEvent(triggerHitCondition);
+ /// ...
+ /// // do something with your robot
+ /// ...
+ /// // Remove the custom event based on our condition
+ /// RemoveCustomEvent(triggerHitCondition);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The condition that was previous added and that must be removed now.
+ ///
+ public void RemoveCustomEvent(Condition condition)
+ {
+ if (condition == null)
+ {
+ throw new ArgumentException("the condition cannot be null");
+ }
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).RemoveCustomEvent(condition);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Clears Out any pending events in the robot's event queue immediately.
+ ///
+ ///
+ ///
+ public void ClearAllEvents()
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).clearAllEvents();
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Executes any pending actions, or continues executing actions that are
+ /// in process. This call returns after the actions have been started.
+ ///
+ /// Note that advanced robots must call this function in order to
+ /// Execute pending set* calls like e.g. ,
+ /// , etc.
+ /// Otherwise, these calls will never get executed.
+ ///
+ /// In this example the robot will move while turning:
+ ///
+ ///
+ /// SetTurnRight(90);
+ /// SetAhead(100);
+ /// Execute();
+ ///
+ /// while (DistanceRemaining > 0 && TurnRemaining > 0)
+ /// {
+ /// Execute();
+ /// }
+ ///
+ ///
+ ///
+ public virtual void Execute()
+ {
+ if (peer != null)
+ {
+ peer.Execute();
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Returns a list containing all events currently in the robot's queue.
+ /// You might, for example, call this while processing another event.
+ ///
+ ///
+ ///
+ /// for (Event evnt : GetAllEvents()) {
+ /// if (evnt is HitRobotEvent) {
+ /// // do something with the event
+ /// } else if (evnt is HitByBulletEvent) {
+ /// // do something with the event
+ /// }
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public IList GetAllEvents()
+ {
+ if (peer != null)
+ {
+ return new List(((IAdvancedRobotPeer) peer).GetAllEvents());
+ }
+ UninitializedException();
+ return null; // never called
+ }
+
+ ///
+ /// Returns a list containing all BulletHitBulletEvents currently in the
+ /// robot's queue. You might, for example, call this while processing another
+ /// event.
+ ///
+ ///
+ ///
+ /// for (BulletHitBulletEvent evnt : GetBulletHitBulletEvents())
+ /// {
+ /// // do something with the event
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public IList GetBulletHitBulletEvents()
+ {
+ if (peer != null)
+ {
+ return new List(((IAdvancedRobotPeer) peer).GetBulletHitBulletEvents());
+ }
+ UninitializedException();
+ return null; // never called
+ }
+
+ ///
+ /// Returns a list containing all BulletHitEvents currently in the robot's
+ /// queue. You might, for example, call this while processing another event.
+ ///
+ ///
+ ///
+ /// for (BulletHitEvent event: GetBulletHitEvents())
+ /// {
+ /// // do something with the event
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public IList GetBulletHitEvents()
+ {
+ if (peer != null)
+ {
+ return new List(((IAdvancedRobotPeer) peer).GetBulletHitEvents());
+ }
+ UninitializedException();
+ return null; // never called
+ }
+
+ ///
+ /// Returns a list containing all BulletMissedEvents currently in the
+ /// robot's queue. You might, for example, call this while processing another
+ /// event.
+ ///
+ ///
+ ///
+ /// for (BulletMissedEvent evnt : GetBulletMissedEvents())
+ /// {
+ /// // do something with the event
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public IList GetBulletMissedEvents()
+ {
+ if (peer != null)
+ {
+ return new List(((IAdvancedRobotPeer) peer).GetBulletMissedEvents());
+ }
+ UninitializedException();
+ return null; // never called
+ }
+
+ ///
+ /// Returns a file representing a data directory for the robot.
+ ///
+ /// The system will automatically create the directory for you, so you do not
+ /// need to create it by yourself.
+ ///
+ ///
+ public string GetDataDirectory()
+ {
+ if (peer != null)
+ {
+ return ((IAdvancedRobotPeer) peer).GetDataDirectory();
+ }
+ UninitializedException();
+ return null; // never called
+ }
+
+ ///
+ /// Returns a file in your data directory that you can write to.
+ ///
+ /// The system will automatically create the directory for you, so you do not
+ /// need to create it by yourself.
+ ///
+ /// Please notice that the max. size of your data file is set to 200000 bytes
+ /// (~195 KB).
+ ///
+ /// See the Sample.SittingDuck to see an example of how to use this
+ /// method.
+ ///
+ ///
+ ///
+ /// The file name of the data file for your robot
+ ///
+ public Stream GetDataFile(string filename)
+ {
+ if (peer != null)
+ {
+ return ((IAdvancedRobotPeer) peer).GetDataFile(filename);
+ }
+ UninitializedException();
+ return null; // never called
+ }
+
+ ///
+ /// Returns the data quota available in your data directory, i.e. the amount
+ /// of bytes left in the data directory for the robot.
+ ///
+ ///
+ ///
+ public long DataQuotaAvailable
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return ((IAdvancedRobotPeer) peer).GetDataQuotaAvailable();
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Returns the current priority of a class of events.
+ /// An event priority is a value from 0 - 99. The higher value, the higher priority.
+ ///
+ ///
+ ///
+ /// int myHitRobotPriority = GetEventPriority("HitRobotEvent");
+ ///
+ ///
+ ///
+ /// The default priorities are, from highest to lowest:
+ ///
+ ///
+ ///
+ ///
+ /// the name of the event class (string)
+ ///
+ public int GetEventPriority(string eventClass)
+ {
+ if (peer != null)
+ {
+ return ((IAdvancedRobotPeer) peer).GetEventPriority(eventClass);
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+
+ ///
+ /// Returns a list containing all HitByBulletEvents currently in the
+ /// robot's queue. You might, for example, call this while processing
+ /// another event.
+ ///
+ ///
+ ///
+ /// for (HitByBulletEvent evnt : GetHitByBulletEvents())
+ /// {
+ /// // do something with the event
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public IList GetHitByBulletEvents()
+ {
+ if (peer != null)
+ {
+ return new List(((IAdvancedRobotPeer) peer).GetHitByBulletEvents());
+ }
+ UninitializedException();
+ return null; // never called
+ }
+
+ ///
+ /// Returns a list containing all HitRobotEvents currently in the robot's
+ /// queue. You might, for example, call this while processing another event.
+ ///
+ ///
+ ///
+ /// for (HitRobotEvent evnt : GetHitRobotEvents())
+ /// {
+ /// // do something with the event
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public IList GetHitRobotEvents()
+ {
+ if (peer != null)
+ {
+ return new List(((IAdvancedRobotPeer) peer).GetHitRobotEvents());
+ }
+ UninitializedException();
+ return null; // never called
+ }
+
+ ///
+ /// Returns a list containing all HitWallEvents currently in the robot's
+ /// queue. You might, for example, call this while processing another event.
+ ///
+ ///
+ ///
+ /// for (HitWallEvent evnt : GetHitWallEvents())
+ /// {
+ /// // do something with the event
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public IList GetHitWallEvents()
+ {
+ if (peer != null)
+ {
+ return new List(((IAdvancedRobotPeer) peer).GetHitWallEvents());
+ }
+ UninitializedException();
+ return null; // never called
+ }
+
+ ///
+ /// Returns a list containing all RobotDeathEvents currently in the robot's
+ /// queue. You might, for example, call this while processing another event.
+ ///
+ ///
+ ///
+ /// for (RobotDeathEvent evnt : GetRobotDeathEvents())
+ /// {
+ /// // do something with the event
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public IList GetRobotDeathEvents()
+ {
+ if (peer != null)
+ {
+ return new List(((IAdvancedRobotPeer) peer).GetRobotDeathEvents());
+ }
+ UninitializedException();
+ return null; // never called
+ }
+
+ ///
+ /// Returns a list containing all ScannedRobotEvents currently in the robot's queue.
+ /// You might, for example, call this while processing another event.
+ ///
+ ///
+ ///
+ /// for (ScannedRobotEvent evnt : GetScannedRobotEvents())
+ /// {
+ /// // do something with the event
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public IList GetScannedRobotEvents()
+ {
+ if (peer != null)
+ {
+ return new List(((IAdvancedRobotPeer) peer).GetScannedRobotEvents());
+ }
+ UninitializedException();
+ return null; // never called
+ }
+
+ ///
+ /// Returns a list containing all StatusEvents currently in the robot's
+ /// queue. You might, for example, call this while processing another event.
+ ///
+ ///
+ ///
+ /// for (StatusEvent evnt : GetStatusEvents())
+ /// {
+ /// // do something with the event
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public IList GetStatusEvents()
+ {
+ if (peer != null)
+ {
+ return new List(((IAdvancedRobotPeer) peer).GetStatusEvents());
+ }
+ UninitializedException();
+ return null; // never called
+ }
+
+ ///
+ public virtual void OnCustomEvent(CustomEvent evnt)
+ {
+ }
+
+ ///
+ /// Sets the priority of a class of events.
+ ///
+ /// Events are sent to the onXXX handlers in order of priority.
+ /// Higher priority events can interrupt lower priority events.
+ /// For events with the same priority, newer events are always sent first.
+ /// Valid priorities are 0 - 99, where 100 is reserved and 80 is the default
+ /// priority.
+ ///
+ ///
+ ///
+ /// SetEventPriority("RobotDeathEvent", 15);
+ ///
+ ///
+ ///
+ /// The default priorities are, from highest to lowest:
+ ///
+ ///
+ /// Note that you cannot change the priority for events with the special
+ /// priority value -1 or 100 (reserved) as these events are system events.
+ /// Also note that you cannot change the priority of CustomEvent.
+ /// Instead you must change the priority of the condition(s) for your custom
+ /// event(s).
+ ///
+ ///
+ ///
+ /// The name of the event class (string) to set the priority for
+ ///
+ ///
+ /// The new priority for that event class
+ ///
+ public void SetEventPriority(string eventClass, int priority)
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).SetEventPriority(eventClass, priority);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Call this during an event handler to allow new events of the same
+ /// priority to restart the event handler.
+ ///
+ ///
+ ///
+ /// public override void OnScannedRobot(ScannedRobotEvent e)
+ /// {
+ /// Fire(1);
+ /// IsInterruptible = true;
+ /// Ahead(100); // If you see a robot while moving ahead,
+ /// // this handler will start from the top
+ /// // Without IsInterruptible (true), we wouldn't
+ /// // receive scan events at all!
+ /// // We'll only get here if we don't see a robot during the move.
+ /// Out.WriteLine("Ok, I can't see anyone");
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ public bool IsInterruptible
+ {
+ set
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).SetInterruptible(value);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+ }
+
+ ///
+ /// Sets the maximum turn rate of the robot measured in degrees if the robot
+ /// should turn slower than (10 degress/turn).
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public double MaxTurnRate
+ {
+ set
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).SetMaxTurnRate(Utils.ToRadians(value));
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+ }
+
+ ///
+ /// Sets the maximum velocity of the robot measured in pixels/turn if the
+ /// robot should move slower than (8 pixels/turn).
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public double MaxVelocity
+ {
+ set
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).SetMaxVelocity(value);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+ }
+
+ ///
+ /// Sets the robot to resume the movement stopped by
+ /// or , if any.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// or take an action that executes.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void SetResume()
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).SetResume();
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// This call is identical to , but returns immediately, and
+ /// will not execute until you call or take an action that
+ /// executes.
+ ///
+ /// If there is already movement saved from a previous stop, this will have
+ /// no effect.
+ ///
+ /// This call is equivalent to calling SetStop(false);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void SetStop()
+ {
+ SetStop(false);
+ }
+
+ ///
+ /// This call is identical to , but
+ /// returns immediately, and will not execute until you call
+ /// or take an action that executes.
+ ///
+ /// If there is already movement saved from a previous stop, you can
+ /// overwrite it by calling SetStop(true).
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// true if the movement saved from a previous stop
+ /// should be overwritten; false otherwise.
+ ///
+ public void SetStop(bool overwrite)
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).SetStop(overwrite);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Sets the robot's gun to turn left by degrees when the next execution
+ /// takes place.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// Execute() or take an action that executes.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's gun is set to turn right
+ /// instead of left.
+ ///
+ ///
+ ///
+ /// // Set the gun to turn 180 degrees to the left
+ /// SetTurnGunLeft(180);
+ ///
+ /// // Set the gun to turn 90 degrees to the right instead of left
+ /// // (overrides the previous order)
+ /// SetTurnGunLeft(-90);
+ ///
+ /// ...
+ /// // Executes the last SetTurnGunLeft()
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of degrees to turn the robot's gun to the left.
+ /// If degrees > 0 the robot's gun is set to turn left.
+ /// If degrees < 0 the robot's gun is set to turn right.
+ /// If degrees = 0 the robot's gun is set to stop turning.
+ ///
+ public void SetTurnGunLeft(double degrees)
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).SetTurnGun(-Utils.ToRadians(degrees));
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Sets the robot's gun to turn right by degrees when the next execution
+ /// takes place.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// Execute() or take an action that executes.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's gun is set to turn left
+ /// instead of right.
+ ///
+ ///
+ ///
+ /// // Set the gun to turn 180 degrees to the right
+ /// SetTurnGunRight(180);
+ ///
+ /// // Set the gun to turn 90 degrees to the left instead of right
+ /// // (overrides the previous order)
+ /// SetTurnGunRight(-90);
+ ///
+ /// ...
+ /// // Executes the last SetTurnGunRight()
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of degrees to turn the robot's gun to the right.
+ /// If degrees > 0 the robot's gun is set to turn right.
+ /// If degrees < 0 the robot's gun is set to turn left.
+ /// If degrees = 0 the robot's gun is set to stop turning.
+ ///
+ public void SetTurnGunRight(double degrees)
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).SetTurnGun(Utils.ToRadians(degrees));
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Sets the robot's radar to turn left by degrees when the next execution
+ /// takes place.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// Execute() or take an action that executes.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's radar is set to turn right
+ /// instead of left.
+ ///
+ ///
+ ///
+ /// // Set the radar to turn 180 degrees to the left
+ /// SetTurnRadarLeft(180);
+ ///
+ /// // Set the radar to turn 90 degrees to the right instead of left
+ /// // (overrides the previous order)
+ /// SetTurnRadarLeft(-90);
+ ///
+ /// ...
+ /// // Executes the last SetTurnRadarLeft()
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of degrees to turn the robot's radar to the left.
+ /// If degrees > 0 the robot's radar is set to turn left.
+ /// If degrees < 0 the robot's radar is set to turn right.
+ /// If degrees = 0 the robot's radar is set to stop turning.
+ ///
+ public void SetTurnRadarLeft(double degrees)
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).SetTurnRadar(-Utils.ToRadians(degrees));
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Sets the robot's radar to turn right by degrees when the next execution
+ /// takes place.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// Execute() or take an action that executes.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's radar is set to turn left
+ /// instead of right.
+ ///
+ ///
+ ///
+ /// // Set the radar to turn 180 degrees to the right
+ /// SetTurnRadarRight(180);
+ ///
+ /// // Set the radar to turn 90 degrees to the right instead of right
+ /// // (overrides the previous order)
+ /// SetTurnRadarRight(-90);
+ ///
+ /// ...
+ /// // Executes the last SetTurnRadarRight()
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of degrees to turn the robot's radar to the rright.
+ /// If degrees > 0 the robot's radar is set to turn right.
+ /// If degrees < 0 the robot's radar is set to turn left.
+ /// If degrees = 0 the robot's radar is set to stop turning.
+ ///
+ public void SetTurnRadarRight(double degrees)
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).SetTurnRadar(Utils.ToRadians(degrees));
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Does not return until a condition is met, i.e. when a
+ /// returns true.
+ ///
+ /// This call executes immediately.
+ ///
+ /// See the Sample.Crazy robot for how this method can be used.
+ ///
+ ///
+ ///
+ ///
+ /// the condition that must be met before this call returns
+ ///
+ public void WaitFor(Condition condition)
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).WaitFor(condition);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// This method is called if your robot dies.
+ ///
+ /// You should override it in your robot if you want to be informed of this
+ /// event. Actions will have no effect if called from this section. The
+ /// intent is to allow you to perform calculations or print something out
+ /// when the robot is killed.
+ ///
+ ///
+ ///
+ /// the death event set by the game
+ public override void OnDeath(DeathEvent evnt)
+ {
+ }
+
+ ///
+ public virtual void OnSkippedTurn(SkippedTurnEvent evnt)
+ {
+ }
+
+ ///
+ /// Returns the direction that the robot's body is facing, in radians.
+ /// The value returned will be between 0 and 2 * PI (is excluded).
+ ///
+ /// Note that the heading in Robocode is like a compass, where 0 means North,
+ /// PI / 2 means East, PI means South, and 3 * PI / 2 means West.
+ ///
+ ///
+ ///
+ ///
+ public double HeadingRadians
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetBodyHeading();
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Sets the robot's body to turn left by radians when the next execution
+ /// takes place.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// Execute() or take an action that executes.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's body is set to turn right
+ /// instead of left.
+ ///
+ ///
+ ///
+ /// // Set the robot to turn 180 degrees to the left
+ /// SetTurnLeftRadians(Math.PI);
+ ///
+ /// // Set the robot to turn 90 degrees to the right instead of left
+ /// // (overrides the previous order)
+ /// SetTurnLeftRadians(-Math.PI / 2);
+ ///
+ /// ...
+ /// // Executes the last SetTurnLeftRadians()
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// the amount of radians to turn the robot's body to the left.
+ /// If radians > 0 the robot is set to turn left.
+ /// If radians < 0 the robot is set to turn right.
+ /// If radians = 0 the robot is set to stop turning.
+ public void SetTurnLeftRadians(double radians)
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).SetTurnBody(-radians);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Sets the robot's body to turn right by radians when the next execution
+ /// takes place.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// Execute() or take an action that executes.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's body is set to turn left
+ /// instead of right.
+ ///
+ ///
+ ///
+ /// // Set the robot to turn 180 degrees to the right
+ /// SetTurnRightRadians(Math.PI);
+ ///
+ /// // Set the robot to turn 90 degrees to the left instead of right
+ /// // (overrides the previous order)
+ /// SetTurnRightRadians(-Math.PI / 2);
+ ///
+ /// ...
+ /// // Executes the last SetTurnRightRadians()
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// the amount of radians to turn the robot's body to the right.
+ /// If radians > 0 the robot is set to turn right.
+ /// If radians < 0 the robot is set to turn left.
+ /// If radians = 0 the robot is set to stop turning.
+ public void SetTurnRightRadians(double radians)
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).SetTurnBody(radians);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Immediately turns the robot's body to the left by radians.
+ ///
+ /// This call executes immediately, and does not return until it is complete,
+ /// i.e. when the angle remaining in the robot's turn is 0.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's body is set to turn right
+ /// instead of left.
+ ///
+ ///
+ ///
+ /// // Turn the robot 180 degrees to the left
+ /// TurnLeftRadians(Math.PI);
+ ///
+ /// // Afterwards, turn the robot 90 degrees to the right
+ /// TurnLeftRadians(-Math.PI / 2);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// the amount of radians to turn the robot's body to the left.
+ /// If radians > 0 the robot will turn right.
+ /// If radians < 0 the robot will turn left.
+ /// If radians = 0 the robot will not turn, but execute.
+ public void TurnLeftRadians(double radians)
+ {
+ if (peer != null)
+ {
+ peer.TurnBody(-radians);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Immediately turns the robot's body to the right by radians.
+ /// This call executes immediately, and does not return until it is complete,
+ /// i.e. when the angle remaining in the robot's turn is 0.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's body is set to turn left
+ /// instead of right.
+ ///
+ ///
+ ///
+ /// // Turn the robot 180 degrees to the right
+ /// TurnRightRadians(Math.PI);
+ ///
+ /// // Afterwards, turn the robot 90 degrees to the left
+ /// TurnRightRadians(-Math.PI / 2);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// the amount of radians to turn the robot's body to the right.
+ /// If radians > 0 the robot will turn right.
+ /// If radians < 0 the robot will turn left.
+ /// If radians = 0 the robot will not turn, but execute.
+ public void TurnRightRadians(double radians)
+ {
+ if (peer != null)
+ {
+ peer.TurnBody(radians);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Returns the direction that the robot's gun is facing, in radians.
+ /// The value returned will be between 0 and 2 * PI (is excluded).
+ ///
+ /// Note that the heading in Robocode is like a compass, where 0 means North,
+ /// PI / 2 means East, PI means South, and 3 * PI / 2 means West.
+ ///
+ ///
+ ///
+ ///
+ public double GunHeadingRadians
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetGunHeading();
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Returns the direction that the robot's radar is facing, in radians.
+ /// The value returned will be between 0 and 2 * PI (is excluded).
+ ///
+ /// Note that the heading in Robocode is like a compass, where 0 means North,
+ /// PI / 2 means East, PI means South, and 3 * PI / 2 means West.
+ ///
+ ///
+ ///
+ ///
+ public double RadarHeadingRadians
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetRadarHeading();
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Sets the robot's gun to turn left by radians when the next execution
+ /// takes place.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// Execute() or take an action that executes.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's gun is set to turn right
+ /// instead of left.
+ ///
+ ///
+ ///
+ /// // Set the gun to turn 180 degrees to the left
+ /// SetTurnGunLeftRadians(Math.PI);
+ ///
+ /// // Set the gun to turn 90 degrees to the right instead of left
+ /// // (overrides the previous order)
+ /// SetTurnGunLeftRadians(-Math.PI / 2);
+ ///
+ /// ...
+ /// // Executes the last SetTurnGunLeftRadians()
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// the amount of radians to turn the robot's gun to the left.
+ /// If radians > 0 the robot's gun is set to turn left.
+ /// If radians < 0 the robot's gun is set to turn right.
+ /// If radians = 0 the robot's gun is set to stop turning.
+ public void SetTurnGunLeftRadians(double radians)
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).SetTurnGun(-radians);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Sets the robot's gun to turn right by radians when the next execution
+ /// takes place.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// Execute() or take an action that executes.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's gun is set to turn left
+ /// instead of right.
+ ///
+ ///
+ ///
+ /// // Set the gun to turn 180 degrees to the right
+ /// SetTurnGunRightRadians(Math.PI);
+ ///
+ /// // Set the gun to turn 90 degrees to the left instead of right
+ /// // (overrides the previous order)
+ /// SetTurnGunRightRadians(-Math.PI / 2);
+ ///
+ /// ...
+ /// // Executes the last SetTurnGunRightRadians()
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// the amount of radians to turn the robot's gun to the right.
+ /// If radians > 0 the robot's gun is set to turn left.
+ /// If radians < 0 the robot's gun is set to turn right.
+ /// If radians = 0 the robot's gun is set to stop turning.
+ public void SetTurnGunRightRadians(double radians)
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).SetTurnGun(radians);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Sets the robot's radar to turn left by radians when the next execution
+ /// takes place.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// Execute() or take an action that executes.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's radar is set to turn right
+ /// instead of left.
+ ///
+ ///
+ ///
+ /// // Set the radar to turn 180 degrees to the left
+ /// SetTurnRadarLeftRadians(Math.PI);
+ ///
+ /// // Set the radar to turn 90 degrees to the right instead of left
+ /// // (overrides the previous order)
+ /// SetTurnRadarLeftRadians(-Math.PI / 2);
+ ///
+ /// ...
+ /// // Executes the last SetTurnRadarLeftRadians()
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// the amount of radians to turn the robot's radar to the left.
+ /// If radians > 0 the robot's radar is set to turn left.
+ /// If radians < 0 the robot's radar is set to turn right.
+ /// If radians = 0 the robot's radar is set to stop turning.
+ public void SetTurnRadarLeftRadians(double radians)
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).SetTurnRadar(-radians);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Sets the robot's radar to turn right by radians when the next execution
+ /// takes place.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// Execute() or take an action that executes.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's radar is set to turn left
+ /// instead of right.
+ ///
+ ///
+ ///
+ /// // Set the radar to turn 180 degrees to the right
+ /// SetTurnRadarRightRadians(Math.PI);
+ ///
+ /// // Set the radar to turn 90 degrees to the right instead of right
+ /// // (overrides the previous order)
+ /// SetTurnRadarRightRadians(-Math.PI / 2);
+ ///
+ /// ...
+ /// // Executes the last SetTurnRadarRightRadians()
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// the amount of radians to turn the robot's radar to the right.
+ /// If radians > 0 the robot's radar is set to turn left.
+ /// If radians < 0 the robot's radar is set to turn right.
+ /// If radians = 0 the robot's radar is set to stop turning.
+ public void SetTurnRadarRightRadians(double radians)
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).SetTurnRadar(radians);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Immediately turns the robot's gun to the left by radians.
+ ///
+ /// This call executes immediately, and does not return until it is complete,
+ /// i.e. when the angle remaining in the gun's turn is 0.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's gun is set to turn right
+ /// instead of left.
+ ///
+ ///
+ ///
+ /// // Turn the robot's gun 180 degrees to the left
+ /// TurnGunLeftRadians(Math.PI);
+ ///
+ /// // Afterwards, turn the robot's gun 90 degrees to the right
+ /// TurnGunLeftRadians(-Math.PI / 2);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// the amount of radians to turn the robot's gun to the left.
+ /// If radians > 0 the robot's gun will turn left.
+ /// If radians < 0 the robot's gun will turn right.
+ /// If radians = 0 the robot's gun will not turn, but execute.
+ public void TurnGunLeftRadians(double radians)
+ {
+ if (peer != null)
+ {
+ peer.TurnGun(-radians);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Immediately turns the robot's gun to the right by radians.
+ /// This call executes immediately, and does not return until it is complete,
+ /// i.e. when the angle remaining in the gun's turn is 0.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's gun is set to turn left
+ /// instead of right.
+ ///
+ ///
+ ///
+ /// // Turn the robot's gun 180 degrees to the right
+ /// TurnGunRightRadians(Math.PI);
+ ///
+ /// // Afterwards, turn the robot's gun 90 degrees to the left
+ /// TurnGunRightRadians(-Math.PI / 2);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// the amount of radians to turn the robot's gun to the right.
+ /// If radians > 0 the robot's gun will turn right.
+ /// If radians < 0 the robot's gun will turn left.
+ /// If radians = 0 the robot's gun will not turn, but execute.
+ public void TurnGunRightRadians(double radians)
+ {
+ if (peer != null)
+ {
+ peer.TurnGun(radians);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Immediately turns the robot's radar to the left by radians.
+ ///
+ /// This call executes immediately, and does not return until it is complete,
+ /// i.e. when the angle remaining in the radar's turn is 0.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's radar is set to turn right
+ /// instead of left.
+ ///
+ ///
+ ///
+ /// // Turn the robot's radar 180 degrees to the left
+ /// TurnRadarLeftRadians(Math.PI);
+ ///
+ /// // Afterwards, turn the robot's radar 90 degrees to the right
+ /// TurnRadarLeftRadians(-Math.PI / 2);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// the amount of radians to turn the robot's radar to the left.
+ /// If radians > 0 the robot's radar will turn left.
+ /// If radians < 0 the robot's radar will turn right.
+ /// If radians = 0 the robot's radar will not turn, but execute.
+ public void TurnRadarLeftRadians(double radians)
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).TurnRadar(-radians);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Immediately turns the robot's radar to the right by radians.
+ /// This call executes immediately, and does not return until it is complete,
+ /// i.e. when the angle remaining in the radar's turn is 0.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's radar is set to turn left
+ /// instead of right.
+ ///
+ ///
+ ///
+ /// // Turn the robot's radar 180 degrees to the right
+ /// TurnRadarRightRadians(Math.PI);
+ ///
+ /// // Afterwards, turn the robot's radar 90 degrees to the left
+ /// TurnRadarRightRadians(-Math.PI / 2);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// the amount of radians to turn the robot's radar to the right.
+ /// If radians > 0 the robot's radar will turn right.
+ /// If radians < 0 the robot's radar will turn left.
+ /// If radians = 0 the robot's radar will not turn, but execute.
+ public void TurnRadarRightRadians(double radians)
+ {
+ if (peer != null)
+ {
+ ((IAdvancedRobotPeer) peer).TurnRadar(radians);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Returns the angle remaining in the gun's turn, in radians.
+ ///
+ /// This call returns both positive and negative values. Positive values
+ /// means that the gun is currently turning to the right. Negative values
+ /// means that the gun is currently turning to the left.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public double GunTurnRemainingRadians
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetGunTurnRemaining();
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Returns the angle remaining in the radar's turn, in radians.
+ ///
+ /// This call returns both positive and negative values. Positive values
+ /// means that the radar is currently turning to the right. Negative values
+ /// means that the radar is currently turning to the left.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public double RadarTurnRemainingRadians
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetRadarTurnRemaining();
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Returns the angle remaining in the robot's turn, in radians.
+ ///
+ /// This call returns both positive and negative values. Positive values
+ /// means that the robot is currently turning to the right. Negative values
+ /// means that the robot is currently turning to the left.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public double TurnRemainingRadians
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetBodyTurnRemaining();
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ IAdvancedEvents IAdvancedRobot.GetAdvancedEventListener()
+ {
+ return this; // this robot is listening
+ }
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/BattleEndedEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/BattleEndedEvent.cs
new file mode 100644
index 0000000..7c877c1
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/BattleEndedEvent.cs
@@ -0,0 +1,126 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// A BattleEndedEvent is sent to
+ /// when the battle is ended.
+ /// You can use the information contained in this event to determine if the
+ /// battle was aborted and also get the results of the battle.
+ ///
+ ///
+ ///
+ [Serializable]
+ public sealed class BattleEndedEvent : Event
+ {
+ private const int DEFAULT_PRIORITY = 100; // System event -> cannot be changed!;
+
+ private readonly bool aborted;
+ private readonly BattleResults results;
+
+ ///
+ ///
+ /// Called by the game to create a new BattleEndedEvent.
+ ///
+ public BattleEndedEvent(bool aborted, BattleResults results)
+ {
+ this.aborted = aborted;
+ this.results = results;
+ }
+
+ ///
+ /// Checks if this battle was aborted.
+ /// Returns true if the battle was aborted
+ ///
+ public bool IsAborted
+ {
+ get { return aborted; }
+ }
+
+ ///
+ /// Returns the battle results.
+ ///
+ public BattleResults Results
+ {
+ get { return results; }
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ ///
+ public override int Priority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ if (robot != null)
+ {
+ var listener = robot.GetBasicEventListener() as IBasicEvents2;
+ if (listener != null)
+ {
+ listener.OnBattleEnded(this);
+ }
+ }
+ }
+
+ internal override bool IsCriticalEvent
+ {
+ get { return true; }
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.BattleEndedEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ var obj = (BattleEndedEvent) objec;
+
+ return RbSerializerN.SIZEOF_TYPEINFO + RbSerializerN.SIZEOF_BOOL
+ + serializer.sizeOf(RbSerializerN.BattleResults_TYPE, obj.results);
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (BattleEndedEvent) objec;
+
+ serializer.serialize(buffer, obj.aborted);
+ serializer.serialize(buffer, RbSerializerN.BattleResults_TYPE, obj.results);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ bool aborted = serializer.deserializeBoolean(buffer);
+ var results = (BattleResults) serializer.deserializeAny(buffer);
+
+ return new BattleEndedEvent(aborted, results);
+ }
+ }
+ }
+}
+
+//docl
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/BattleResults.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/BattleResults.cs
new file mode 100644
index 0000000..8975462
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/BattleResults.cs
@@ -0,0 +1,225 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.nio;
+using net.sf.robocode.serialization;
+
+namespace Robocode
+{
+ ///
+ /// Contains the battle results returned by
+ /// when a battle has ended.
+ ///
+ ///
+ ///
+ [Serializable]
+ public class BattleResults : IComparable
+ {
+ internal string teamLeaderName;
+ internal int rank;
+ internal double score;
+ internal double survival;
+ internal double lastSurvivorBonus;
+ internal double bulletDamage;
+ internal double bulletDamageBonus;
+ internal double ramDamage;
+ internal double ramDamageBonus;
+ internal int firsts;
+ internal int seconds;
+ internal int thirds;
+
+ ///
+ /// Constructs this BattleResults object.
+ ///
+ public BattleResults(
+ string teamLeaderName,
+ int rank,
+ double score,
+ double survival,
+ double lastSurvivorBonus,
+ double bulletDamage,
+ double bulletDamageBonus,
+ double ramDamage,
+ double ramDamageBonus,
+ int firsts,
+ int seconds,
+ int thirds
+ )
+ {
+ this.teamLeaderName = teamLeaderName;
+ this.rank = rank;
+ this.score = score;
+ this.survival = survival;
+ this.lastSurvivorBonus = lastSurvivorBonus;
+ this.bulletDamage = bulletDamage;
+ this.bulletDamageBonus = bulletDamageBonus;
+ this.ramDamage = ramDamage;
+ this.ramDamageBonus = ramDamageBonus;
+ this.firsts = firsts;
+ this.seconds = seconds;
+ this.thirds = thirds;
+ }
+
+ ///
+ /// Returns the name of the team leader in the team or the name of the
+ /// robot if the robot is not participating in a team.
+ ///
+ public string TeamLeaderName
+ {
+ get { return teamLeaderName; }
+ }
+
+ ///
+ /// Returns the rank of this robot in the battle results.
+ ///
+ public int Rank
+ {
+ get { return rank; }
+ }
+
+ ///
+ /// Returns the total score of this robot in the battle.
+ ///
+ public int Score
+ {
+ get { return (int) (score + 0.5); }
+ }
+
+ ///
+ /// Returns the survival score of this robot in the battle.
+ ///
+ public int Survival
+ {
+ get { return (int) (survival + 0.5); }
+ }
+
+ ///
+ /// Returns the last survivor score of this robot in the battle.
+ ///
+ public int LastSurvivorBonus
+ {
+ get { return (int) (lastSurvivorBonus + 0.5); }
+ }
+
+ ///
+ /// Returns the bullet damage score of this robot in the battle.
+ ///
+ public int BulletDamage
+ {
+ get { return (int) (bulletDamage + 0.5); }
+ }
+
+ ///
+ /// Returns the bullet damage bonus of this robot in the battle.
+ ///
+ public int BulletDamageBonus
+ {
+ get { return (int) (bulletDamageBonus + 0.5); }
+ }
+
+ ///
+ /// Returns the ram damage score of this robot in the battle.
+ ///
+ public int RamDamage
+ {
+ get { return (int) (ramDamage + 0.5); }
+ }
+
+ ///
+ /// Returns the ram damage bonus of this robot in the battle.
+ ///
+ public int RamDamageBonus
+ {
+ get { return (int) (ramDamageBonus + 0.5); }
+ }
+
+ ///
+ /// Returns the number of rounds this robot placed first in the battle.
+ ///
+ public int Firsts
+ {
+ get { return firsts; }
+ }
+
+ ///
+ /// Returns the number of rounds this robot placed second in the battle.
+ ///
+ public int Seconds
+ {
+ get { return seconds; }
+ }
+
+ ///
+ /// Returns the number of rounds this robot placed third in the battle.
+ ///
+ public int Thirds
+ {
+ get { return thirds; }
+ }
+
+ public int CompareTo(BattleResults o)
+ {
+ return score.CompareTo(o.score);
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ var obj = (BattleResults) objec;
+
+ return RbSerializerN.SIZEOF_TYPEINFO + serializer.sizeOf(obj.teamLeaderName) +
+ 4*RbSerializerN.SIZEOF_INT
+ + 7*RbSerializerN.SIZEOF_DOUBLE;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (BattleResults) objec;
+
+ serializer.serialize(buffer, obj.teamLeaderName);
+ serializer.serialize(buffer, obj.rank);
+ serializer.serialize(buffer, obj.score);
+ serializer.serialize(buffer, obj.survival);
+ serializer.serialize(buffer, obj.lastSurvivorBonus);
+ serializer.serialize(buffer, obj.bulletDamage);
+ serializer.serialize(buffer, obj.bulletDamageBonus);
+ serializer.serialize(buffer, obj.ramDamage);
+ serializer.serialize(buffer, obj.ramDamageBonus);
+ serializer.serialize(buffer, obj.firsts);
+ serializer.serialize(buffer, obj.seconds);
+ serializer.serialize(buffer, obj.thirds);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ string teamLeaderName = serializer.deserializeString(buffer);
+ int rank = buffer.getInt();
+ double score = buffer.getDouble();
+ double survival = buffer.getDouble();
+ double lastSurvivorBonus = buffer.getDouble();
+ double bulletDamage = buffer.getDouble();
+ double bulletDamageBonus = buffer.getDouble();
+ double ramDamage = buffer.getDouble();
+ double ramDamageBonus = buffer.getDouble();
+ int firsts = buffer.getInt();
+ int seconds = buffer.getInt();
+ int thirds = buffer.getInt();
+
+ return new BattleResults(teamLeaderName, rank, score, survival, lastSurvivorBonus, bulletDamage,
+ bulletDamageBonus, ramDamage, ramDamageBonus, firsts, seconds, thirds);
+ }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/BattleRules.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/BattleRules.cs
new file mode 100644
index 0000000..461d0f1
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/BattleRules.cs
@@ -0,0 +1,137 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.security;
+
+namespace Robocode
+{
+ ///
+ /// Contains the battle rules returned by BattleStartedEvent.BattleRules
+ /// when a battle is started and BattleCompletedEvent.BattleRules
+ /// when a battle is completed.
+ ///
+ /// BattleStartedEvent
+ /// BattleCompletedEvent
+ [Serializable]
+ public sealed class BattleRules
+ {
+ private readonly int battlefieldWidth;
+ private readonly int battlefieldHeight;
+ private readonly int numRounds;
+ private readonly double gunCoolingRate;
+ private readonly long inactivityTime;
+ private readonly bool hideEnemyNames;
+ private readonly int sentryBorderSize;
+
+ ///
+ /// Returns the battlefield width.
+ ///
+ public int BattlefieldWidth
+ {
+ get { return battlefieldWidth; }
+ }
+
+ ///
+ /// Returns the battlefield height.
+ ///
+ public int BattlefieldHeight
+ {
+ get { return battlefieldHeight; }
+ }
+
+ ///
+ /// Returns the number of rounds.
+ ///
+ public int NumRounds
+ {
+ get { return numRounds; }
+ }
+
+ ///
+ /// Returns the rate at which the gun will cool down, i.e. the amount of heat the gun heat will drop per turn.
+ ///
+ /// The gun cooling rate is default 0.1 per turn, but can be changed by the battle setup.
+ /// So don't count on the cooling rate being 0.1!
+ ///
+ ///
+ ///
+ ///
+ public double GunCoolingRate
+ {
+ get { return gunCoolingRate; }
+ }
+
+ ///
+ /// Returns the allowed inactivity time, where the robot is not taking any action, before will begin to be zapped.
+ /// The inactivity time is measured in turns, and is the allowed time that a robot is allowed to omit taking
+ /// action before being punished by the game by zapping.
+ ///
+ /// When a robot is zapped by the game, it will loose 0.1 energy points per turn. Eventually the robot will be
+ /// killed by zapping until the robot takes action. When the robot takes action, the inactivity time counter is
+ /// reset.
+ ///
+ /// The allowed inactivity time is per default 450 turns, but can be changed by the battle setup.
+ /// So don't count on the inactivity time being 450 turns!
+ ///
+ ///
+ ///
+ public long InactivityTime
+ {
+ get { return inactivityTime; }
+ }
+
+ ///
+ /// Returns true if the enemy names are hidden, i.e. anonymous; false otherwise.
+ ///
+ public bool HideEnemyNames
+ {
+ get { return hideEnemyNames; }
+ }
+
+ ///
+ /// Returns the sentry border size for a BorderSentry that defines the how
+ /// far a BorderSentry is allowed to move from the border edges measured in units.
+ /// Hence, the sentry border size defines the width/range of the border area surrounding the battlefield that
+ /// BorderSentrys cannot leave (sentry robots robots must stay in the border area), but it also define the
+ /// distance from the border edges where BorderSentrys are allowed/able to make damage to robots entering this
+ /// border area.
+ ///
+ public int SentryBorderSize
+ {
+ get { return sentryBorderSize; }
+ }
+
+ private BattleRules(int battlefieldWidth, int battlefieldHeight, int numRounds, double gunCoolingRate, long inactivityTime,
+ bool hideEnemyNames, int sentryBorderSize)
+ {
+ this.battlefieldWidth = battlefieldWidth;
+ this.battlefieldHeight = battlefieldHeight;
+ this.numRounds = numRounds;
+ this.gunCoolingRate = gunCoolingRate;
+ this.inactivityTime = inactivityTime;
+ this.hideEnemyNames = hideEnemyNames;
+ this.sentryBorderSize = sentryBorderSize;
+ }
+
+ private static IHiddenRulesHelper createHiddenHelper()
+ {
+ return new HiddenHelper();
+ }
+
+ private class HiddenHelper : IHiddenRulesHelper
+ {
+ public BattleRules createRules(int battlefieldWidth, int battlefieldHeight, int numRounds, double gunCoolingRate, long inactivityTime,
+ bool hideEnemyNames, int borderSentryRobotAttackRange)
+ {
+ return new BattleRules(battlefieldWidth, battlefieldHeight, numRounds, gunCoolingRate, inactivityTime, hideEnemyNames, borderSentryRobotAttackRange);
+ }
+ }
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/Bullet.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/Bullet.cs
new file mode 100644
index 0000000..2a4ddef
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/Bullet.cs
@@ -0,0 +1,217 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.nio;
+using net.sf.robocode.security;
+using net.sf.robocode.serialization;
+using Robocode.Util;
+
+namespace Robocode
+{
+ ///
+ ///
+ /// Represents a bullet. This is returned from
+ /// and , and all the bullet-related
+ /// events.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [Serializable]
+ public class Bullet
+ {
+ private readonly double headingRadians;
+ private double x;
+ private double y;
+ private readonly double power;
+ private readonly string ownerName;
+ private string victimName;
+ private bool _isActive;
+ private readonly int bulletId;
+
+ ///
+ /// Called by the game to create a new Bullet object
+ ///
+ public Bullet(double heading, double x, double y, double power, string ownerName, string victimName,
+ bool isActive, int bulletId)
+ {
+ headingRadians = heading;
+ this.x = x;
+ this.y = y;
+ this.power = power;
+ this.ownerName = ownerName;
+ this.victimName = victimName;
+ _isActive = isActive;
+ this.bulletId = bulletId;
+ }
+
+ public override bool Equals(Object obj)
+ {
+ if (obj is Bullet)
+ {
+ Bullet bullet = (Bullet)obj;
+ return bullet.bulletId == bulletId;
+ }
+ return Equals(obj);
+ }
+
+ ///
+ /// Returns the direction the bullet is/was heading, in degrees
+ /// (0 <= getHeading() < 360). This is not relative to the direction you are facing.
+ ///
+ public double Heading
+ {
+ get { return Utils.ToDegrees(headingRadians); }
+ }
+
+ ///
+ /// Returns the direction the bullet is/was heading, in radians
+ /// (0 <= getHeadingRadians() < 2 * Math.PI). This is not relative to the direction you are facing.
+ ///
+ public double HeadingRadians
+ {
+ get { return headingRadians; }
+ }
+
+ ///
+ /// Returns the name of the robot that fired this bullet.
+ ///
+ public string Name
+ {
+ get { return ownerName; }
+ }
+
+ ///
+ /// Returns the power of this bullet.
+ ///
+ /// The bullet will do (4 * power) damage if it hits another robot.
+ /// If power is greater than 1, it will do an additional 2 * (power - 1)
+ /// damage. You will get (3 * power) back if you hit the other robot.
+ ///
+ public double Power
+ {
+ get { return power; }
+ }
+
+ ///
+ /// Returns the velocity of this bullet. The velocity of the bullet is
+ /// constant once it has been fired.
+ ///
+ public double Velocity
+ {
+ get { return Rules.GetBulletSpeed(power); }
+ }
+
+ ///
+ /// Returns the name of the robot that this bullet hit, or null if
+ /// the bullet has not hit a robot.
+ ///
+ public string Victim
+ {
+ get { return victimName; }
+ }
+
+ ///
+ /// Returns the X position of the bullet.
+ ///
+ public double X
+ {
+ get { return x; }
+ }
+
+ ///
+ /// Returns the Y position of the bullet.
+ ///
+ public double Y
+ {
+ get { return y; }
+ }
+
+ ///
+ /// Checks if this bullet is still active on the battlefield.
+ ///
+ public bool IsActive
+ {
+ get { return _isActive; }
+ }
+
+ ///
+ /// Updates this bullet based on the specified bullet status.
+ ///
+ // this method is invisible on RobotAPI
+ private void update(double x, double y, string victimName, bool isActive)
+ {
+ this.x = x;
+ this.y = y;
+ this.victimName = victimName;
+ _isActive = isActive;
+ }
+
+ internal int getBulletId()
+ {
+ return bulletId;
+ }
+
+ private static IHiddenBulletHelper createHiddenHelper()
+ {
+ return new HiddenBulletHelper();
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new HiddenBulletHelper();
+ }
+
+ private class HiddenBulletHelper : IHiddenBulletHelper, ISerializableHelperN
+ {
+ public void update(Bullet bullet, double x, double y, string victimName, bool isActive)
+ {
+ bullet.update(x, y, victimName, isActive);
+ }
+
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ var obj = (Bullet)objec;
+
+ return RbSerializerN.SIZEOF_TYPEINFO + 4 * RbSerializerN.SIZEOF_DOUBLE + serializer.sizeOf(obj.ownerName)
+ + serializer.sizeOf(obj.victimName) + RbSerializerN.SIZEOF_BOOL + RbSerializerN.SIZEOF_INT;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (Bullet)objec;
+
+ serializer.serialize(buffer, obj.headingRadians);
+ serializer.serialize(buffer, obj.x);
+ serializer.serialize(buffer, obj.y);
+ serializer.serialize(buffer, obj.power);
+ serializer.serialize(buffer, obj.ownerName);
+ serializer.serialize(buffer, obj.victimName);
+ serializer.serialize(buffer, obj._isActive);
+ serializer.serialize(buffer, obj.bulletId);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ double headingRadians = buffer.getDouble();
+ double x = buffer.getDouble();
+ double y = buffer.getDouble();
+ double power = buffer.getDouble();
+ string ownerName = serializer.deserializeString(buffer);
+ string victimName = serializer.deserializeString(buffer);
+ bool isActive = serializer.deserializeBoolean(buffer);
+ int bulletId = serializer.deserializeInt(buffer);
+
+ return new Bullet(headingRadians, x, y, power, ownerName, victimName, isActive, bulletId);
+ }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/BulletHitBulletEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/BulletHitBulletEvent.cs
new file mode 100644
index 0000000..6723d1b
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/BulletHitBulletEvent.cs
@@ -0,0 +1,116 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using System.Collections.Generic;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// This event is sent to
+ /// when one of your bullets has hit another bullet.
+ ///
+ [Serializable]
+ public sealed class BulletHitBulletEvent : Event
+ {
+ private const int DEFAULT_PRIORITY = 55;
+
+ private Bullet bullet;
+ private readonly Bullet hitBullet;
+
+ ///
+ /// Called by the game to create a new BulletHitEvent.
+ ///
+ public BulletHitBulletEvent(Bullet bullet, Bullet hitBullet)
+ {
+ this.bullet = bullet;
+ this.hitBullet = hitBullet;
+ }
+
+ ///
+ /// Returns your bullet that hit another bullet.
+ ///
+ public Bullet Bullet
+ {
+ get { return bullet; }
+ }
+
+ ///
+ /// Returns the bullet that was hit by your bullet.
+ ///
+ public Bullet HitBullet
+ {
+ get { return hitBullet; }
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ IBasicEvents listener = robot.GetBasicEventListener();
+
+ if (listener != null)
+ {
+ listener.OnBulletHitBullet(this);
+ }
+ }
+
+ // Needed for .NET version
+ internal override void UpdateBullets(Dictionary bullets)
+ {
+ // we need to pass same instance
+ bullet = bullets[bullet.getBulletId()];
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.BulletHitBulletEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ var obj = (BulletHitBulletEvent) objec;
+
+ return RbSerializerN.SIZEOF_TYPEINFO + RbSerializerN.SIZEOF_INT
+ + serializer.sizeOf(RbSerializerN.Bullet_TYPE, obj.hitBullet);
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (BulletHitBulletEvent) objec;
+
+ // no need to transmit whole bullet, rest of it is already known to proxy side
+ serializer.serialize(buffer, obj.bullet.getBulletId());
+ serializer.serialize(buffer, RbSerializerN.Bullet_TYPE, obj.hitBullet);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ var bullet = new Bullet(0, 0, 0, 0, null, null, false, buffer.getInt());
+ var hitBullet = (Bullet) serializer.deserializeAny(buffer);
+
+ return new BulletHitBulletEvent(bullet, hitBullet);
+ }
+ }
+ }
+}
+
+//doc
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/BulletHitEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/BulletHitEvent.cs
new file mode 100644
index 0000000..bc35644
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/BulletHitEvent.cs
@@ -0,0 +1,128 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using System.Collections.Generic;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// This event is sent to
+ /// when one of your bullets has hit another robot.
+ ///
+ [Serializable]
+ public sealed class BulletHitEvent : Event
+ {
+ private const int DEFAULT_PRIORITY = 50;
+
+ private readonly string name;
+ private readonly double energy;
+ private Bullet bullet;
+
+ ///
+ /// Called by the game to create a new BulletHitEvent.
+ ///
+ public BulletHitEvent(string name, double energy, Bullet bullet)
+ {
+ this.name = name;
+ this.energy = energy;
+ this.bullet = bullet;
+ }
+
+ ///
+ /// Returns the bullet of yours that hit the robot.
+ ///
+ public Bullet Bullet
+ {
+ get { return bullet; }
+ }
+
+ ///
+ /// Returns the remaining energy of the robot your bullet has hit (after the
+ /// damage done by your bullet).
+ ///
+ public double VictimEnergy
+ {
+ get { return energy; }
+ }
+
+ ///
+ /// Returns the name of the robot your bullet hit.
+ ///
+ public string VictimName
+ {
+ get { return name; }
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ IBasicEvents listener = robot.GetBasicEventListener();
+
+ if (listener != null)
+ {
+ listener.OnBulletHit(this);
+ }
+ }
+
+ // Needed for .NET version
+ internal override void UpdateBullets(Dictionary bullets)
+ {
+ // we need to pass same instance
+ bullet = bullets[bullet.getBulletId()];
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.BulletHitEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ var obj = (BulletHitEvent) objec;
+
+ return RbSerializerN.SIZEOF_TYPEINFO + RbSerializerN.SIZEOF_INT + serializer.sizeOf(obj.name)
+ + RbSerializerN.SIZEOF_DOUBLE;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (BulletHitEvent) objec;
+
+ serializer.serialize(buffer, obj.bullet.getBulletId());
+ serializer.serialize(buffer, obj.name);
+ serializer.serialize(buffer, obj.energy);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ var bullet = new Bullet(0, 0, 0, 0, null, null, false, buffer.getInt());
+ string name = serializer.deserializeString(buffer);
+ double energy = buffer.getDouble();
+
+ return new BulletHitEvent(name, energy, bullet);
+ }
+ }
+ }
+}
+
+//doc
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/BulletMissedEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/BulletMissedEvent.cs
new file mode 100644
index 0000000..19294d6
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/BulletMissedEvent.cs
@@ -0,0 +1,102 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using System.Collections.Generic;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// This event is sent to
+ /// when one of your bullets has missed, i.e. when the bullet has
+ /// reached the border of the battlefield.
+ ///
+ [Serializable]
+ public sealed class BulletMissedEvent : Event
+ {
+ private const int DEFAULT_PRIORITY = 60;
+
+ private Bullet bullet;
+
+ ///
+ ///
+ /// Called by the game to create a new BulletMissedEvent.
+ ///
+ public BulletMissedEvent(Bullet bullet)
+ {
+ this.bullet = bullet;
+ }
+
+ ///
+ ///
+ /// Returns the bullet that missed.
+ ///
+ public Bullet Bullet
+ {
+ get { return bullet; }
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ IBasicEvents listener = robot.GetBasicEventListener();
+
+ if (listener != null)
+ {
+ listener.OnBulletMissed(this);
+ }
+ }
+
+ // Needed for .NET version
+ internal override void UpdateBullets(Dictionary bullets)
+ {
+ // we need to pass same instance
+ bullet = bullets[bullet.getBulletId()];
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.BulletMissedEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ return RbSerializerN.SIZEOF_TYPEINFO + RbSerializerN.SIZEOF_INT;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (BulletMissedEvent) objec;
+
+ serializer.serialize(buffer, obj.bullet.getBulletId());
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ var bullet = new Bullet(0, 0, 0, 0, null, null, false, buffer.getInt());
+
+ return new BulletMissedEvent(bullet);
+ }
+ }
+ }
+}
+//doc
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/Condition.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/Condition.cs
new file mode 100644
index 0000000..974fcea
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/Condition.cs
@@ -0,0 +1,155 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.io;
+
+namespace Robocode
+{
+ ///
+ /// Condition is used to define custom
+ /// and custom events for an AdvancedRobot. The code below is taken from the sample robot
+ /// named samplecs.Target. See the samplecs/Target.cs for details.
+ ///
+ ///
+ /// AddCustomEvent(
+ /// new Condition("triggerhit", (c) =>
+ /// {
+ /// return Energy <= trigger;
+ /// }));
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public class Condition
+ {
+ private readonly ConditionTest test;
+
+ ///
+ /// The priority of this condition. Defaults to 80.
+ ///
+ public int priority = 80;
+
+ ///
+ /// The name of this condition.
+ ///
+ public string name;
+
+ ///
+ /// Convinience constructor, allows to pass delegate to method, instead of overriding Test() method.
+ ///
+ public Condition(string name, int priority, ConditionTest test)
+ : this(name, priority)
+ {
+ this.test = test;
+ }
+
+ ///
+ /// Convinience constructor, allows to pass delegate to method, instead of overriding Test() method.
+ ///
+ public Condition(string name, ConditionTest test)
+ : this(name)
+ {
+ this.test = test;
+ }
+
+ ///
+ /// Convinience constructor, allows to pass delegate to method, instead of overriding Test() method.
+ ///
+ public Condition(ConditionTest test)
+ {
+ this.test = test;
+ }
+
+ ///
+ /// Creates a new, unnamed Condition with the default priority, which is 80.
+ ///
+ protected Condition()
+ {
+ }
+
+ ///
+ /// Creates a new Condition with the specified name, and default priority, which is 80.
+ ///
+ /// The name for the new Condition
+ protected Condition(string name)
+ {
+ this.name = name;
+ }
+
+ ///
+ /// Creates a new Condition with the specified name and priority.
+ /// A condition priority is a value from 0 - 99. The higher value, the
+ /// higher priority. The default priority is 80.
+ ///
+ /// The name for the new condition
+ /// The priority of the new condition
+ protected Condition(string name, int priority)
+ {
+ this.name = name;
+ if (priority < 0)
+ {
+ LoggerN.WriteLineToRobotsConsole("SYSTEM: Priority must be between 0 and 99.");
+ LoggerN.WriteLineToRobotsConsole("SYSTEM: Priority for condition " + name + " will be 0.");
+ priority = 0;
+ }
+ else if (priority > 99)
+ {
+ LoggerN.WriteLineToRobotsConsole("SYSTEM: Priority must be between 0 and 99.");
+ LoggerN.WriteLineToRobotsConsole("SYSTEM: Priority for condition " + name + " will be 99.");
+ priority = 99;
+ }
+ this.priority = priority;
+ }
+
+ ///
+ /// Returns the name of this condition.
+ ///
+ public string Name
+ {
+ get { return name ?? GetType().Name; }
+ set { name = value; }
+ }
+
+ ///
+ /// Returns the priority of this condition.
+ /// A condition priority is a value from 0 - 99. The higher value, the
+ /// higher priority. The default priority is 80.
+ ///
+ public int Priority
+ {
+ get { return priority; }
+ set { priority=value; }
+ }
+
+ ///
+ /// Overriding the Test() method is the point of a Condition.
+ /// The game will call your Test() function, and take action if it returns true.
+ /// This is valid for both and
+ ///
+ ///
+ /// You may not take any actions inside of Test().
+ ///
+ public virtual bool Test()
+ {
+ if (test != null)
+ {
+ return test(this);
+ }
+ throw new NotImplementedException("You should inherit from Condition class and override Test() method or pass delegate into constructor");
+ }
+ }
+
+ ///
+ /// Method signature for Test method of
+ ///
+ public delegate bool ConditionTest(Condition condition);
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/CustomEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/CustomEvent.cs
new file mode 100644
index 0000000..7a3ec36
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/CustomEvent.cs
@@ -0,0 +1,123 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.peer;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// This event is sent to
+ /// when a custom condition is met. Be sure to reset or remove the custom condition to avoid
+ /// having it recurring repeatedly (see the example for the method.
+ ///
+ ///
+ [Serializable]
+ public class CustomEvent : Event
+ {
+ private const int DEFAULT_PRIORITY = 80;
+
+ private readonly Condition condition;
+
+ ///
+ /// Called by the game to create a new CustomEvent when a condition is met.
+ ///
+ public CustomEvent(Condition condition)
+ {
+ this.condition = condition;
+ if (condition != null)
+ {
+ Priority = condition.Priority;
+ }
+ }
+
+ ///
+ /// Called by the game to create a new CustomEvent when a condition is met.
+ /// The event will have the given priority.
+ /// An event priority is a value from 0 - 99. The higher value, the higher
+ /// priority. The default priority is 80.
+ ///
+ /// This is equivalent to calling on the
+ /// Condition.
+ ///
+ /// The condition that must be met
+ /// The priority of the condition
+ public CustomEvent(Condition condition, int priority)
+ {
+ this.condition = condition;
+ Priority = priority;
+ if (condition != null)
+ {
+ condition.Priority = priority;
+ }
+ }
+
+ ///
+ /// Returns the condition that fired, causing this event to be generated.
+ /// Use this to determine which condition fired, and to remove the custom event.
+ ///
+ ///
+ /// public void OnCustomEvent(CustomEvent evnt)
+ /// {
+ /// if (event.Condition.Name == "mycondition")
+ /// {
+ /// RemoveCustomEvent(event.Condition);
+ /// // do something else
+ /// }
+ /// }
+ ///
+ ///
+ ///
+ public Condition Condition
+ {
+ get { return condition; }
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override sealed void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ if (statics.IsAdvancedRobot())
+ {
+ IAdvancedEvents listener = ((IAdvancedRobot) robot).GetAdvancedEventListener();
+
+ if (listener != null)
+ {
+ listener.OnCustomEvent(this);
+ }
+ }
+ }
+
+ // sealed to disable overrides
+ public override sealed int CompareTo(Event evnt)
+ {
+ return base.CompareTo(evnt);
+ }
+
+ // sealed to disable overrides
+ internal override bool IsCriticalEvent
+ {
+ get { return false; }
+ }
+
+ // sealed to disable overrides
+ public sealed override int Priority
+ {
+ get { return base.Priority; }
+ }
+
+ internal override byte SerializationType
+ {
+ get { throw new System.Exception("Serialization not supported on this event type"); }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/DeathEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/DeathEvent.cs
new file mode 100644
index 0000000..7c02457
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/DeathEvent.cs
@@ -0,0 +1,78 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// This event is sent to when your robot dies.
+ ///
+ [Serializable]
+ public sealed class DeathEvent : Event
+ {
+ private const int DEFAULT_PRIORITY = -1; // System event -> cannot be changed!;
+
+ ///
+ public override int Priority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ IBasicEvents listener = robot.GetBasicEventListener();
+
+ if (listener != null)
+ {
+ listener.OnDeath(this);
+ }
+ }
+
+ internal override bool IsCriticalEvent
+ {
+ get { return true; }
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.DeathEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ return RbSerializerN.SIZEOF_TYPEINFO;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ return new DeathEvent();
+ }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/Event.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/Event.cs
new file mode 100644
index 0000000..b09b84b
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/Event.cs
@@ -0,0 +1,279 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using System.Collections.Generic;
+using net.sf.robocode.io;
+using net.sf.robocode.peer;
+using net.sf.robocode.security;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// The superclass of all Robocode events.
+ ///
+ [Serializable]
+ public abstract class Event : IComparable
+ {
+ private const int DEFAULT_PRIORITY = 80;
+
+ private long time;
+ private int priority;
+
+ // time is valid only after adding to event manager on proxy side, we do not update it on battle side
+ private volatile bool addedToQueue;
+
+ ///
+ /// Compares this event to another event regarding precedence.
+ ///
+ /// The event precedence is first and foremost determined by the event time,
+ /// secondly the event priority, and lastly specific event information.
+ ///
+ /// This method will first compare the time of each event. If the event time
+ /// is the same for both events, then this method compared the priority of
+ /// each event. If the event priorities are equals, then this method will
+ /// compare the two events based on specific event information.
+ ///
+ /// This method is called by the game in order to sort the event queue of a
+ /// robot to make sure the events are listed in chronological order.
+ ///
+ ///
+ /// the event to compare to this event.
+ ///
+ /// Returns a negative value if this event has higher precedence, i.e. must
+ /// be listed before the specified event. A positive value if this event
+ /// has a lower precedence, i.e. must be listed after the specified event.
+ /// 0 means that the precedence of the two events are equal.
+ ///
+ public virtual int CompareTo(Event evnt)
+ {
+ // Compare the time difference which has precedence over priority.
+ var timeDiff = (int) (time - evnt.time);
+
+ if (timeDiff != 0)
+ {
+ return timeDiff; // Time differ
+ }
+
+ // Same time -> Compare the difference in priority
+ int priorityDiff = evnt.Priority - Priority;
+
+ if (priorityDiff != 0)
+ {
+ return priorityDiff; // Priority differ
+ }
+
+ // Same time and priority -> Compare specific event types
+ // look at overrides in ScannedRobotEvent and HitRobotEvent
+
+ // No difference found
+ return 0;
+ }
+
+ ///
+ /// The time when this event occurred.
+ ///
+ ///
+ /// Note that the time is equal to the turn of a battle round.
+ ///
+ /// This method is intended for letting robot developers create their own event types.
+ /// It is not possible to change the time of an event after it has been added to the event
+ /// queue of the robot.
+ ///
+ public long Time
+ {
+ get { return time; }
+ set
+ {
+ if (addedToQueue)
+ {
+ LoggerN.WriteLineToRobotsConsole("SYSTEM: The time of an event cannot be changed after it has been added the event queue.");
+ }
+ else
+ {
+ time = value;
+ }
+ }
+ }
+
+ ///
+ /// The priority of this event.
+ ///
+ /// An event priority is a value from 0 - 99. The higher value, the higher priority.
+ ///
+ /// The default priority is 80, but varies depending on the type of event.
+ ///
+ ///
+ /// This method is intended for letting robot developers create their own event types.
+ ///
+ /// It is not possible to change the priority of an event after it has been added to the event
+ /// queue of the robot.
+ ///
+ ///
+ public virtual int Priority
+ {
+ get { return priority; }
+ set
+ {
+ if (addedToQueue)
+ {
+ LoggerN.WriteLineToRobotsConsole("SYSTEM: The priority of an event cannot be changed after it has been added the event queue.");
+ }
+ else
+ {
+ SetPriorityHidden(value);
+ }
+ }
+ }
+
+ ///
+ /// Hidden method for setting the exact time when this event occurred.
+ ///
+ ///
+ /// This method is called by the game engine only.
+ ///
+ /// the time when this event occurred.
+ // This method must be invisible on Robot API
+ private void SetTimeHidden(long time)
+ {
+ // we do not replace time which is set by robot to the future
+ if (this.time < time)
+ {
+ this.time = time;
+ }
+ // when this flag is set, robots are not allowed to change the time or priority of the event anymore
+ addedToQueue = true;
+ }
+
+ ///
+ /// Hidden method for setting the priority from the game engine without checking for the 'addedToQueue' flag.
+ ///
+ ///
+ /// This method is called by the game engine only.
+ ///
+ /// the new priority of this event.
+ // This method must be invisible on Robot API
+ private void SetPriorityHidden(int newPriority)
+ {
+ if (newPriority < 0)
+ {
+ LoggerN.WriteLineToRobotsConsole("SYSTEM: Priority must be between 0 and 99");
+ LoggerN.WriteLineToRobotsConsole("SYSTEM: Priority for " + GetType().Name + " will be 0");
+ newPriority = 0;
+ }
+ else if (newPriority > 99)
+ {
+ LoggerN.WriteLineToRobotsConsole("SYSTEM: Priority must be between 0 and 99");
+ LoggerN.WriteLineToRobotsConsole("SYSTEM: Priority for " + GetType().Name + " will be 99");
+ newPriority = 99;
+ }
+ priority = newPriority;
+ }
+
+ ///
+ /// Dispatch this event for a robot, it's statistics, and graphics context.
+ ///
+ /// the robot to dispatch to.
+ /// the robot to statistics to.
+ /// the robot to graphics to.
+ // This method must be invisible on Robot API
+ internal virtual void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ }
+
+ ///
+ /// The default priority of this event class.
+ ///
+ // This method must be invisible on Robot API
+ internal virtual int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ ///
+ /// Checks if this event must be delivered even after timeout.
+ ///
+ ///
+ /// true when this event must be delivered even after timeout;
+ /// false otherwise.
+ ///
+ // This method must be invisible on Robot API
+ internal virtual bool IsCriticalEvent
+ {
+ get { return false; }
+ }
+
+ // This method must be invisible on Robot API
+ internal virtual byte SerializationType
+ {
+ get { throw new System.Exception("Serialization not supported on this event type"); }
+ }
+
+ // Needed for .NET version
+ // This method must be invisible on Robot API
+ internal virtual void UpdateBullets(Dictionary bullets)
+ {
+ }
+
+ ///
+ /// Returns a hidden event helper for accessing hidden methods on this object.
+ ///
+ // This method must be invisible on Robot API
+ private static IHiddenEventHelper createHiddenHelper()
+ {
+ return new HiddenEventHelper();
+ }
+
+ ///
+ /// Hidden event helper implementation for accessing the internal methods of an event.
+ ///
+ ///
+ /// This class is used internally by the game engine.
+ ///
+ // This method must be invisible on Robot API
+ private class HiddenEventHelper : IHiddenEventHelper
+ {
+ public void SetTime(Event evnt, long newTime)
+ {
+ evnt.SetTimeHidden(newTime);
+ }
+
+ public void SetDefaultPriority(Event evnt)
+ {
+ evnt.Priority = evnt.DefaultPriority;
+ }
+
+ public void SetPriority(Event evnt, int newPriority)
+ {
+ evnt.SetPriorityHidden(newPriority);
+ }
+
+ public bool IsCriticalEvent(Event evnt)
+ {
+ return evnt.IsCriticalEvent;
+ }
+
+ public void Dispatch(Event evnt, IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ evnt.Dispatch(robot, statics, graphics);
+ }
+
+ public byte GetSerializationType(Event evnt)
+ {
+ return evnt.SerializationType;
+ }
+
+ // Needed for .NET version
+ public void UpdateBullets(Event evnt, Dictionary bullets)
+ {
+ evnt.UpdateBullets(bullets);
+ }
+ }
+ }
+}
+//doc
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/GunTurnCompleteCondition.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/GunTurnCompleteCondition.cs
new file mode 100644
index 0000000..e6f7fe0
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/GunTurnCompleteCondition.cs
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+namespace Robocode
+{
+ ///
+ /// A prebuilt condition you can use that indicates your gun has finished turning.
+ ///
+ ///
+ public class GunTurnCompleteCondition : Condition
+ {
+ private readonly AdvancedRobot robot;
+
+ ///
+ /// Creates a new GunTurnCompleteCondition with default priority.
+ /// The default priority is 80.
+ ///
+ /// Your robot, which must be an
+ public GunTurnCompleteCondition(AdvancedRobot robot)
+ {
+ this.robot = robot;
+ }
+
+ ///
+ /// Creates a new GunTurnCompleteCondition with a specific priority.
+ /// A condition priority is a value from 0 - 99. The higher value, the
+ /// higher priority. The default priority is 80.
+ ///
+ ///
+ /// Your robot, which must be an
+ /// The priority of this condition
+ public GunTurnCompleteCondition(AdvancedRobot robot, int priority)
+ {
+ this.robot = robot;
+ this.priority = priority;
+ }
+
+ ///
+ /// Tests if the gun has stopped turning.
+ /// Returns true if the gun has stopped turning
+ ///
+ public override bool Test()
+ {
+ return (robot.GunTurnRemaining == 0);
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/HitByBulletEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/HitByBulletEvent.cs
new file mode 100644
index 0000000..394eff0
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/HitByBulletEvent.cs
@@ -0,0 +1,177 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// A HitByBulletEvent is sent to
+ /// when your robot has been hit by a bullet.
+ /// You can use the information contained in this event to determine what to do.
+ ///
+ [Serializable]
+ public sealed class HitByBulletEvent : Event
+ {
+ private const int DEFAULT_PRIORITY = 20;
+
+ private readonly double bearing;
+ private readonly Bullet bullet;
+
+ ///
+ /// Called by the game to create a new HitByBulletEvent.
+ ///
+ public HitByBulletEvent(double bearing, Bullet bullet)
+ {
+ this.bearing = bearing;
+ this.bullet = bullet;
+ }
+
+ ///
+ /// Returns the bearing to the bullet, relative to your robot's heading,
+ /// in degrees (-180 < getBearing() <= 180).
+ ///
+ /// If you were to TurnRight(event.Bearing), you would be facing the
+ /// direction the bullet came from. The calculation used here is:
+ /// (bullet's heading in degrees + 180) - (your heading in degrees)
+ ///
+ public double Bearing
+ {
+ get { return bearing*180.0/Math.PI; }
+ }
+
+ ///
+ /// Returns the bearing to the bullet, relative to your robot's heading,
+ /// in radians (-Math.PI < getBearingRadians() <= Math.PI).
+ ///
+ /// If you were to TurnRightRadians(event.BearingRadians), you would be
+ /// facing the direction the bullet came from. The calculation used here is:
+ /// (bullet's heading in radians + Math.PI) - (your heading in radians)
+ ///
+ public double BearingRadians
+ {
+ get { return bearing; }
+ }
+
+ ///
+ /// Returns the bullet that hit your robot.
+ ///
+ public Bullet Bullet
+ {
+ get { return bullet; }
+ }
+
+ ///
+ /// Returns the heading of the bullet when it hit you, in degrees
+ /// (0 <= getHeading() < 360).
+ ///
+ /// Note: This is not relative to the direction you are facing. The robot
+ /// that fired the bullet was in the opposite direction of getHeading() when
+ /// it fired the bullet.
+ ///
+ public double Heading
+ {
+ get { return bullet.Heading; }
+ }
+
+ ///
+ /// Returns the heading of the bullet when it hit you, in radians
+ /// (0 <= getHeadingRadians() < 2 * PI).
+ ///
+ /// Note: This is not relative to the direction you are facing. The robot
+ /// that fired the bullet was in the opposite direction of
+ /// getHeadingRadians() when it fired the bullet.
+ ///
+ public double HeadingRadians
+ {
+ get { return bullet.HeadingRadians; }
+ }
+
+ ///
+ /// Returns the name of the robot that fired the bullet.
+ ///
+ public string Name
+ {
+ get { return bullet.Name; }
+ }
+
+ ///
+ /// Returns the power of this bullet. The damage you take (in fact, already
+ /// took) is 4 * power, plus 2 * (power-1) if power > 1. The robot that fired
+ /// the bullet receives 3 * power back.
+ ///
+ public double Power
+ {
+ get { return bullet.Power; }
+ }
+
+ ///
+ /// Returns the velocity of this bullet.
+ ///
+ public double Velocity
+ {
+ get { return bullet.Velocity; }
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ IBasicEvents listener = robot.GetBasicEventListener();
+
+ if (listener != null)
+ {
+ listener.OnHitByBullet(this);
+ }
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.HitByBulletEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ var obj = (HitByBulletEvent) objec;
+
+ return RbSerializerN.SIZEOF_TYPEINFO + serializer.sizeOf(RbSerializerN.Bullet_TYPE, obj.bullet)
+ + RbSerializerN.SIZEOF_DOUBLE;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (HitByBulletEvent) objec;
+
+ serializer.serialize(buffer, RbSerializerN.Bullet_TYPE, obj.bullet);
+ serializer.serialize(buffer, obj.bearing);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ var bullet = (Bullet) serializer.deserializeAny(buffer);
+ double bearing = buffer.getDouble();
+
+ return new HitByBulletEvent(bearing, bullet);
+ }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/HitRobotEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/HitRobotEvent.cs
new file mode 100644
index 0000000..675b933
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/HitRobotEvent.cs
@@ -0,0 +1,172 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// A HitRobotEvent is sent to
+ /// when your robot collides with another robot.
+ /// You can use the information contained in this event to determine what to do.
+ ///
+ [Serializable]
+ public sealed class HitRobotEvent : Event
+ {
+ private const int DEFAULT_PRIORITY = 40;
+
+ private readonly string name;
+ private readonly double bearing;
+ private readonly double energy;
+ private readonly bool atFault;
+
+ ///
+ /// Called by the game to create a new HitRobotEvent.
+ ///
+ public HitRobotEvent(string name, double bearing, double energy, bool atFault)
+ {
+ this.name = name;
+ this.bearing = bearing;
+ this.energy = energy;
+ this.atFault = atFault;
+ }
+
+ ///
+ /// Returns the bearing to the robot you hit, relative to your robot's
+ /// heading, in degrees (-180 <= getBearing() < 180)
+ ///
+ public double Bearing
+ {
+ get { return bearing*180.0/Math.PI; }
+ }
+
+ ///
+ /// Returns the bearing to the robot you hit, relative to your robot's
+ /// heading, in radians (-PI <= getBearingRadians() < PI)
+ ///
+ public double BearingRadians
+ {
+ get { return bearing; }
+ }
+
+ ///
+ /// Returns the amount of energy of the robot you hit.
+ ///
+ public double Energy
+ {
+ get { return energy; }
+ }
+
+ ///
+ /// Returns the name of the robot you hit.
+ ///
+ public string Name
+ {
+ get { return name; }
+ }
+
+ ///
+ /// Checks if your robot was moving towards the robot that was hit.
+ ///
+ /// If returns true then your robot's movement (including
+ /// turning) will have stopped and been marked complete.
+ ///
+ /// Note: If two robots are moving toward each other and collide, they will
+ /// each receive two HitRobotEvents. The first will be the one if isMyFault()
+ /// returns true.
+ ///
+ public bool IsMyFault
+ {
+ get { return atFault; }
+ }
+
+ ///
+ public override int CompareTo(Event evnt)
+ {
+ int res = base.CompareTo(evnt);
+
+ if (res != 0)
+ {
+ return res;
+ }
+
+ // Compare the IsMyFault, if the events are HitRobotEvents
+ // The isMyFault has higher priority when it is set compared to when it is not set
+ if (evnt is HitRobotEvent)
+ {
+ int compare1 = (this).IsMyFault ? -1 : 0;
+ int compare2 = ((HitRobotEvent) evnt).IsMyFault ? -1 : 0;
+
+ return compare1 - compare2;
+ }
+
+ // No difference found
+ return 0;
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ IBasicEvents listener = robot.GetBasicEventListener();
+
+ if (listener != null)
+ {
+ listener.OnHitRobot(this);
+ }
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.HitRobotEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ var obj = (HitRobotEvent) objec;
+
+ return RbSerializerN.SIZEOF_TYPEINFO + serializer.sizeOf(obj.name) + 2*RbSerializerN.SIZEOF_DOUBLE
+ + RbSerializerN.SIZEOF_BOOL;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (HitRobotEvent) objec;
+
+ serializer.serialize(buffer, obj.name);
+ serializer.serialize(buffer, obj.bearing);
+ serializer.serialize(buffer, obj.energy);
+ serializer.serialize(buffer, obj.atFault);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ string robotName = serializer.deserializeString(buffer);
+ double bearing = buffer.getDouble();
+ double energy = buffer.getDouble();
+ bool atFault = serializer.deserializeBoolean(buffer);
+
+ return new HitRobotEvent(robotName, bearing, energy, atFault);
+ }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/HitWallEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/HitWallEvent.cs
new file mode 100644
index 0000000..1b73982
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/HitWallEvent.cs
@@ -0,0 +1,103 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// A HitWallEvent is sent to
+ /// when you collide a wall.
+ /// You can use the information contained in this event to determine what to do.
+ ///
+ [Serializable]
+ public sealed class HitWallEvent : Event
+ {
+ private const int DEFAULT_PRIORITY = 30;
+
+ private readonly double bearing;
+
+ ///
+ /// Called by the game to create a new HitWallEvent.
+ ///
+ public HitWallEvent(double bearing)
+ {
+ this.bearing = bearing;
+ }
+
+ ///
+ /// Returns the bearing to the wall you hit, relative to your robot's
+ /// heading, in degrees (-180 <= getBearing() < 180)
+ ///
+ public double Bearing
+ {
+ get { return bearing*180.0/Math.PI; }
+ }
+
+
+ ///
+ /// Returns the bearing to the wall you hit, relative to your robot's
+ /// heading, in radians (-PI <= getBearingRadians() < PI)
+ ///
+ public double BearingRadians
+ {
+ get { return bearing; }
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ IBasicEvents listener = robot.GetBasicEventListener();
+
+ if (listener != null)
+ {
+ listener.OnHitWall(this);
+ }
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.HitWallEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ return RbSerializerN.SIZEOF_TYPEINFO + RbSerializerN.SIZEOF_DOUBLE;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (HitWallEvent) objec;
+
+ serializer.serialize(buffer, obj.bearing);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ double bearing = buffer.getDouble();
+
+ return new HitWallEvent(bearing);
+ }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/IBorderSentry.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/IBorderSentry.cs
new file mode 100644
index 0000000..ea60f9c
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/IBorderSentry.cs
@@ -0,0 +1,32 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+namespace Robocode
+{
+ ///
+ /// A robot that implement IBorderSentry is a robot type used for keeping other robots away from the borders,
+ /// i.e. guarding the borders in order to prevent "wall crawlers".
+ /// Robots that implement IBorderSentry have 400 extra life/energy (500 in total), but is placed at the border
+ /// of the battlefield when the game is started.
+ /// Border sentry robots cannot move away from the border area, and they can only make damage to robots that
+ /// are moving into the border area. The size of the border area is determined by the
+ /// battle rules.
+ /// This type of robot is intended for use in battles where robots should be forced away from the borders in
+ /// order to prevent "wall crawlers".
+ /// Border sentry robots does not get scores, and will not occur in the battle results or rankings.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public interface IBorderSentry
+ {
+ }
+}
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/IDroid.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/IDroid.cs
new file mode 100644
index 0000000..4c682b3
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/IDroid.cs
@@ -0,0 +1,23 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+namespace Robocode
+{
+ ///
+ /// Robots that implement IDroid have no scanner, but an extra 20 life/energy.
+ /// This class is intended for use in teams.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public interface IDroid
+ {
+ }
+}
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/IGraphics.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/IGraphics.cs
new file mode 100644
index 0000000..e92c808
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/IGraphics.cs
@@ -0,0 +1,160 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System.Drawing;
+
+namespace Robocode
+{
+ ///
+ ///
+ ///
+ public interface IGraphics
+ {
+#pragma warning disable 1591
+ //TODO xml doc
+ void DrawLine(Pen pen, float x1, float y1, float x2, float y2);
+ void DrawLine(Pen pen, PointF pt1, PointF pt2);
+ void DrawLine(Pen pen, int x1, int y1, int x2, int y2);
+ void DrawLine(Pen pen, Point pt1, Point pt2);
+ void DrawArc(Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle);
+ void DrawArc(Pen pen, RectangleF rect, float startAngle, float sweepAngle);
+ void DrawArc(Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle);
+ void DrawArc(Pen pen, Rectangle rect, float startAngle, float sweepAngle);
+ void DrawRectangle(Pen pen, RectangleF rect);
+ void DrawRectangle(Pen pen, Rectangle rect);
+ void DrawRectangle(Pen pen, float x, float y, float width, float height);
+ void DrawRectangle(Pen pen, int x, int y, int width, int height);
+ void DrawEllipse(Pen pen, RectangleF rect);
+ void DrawEllipse(Pen pen, float x, float y, float width, float height);
+ void DrawEllipse(Pen pen, Rectangle rect);
+ void DrawEllipse(Pen pen, int x, int y, int width, int height);
+ void DrawPie(Pen pen, RectangleF rect, float startAngle, float sweepAngle);
+ void DrawPie(Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle);
+ void DrawPie(Pen pen, Rectangle rect, float startAngle, float sweepAngle);
+ void DrawPie(Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle);
+ void DrawPolygon(Pen pen, PointF[] points);
+ void DrawPolygon(Pen pen, Point[] points);
+ void FillRectangle(Brush brush, RectangleF rect);
+ void FillRectangle(Brush brush, float x, float y, float width, float height);
+ void FillRectangle(Brush brush, Rectangle rect);
+ void FillRectangle(Brush brush, int x, int y, int width, int height);
+ void FillPolygon(Brush brush, PointF[] points);
+ void FillPolygon(Brush brush, Point[] points);
+ void FillEllipse(Brush brush, RectangleF rect);
+ void FillEllipse(Brush brush, float x, float y, float width, float height);
+ void FillEllipse(Brush brush, Rectangle rect);
+ void FillEllipse(Brush brush, int x, int y, int width, int height);
+ void FillPie(Brush brush, Rectangle rect, float startAngle, float sweepAngle);
+ void FillPie(Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle);
+ void FillPie(Brush brush, int x, int y, int width, int height, int startAngle, int sweepAngle);
+ void DrawString(string s, Font font, Brush brush, int x, int y);
+ void DrawString(string s, Font font, Brush brush, float x, float y);
+ void DrawString(string s, Font font, Brush brush, PointF point);
+ void DrawString(string s, Font font, Brush brush, Point point);
+
+ /*
+ void DrawLines(Pen pen, PointF[] points);
+ void DrawLines(Pen pen, Point[] points);
+ void DrawRectangles(Pen pen, RectangleF[] rects);
+ void DrawRectangles(Pen pen, Rectangle[] rects);
+ void DrawPath(Pen pen, GraphicsPath path);
+ void DrawCurve(Pen pen, PointF[] points);
+ void DrawCurve(Pen pen, PointF[] points, float tension);
+ void DrawCurve(Pen pen, PointF[] points, int offset, int numberOfSegments);
+ void DrawCurve(Pen pen, PointF[] points, int offset, int numberOfSegments, float tension);
+ void DrawCurve(Pen pen, Point[] points);
+ void DrawCurve(Pen pen, Point[] points, float tension);
+ void DrawCurve(Pen pen, Point[] points, int offset, int numberOfSegments, float tension);
+ void DrawClosedCurve(Pen pen, PointF[] points);
+ void DrawClosedCurve(Pen pen, PointF[] points, float tension, FillMode fillmode);
+ void DrawClosedCurve(Pen pen, Point[] points);
+ void DrawClosedCurve(Pen pen, Point[] points, float tension, FillMode fillmode);
+ void FillPolygon(Brush brush, PointF[] points, FillMode fillMode);
+ void FillPolygon(Brush brush, Point[] points, FillMode fillMode);
+ void FillRectangles(Brush brush, RectangleF[] rects);
+ void FillRectangles(Brush brush, Rectangle[] rects);
+ void FillClosedCurve(Brush brush, PointF[] points);
+ void FillClosedCurve(Brush brush, PointF[] points, FillMode fillmode);
+ void FillClosedCurve(Brush brush, PointF[] points, FillMode fillmode, float tension);
+ void FillClosedCurve(Brush brush, Point[] points);
+ void FillClosedCurve(Brush brush, Point[] points, FillMode fillmode);
+ void FillClosedCurve(Brush brush, Point[] points, FillMode fillmode, float tension);
+ void FillRegion(Brush brush, Region region);
+ void FillPath(Brush brush, GraphicsPath path);
+ void DrawString(string s, Font font, Brush brush, float x, float y, StringFormat format);
+ void DrawString(string s, Font font, Brush brush, PointF point, StringFormat format);
+ void DrawString(string s, Font font, Brush brush, RectangleF layoutRectangle);
+ void DrawString(string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format);
+
+ SizeF MeasureString(string text, Font font, SizeF layoutArea, StringFormat stringFormat,
+ out int charactersFitted, out int linesFilled);
+
+ SizeF MeasureString(string text, Font font, PointF origin, StringFormat stringFormat);
+ SizeF MeasureString(string text, Font font, SizeF layoutArea);
+ SizeF MeasureString(string text, Font font, SizeF layoutArea, StringFormat stringFormat);
+ SizeF MeasureString(string text, Font font);
+ SizeF MeasureString(string text, Font font, int width);
+ SizeF MeasureString(string text, Font font, int width, StringFormat format);
+ Region[] MeasureCharacterRanges(string text, Font font, RectangleF layoutRect, StringFormat stringFormat);
+
+ void ResetTransform();
+ void MultiplyTransform(Matrix matrix);
+ void MultiplyTransform(Matrix matrix, MatrixOrder order);
+ void TranslateTransform(float dx, float dy);
+ void TranslateTransform(float dx, float dy, MatrixOrder order);
+ void ScaleTransform(float sx, float sy);
+ void ScaleTransform(float sx, float sy, MatrixOrder order);
+ void RotateTransform(float angle);
+ void RotateTransform(float angle, MatrixOrder order);
+ void TransformPoints(CoordinateSpace destSpace, CoordinateSpace srcSpace, PointF[] pts);
+ void TransformPoints(CoordinateSpace destSpace, CoordinateSpace srcSpace, Point[] pts);
+ void SetClip(Graphics g);
+ void SetClip(Graphics g, CombineMode combineMode);
+ void SetClip(Rectangle rect);
+ void SetClip(Rectangle rect, CombineMode combineMode);
+ void SetClip(RectangleF rect);
+ void SetClip(RectangleF rect, CombineMode combineMode);
+ void SetClip(GraphicsPath path);
+ void SetClip(GraphicsPath path, CombineMode combineMode);
+ void SetClip(Region region, CombineMode combineMode);
+ void IntersectClip(Rectangle rect);
+ void IntersectClip(RectangleF rect);
+ void IntersectClip(Region region);
+ void ExcludeClip(Rectangle rect);
+ void ExcludeClip(Region region);
+ void ResetClip();
+ void TranslateClip(float dx, float dy);
+ void TranslateClip(int dx, int dy);
+ bool IsVisible(int x, int y);
+ bool IsVisible(Point point);
+ bool IsVisible(float x, float y);
+ bool IsVisible(PointF point);
+ bool IsVisible(int x, int y, int width, int height);
+ bool IsVisible(Rectangle rect);
+ bool IsVisible(float x, float y, float width, float height);
+ bool IsVisible(RectangleF rect);
+ CompositingMode CompositingMode { get; set; }
+ Point RenderingOrigin { get; set; }
+ CompositingQuality CompositingQuality { get; set; }
+ TextRenderingHint TextRenderingHint { get; set; }
+ int TextContrast { get; set; }
+ SmoothingMode SmoothingMode { get; set; }
+ PixelOffsetMode PixelOffsetMode { get; set; }
+ InterpolationMode InterpolationMode { get; set; }
+ Matrix Transform { get; set; }
+ GraphicsUnit PageUnit { get; set; }
+ float PageScale { get; set; }
+ float DpiX { get; }
+ float DpiY { get; }
+ Region Clip { get; set; }
+ RectangleF ClipBounds { get; }
+ bool IsClipEmpty { get; }
+ RectangleF VisibleClipBounds { get; }
+ bool IsVisibleClipEmpty { get; }
+ */
+ }
+}
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/JuniorRobot.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/JuniorRobot.cs
new file mode 100644
index 0000000..0ea5d59
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/JuniorRobot.cs
@@ -0,0 +1,1324 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using System.Drawing;
+using System.IO;
+using Robocode.Exception;
+using Robocode.RobotInterfaces;
+using Robocode.RobotInterfaces.Peer;
+using Robocode.Util;
+
+namespace Robocode
+{
+ ///
+ /// This is the simplest robot type, which is simpler than the and
+ /// classes. The JuniorRobot has a simplified model, in
+ /// purpose of teaching programming skills to inexperienced in programming
+ /// students. The simplified robot model will keep player from overwhelming of
+ /// Robocode's rules, programming syntax and programming concept.
+ ///
+ /// Instead of using getters and setters, public fields are provided for
+ /// receiving information like the last scanned robot, the coordinate of the
+ /// robot etc.
+ ///
+ /// All methods on this class are blocking calls, i.e. they do not return before
+ /// their action has been completed and will at least take one turn to execute.
+ /// However, setting colors is executed immediately and does not cost a turn to
+ /// perform.
+ ///
+ ///
+ ///
+ ///
+ ///
+ public abstract class JuniorRobot : IJuniorRobot
+ {
+ internal IBasicRobotPeer peer;
+ internal TextWriter _output;
+
+ ///
+ /// The color black (0x000000)
+ ///
+ public const int BLACK=0;
+
+ ///
+ /// The color white (0xFFFFFF)
+ ///
+ public const int WHITE = 0xFFFFFF;
+
+ ///
+ /// The color red (0xFF0000)
+ ///
+ public const int RED = 0xFF0000;
+
+ ///
+ /// The color orange (0xFFA500)
+ ///
+ public const int ORANGE = 0xFFA500;
+
+ ///
+ /// The color yellow (0xFFFF00)
+ ///
+ public const int YELLOW = 0xFFFF00;
+
+ ///
+ /// The color green (0x008000)
+ ///
+ public const int GREEN = 0x008000;
+
+ ///
+ /// The color blue (0x0000FF)
+ ///
+ public const int BLUE = 0x0000FF;
+
+ ///
+ /// The color purple (0x800080)
+ ///
+ public const int PURPLE = 0x800080;
+
+ ///
+ /// The color brown (0x8B4513)
+ ///
+ public const int BROWN = 0x8B4513;
+
+ ///
+ /// The color gray (0x808080)
+ ///
+ public const int GRAY = 0x808080;
+
+ ///
+ /// Contains the width of the battlefield.
+ ///
+ ///
+ ///
+ private int fieldWidth;
+
+ ///
+ /// Contains the height of the battlefield.
+ ///
+ ///
+ ///
+ private int fieldHeight;
+
+ ///
+ /// Current number of other robots on the battle field.
+ ///
+ private int others;
+
+ ///
+ /// Current energy of this robot, where 100 means full energy and 0 means no energy (dead).
+ ///
+ private int energy;
+
+ ///
+ /// Current horizontal location of this robot (in pixels).
+ ///
+ ///
+ ///
+ private int robotX;
+
+ ///
+ /// Current vertical location of this robot (in pixels).
+ ///
+ ///
+ ///
+ private int robotY;
+
+ ///
+ /// Current heading angle of this robot (in degrees).
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private int heading;
+
+ ///
+ /// Current gun heading angle of this robot (in degrees).
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private int gunHeading;
+
+ ///
+ /// Current gun heading angle of this robot compared to its body (in degrees).
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private int gunBearing;
+
+ ///
+ /// Flag specifying if the gun is ready to Fire, i.e. gun heat <= 0.
+ /// true means that the gun is able to Fire; false
+ /// means that the gun cannot Fire yet as it still needs to cool down.
+ ///
+ ///
+ ///
+ ///
+ private bool gunReady;
+
+ ///
+ /// Current distance to the scanned nearest other robot (in pixels).
+ /// If there is no robot in the radar's sight, this field will be less than 0, i.e -1.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private int scannedDistance = -1;
+
+ ///
+ /// Current angle to the scanned nearest other robot (in degrees).
+ /// If there is no robot in the radar's sight, this field will be less than 0, i.e -1.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private int scannedAngle = -1;
+
+ ///
+ /// Current angle to the scanned nearest other robot (in degrees) compared to
+ /// the body of this robot.
+ /// If there is no robot in the radar's sight, this field will be less than 0, i.e -1.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private int scannedBearing = -1;
+
+ ///
+ /// Current velocity of the scanned nearest other robot.
+ /// If there is no robot in the radar's sight, this field will be -99.
+ /// Note that a positive value means that the robot moves forward, a negative
+ /// value means that the robot moved backward, and 0 means that the robot is
+ /// not moving at all.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private int scannedVelocity = -99;
+
+ ///
+ /// Current heading of the scanned nearest other robot (in degrees).
+ /// If there is no robot in the radar's sight, this field will be less than 0, i.e -1.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private int scannedHeading = -1;
+
+ ///
+ /// Current energy of scanned nearest other robot.
+ /// If there is no robot in the radar's sight, this field will be less than 0, i.e -1.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private int scannedEnergy = -1;
+
+ ///
+ /// Latest angle from where this robot was hit by a bullet (in degrees).
+ /// If the robot has never been hit, this field will be less than 0, i.e. -1.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ private int hitByBulletAngle = -1;
+
+ ///
+ /// Latest angle from where this robot was hit by a bullet (in degrees)
+ /// compared to the body of this robot.
+ /// If the robot has never been hit, this field will be less than 0, i.e. -1.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ private int hitByBulletBearing = -1;
+
+ ///
+ /// Latest angle where this robot has hit another robot (in degrees).
+ /// If this robot has never hit another robot, this field will be less than 0, i.e. -1.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ private int hitRobotAngle = -1;
+
+ ///
+ /// Latest angle where this robot has hit another robot (in degrees)
+ /// compared to the body of this robot.
+ /// If this robot has never hit another robot, this field will be less than 0, i.e. -1.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ private int hitRobotBearing = -1;
+
+ ///
+ /// Latest angle where this robot has hit a wall (in degrees).
+ /// If this robot has never hit a wall, this field will be less than 0, i.e. -1.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ private int hitWallAngle = -1;
+
+ ///
+ /// Latest angle where this robot has hit a wall (in degrees)
+ /// compared to the body of this robot.
+ /// If this robot has never hit a wall, this field will be less than 0, i.e. -1.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ private int hitWallBearing = -1;
+
+ ///
+ /// The robot event handler for this robot.
+ ///
+ private InnerEventHandler innerEventHandler;
+
+
+ ///
+ /// The Out stream your robot should use to print.
+ ///
+ /// You can view the print-outs by clicking the button for your robot in the
+ /// right side of the battle window.
+ ///
+ ///
+ ///
+ /// // Print Out a line each time my robot hits another robot
+ /// public void OnHitRobot(HitRobotEvent e)
+ /// {
+ /// Out.WriteLine("I hit a robot! My energy: " + Energy + " his energy: " + e.Energy);
+ /// }
+ ///
+ ///
+ ///
+ public TextWriter Out
+ {
+ get { return _output; }
+ }
+
+ ///
+ /// Contains the width of the battlefield.
+ ///
+ ///
+ ///
+ public int FieldWidth
+ {
+ get { return fieldWidth; }
+ }
+
+ ///
+ /// Contains the height of the battlefield.
+ ///
+ ///
+ ///
+ public int FieldHeight
+ {
+ get { return fieldHeight; }
+ }
+
+ ///
+ /// Current number of other robots on the battle field.
+ ///
+ public int Others
+ {
+ get { return others; }
+ }
+
+ ///
+ /// Current energy of this robot, where 100 means full energy and 0 means no energy (dead).
+ ///
+ public int Energy
+ {
+ get { return energy; }
+ }
+
+ ///
+ /// Current horizontal location of this robot (in pixels).
+ ///
+ ///
+ ///
+ public int RobotX
+ {
+ get { return robotX; }
+ }
+
+ ///
+ /// Current vertical location of this robot (in pixels).
+ ///
+ ///
+ ///
+ public int RobotY
+ {
+ get { return robotY; }
+ }
+
+ ///
+ /// Current heading angle of this robot (in degrees).
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public int Heading
+ {
+ get { return heading; }
+ }
+
+ ///
+ /// Current gun heading angle of this robot (in degrees).
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public int GunHeading
+ {
+ get { return gunHeading; }
+ }
+
+ ///
+ /// Current gun heading angle of this robot compared to its body (in degrees).
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public int GunBearing
+ {
+ get { return gunBearing; }
+ }
+
+ ///
+ /// Flag specifying if the gun is ready to Fire, i.e. gun heat <= 0.
+ /// true means that the gun is able to Fire; false
+ /// means that the gun cannot Fire yet as it still needs to cool down.
+ ///
+ ///
+ ///
+ ///
+ public bool IsGunReady
+ {
+ get { return gunReady; }
+ }
+
+ ///
+ /// Current distance to the scanned nearest other robot (in pixels).
+ /// If there is no robot in the radar's sight, this field will be less than 0, i.e -1.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public int ScannedDistance
+ {
+ get { return scannedDistance; }
+ }
+
+ ///
+ /// Current angle to the scanned nearest other robot (in degrees).
+ /// If there is no robot in the radar's sight, this field will be less than 0, i.e -1.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public int ScannedAngle
+ {
+ get { return scannedAngle; }
+ }
+
+ ///
+ /// Current angle to the scanned nearest other robot (in degrees) compared to
+ /// the body of this robot.
+ /// If there is no robot in the radar's sight, this field will be less than 0, i.e -1.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public int ScannedBearing
+ {
+ get { return scannedBearing; }
+ }
+
+ ///
+ /// Current velocity of the scanned nearest other robot.
+ /// If there is no robot in the radar's sight, this field will be -99.
+ /// Note that a positive value means that the robot moves forward, a negative
+ /// value means that the robot moved backward, and 0 means that the robot is
+ /// not moving at all.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public int ScannedVelocity
+ {
+ get { return scannedVelocity; }
+ }
+
+ ///
+ /// Current heading of the scanned nearest other robot (in degrees).
+ /// If there is no robot in the radar's sight, this field will be less than 0, i.e -1.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public int ScannedHeading
+ {
+ get { return scannedHeading; }
+ }
+
+ ///
+ /// Current energy of scanned nearest other robot.
+ /// If there is no robot in the radar's sight, this field will be less than 0, i.e -1.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public int ScannedEnergy
+ {
+ get { return scannedEnergy; }
+ }
+
+ ///
+ /// Latest angle from where this robot was hit by a bullet (in degrees).
+ /// If the robot has never been hit, this field will be less than 0, i.e. -1.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ public int HitByBulletAngle
+ {
+ get { return hitByBulletAngle; }
+ }
+
+ ///
+ /// Latest angle from where this robot was hit by a bullet (in degrees)
+ /// compared to the body of this robot.
+ /// If the robot has never been hit, this field will be less than 0, i.e. -1.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ public int HitByBulletBearing
+ {
+ get { return hitByBulletBearing; }
+ }
+
+ ///
+ /// Latest angle where this robot has hit another robot (in degrees).
+ /// If this robot has never hit another robot, this field will be less than 0, i.e. -1.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ public int HitRobotAngle
+ {
+ get { return hitRobotAngle; }
+ }
+
+ ///
+ /// Latest angle where this robot has hit another robot (in degrees)
+ /// compared to the body of this robot.
+ /// If this robot has never hit another robot, this field will be less than 0, i.e. -1.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ public int HitRobotBearing
+ {
+ get { return hitRobotBearing; }
+ }
+
+ ///
+ /// Latest angle where this robot has hit a wall (in degrees).
+ /// If this robot has never hit a wall, this field will be less than 0, i.e. -1.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ public int HitWallAngle
+ {
+ get { return hitWallAngle; }
+ }
+
+ ///
+ /// Latest angle where this robot has hit a wall (in degrees)
+ /// compared to the body of this robot.
+ /// If this robot has never hit a wall, this field will be less than 0, i.e. -1.
+ /// This field will not be updated while event is active.
+ ///
+ ///
+ ///
+ ///
+ public int HitWallBearing
+ {
+ get { return hitWallBearing; }
+ }
+
+ ///
+ void IBasicRobot.SetOut(TextWriter outpt)
+ {
+ _output = outpt;
+ }
+
+ ///
+ void IBasicRobot.SetPeer(IBasicRobotPeer per)
+ {
+ peer = per;
+ }
+
+ ///
+ /// Throws a RobotException. This method should be called when the robot's peer
+ /// is uninitialized.
+ ///
+ internal static void UninitializedException()
+ {
+ throw new RobotException(
+ "You cannot call the methods before your Run() method is called, or you are using a Robot object that the game doesn't know about.");
+ }
+
+ ///
+ IRunnable IBasicRobot.GetRobotRunnable()
+ {
+ return getEventHandler();
+ }
+
+ ///
+ IBasicEvents IBasicRobot.GetBasicEventListener()
+ {
+ return getEventHandler();
+ }
+
+
+ ///
+ /// Moves this robot forward by pixels.
+ ///
+ ///
+ ///
+ ///
+ /// The amount of pixels to move forward
+ public void Ahead(int distance)
+ {
+ if (peer != null)
+ {
+ peer.Move(distance);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Moves this robot backward by pixels.
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// the amount of pixels to move backward
+ public void Back(int distance)
+ {
+ Ahead(-distance);
+ }
+
+ ///
+ /// Turns the gun to the specified angle (in degrees) relative to body of this robot.
+ /// The gun will turn to the side with the shortest delta angle to the specified angle.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// the angle to turn the gun to relative to the body of this robot
+ public void BearGunTo(int angle)
+ {
+ if (peer != null)
+ {
+ peer.TurnGun(
+ Utils.NormalRelativeAngle(peer.GetBodyHeading() + Utils.ToRadians(angle) - peer.GetGunHeading()));
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Skips a turn.
+ ///
+ ///
+ public void DoNothing()
+ {
+ if (peer != null)
+ {
+ peer.Execute();
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Skips the specified number of turns.
+ ///
+ ///
+ /// The number of turns to skip
+ public void DoNothing(int turns)
+ {
+ if (turns <= 0)
+ {
+ return;
+ }
+ if (peer != null)
+ {
+ for (int i = 0; i < turns; i++)
+ {
+ peer.Execute();
+ }
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Fires a bullet with the default power of 1.
+ /// If the gun heat is more than 0 and hence cannot Fire, this method will
+ /// suspend until the gun is ready to Fire, and then Fire a bullet.
+ ///
+ ///
+ ///
+ public void Fire()
+ {
+ Fire(1);
+ }
+
+ ///
+ /// Fires a bullet with the specified bullet power, which is between 0.1 and 3
+ /// where 3 is the maximum bullet power.
+ /// If the gun heat is more than 0 and hence cannot Fire, this method will
+ /// suspend until the gun is ready to Fire, and then Fire a bullet.
+ ///
+ ///
+ /// Between 0.1 and 3
+ public void Fire(double power)
+ {
+ if (peer != null)
+ {
+ getEventHandler().juniorFirePower = power;
+ peer.Execute();
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// This event method is called from the game when this robot has been hit
+ /// by another robot's bullet. When this event occurs the
+ /// and fields values
+ /// are automatically updated.
+ ///
+ ///
+ ///
+ ///
+ public virtual void OnHitByBullet()
+ {
+ }
+
+ ///
+ /// This event method is called from the game when a bullet from this robot
+ /// has hit another robot. When this event occurs the
+ /// and fields values are automatically updated.
+ ///
+ ///
+ ///
+ ///
+ public virtual void OnHitRobot()
+ {
+ }
+
+ ///
+ /// This event method is called from the game when this robot has hit a wall.
+ /// When this event occurs the and
+ /// fields values are automatically updated.
+ ///
+ ///
+ ///
+ ///
+ public virtual void OnHitWall()
+ {
+ }
+
+ ///
+ /// This event method is called from the game when the radar detects another
+ /// robot. When this event occurs the ,
+ /// , , and
+ /// field values are automatically updated.
+ ///
+ ///
+ ///
+ ///
+ ///
+ public virtual void OnScannedRobot()
+ {
+ }
+
+ ///
+ /// The main method in every robot. You must override this to set up your
+ /// robot's basic behavior.
+ ///
+ ///
+ ///
+ /// // A basic robot that moves around in a square
+ /// public void Run()
+ /// {
+ /// Ahead(100);
+ /// TurnRight(90);
+ /// }
+ ///
+ ///
+ /// This method is automatically re-called when it has returned.
+ ///
+ public virtual void Run()
+ {
+ }
+
+ ///
+ /// Sets the colors of the robot. The color values are RGB values.
+ /// You can use the colors that are already defined for this class.
+ ///
+ ///
+ /// The RGB color value for the body
+ /// The RGB color value for the gun
+ /// The RGB color value for the radar
+ public void SetColors(int bodyColor, int gunColor, int radarColor)
+ {
+ if (peer != null)
+ {
+ peer.SetBodyColor(Color.FromArgb(bodyColor));
+ peer.SetGunColor(Color.FromArgb(gunColor));
+ peer.SetRadarColor(Color.FromArgb(radarColor));
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Sets the colors of the robot. The color values are RGB values.
+ /// You can use the colors that are already defined for this class.
+ ///
+ ///
+ /// The RGB color value for the body
+ /// The RGB color value for the gun
+ /// The RGB color value for the radar
+ /// The RGB color value for the bullets
+ /// The RGB color value for the scan arc
+ public void SetColors(int bodyColor, int gunColor, int radarColor, int bulletColor, int scanArcColor)
+ {
+ if (peer != null)
+ {
+ peer.SetBodyColor(Color.FromArgb(bodyColor));
+ peer.SetGunColor(Color.FromArgb(gunColor));
+ peer.SetRadarColor(Color.FromArgb(radarColor));
+ peer.SetBulletColor(Color.FromArgb(bulletColor));
+ peer.SetScanColor(Color.FromArgb(scanArcColor));
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Moves this robot forward by pixels and turns this robot left by degrees
+ /// at the same time. The robot will move in a curve that follows a perfect
+ /// circle, and the moving and turning will end at the same time.
+ ///
+ /// Note that the max. velocity and max. turn rate is automatically adjusted,
+ /// which means that the robot will move slower the sharper the turn is
+ /// compared to the distance.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of pixels to move forward
+ /// The amount of degrees to turn to the left
+ public void TurnAheadLeft(int distance, int degrees)
+ {
+ TurnAheadRight(distance, -degrees);
+ }
+
+ ///
+ /// Moves this robot forward by pixels and turns this robot right by degrees
+ /// at the same time. The robot will move in a curve that follows a perfect
+ /// circle, and the moving and turning will end at the same time.
+ ///
+ /// Note that the max. velocity and max. turn rate is automatically adjusted,
+ /// which means that the robot will move slower the sharper the turn is
+ /// compared to the distance.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of pixels to move forward
+ /// The amount of degrees to turn to the right
+ public void TurnAheadRight(int distance, int degrees)
+ {
+ if (peer != null)
+ {
+ ((IJuniorRobotPeer) peer).TurnAndMove(distance, Utils.ToRadians(degrees));
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Moves this robot backward by pixels and turns this robot left by degrees
+ /// at the same time. The robot will move in a curve that follows a perfect
+ /// circle, and the moving and turning will end at the same time.
+ ///
+ /// Note that the max. velocity and max. turn rate is automatically adjusted,
+ /// which means that the robot will move slower the sharper the turn is
+ /// compared to the distance.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of pixels to move backward
+ /// The amount of degrees to turn to the left
+ public void TurnBackLeft(int distance, int degrees)
+ {
+ TurnAheadRight(-distance, degrees);
+ }
+
+ ///
+ /// Moves this robot backward by pixels and turns this robot right by degrees
+ /// at the same time. The robot will move in a curve that follows a perfect
+ /// circle, and the moving and turning will end at the same time.
+ ///
+ /// Note that the max. velocity and max. turn rate is automatically adjusted,
+ /// which means that the robot will move slower the sharper the turn is
+ /// compared to the distance.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of pixels to move backward
+ /// The amount of degrees to turn to the right
+ public void TurnBackRight(int distance, int degrees)
+ {
+ TurnAheadRight(-distance, -degrees);
+ }
+
+ ///
+ /// Turns the gun left by degrees.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of degrees to turn the gun to the left
+ public void TurnGunLeft(int degrees)
+ {
+ TurnGunRight(-degrees);
+ }
+
+ ///
+ /// Turns the gun right by degrees.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of degrees to turn the gun to the right
+ public void TurnGunRight(int degrees)
+ {
+ if (peer != null)
+ {
+ peer.TurnGun(Utils.ToRadians(degrees));
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Turns the gun to the specified angle (in degrees).
+ /// The gun will turn to the side with the shortest delta angle to the
+ /// specified angle.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The angle to turn the gun to
+ public void TurnGunTo(int angle)
+ {
+ if (peer != null)
+ {
+ peer.TurnGun(Utils.NormalRelativeAngle(Utils.ToRadians(angle) - peer.GetGunHeading()));
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Turns this robot left by degrees.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of degrees to turn to the left
+ public void TurnLeft(int degrees)
+ {
+ TurnRight(-degrees);
+ }
+
+ ///
+ /// Turns this robot right by degrees.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of degrees to turn to the right
+ public void TurnRight(int degrees)
+ {
+ if (peer != null)
+ {
+ peer.TurnBody(Utils.ToRadians(degrees));
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Turns this robot to the specified angle (in degrees).
+ /// The robot will turn to the side with the shortest delta angle to the
+ /// specified angle.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The angle to turn this robot to
+ public void TurnTo(int angle)
+ {
+ if (peer != null)
+ {
+ peer.TurnBody(Utils.NormalRelativeAngle(Utils.ToRadians(angle) - peer.GetBodyHeading()));
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Returns the event handler of this robot.
+ ///
+ private InnerEventHandler getEventHandler()
+ {
+ if (innerEventHandler == null)
+ {
+ innerEventHandler = new InnerEventHandler(this);
+ }
+ return innerEventHandler;
+ }
+
+ ///
+ /// The JuniorRobot event handler, which extends the basic robot events,
+ /// IBasicEvents, and IRunnable.
+ ///
+ private sealed class InnerEventHandler : IBasicEvents, IRunnable
+ {
+ public InnerEventHandler(JuniorRobot robot)
+ {
+ this.robot = robot;
+ }
+
+ private readonly JuniorRobot robot;
+ internal double juniorFirePower;
+ private long currentTurn;
+
+ public void OnBulletHit(BulletHitEvent evnt)
+ {
+ }
+
+ public void OnBulletHitBullet(BulletHitBulletEvent evnt)
+ {
+ }
+
+ public void OnBulletMissed(BulletMissedEvent evnt)
+ {
+ }
+
+ public void OnDeath(DeathEvent evnt)
+ {
+ }
+
+ public void OnHitByBullet(HitByBulletEvent evnt)
+ {
+ double angle = robot.peer.GetBodyHeading() + evnt.BearingRadians;
+
+ robot.hitByBulletAngle = (int) (Utils.ToDegrees(Utils.NormalAbsoluteAngle(angle)) + 0.5);
+ robot.hitByBulletBearing = (int) (evnt.Bearing + 0.5);
+ robot.OnHitByBullet();
+ }
+
+ public void OnHitRobot(HitRobotEvent evnt)
+ {
+ double angle = robot.peer.GetBodyHeading() + evnt.BearingRadians;
+
+ robot.hitRobotAngle = (int) (Utils.ToDegrees(Utils.NormalAbsoluteAngle(angle)) + 0.5);
+ robot.hitRobotBearing = (int) (evnt.Bearing + 0.5);
+ robot.OnHitRobot();
+ }
+
+ public void OnHitWall(HitWallEvent evnt)
+ {
+ double angle = robot.peer.GetBodyHeading() + evnt.BearingRadians;
+
+ robot.hitWallAngle = (int) (Utils.ToDegrees(Utils.NormalAbsoluteAngle(angle)) + 0.5);
+ robot.hitWallBearing = (int) (evnt.Bearing + 0.5);
+ robot.OnHitWall();
+ }
+
+ public void OnRobotDeath(RobotDeathEvent evnt)
+ {
+ robot.others = robot.peer.GetOthers();
+ }
+
+ public void OnScannedRobot(ScannedRobotEvent evnt)
+ {
+ robot.scannedDistance = (int) (evnt.Distance + 0.5);
+ robot.scannedEnergy = Math.Max(1, (int) (evnt.Energy + 0.5));
+ robot.scannedAngle = (int) (Utils.ToDegrees(
+ Utils.NormalAbsoluteAngle(robot.peer.GetBodyHeading() +
+ evnt.BearingRadians))
+ + 0.5);
+ robot.scannedBearing = (int) (evnt.Bearing + 0.5);
+ robot.scannedHeading = (int) (evnt.Heading + 0.5);
+ robot.scannedVelocity = (int) (evnt.Velocity + 0.5);
+
+ robot.OnScannedRobot();
+ }
+
+ public void OnStatus(StatusEvent e)
+ {
+ RobotStatus s = e.Status;
+
+ robot.others = robot.peer.GetOthers();
+ robot.energy = Math.Max(1, (int) (s.Energy + 0.5));
+ robot.robotX = (int) (s.X + 0.5);
+ robot.robotY = (int) (s.Y + 0.5);
+ robot.heading = (int) (Utils.ToDegrees(s.Heading) + 0.5);
+ robot.gunHeading = (int) (Utils.ToDegrees(s.GunHeading) + 0.5);
+ robot.gunBearing =
+ (int) (Utils.ToDegrees(Utils.NormalRelativeAngle(s.GunHeading - s.Heading)) + 0.5);
+ robot.gunReady = (s.GunHeat <= 0);
+
+ currentTurn = e.Time;
+
+ // Auto Fire
+ if (juniorFirePower > 0 && robot.gunReady && (robot.peer.GetGunTurnRemaining() == 0))
+ {
+ if (robot.peer.SetFire(juniorFirePower) != null)
+ {
+ robot.gunReady = false;
+ juniorFirePower = 0;
+ }
+ }
+
+ // Reset event data
+ robot.scannedDistance = -1;
+ robot.scannedAngle = -1;
+ robot.scannedBearing = -1;
+ robot.scannedVelocity = -99;
+ robot.scannedHeading = -1;
+ robot.scannedEnergy = -1;
+ robot.hitByBulletAngle = -1;
+ robot.hitByBulletBearing = -1;
+ robot.hitRobotAngle = -1;
+ robot.hitRobotBearing = -1;
+ robot.hitWallAngle = -1;
+ robot.hitWallBearing = -1;
+ }
+
+ public void OnWin(WinEvent evnt)
+ {
+ }
+
+ // ReSharper disable FunctionNeverReturns
+ public void Run()
+ {
+ robot.fieldWidth = (int) (robot.peer.GetBattleFieldWidth() + 0.5);
+ robot.fieldHeight = (int) (robot.peer.GetBattleFieldHeight() + 0.5);
+
+ // noinspection InfiniteLoopStatement
+ while (true)
+ {
+ long lastTurn = currentTurn; // Used for the Rescan check
+
+ robot.Run(); // Run the code in the JuniorRobot
+
+ // Make sure that we Rescan if the robot did not execute anything this turn.
+ // When the robot executes the currentTurn will automatically be increased by 1,
+ // So when the turn stays the same, the robot did not take any action this turn.
+ if (lastTurn == currentTurn)
+ {
+ robot.peer.Rescan(); // Spend a turn on rescanning
+ }
+ }
+ }
+ }
+ // ReSharper restore FunctionNeverReturns
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/KeyEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/KeyEvent.cs
new file mode 100644
index 0000000..1bb3bdd
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/KeyEvent.cs
@@ -0,0 +1,78 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+
+namespace Robocode
+{
+ ///
+ /// Super class of all events that originates from the keyboard.
+ ///
+ [Serializable]
+ public abstract class KeyEvent : Event
+ {
+ private readonly char keyChar;
+ private readonly int keyCode;
+ private readonly int keyLocation;
+ private readonly int id;
+ private readonly int modifiersEx;
+ private readonly long when;
+
+ ///
+ /// Called by game
+ ///
+ protected KeyEvent(char keyChar, int keyCode, int keyLocation, int id, int modifiersEx, long when)
+ {
+ this.keyChar = keyChar;
+ this.keyCode = keyCode;
+ this.keyLocation = keyLocation;
+ this.id = id;
+ this.modifiersEx = modifiersEx;
+ this.when = when;
+ }
+
+ ///
+ /// Char of they key pressed
+ ///
+ public char KeyChar
+ {
+ get { return keyChar; }
+ }
+
+ ///
+ ///
+ ///
+ public int KeyCode
+ {
+ get { return keyCode; }
+ }
+
+ internal int KeyLocation
+ {
+ get { return keyLocation; }
+ }
+
+ internal int ID
+ {
+ get { return id; }
+ }
+
+ internal int ModifiersEx
+ {
+ get { return modifiersEx; }
+ }
+
+ ///
+ /// Age of the event
+ ///
+ public long When
+ {
+ get { return when; }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/KeyPressedEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/KeyPressedEvent.cs
new file mode 100644
index 0000000..0ec1caa
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/KeyPressedEvent.cs
@@ -0,0 +1,96 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// A KeyPressedEvent is sent to
+ /// when a key has been pressed on the keyboard.
+ ///
+ ///
+ ///
+ [Serializable]
+ public sealed class KeyPressedEvent : KeyEvent
+ {
+ private const int DEFAULT_PRIORITY = 98;
+
+ ///
+ /// Called by the game to create a new KeyPressedEvent.
+ ///
+ public KeyPressedEvent(char keyChar, int keyCode, int keyLocation, int id, int modifiersEx, long when)
+ : base(keyChar, keyCode, keyLocation, id, modifiersEx, when)
+ {
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ if (statics.IsInteractiveRobot())
+ {
+ IInteractiveEvents listener = ((IInteractiveRobot) robot).GetInteractiveEventListener();
+
+ if (listener != null)
+ {
+ listener.OnKeyPressed(this);
+ }
+ }
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.KeyPressedEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ return RbSerializerN.SIZEOF_TYPEINFO + RbSerializerN.SIZEOF_CHAR + RbSerializerN.SIZEOF_INT
+ + RbSerializerN.SIZEOF_INT + RbSerializerN.SIZEOF_LONG + RbSerializerN.SIZEOF_INT +
+ RbSerializerN.SIZEOF_INT;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (KeyPressedEvent) objec;
+ serializer.serialize(buffer, obj.KeyChar);
+ serializer.serialize(buffer, obj.KeyCode);
+ serializer.serialize(buffer, obj.KeyLocation);
+ serializer.serialize(buffer, obj.ID);
+ serializer.serialize(buffer, obj.ModifiersEx);
+ serializer.serialize(buffer, obj.When);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ char keyChar = buffer.getChar();
+ int keyCode = buffer.getInt();
+ int keyLocation = buffer.getInt();
+ int id = buffer.getInt();
+ int modifiersEx = buffer.getInt();
+ long when = buffer.getLong();
+ return new KeyPressedEvent(keyChar, keyCode, keyLocation, id, modifiersEx, when);
+ }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/KeyReleasedEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/KeyReleasedEvent.cs
new file mode 100644
index 0000000..30add3e
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/KeyReleasedEvent.cs
@@ -0,0 +1,98 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// A KeyReleasedEvent is sent to
+ /// when a key has been released on the keyboard.
+ ///
+ ///
+ ///
+ [Serializable]
+ public sealed class KeyReleasedEvent : KeyEvent
+ {
+ private const int DEFAULT_PRIORITY = 98;
+
+ ///
+ /// Called by the game to create a new KeyReleasedEvent.
+ ///
+ public KeyReleasedEvent(char keyChar, int keyCode, int keyLocation, int id, int modifiersEx, long when)
+ : base(keyChar, keyCode, keyLocation, id, modifiersEx, when)
+ {
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ if (statics.IsInteractiveRobot())
+ {
+ IInteractiveEvents listener = ((IInteractiveRobot) robot).GetInteractiveEventListener();
+
+ if (listener != null)
+ {
+ listener.OnKeyReleased(this);
+ }
+ }
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.KeyReleasedEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ return RbSerializerN.SIZEOF_TYPEINFO + RbSerializerN.SIZEOF_CHAR + RbSerializerN.SIZEOF_INT
+ + RbSerializerN.SIZEOF_INT + RbSerializerN.SIZEOF_LONG + RbSerializerN.SIZEOF_INT +
+ RbSerializerN.SIZEOF_INT;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (KeyReleasedEvent) objec;
+
+ serializer.serialize(buffer, obj.KeyChar);
+ serializer.serialize(buffer, obj.KeyCode);
+ serializer.serialize(buffer, obj.KeyLocation);
+ serializer.serialize(buffer, obj.ID);
+ serializer.serialize(buffer, obj.ModifiersEx);
+ serializer.serialize(buffer, obj.When);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ char keyChar = buffer.getChar();
+ int keyCode = buffer.getInt();
+ int keyLocation = buffer.getInt();
+ int id = buffer.getInt();
+ int modifiersEx = buffer.getInt();
+ long when = buffer.getLong();
+
+ return new KeyReleasedEvent(keyChar, keyCode, keyLocation, id, modifiersEx, when);
+ }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/KeyTypedEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/KeyTypedEvent.cs
new file mode 100644
index 0000000..b59b4fa
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/KeyTypedEvent.cs
@@ -0,0 +1,98 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// A KeyTypedEvent is sent to
+ /// when a key has been typed (pressed and released) on the keyboard.
+ ///
+ ///
+ ///
+ [Serializable]
+ public sealed class KeyTypedEvent : KeyEvent
+ {
+ private const int DEFAULT_PRIORITY = 98;
+
+ ///
+ /// Called by the game to create a new KeyTypedEvent.
+ ///
+ public KeyTypedEvent(char keyChar, int keyCode, int keyLocation, int id, int modifiersEx, long when)
+ : base(keyChar, keyCode, keyLocation, id, modifiersEx, when)
+ {
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ if (statics.IsInteractiveRobot())
+ {
+ IInteractiveEvents listener = ((IInteractiveRobot) robot).GetInteractiveEventListener();
+
+ if (listener != null)
+ {
+ listener.OnKeyTyped(this);
+ }
+ }
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.KeyTypedEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ return RbSerializerN.SIZEOF_TYPEINFO + RbSerializerN.SIZEOF_CHAR + RbSerializerN.SIZEOF_INT
+ + RbSerializerN.SIZEOF_INT + RbSerializerN.SIZEOF_LONG + RbSerializerN.SIZEOF_INT +
+ RbSerializerN.SIZEOF_INT;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (KeyTypedEvent) objec;
+
+ serializer.serialize(buffer, obj.KeyChar);
+ serializer.serialize(buffer, obj.KeyCode);
+ serializer.serialize(buffer, obj.KeyLocation);
+ serializer.serialize(buffer, obj.ID);
+ serializer.serialize(buffer, obj.ModifiersEx);
+ serializer.serialize(buffer, obj.When);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ char keyChar = buffer.getChar();
+ int keyCode = buffer.getInt();
+ int keyLocation = buffer.getInt();
+ int id = buffer.getInt();
+ int modifiersEx = buffer.getInt();
+ long when = buffer.getLong();
+
+ return new KeyTypedEvent(keyChar, keyCode, keyLocation, id, modifiersEx, when);
+ }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/Keys.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/Keys.cs
new file mode 100644
index 0000000..fd834ca
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/Keys.cs
@@ -0,0 +1,292 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+// This class is based on the source code from Sun's Java 1.5.0 API for java.awt.event.KeyEvent, but
+// rewritten for C# and .NET with the purpose to bridge the .NET and Java internals of Robocode.
+
+namespace Robocode
+{
+#pragma warning disable 1591
+ ///
+ public static class Keys
+ {
+ public const int KEY_FIRST = 400;
+
+ public const int KEY_LAST = 402;
+
+ public const int KEY_TYPED = KEY_FIRST;
+
+ public const int KEY_PRESSED = 1 + KEY_FIRST;
+
+ public const int KEY_RELEASED = 2 + KEY_FIRST;
+
+ public const int VK_ENTER = 0x0A;
+ public const int VK_BACK_SPACE = 0x20;
+ public const int VK_TAB = 0x08;
+ public const int VK_CANCEL = 0x03;
+ public const int VK_CLEAR = 0x0C;
+ public const int VK_SHIFT = 0x10;
+ public const int VK_CONTROL = 0x11;
+ public const int VK_ALT = 0x12;
+ public const int VK_PAUSE = 0x13;
+ public const int VK_CAPS_LOCK = 0x14;
+ public const int VK_ESCAPE = 0x1B;
+ public const int VK_SPACE = 0x20;
+ public const int VK_PAGE_UP = 0x21;
+ public const int VK_PAGE_DOWN = 0x22;
+ public const int VK_END = 0x23;
+ public const int VK_HOME = 0x24;
+
+ public const int VK_LEFT = 0x25;
+
+ public const int VK_UP = 0x26;
+
+ public const int VK_RIGHT = 0x27;
+
+ public const int VK_DOWN = 0x28;
+
+ public const int VK_COMMA = 0x2C;
+
+ public const int VK_MINUS = 0x2D;
+
+ public const int VK_PERIOD = 0x2E;
+
+ public const int VK_SLASH = 0x2F;
+
+ public const int VK_0 = 0x30;
+ public const int VK_1 = 0x31;
+ public const int VK_2 = 0x32;
+ public const int VK_3 = 0x33;
+ public const int VK_4 = 0x34;
+ public const int VK_5 = 0x35;
+ public const int VK_6 = 0x36;
+ public const int VK_7 = 0x37;
+ public const int VK_8 = 0x38;
+ public const int VK_9 = 0x39;
+
+ public const int VK_SEMICOLON = 0x3B;
+
+ public const int VK_EQUALS = 0x3D;
+
+ public const int VK_A = 0x41;
+ public const int VK_B = 0x42;
+ public const int VK_C = 0x43;
+ public const int VK_D = 0x44;
+ public const int VK_E = 0x45;
+ public const int VK_F = 0x46;
+ public const int VK_G = 0x47;
+ public const int VK_H = 0x48;
+ public const int VK_I = 0x49;
+ public const int VK_J = 0x4A;
+ public const int VK_K = 0x4B;
+ public const int VK_L = 0x4C;
+ public const int VK_M = 0x4D;
+ public const int VK_N = 0x4E;
+ public const int VK_O = 0x4F;
+ public const int VK_P = 0x50;
+ public const int VK_Q = 0x51;
+ public const int VK_R = 0x52;
+ public const int VK_S = 0x53;
+ public const int VK_T = 0x54;
+ public const int VK_U = 0x55;
+ public const int VK_V = 0x56;
+ public const int VK_W = 0x57;
+ public const int VK_X = 0x58;
+ public const int VK_Y = 0x59;
+ public const int VK_Z = 0x5A;
+
+ public const int VK_OPEN_BRACKET = 0x5B;
+
+ public const int VK_BACK_SLASH = 0x5C;
+
+ public const int VK_CLOSE_BRACKET = 0x5D;
+
+ public const int VK_NUMPAD0 = 0x60;
+ public const int VK_NUMPAD1 = 0x61;
+ public const int VK_NUMPAD2 = 0x62;
+ public const int VK_NUMPAD3 = 0x63;
+ public const int VK_NUMPAD4 = 0x64;
+ public const int VK_NUMPAD5 = 0x65;
+ public const int VK_NUMPAD6 = 0x66;
+ public const int VK_NUMPAD7 = 0x67;
+ public const int VK_NUMPAD8 = 0x68;
+ public const int VK_NUMPAD9 = 0x69;
+ public const int VK_MULTIPLY = 0x6A;
+ public const int VK_ADD = 0x6B;
+
+ public const int VK_SEPARATER = 0x6C;
+
+ public const int VK_SEPARATOR = VK_SEPARATER;
+
+ public const int VK_SUBTRACT = 0x6D;
+ public const int VK_DECIMAL = 0x6E;
+ public const int VK_DIVIDE = 0x6F;
+ public const int VK_DELETE = 0x7F;
+ public const int VK_NUM_LOCK = 0x90;
+ public const int VK_SCROLL_LOCK = 0x91;
+
+ public const int VK_F1 = 0x70;
+
+ public const int VK_F2 = 0x71;
+
+ public const int VK_F3 = 0x72;
+
+ public const int VK_F4 = 0x73;
+
+ public const int VK_F5 = 0x74;
+
+ public const int VK_F6 = 0x75;
+
+ public const int VK_F7 = 0x76;
+
+ public const int VK_F8 = 0x77;
+
+ public const int VK_F9 = 0x78;
+
+ public const int VK_F10 = 0x79;
+
+ public const int VK_F11 = 0x7A;
+
+ public const int VK_F12 = 0x7B;
+
+ public const int VK_F13 = 0xF000;
+
+ public const int VK_F14 = 0xF001;
+
+ public const int VK_F15 = 0xF002;
+
+ public const int VK_F16 = 0xF003;
+
+ public const int VK_F17 = 0xF004;
+
+ public const int VK_F18 = 0xF005;
+
+ public const int VK_F19 = 0xF006;
+
+ public const int VK_F20 = 0xF007;
+
+ public const int VK_F21 = 0xF008;
+
+ public const int VK_F22 = 0xF009;
+
+ public const int VK_F23 = 0xF00A;
+
+ public const int VK_F24 = 0xF00B;
+
+ public const int VK_PRINTSCREEN = 0x9A;
+ public const int VK_INSERT = 0x9B;
+ public const int VK_HELP = 0x9C;
+ public const int VK_META = 0x9D;
+
+ public const int VK_BACK_QUOTE = 0xC0;
+ public const int VK_QUOTE = 0xDE;
+
+ public const int VK_KP_UP = 0xE0;
+
+ public const int VK_KP_DOWN = 0xE1;
+
+ public const int VK_KP_LEFT = 0xE2;
+
+ public const int VK_KP_RIGHT = 0xE3;
+
+ public const int VK_DEAD_GRAVE = 0x80;
+ public const int VK_DEAD_ACUTE = 0x81;
+ public const int VK_DEAD_CIRCUMFLEX = 0x82;
+ public const int VK_DEAD_TILDE = 0x83;
+ public const int VK_DEAD_MACRON = 0x84;
+ public const int VK_DEAD_BREVE = 0x85;
+ public const int VK_DEAD_ABOVEDOT = 0x86;
+ public const int VK_DEAD_DIAERESIS = 0x87;
+ public const int VK_DEAD_ABOVERING = 0x88;
+ public const int VK_DEAD_DOUBLEACUTE = 0x89;
+ public const int VK_DEAD_CARON = 0x8a;
+ public const int VK_DEAD_CEDILLA = 0x8b;
+ public const int VK_DEAD_OGONEK = 0x8c;
+ public const int VK_DEAD_IOTA = 0x8d;
+ public const int VK_DEAD_VOICED_SOUND = 0x8e;
+ public const int VK_DEAD_SEMIVOICED_SOUND = 0x8f;
+
+ public const int VK_AMPERSAND = 0x96;
+ public const int VK_ASTERISK = 0x97;
+ public const int VK_QUOTEDBL = 0x98;
+ public const int VK_LESS = 0x99;
+ public const int VK_GREATER = 0xa0;
+ public const int VK_BRACELEFT = 0xa1;
+ public const int VK_BRACERIGHT = 0xa2;
+
+ public const int VK_AT = 0x0200;
+ public const int VK_COLON = 0x0201;
+ public const int VK_CIRCUMFLEX = 0x0202;
+ public const int VK_DOLLAR = 0x0203;
+ public const int VK_EURO_SIGN = 0x0204;
+
+ public const int VK_EXCLAMATION_MARK = 0x0205;
+ public const int VK_INVERTED_EXCLAMATION_MARK = 0x0206;
+ public const int VK_LEFT_PARENTHESIS = 0x0207;
+ public const int VK_NUMBER_SIGN = 0x0208;
+ public const int VK_PLUS = 0x0209;
+ public const int VK_RIGHT_PARENTHESIS = 0x020A;
+ public const int VK_UNDERSCORE = 0x020B;
+ public const int VK_WINDOWS = 0x020C;
+ public const int VK_CONTEXT_MENU = 0x020D;
+ public const int VK_const = 0x0018;
+ public const int VK_CONVERT = 0x001C;
+ public const int VK_NONCONVERT = 0x001D;
+ public const int VK_ACCEPT = 0x001E;
+ public const int VK_MODECHANGE = 0x001F;
+ public const int VK_KANA = 0x0015;
+ public const int VK_KANJI = 0x0019;
+ public const int VK_ALPHANUMERIC = 0x00F0;
+ public const int VK_KATAKANA = 0x00F1;
+ public const int VK_HIRAGANA = 0x00F2;
+ public const int VK_FULL_WIDTH = 0x00F3;
+ public const int VK_HALF_WIDTH = 0x00F4;
+ public const int VK_ROMAN_CHARACTERS = 0x00F5;
+ public const int VK_ALL_CANDIDATES = 0x0100;
+ public const int VK_PREVIOUS_CANDIDATE = 0x0101;
+ public const int VK_CODE_INPUT = 0x0102;
+ public const int VK_JAPANESE_KATAKANA = 0x0103;
+ public const int VK_JAPANESE_HIRAGANA = 0x0104;
+ public const int VK_JAPANESE_ROMAN = 0x0105;
+ public const int VK_KANA_LOCK = 0x0106;
+ public const int VK_INPUT_METHOD_ON_OFF = 0x0107;
+ public const int VK_CUT = 0xFFD1;
+ public const int VK_COPY = 0xFFCD;
+ public const int VK_PASTE = 0xFFCF;
+ public const int VK_UNDO = 0xFFCB;
+ public const int VK_AGAIN = 0xFFC9;
+ public const int VK_FIND = 0xFFD0;
+ public const int VK_PROPS = 0xFFCA;
+ public const int VK_STOP = 0xFFC8;
+ public const int VK_COMPOSE = 0xFF20;
+ public const int VK_ALT_GRAPH = 0xFF7E;
+ public const int VK_BEGIN = 0xFF58;
+ public const int VK_UNDEFINED = 0x0;
+ public const int KEY_LOCATION_UNKNOWN = 0;
+ public const int KEY_LOCATION_STANDARD = 1;
+ public const int KEY_LOCATION_LEFT = 2;
+ public const int KEY_LOCATION_RIGHT = 3;
+ public const int KEY_LOCATION_NUMPAD = 4;
+ public static readonly char CHAR_UNDEFINED = (char) 0xFFFF;
+ public const int MOUSE_FIRST = 500;
+ public const int MOUSE_LAST = 507;
+ public const int MOUSE_CLICKED = MOUSE_FIRST;
+ public const int MOUSE_PRESSED = 1 + MOUSE_FIRST; //Event.MOUSE_DOWN
+ public const int MOUSE_RELEASED = 2 + MOUSE_FIRST; //Event.MOUSE_UP
+ public const int MOUSE_MOVED = 3 + MOUSE_FIRST; //Event.MOUSE_MOVE
+ public const int MOUSE_ENTERED = 4 + MOUSE_FIRST; //Event.MOUSE_ENTER
+ public const int MOUSE_EXITED = 5 + MOUSE_FIRST; //Event.MOUSE_EXIT
+ public const int MOUSE_DRAGGED = 6 + MOUSE_FIRST; //Event.MOUSE_DRAG
+ public const int MOUSE_WHEEL = 7 + MOUSE_FIRST;
+ public const int NOBUTTON = 0;
+ public const int BUTTON1 = 1;
+ public const int BUTTON2 = 2;
+ public const int BUTTON3 = 3;
+
+ }
+#pragma warning restore 1591
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MessageEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MessageEvent.cs
new file mode 100644
index 0000000..8e01625
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MessageEvent.cs
@@ -0,0 +1,77 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.peer;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// A MessageEvent is sent to
+ /// when a teammate sends a message to your robot.
+ /// You can use the information contained in this event to determine what to do.
+ ///
+ [Serializable]
+ public sealed class MessageEvent : Event
+ {
+ private const int DEFAULT_PRIORITY = 75;
+
+ private readonly string sender;
+ [NonSerialized]
+ private readonly object message;
+
+ ///
+ /// Called by the game to create a new MessageEvent.
+ ///
+ public MessageEvent(string sender, object message)
+ {
+ this.sender = sender;
+ this.message = message;
+ }
+
+ ///
+ /// Returns the name of the sending robot.
+ ///
+ public string Sender
+ {
+ get { return sender; }
+ }
+
+ ///
+ /// Returns the message itself.
+ ///
+ public object Message
+ {
+ get { return message; }
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ if (statics.IsTeamRobot())
+ {
+ ITeamEvents listener = ((ITeamRobot) robot).GetTeamEventListener();
+
+ if (listener != null)
+ {
+ listener.OnMessageReceived(this);
+ }
+ }
+ }
+
+ internal override byte SerializationType
+ {
+ get { throw new System.Exception("Serialization of event type not supported"); }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseClickedEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseClickedEvent.cs
new file mode 100644
index 0000000..bfeba0b
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseClickedEvent.cs
@@ -0,0 +1,103 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// A MouseClickedEvent is sent to
+ /// when the mouse is clicked inside the battle view.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [Serializable]
+ public sealed class MouseClickedEvent : MouseEvent
+ {
+ private const int DEFAULT_PRIORITY = 98;
+
+ ///
+ /// Called by the game to create a new MouseClickedEvent.
+ ///
+ public MouseClickedEvent(int button, int clickCount, int x, int y, int id, int modifiersEx, long when)
+ : base(button, clickCount, x, y, id, modifiersEx, when)
+ {
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ if (statics.IsInteractiveRobot())
+ {
+ IInteractiveEvents listener = ((IInteractiveRobot) robot).GetInteractiveEventListener();
+
+ if (listener != null)
+ {
+ listener.OnMouseClicked(this);
+ }
+ }
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.MouseClickedEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ return RbSerializerN.SIZEOF_TYPEINFO + 6*RbSerializerN.SIZEOF_INT + RbSerializerN.SIZEOF_LONG;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (MouseClickedEvent) objec;
+
+ serializer.serialize(buffer, obj.Button);
+ serializer.serialize(buffer, obj.ClickCount);
+ serializer.serialize(buffer, obj.X);
+ serializer.serialize(buffer, obj.Y);
+ serializer.serialize(buffer, obj.ID);
+ serializer.serialize(buffer, obj.ModifiersEx);
+ serializer.serialize(buffer, obj.When);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ int button = buffer.getInt();
+ int clickCount = buffer.getInt();
+ int x = buffer.getInt();
+ int y = buffer.getInt();
+ int id = buffer.getInt();
+ int modifiersEx = buffer.getInt();
+ long when = buffer.getLong();
+
+ return new MouseClickedEvent(button, clickCount, x, y, id, modifiersEx, when);
+ }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseDraggedEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseDraggedEvent.cs
new file mode 100644
index 0000000..013a1e3
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseDraggedEvent.cs
@@ -0,0 +1,103 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// A MouseDraggedEvent is sent to
+ /// when the mouse is dragged inside the battle view.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [Serializable]
+ public sealed class MouseDraggedEvent : MouseEvent
+ {
+ private const int DEFAULT_PRIORITY = 98;
+
+ ///
+ /// Called by the game to create a new MouseDraggedEvent.
+ ///
+ public MouseDraggedEvent(int button, int clickCount, int x, int y, int id, int modifiersEx, long when)
+ : base(button, clickCount, x, y, id, modifiersEx, when)
+ {
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ if (statics.IsInteractiveRobot())
+ {
+ IInteractiveEvents listener = ((IInteractiveRobot) robot).GetInteractiveEventListener();
+
+ if (listener != null)
+ {
+ listener.OnMouseDragged(this);
+ }
+ }
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.MouseDraggedEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ return RbSerializerN.SIZEOF_TYPEINFO + 6*RbSerializerN.SIZEOF_INT + RbSerializerN.SIZEOF_LONG;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (MouseDraggedEvent) objec;
+
+ serializer.serialize(buffer, obj.Button);
+ serializer.serialize(buffer, obj.ClickCount);
+ serializer.serialize(buffer, obj.X);
+ serializer.serialize(buffer, obj.Y);
+ serializer.serialize(buffer, obj.ID);
+ serializer.serialize(buffer, obj.ModifiersEx);
+ serializer.serialize(buffer, obj.When);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ int button = buffer.getInt();
+ int clickCount = buffer.getInt();
+ int x = buffer.getInt();
+ int y = buffer.getInt();
+ int id = buffer.getInt();
+ int modifiersEx = buffer.getInt();
+ long when = buffer.getLong();
+
+ return new MouseDraggedEvent(button, clickCount, x, y, id, modifiersEx, when);
+ }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseEnteredEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseEnteredEvent.cs
new file mode 100644
index 0000000..b0ce310
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseEnteredEvent.cs
@@ -0,0 +1,104 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// A MouseEnteredEvent is sent to
+ /// when the mouse has entered the battle view.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [Serializable]
+ public sealed class MouseEnteredEvent : MouseEvent
+ {
+ private const int DEFAULT_PRIORITY = 98;
+
+ ///
+ /// Called by the game to create a new MouseDraggedEvent.
+ ///
+ public MouseEnteredEvent(int button, int clickCount, int x, int y, int id, int modifiersEx, long when)
+ : base(button, clickCount, x, y, id, modifiersEx, when)
+ {
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ if (statics.IsInteractiveRobot())
+ {
+ IInteractiveEvents listener = ((IInteractiveRobot) robot).GetInteractiveEventListener();
+
+ if (listener != null)
+ {
+ listener.OnMouseEntered(this);
+ }
+ }
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.MouseEnteredEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ return RbSerializerN.SIZEOF_TYPEINFO + 6*RbSerializerN.SIZEOF_INT + RbSerializerN.SIZEOF_LONG;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (MouseEnteredEvent)objec;
+
+ serializer.serialize(buffer, obj.Button);
+ serializer.serialize(buffer, obj.ClickCount);
+ serializer.serialize(buffer, obj.X);
+ serializer.serialize(buffer, obj.Y);
+ serializer.serialize(buffer, obj.ID);
+ serializer.serialize(buffer, obj.ModifiersEx);
+ serializer.serialize(buffer, obj.When);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ int button = buffer.getInt();
+ int clickCount = buffer.getInt();
+ int x = buffer.getInt();
+ int y = buffer.getInt();
+ int id = buffer.getInt();
+ int modifiersEx = buffer.getInt();
+ long when = buffer.getLong();
+
+ return new MouseEnteredEvent(button, clickCount, x, y, id, modifiersEx, when);
+ }
+ }
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseEvent.cs
new file mode 100644
index 0000000..2f87e17
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseEvent.cs
@@ -0,0 +1,91 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+
+namespace Robocode
+{
+ ///
+ /// Super class of all events that originates from the mouse.
+ ///
+ [Serializable]
+ public abstract class MouseEvent : Event
+ {
+ private readonly int button;
+ private readonly int clickCount;
+ private readonly int x;
+ private readonly int y;
+ private readonly int id;
+ private readonly int modifiersEx;
+ private readonly long when;
+
+ ///
+ /// Called by the game to create a new MouseEvent.
+ ///
+ protected MouseEvent(int button, int clickCount, int x, int y, int id, int modifiersEx, long when)
+ {
+ this.button = button;
+ this.clickCount = clickCount;
+ this.x = x;
+ this.y = y;
+ this.id = id;
+ this.modifiersEx = modifiersEx;
+ this.when = when;
+ }
+
+ ///
+ /// Number of the button
+ ///
+ public int Button
+ {
+ get { return button; }
+ }
+
+ ///
+ /// Click count
+ ///
+ public int ClickCount
+ {
+ get { return clickCount; }
+ }
+
+ ///
+ /// Cursor coordinates
+ ///
+ public int X
+ {
+ get { return x; }
+ }
+
+ ///
+ /// Cursor coordinates
+ ///
+ public int Y
+ {
+ get { return y; }
+ }
+
+ internal int ID
+ {
+ get { return id; }
+ }
+
+ internal int ModifiersEx
+ {
+ get { return modifiersEx; }
+ }
+
+ ///
+ /// Age of the event
+ ///
+ public long When
+ {
+ get { return when; }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseExitedEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseExitedEvent.cs
new file mode 100644
index 0000000..7a39cc7
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseExitedEvent.cs
@@ -0,0 +1,103 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// A MouseExitedEvent is sent to
+ /// when the mouse has exited the battle view.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [Serializable]
+ public sealed class MouseExitedEvent : MouseEvent
+ {
+ private const int DEFAULT_PRIORITY = 98;
+
+ ///
+ /// Called by the game to create a new MouseDraggedEvent.
+ ///
+ public MouseExitedEvent(int button, int clickCount, int x, int y, int id, int modifiersEx, long when)
+ : base(button, clickCount, x, y, id, modifiersEx, when)
+ {
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ if (statics.IsInteractiveRobot())
+ {
+ IInteractiveEvents listener = ((IInteractiveRobot) robot).GetInteractiveEventListener();
+
+ if (listener != null)
+ {
+ listener.OnMouseExited(this);
+ }
+ }
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.MouseExitedEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ return RbSerializerN.SIZEOF_TYPEINFO + 6*RbSerializerN.SIZEOF_INT + RbSerializerN.SIZEOF_LONG;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (MouseExitedEvent)objec;
+
+ serializer.serialize(buffer, obj.Button);
+ serializer.serialize(buffer, obj.ClickCount);
+ serializer.serialize(buffer, obj.X);
+ serializer.serialize(buffer, obj.Y);
+ serializer.serialize(buffer, obj.ID);
+ serializer.serialize(buffer, obj.ModifiersEx);
+ serializer.serialize(buffer, obj.When);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ int button = buffer.getInt();
+ int clickCount = buffer.getInt();
+ int x = buffer.getInt();
+ int y = buffer.getInt();
+ int id = buffer.getInt();
+ int modifiersEx = buffer.getInt();
+ long when = buffer.getLong();
+
+ return new MouseExitedEvent(button, clickCount, x, y, id, modifiersEx, when);
+ }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseMovedEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseMovedEvent.cs
new file mode 100644
index 0000000..6b4b640
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseMovedEvent.cs
@@ -0,0 +1,104 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using System.Drawing;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// A MouseMovedEvent is sent to
+ /// when the mouse has moved inside the battle view.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [Serializable]
+ public sealed class MouseMovedEvent : MouseEvent
+ {
+ private const int DEFAULT_PRIORITY = 98;
+
+ ///
+ /// Called by the game to create a new MouseDraggedEvent.
+ ///
+ public MouseMovedEvent(int button, int clickCount, int x, int y, int id, int modifiersEx, long when)
+ : base(button, clickCount, x, y, id, modifiersEx, when)
+ {
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ if (statics.IsInteractiveRobot())
+ {
+ IInteractiveEvents listener = ((IInteractiveRobot) robot).GetInteractiveEventListener();
+
+ if (listener != null)
+ {
+ listener.OnMouseMoved(this);
+ }
+ }
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.MouseMovedEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ return RbSerializerN.SIZEOF_TYPEINFO + 6*RbSerializerN.SIZEOF_INT + RbSerializerN.SIZEOF_LONG;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (MouseMovedEvent)objec;
+
+ serializer.serialize(buffer, obj.Button);
+ serializer.serialize(buffer, obj.ClickCount);
+ serializer.serialize(buffer, obj.X);
+ serializer.serialize(buffer, obj.Y);
+ serializer.serialize(buffer, obj.ID);
+ serializer.serialize(buffer, obj.ModifiersEx);
+ serializer.serialize(buffer, obj.When);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ int button = buffer.getInt();
+ int clickCount = buffer.getInt();
+ int x = buffer.getInt();
+ int y = buffer.getInt();
+ int id = buffer.getInt();
+ int modifiersEx = buffer.getInt();
+ long when = buffer.getLong();
+
+ return new MouseMovedEvent(button, clickCount, x, y, id, modifiersEx, when);
+ }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MousePressedEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MousePressedEvent.cs
new file mode 100644
index 0000000..35b7470
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MousePressedEvent.cs
@@ -0,0 +1,105 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using System.Drawing;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// A MousePressedEvent is sent to
+ /// when the mouse is pressed inside the battle view.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [Serializable]
+ public sealed class MousePressedEvent : MouseEvent
+ {
+ private const int DEFAULT_PRIORITY = 98;
+
+ ///
+ /// Called by the game to create a new MouseDraggedEvent.
+ ///
+ public MousePressedEvent(int button, int clickCount, int x, int y, int id, int modifiersEx, long when)
+ : base(button, clickCount, x, y, id, modifiersEx, when)
+ {
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ if (statics.IsInteractiveRobot())
+ {
+ IInteractiveEvents listener = ((IInteractiveRobot) robot).GetInteractiveEventListener();
+
+ if (listener != null)
+ {
+ listener.OnMousePressed(this);
+ }
+ }
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.MousePressedEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ return RbSerializerN.SIZEOF_TYPEINFO + 6*RbSerializerN.SIZEOF_INT + RbSerializerN.SIZEOF_LONG;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (MousePressedEvent)objec;
+
+ serializer.serialize(buffer, obj.Button);
+ serializer.serialize(buffer, obj.ClickCount);
+ serializer.serialize(buffer, obj.X);
+ serializer.serialize(buffer, obj.Y);
+ serializer.serialize(buffer, obj.ID);
+ serializer.serialize(buffer, obj.ModifiersEx);
+ serializer.serialize(buffer, obj.When);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ int button = buffer.getInt();
+ int clickCount = buffer.getInt();
+ int x = buffer.getInt();
+ int y = buffer.getInt();
+ int id = buffer.getInt();
+ int modifiersEx = buffer.getInt();
+ long when = buffer.getLong();
+
+ return new MousePressedEvent(button, clickCount, x, y, id, modifiersEx, when);
+ }
+ }
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseReleasedEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseReleasedEvent.cs
new file mode 100644
index 0000000..f3c6e75
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseReleasedEvent.cs
@@ -0,0 +1,104 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// A MouseReleasedEvent is sent to
+ /// when the mouse is released inside the battle view.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [Serializable]
+ public sealed class MouseReleasedEvent : MouseEvent
+ {
+ private const int DEFAULT_PRIORITY = 98;
+
+ ///
+ /// Called by the game to create a new MouseDraggedEvent.
+ ///
+ public MouseReleasedEvent(int button, int clickCount, int x, int y, int id, int modifiersEx, long when)
+ : base(button, clickCount, x, y, id, modifiersEx, when)
+ {
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ if (statics.IsInteractiveRobot())
+ {
+ IInteractiveEvents listener = ((IInteractiveRobot) robot).GetInteractiveEventListener();
+
+ if (listener != null)
+ {
+ listener.OnMouseReleased(this);
+ }
+ }
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.MouseReleasedEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ return RbSerializerN.SIZEOF_TYPEINFO + 6*RbSerializerN.SIZEOF_INT + RbSerializerN.SIZEOF_LONG;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (MouseReleasedEvent)objec;
+
+ serializer.serialize(buffer, obj.Button);
+ serializer.serialize(buffer, obj.ClickCount);
+ serializer.serialize(buffer, obj.X);
+ serializer.serialize(buffer, obj.Y);
+ serializer.serialize(buffer, obj.ID);
+ serializer.serialize(buffer, obj.ModifiersEx);
+ serializer.serialize(buffer, obj.When);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ int button = buffer.getInt();
+ int clickCount = buffer.getInt();
+ int x = buffer.getInt();
+ int y = buffer.getInt();
+ int id = buffer.getInt();
+ int modifiersEx = buffer.getInt();
+ long when = buffer.getLong();
+
+ return new MouseReleasedEvent(button, clickCount, x, y, id, modifiersEx, when);
+ }
+ }
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseWheelMovedEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseWheelMovedEvent.cs
new file mode 100644
index 0000000..986507d
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MouseWheelMovedEvent.cs
@@ -0,0 +1,134 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// A MouseWheelMovedEvent is sent to
+ /// when the mouse wheel is rotated inside the battle view.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [Serializable]
+ public sealed class MouseWheelMovedEvent : MouseEvent
+ {
+ private const int DEFAULT_PRIORITY = 98;
+ private readonly int scrollType;
+ private readonly int scrollAmount;
+ private readonly int wheelRotation;
+
+ ///
+ /// Called by the game to create a new MouseWheelMovedEvent.
+ ///
+ public MouseWheelMovedEvent(int clickCount, int x, int y, int scrollType, int scrollAmount, int wheelRotation,
+ int id, int modifiersEx, long when)
+ : base(-1, clickCount, x, y, id, modifiersEx, when)
+ {
+ this.scrollType = scrollType;
+ this.scrollAmount = scrollAmount;
+ this.wheelRotation = wheelRotation;
+ }
+
+ internal int ScrollType
+ {
+ get { return scrollType; }
+ }
+
+ internal int ScrollAmount
+ {
+ get { return scrollAmount; }
+ }
+
+ ///
+ /// Indicates how far the mouse wheel was rotated.
+ ///
+ public int WheelRotation
+ {
+ get { return wheelRotation; }
+ }
+
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ if (statics.IsInteractiveRobot())
+ {
+ IInteractiveEvents listener = ((IInteractiveRobot) robot).GetInteractiveEventListener();
+
+ if (listener != null)
+ {
+ listener.OnMouseWheelMoved(this);
+ }
+ }
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.MouseWheelMovedEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ return RbSerializerN.SIZEOF_TYPEINFO + 8*RbSerializerN.SIZEOF_INT + RbSerializerN.SIZEOF_LONG;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (MouseWheelMovedEvent) objec;
+
+ serializer.serialize(buffer, obj.ClickCount);
+ serializer.serialize(buffer, obj.X);
+ serializer.serialize(buffer, obj.Y);
+ serializer.serialize(buffer, obj.ScrollType);
+ serializer.serialize(buffer, obj.ScrollAmount);
+ serializer.serialize(buffer, obj.WheelRotation);
+ serializer.serialize(buffer, obj.ID);
+ serializer.serialize(buffer, obj.ModifiersEx);
+ serializer.serialize(buffer, obj.When);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ int clickCount = buffer.getInt();
+ int x = buffer.getInt();
+ int y = buffer.getInt();
+ int scrollType = buffer.getInt();
+ int scrollAmount = buffer.getInt();
+ int wheelRotation = buffer.getInt();
+ int id = buffer.getInt();
+ int modifiersEx = buffer.getInt();
+ long when = buffer.getLong();
+
+ return new MouseWheelMovedEvent(clickCount, x, y, scrollType, scrollAmount, wheelRotation, id,
+ modifiersEx, when);
+ }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MoveCompleteCondition.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MoveCompleteCondition.cs
new file mode 100644
index 0000000..dde6a0b
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/MoveCompleteCondition.cs
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+namespace Robocode
+{
+ ///
+ /// A prebuilt condition you can use that indicates your robot has finished moving.
+ ///
+ ///
+ public class MoveCompleteCondition : Condition
+ {
+ private readonly AdvancedRobot robot;
+
+ ///
+ /// Creates a new MoveCompleteCondition with default priority.
+ /// The default priority is 80.
+ ///
+ /// Your robot, which must be a
+ public MoveCompleteCondition(AdvancedRobot robot)
+ {
+ this.robot = robot;
+ }
+
+ ///
+ /// Creates a new MoveCompleteCondition with the specified priority.
+ /// A condition priority is a value from 0 - 99. The higher value, the
+ /// higher priority. The default priority is 80.
+ ///
+ ///
+ /// Your robot, which must be a
+ /// The priority of this condition
+ public MoveCompleteCondition(AdvancedRobot robot, int priority)
+ {
+ this.robot = robot;
+ this.priority = priority;
+ }
+
+ ///
+ /// Tests if the robot has stopped moving.
+ /// Returns true if the robot has stopped moving
+ ///
+ public override bool Test()
+ {
+ return (robot.DistanceRemaining == 0);
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/PaintEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/PaintEvent.cs
new file mode 100644
index 0000000..6848122
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/PaintEvent.cs
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.peer;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// This event occurs when your robot should paint, where the
+ /// is called on your robot.
+ ///
+ /// You can use this event for setting the event priority by calling
+ ///
+ ///
+ [Serializable]
+ public sealed class PaintEvent : Event
+ {
+ private const int DEFAULT_PRIORITY = 5;
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ if (statics.IsPaintRobot())
+ {
+ IPaintEvents listener = ((IPaintRobot) robot).GetPaintEventListener();
+
+ if (listener != null)
+ {
+ listener.OnPaint(graphics);
+ }
+ }
+ }
+
+ internal override byte SerializationType
+ {
+ get { throw new System.Exception("Serialization of this type is not supported"); }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/RadarTurnCompleteCondition.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/RadarTurnCompleteCondition.cs
new file mode 100644
index 0000000..a46092a
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/RadarTurnCompleteCondition.cs
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+namespace Robocode
+{
+ ///
+ /// A prebuilt condition you can use that indicates your radar has finished turning.
+ ///
+ ///
+ public class RadarTurnCompleteCondition : Condition
+ {
+ private readonly AdvancedRobot robot;
+
+ ///
+ /// Creates a new RadarTurnCompleteCondition with default priority.
+ /// The default priority is 80.
+ ///
+ /// Your robot, which must be a
+ public RadarTurnCompleteCondition(AdvancedRobot robot)
+ {
+ this.robot = robot;
+ }
+
+ ///
+ /// Creates a new RadarTurnCompleteCondition with the specified priority.
+ /// A condition priority is a value from 0 - 99. The higher value, the
+ /// higher priority. The default priority is 80.
+ ///
+ ///
+ /// Your robot, which must be a
+ /// The priority of this condition
+ public RadarTurnCompleteCondition(AdvancedRobot robot, int priority)
+ {
+ this.robot = robot;
+ this.priority = priority;
+ }
+
+ ///
+ /// Tests if the radar has stopped turning.
+ /// Returns true if the radar has stopped turning; false otherwise
+ ///
+ public override bool Test()
+ {
+ return (robot.RadarTurnRemaining == 0);
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/RateControlRobot.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/RateControlRobot.cs
new file mode 100644
index 0000000..2521bcd
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/RateControlRobot.cs
@@ -0,0 +1,364 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using Robocode.Util;
+
+namespace Robocode
+{
+ ///
+ /// This advanced robot type allows you to set a rate for each of the robot's movements.
+ ///
+ /// You can set the rate for:
+ ///
+ ///
velocity - pixels per turn
+ ///
robot turn - radians per turn
+ ///
gun rotation - radians per turn
+ ///
radar rotation - radians per turn
+ ///
+ /// When you set a rate for one of the above movements, the movement will continue the move by
+ /// specified rate for ever, until the rate is changed. In order to move ahead or right, the
+ /// rate must be set to a positive value. If a negative value is used instead, the movement
+ /// will go back or to the left. In order to stop the movement, the rate must be
+ /// set to 0.
+ ///
+ /// Note: When calling , ,
+ /// , and variants,
+ /// any previous calls to "movement" functions outside of ,
+ /// such as ,
+ /// ,
+ /// and similar will be
+ /// overridden when calling the on this robot class.
+ ///
+ /// Look into the source code for the samplecs.VelociRobot in order to see how to use this
+ /// robot type.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public abstract class RateControlRobot : TeamRobot
+ {
+ private double velocityRate; // Pixels per turn
+ private double turnRate; // Radians per turn
+ private double gunRotationRate; // Radians per turn
+ private double radarRotationRate; // Radians per turn
+
+ ///
+ ///
+ /// The speed the robot will move (forward), in pixels per turn.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// Execute() or take an action that executes.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot will move backwards
+ ///
+ ///
+ ///
+ /// // Set the robot to move forward 2 pixels per turn
+ /// VelocityRate = 2;
+ ///
+ /// // Set the robot to move backwards 8 pixels per turn
+ /// // (overrides the previous order)
+ /// VelocityRate = -8;
+ ///
+ /// ...
+ /// // Executes the last VelocityRate
+ /// Execute();
+ ///
+ ///
+ /// Note: This method overrules and
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public double VelocityRate
+ {
+ get { return velocityRate; }
+ set { velocityRate = value; }
+ }
+
+ ///
+ ///
+ /// The robot's clockwise (right) rotation per turn, in degrees.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// Execute() or take an action that executes.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot turns counterclockwise (left)
+ ///
+ ///
+ ///
+ /// // Set the robot to turn right 10 degrees per turn
+ /// TurnRate = 10;
+ ///
+ /// // Set the robot to turn left 4 degrees per turn
+ /// // (overrides the previous order)
+ /// TurnRate = -5;
+ ///
+ /// ...
+ /// // Executes the last TurnRate
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public double TurnRate
+ {
+ get { return Utils.ToRadians(turnRate); }
+ set { turnRate = Utils.ToRadians(value); }
+ }
+
+ ///
+ /// The robot's clockwise (right) rotation per turn, in radians.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// Execute() or take an action that executes.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot turns counterclockwise (left)
+ ///
+ ///
+ ///
+ /// // Set the robot to turn right pi / 32 radians per turn
+ /// TurnRateRadians = Math.PI / 32;
+ ///
+ /// // Set the robot to turn left pi / 20 radians per turn
+ /// // (overrides the previous order)
+ /// TurnRateRadians = -Math.PI / 20;
+ ///
+ /// ...
+ /// // Executes the last TurnRateRadians
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public double TurnRateRadians
+ {
+ get { return turnRate; }
+ set { turnRate = value; }
+ }
+
+ ///
+ /// The gun's clockwise (right) rotation per turn, in degrees.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// Execute() or take an action that executes.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the gun turns counterclockwise (left)
+ ///
+ ///
+ ///
+ /// // Set the gun to turn right 15 degrees per turn
+ /// GunRotationRate = 15;
+ ///
+ /// // Set the gun to turn left 9 degrees per turn
+ /// // (overrides the previous order)
+ /// GunRotationRate = -9;
+ ///
+ /// ...
+ /// // Executes the last GunRotationRate()
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public double GunRotationRate
+ {
+ get { return Utils.ToDegrees(gunRotationRate); }
+ set { gunRotationRate = Utils.ToRadians(value); }
+ }
+
+ ///
+ /// The gun's clockwise (right) rotation per turn, in radians.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// Execute() or take an action that executes.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the gun turns counterclockwise (left)
+ ///
+ ///
+ ///
+ /// // Set the gun to turn right pi / 16 radians per turn
+ /// GunRotationRateRadians = Math.PI / 16;
+ ///
+ /// // Set the gun to turn left pi / 12 radians per turn
+ /// // (overrides the previous order)
+ /// GunRotationRateRadians = -Math.PI / 12;
+ ///
+ /// ...
+ /// // Executes the last GunRotationRateRadians
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public double GunRotationRateRadians
+ {
+ get { return gunRotationRate; }
+ set { gunRotationRate = value; }
+ }
+
+ ///
+ /// The radar's clockwise (right) rotation per turn, in degrees.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// Execute() or take an action that executes.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the radar turns counterclockwise (left)
+ ///
+ ///
+ ///
+ /// // Set the radar to turn right 45 degrees per turn
+ /// RadarRotationRate = 45;
+ ///
+ /// // Set the radar to turn left 15 degrees per turn
+ /// // (overrides the previous order)
+ /// RadarRotationRate = -15;
+ ///
+ /// ...
+ /// // Executes the last RadarRotationRate
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public double RadarRotationRate
+ {
+ get { return Utils.ToDegrees(radarRotationRate); }
+ set { radarRotationRate = Utils.ToRadians(value); }
+ }
+
+ ///
+ /// The radar's clockwise (right) rotation per turn, in radians.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// Execute() or take an action that executes.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the radar turns counterclockwise (left)
+ ///
+ ///
+ ///
+ /// // Set the radar to turn right pi / 4 radians per turn
+ /// RadarRotationRateRadians = Math.PI / 4;
+ ///
+ /// // Set the radar to turn left pi / 8 radians per turn
+ /// // (overrides the previous order)
+ /// RadarRotationRateRadians = -Math.PI / 8;
+ ///
+ /// ...
+ /// // Executes the last RadarRotationRateRadians
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public double RadarRotationRateRadians
+ {
+ get { return radarRotationRate; }
+ set { radarRotationRate = value; }
+ }
+
+ ///
+ /// Executes any pending actions, or continues executing actions that are
+ /// in process. This call returns after the actions have been started.
+ ///
+ /// Note that advanced robots must call this function in order to
+ /// Execute pending set* calls like e.g. ,
+ /// ,
+ /// etc. Otherwise, these calls will never get executed.
+ ///
+ /// Any previous calls to "movement" functions outside of
+ /// , such as
+ /// ,
+ /// ,
+ ///
+ /// etc. will be overridden when this method is called on this robot class.
+ ///
+ ///
+ /// In this example the robot will move while turning:
+ ///
+ /// VelocityRate = 6;
+ /// TurnRate = 7;
+ ///
+ /// while (true)
+ /// {
+ /// Execute();
+ /// }
+ ///
+ ///
+ ///
+ public override void Execute()
+ {
+ MaxVelocity = velocityRate;
+ if (velocityRate > 0)
+ {
+ SetAhead(Double.PositiveInfinity);
+ }
+ else if (velocityRate < 0)
+ {
+ SetBack(Double.PositiveInfinity);
+ }
+ else
+ {
+ SetAhead(0);
+ }
+
+ SetTurnGunRightRadians(gunRotationRate);
+ SetTurnRadarRightRadians(radarRotationRate);
+ SetTurnRightRadians(turnRate);
+
+ base.Execute();
+ }
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/Robot.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/Robot.cs
new file mode 100644
index 0000000..4d65225
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/Robot.cs
@@ -0,0 +1,1927 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using System.Drawing;
+using System.IO;
+using System.Security.Permissions;
+using net.sf.robocode.security;
+using Robocode.Exception;
+using Robocode.RobotInterfaces;
+using Robocode.RobotInterfaces.Peer;
+using Robocode.Util;
+
+namespace Robocode
+{
+ ///
+ ///
+ /// The basic robot class that you will extend to create your own robots.
+ ///
+ /// Please note the following standards will be used:
+ ///
+ /// heading - absolute angle in degrees with 0 facing up the screen,
+ /// positive clockwise. 0 <= heading < 360.
+ ///
+ /// bearing - relative angle to some obj from your robot's heading,
+ /// positive clockwise. -180 < bearing <= 180
+ ///
+ /// All coordinates are expressed as (x,y).
+ /// All coordinates are positive.
+ ///
+ /// The origin (0,0) is at the bottom left of the screen.
+ ///
+ /// Positive X is right.
+ /// Positive Y is up.
+ ///
+ ///
+ /// Building your first robot
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public abstract class Robot : IInteractiveRobot, IPaintRobot, IBasicEvents3, IInteractiveEvents, IPaintEvents, IRunnable
+ {
+ private const int
+ WIDTH = 36,
+ HEIGHT = 36;
+
+ internal IBasicRobotPeer peer;
+ internal TextWriter _output;
+
+ ///
+ /// The Out stream your robot should use to print.
+ ///
+ /// You can view the print-outs by clicking the button for your robot in the
+ /// right side of the battle window.
+ ///
+ ///
+ ///
+ /// // Print Out a line each time my robot hits another robot
+ /// public void OnHitRobot(HitRobotEvent e)
+ /// {
+ /// Out.WriteLine("I hit a robot! My energy: " + Energy + " his energy: " + e.Energy);
+ /// }
+ ///
+ ///
+ ///
+ public TextWriter Out
+ {
+ get { return _output; }
+ }
+
+ [RobocodeInternalPermission(SecurityAction.LinkDemand)]
+ void IBasicRobot.SetOut(TextWriter outpt)
+ {
+ _output = outpt;
+ }
+
+ [RobocodeInternalPermission(SecurityAction.LinkDemand)]
+ void IBasicRobot.SetPeer(IBasicRobotPeer per)
+ {
+ peer = per;
+ }
+
+ ///
+ /// Throws a RobotException.
+ /// This method should be called when the robot's peer is uninitialized.
+ ///
+ internal static void UninitializedException()
+ {
+ throw new RobotException(
+ "You cannot call the methods before your Run() method is called, or you are using a Robot object that the game doesn't know about.");
+ }
+
+ ///
+ IRunnable IBasicRobot.GetRobotRunnable()
+ {
+ return this;
+ }
+
+ ///
+ IBasicEvents IBasicRobot.GetBasicEventListener()
+ {
+ return this;
+ }
+
+ ///
+ IInteractiveEvents IInteractiveRobot.GetInteractiveEventListener()
+ {
+ return this;
+ }
+
+ ///
+ IPaintEvents IPaintRobot.GetPaintEventListener()
+ {
+ return this;
+ }
+
+ ///
+ /// Immediately moves your robot ahead (forward) by distance measured in
+ /// pixels.
+ ///
+ /// This call executes immediately, and does not return until it is complete,
+ /// i.e. when the remaining distance to move is 0.
+ ///
+ /// If the robot collides with a wall, the move is complete, meaning that the
+ /// robot will not move any further. If the robot collides with another
+ /// robot, the move is complete if you are heading toward the other robot.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot is set to move backward
+ /// instead of forward.
+ ///
+ ///
+ ///
+ /// // Move the robot 100 pixels forward
+ /// Ahead(100);
+ ///
+ /// // Afterwards, move the robot 50 pixels backward
+ /// Ahead(-50);
+ ///
+ ///
+ ///
+ ///
+ /// The distance to move ahead measured in pixels.
+ /// If this value is negative, the robot will move back instead of ahead.
+ ///
+ ///
+ ///
+ ///
+ public void Ahead(double distance)
+ {
+ if (peer != null)
+ {
+ peer.Move(distance);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Immediately moves your robot backward by distance measured in pixels.
+ ///
+ /// This call executes immediately, and does not return until it is complete,
+ /// i.e. when the remaining distance to move is 0.
+ ///
+ /// If the robot collides with a wall, the move is complete, meaning that the
+ /// robot will not move any further. If the robot collides with another
+ /// robot, the move is complete if you are heading toward the other robot.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot is set to move forward instead
+ /// of backward.
+ ///
+ ///
+ ///
+ /// // Move the robot 100 pixels backward
+ /// Back(100);
+ ///
+ /// // Afterwards, move the robot 50 pixels forward
+ /// Back(-50);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The distance to move back measured in pixels.
+ /// If this value is negative, the robot will move ahead instead of back.
+ ///
+ public void Back(double distance)
+ {
+ if (peer != null)
+ {
+ peer.Move(-distance);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Returns the width of the current battlefield measured in pixels.
+ ///
+ public double BattleFieldWidth
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetBattleFieldWidth();
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Returns the height of the current battlefield measured in pixels.
+ ///
+ public double BattleFieldHeight
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetBattleFieldHeight();
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Returns the direction that the robot's body is facing, in degrees.
+ /// The value returned will be between 0 and 360 (is excluded).
+ ///
+ /// Note that the heading in Robocode is like a compass, where 0 means North,
+ /// 90 means East, 180 means South, and 270 means West.
+ ///
+ ///
+ ///
+ public double Heading
+ {
+ get
+ {
+ if (peer != null)
+ {
+ double rv = 180.0*peer.GetBodyHeading()/Math.PI;
+
+ while (rv < 0)
+ {
+ rv += 360;
+ }
+ while (rv >= 360)
+ {
+ rv -= 360;
+ }
+ return rv;
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Returns the height of the robot measured in pixels.
+ ///
+ ///
+ public double Height
+ {
+ get
+ {
+ if (peer == null)
+ {
+ UninitializedException();
+ }
+ return HEIGHT;
+ }
+ }
+
+ ///
+ /// Returns the width of the robot measured in pixels.
+ ///
+ ///
+ public double Width
+ {
+ get
+ {
+ if (peer == null)
+ {
+ UninitializedException();
+ }
+ return WIDTH;
+ }
+ }
+
+ ///
+ /// Returns the robot's name.
+ ///
+ public string Name
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetName();
+ }
+ UninitializedException();
+ return null; // never called
+ }
+ }
+
+ ///
+ /// Returns the X position of the robot. (0,0) is at the bottom left of the battlefield.
+ ///
+ ///
+ public double X
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetX();
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Returns the Y position of the robot. (0,0) is at the bottom left of the battlefield.
+ ///
+ ///
+ public double Y
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetY();
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// The main method in every robot. You must override this to set up your
+ /// robot's basic behavior.
+ ///
+ ///
+ ///
+ /// // A basic robot that moves around in a square
+ /// public void Run()
+ /// {
+ /// while (true)
+ /// {
+ /// Ahead(100);
+ /// TurnRight(90);
+ /// }
+ /// }
+ ///
+ ///
+ ///
+ public virtual void Run()
+ {
+ }
+
+ ///
+ /// Immediately turns the robot's body to the left by degrees.
+ ///
+ /// This call executes immediately, and does not return until it is complete,
+ /// i.e. when the angle remaining in the robot's turn is 0.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's body is set to turn right
+ /// instead of left.
+ ///
+ ///
+ ///
+ /// // Turn the robot 180 degrees to the left
+ /// TurnLeft(180);
+ ///
+ /// // Afterwards, turn the robot 90 degrees to the right
+ /// TurnLeft(-90);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of degrees to turn the robot's body to the left.
+ /// If degrees > 0 the robot will turn left.
+ /// If degrees < 0 the robot will turn right.
+ /// If degrees = 0 the robot will not turn, but execute.
+ ///
+ public void TurnLeft(double degrees)
+ {
+ if (peer != null)
+ {
+ peer.TurnBody(-Utils.ToRadians(degrees));
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ ///
+ /// Immediately turns the robot's body to the right by degrees.
+ /// This call executes immediately, and does not return until it is complete,
+ /// i.e. when the angle remaining in the robot's turn is 0.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's body is set to turn left
+ /// instead of right.
+ ///
+ ///
+ ///
+ /// // Turn the robot 180 degrees to the right
+ /// TurnRight(180);
+ ///
+ /// // Afterwards, turn the robot 90 degrees to the left
+ /// TurnRight(-90);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of degrees to turn the robot's body to the right.
+ /// If degrees > 0 the robot will turn right.
+ /// If degrees < 0 the robot will turn left.
+ /// If degrees = 0 the robot will not turn, but execute.
+ ///
+ public void TurnRight(double degrees)
+ {
+ if (peer != null)
+ {
+ peer.TurnBody(Utils.ToRadians(degrees));
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Do nothing this turn, meaning that the robot will skip it's turn.
+ ///
+ /// This call executes immediately, and does not return until the turn is over.
+ ///
+ public void DoNothing()
+ {
+ if (peer != null)
+ {
+ peer.Execute();
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Immediately fires a bullet. The bullet will travel in the direction the
+ /// gun is pointing.
+ ///
+ /// The specified bullet power is an amount of energy that will be taken from
+ /// the robot's energy. Hence, the more power you want to spend on the
+ /// bullet, the more energy is taken from your robot.
+ ///
+ /// The bullet will do (4 * power) damage if it hits another robot. If power
+ /// is greater than 1, it will do an additional 2 * (power - 1) damage.
+ /// You will get (3 * power) back if you hit the other robot. You can call
+ ///
+ /// for getting the damage that a
+ /// bullet with a specific bullet power will do.
+ ///
+ /// The specified bullet power should be between
+ /// and .
+ ///
+ /// Note that the gun cannot Fire if the gun is overheated, meaning that
+ ///
+ /// returns a value > 0.
+ ///
+ /// A event is generated when the bullet hits a robot (),
+ /// wall (), or another bullet
+ /// ().
+ ///
+ ///
+ ///
+ /// // Fire a bullet with maximum power if the gun is ready
+ /// if (GetGunHeat() == 0)
+ /// {
+ /// Fire(Rules.MAX_BULLET_POWER);
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of energy given to the bullet, and subtracted from the robot's energy.
+ ///
+ public void Fire(double power)
+ {
+ if (peer != null)
+ {
+ peer.SetFire(power);
+ peer.Execute();
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ ///
+ /// Immediately fires a bullet. The bullet will travel in the direction the
+ /// gun is pointing.
+ ///
+ /// The specified bullet power is an amount of energy that will be taken from
+ /// the robot's energy. Hence, the more power you want to spend on the
+ /// bullet, the more energy is taken from your robot.
+ ///
+ /// The bullet will do (4 * power) damage if it hits another robot. If power
+ /// is greater than 1, it will do an additional 2 * (power - 1) damage.
+ /// You will get (3 * power) back if you hit the other robot. You can call
+ ///
+ /// for getting the damage that a
+ /// bullet with a specific bullet power will do.
+ ///
+ /// The specified bullet power should be between
+ /// and .
+ ///
+ /// Note that the gun cannot Fire if the gun is overheated, meaning that
+ /// returns a value > 0.
+ ///
+ /// A event is generated when the bullet hits a robot (),
+ /// wall (), or another bullet
+ /// ().
+ ///
+ ///
+ ///
+ /// // Fire a bullet with maximum power if the gun is ready
+ /// if (GetGunHeat() == 0)
+ /// {
+ /// Bullet bullet = FireBullet(Rules.MAX_BULLET_POWER);
+ ///
+ /// // Get the velocity of the bullet
+ /// if (bullet != null)
+ /// {
+ /// double bulletVelocity = bullet.Velocity;
+ /// }
+ /// }
+ ///
+ ///
+ /// Returns a
+ ///
+ /// That contains information about the bullet if it was actually fired,
+ /// which can be used for tracking the bullet after it has been fired.
+ /// If the bullet was not fired, null is returned.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// power the amount of energy given to the bullet, and subtracted from the robot's energy.
+ ///
+ public Bullet FireBullet(double power)
+ {
+ if (peer != null)
+ {
+ return peer.Fire(power);
+ }
+ UninitializedException();
+ return null;
+ }
+
+ ///
+ /// Returns the rate at which the gun will cool down, i.e. the amount of heat
+ /// the gun heat will drop per turn.
+ ///
+ /// The gun cooling rate is default 0.1 / turn, but can be changed by the
+ /// battle setup. So don't count on the cooling rate being 0.1!
+ ///
+ ///
+ ///
+ ///
+ public double GunCoolingRate
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetGunCoolingRate();
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Returns the direction that the robot's gun is facing, in degrees.
+ /// The value returned will be between 0 and 360 (is excluded).
+ ///
+ /// Note that the heading in Robocode is like a compass, where 0 means North,
+ /// 90 means East, 180 means South, and 270 means West.
+ ///
+ ///
+ ///
+ public double GunHeading
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetGunHeading()*180.0/Math.PI;
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Returns the current heat of the gun. The gun cannot Fire unless this is
+ /// 0. (Calls to Fire will succeed, but will not actually Fire unless
+ /// GetGunHeat() == 0).
+ ///
+ /// The amount of gun heat generated when the gun is fired is 1 + (firePower / 5).
+ /// Each turn the gun heat drops by the amount returned by ,
+ /// which is a battle setup.
+ ///
+ /// Note that all guns are "hot" at the start of each round, where the gun heat is 3.
+ ///
+ ///
+ ///
+ ///
+ public double GunHeat
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetGunHeat();
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Returns the number of rounds in the current battle.
+ ///
+ ///
+ public int NumRounds
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetNumRounds();
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Returns the sentry border size for a BorderSentry that defines the how
+ /// far a BorderSentry is allowed to move from the border edges measured in units.
+ /// Hence, the sentry border size defines the width/range of the border area surrounding the battlefield that
+ /// BorderSentrys cannot leave (sentry robots robots must stay in the border area), but it also define the
+ /// distance from the border edges where BorderSentrys are allowed/able to make damage to robots entering this
+ /// border area.
+ ///
+ public int SentryBorderSize
+ {
+ get {
+ if (peer != null)
+ {
+ return peer.GetSentryBorderSize();
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Returns how many opponents that are left in the current round.
+ ///
+ public int Others
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetOthers();
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Returns how many sentry robots that are left in the current round.
+ ///
+ public int NumSentries
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetNumSentries();
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Returns the direction that the robot's radar is facing, in degrees.
+ /// The value returned will be between 0 and 360 (is excluded).
+ ///
+ /// Note that the heading in Robocode is like a compass, where 0 means North,
+ /// 90 means East, 180 means South, and 270 means West.
+ ///
+ ///
+ ///
+ public double RadarHeading
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetRadarHeading()*180.0/Math.PI;
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Returns the current round number (0 to - 1) of the battle.
+ ///
+ ///
+ public int RoundNum
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetRoundNum();
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Returns the game time of the current round, where the time is equal to
+ /// the current turn in the round.
+ ///
+ /// A battle consists of multiple rounds.
+ ///
+ /// Time is reset to 0 at the beginning of every round.
+ ///
+ public long Time
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetTime();
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Returns the velocity of the robot measured in pixels/turn.
+ ///
+ /// The maximum velocity of a robot is defined by
+ /// (8 pixels / turn).
+ ///
+ ///
+ public double Velocity
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetVelocity();
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ public virtual void OnBulletHit(BulletHitEvent evnt)
+ {
+ }
+
+ ///
+ public virtual void OnBulletHitBullet(BulletHitBulletEvent evnt)
+ {
+ }
+
+ ///
+ public virtual void OnBulletMissed(BulletMissedEvent evnt)
+ {
+ }
+
+ ///
+ public virtual void OnDeath(DeathEvent evnt)
+ {
+ }
+
+ ///
+ public virtual void OnHitByBullet(HitByBulletEvent evnt)
+ {
+ }
+
+ ///
+ public virtual void OnHitRobot(HitRobotEvent evnt)
+ {
+ }
+
+ ///
+ public virtual void OnHitWall(HitWallEvent evnt)
+ {
+ }
+
+ ///
+ public virtual void OnRobotDeath(RobotDeathEvent evnt)
+ {
+ }
+
+ ///
+ public virtual void OnScannedRobot(ScannedRobotEvent evnt)
+ {
+ }
+
+ ///
+ public virtual void OnWin(WinEvent evnt)
+ {
+ }
+
+ ///
+ public virtual void OnRoundEnded(RoundEndedEvent evnt)
+ {
+ }
+
+ ///
+ public virtual void OnBattleEnded(BattleEndedEvent evnt)
+ {
+ }
+
+ ///
+ ///
+ /// Scans for other robots. This method is called automatically by the game,
+ /// as long as the robot is moving, turning its body, turning its gun, or
+ /// turning its radar.
+ ///
+ /// Scan will cause
+ /// to be called if you see a robot.
+ ///
+ /// There are 2 reasons to call manually:
+ ///
+ ///
+ /// You want to scan after you stop moving.
+ ///
+ ///
+ /// You want to interrupt the
+ /// event. This is more likely. If you are in
+ /// and call
+ /// , and you still see a robot, then the system will interrupt your
+ /// event immediately and start it
+ /// from the top.
+ ///
+ ///
+ ///
+ /// This call executes immediately.
+ ///
+ ///
+ ///
+ public void Scan()
+ {
+ if (peer != null)
+ {
+ peer.Rescan();
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Sets the gun to turn independent from the robot's turn.
+ ///
+ /// Ok, so this needs some explanation: The gun is mounted on the robot's
+ /// body. So, normally, if the robot turns 90 degrees to the right, then the
+ /// gun will turn with it as it is mounted on top of the robot's body. To
+ /// compensate for this, you can call
+ /// .
+ /// When this is set, the gun will turn independent from the robot's turn,
+ /// i.e. the gun will compensate for the robot's body turn.
+ ///
+ /// Note: This method is additive until you reach the maximum the gun can
+ /// turn. The "adjust" is added to the amount you set for turning the robot,
+ /// then capped by the physics of the game. If you turn infinite, then the
+ /// adjust is ignored (and hence overridden).
+ ///
+ ///
+ /// Assuming both the robot and gun start Out facing up (0 degrees):
+ ///
+ /// // Set gun to turn with the robot's turn
+ /// SetAdjustGunForRobotTurn(false); // This is the default
+ /// TurnRight(90);
+ /// // At this point, both the robot and gun are facing right (90 degrees)
+ /// TurnLeft(90);
+ /// // Both are back to 0 degrees
+ ///
+ /// -- or --
+ ///
+ /// // Set gun to turn independent from the robot's turn
+ /// SetAdjustGunForRobotTurn(true);
+ /// TurnRight(90);
+ /// // At this point, the robot is facing right (90 degrees), but the gun is still facing up.
+ /// TurnLeft(90);
+ /// // Both are back to 0 degrees.
+ ///
+ ///
+ ///
+ /// Note: The gun compensating this way does count as "turning the gun".
+ ///
+ ///
+ public virtual bool IsAdjustGunForRobotTurn
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return ((IStandardRobotPeer) peer).IsAdjustGunForBodyTurn();
+ }
+ UninitializedException();
+ return false;
+ }
+ set
+ {
+ if (peer != null)
+ {
+ ((IStandardRobotPeer) peer).SetAdjustGunForBodyTurn(value);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+ }
+
+ ///
+ /// Sets the radar to turn independent from the robot's turn.
+ ///
+ /// Ok, so this needs some explanation: The radar is mounted on the gun, and
+ /// the gun is mounted on the robot's body. So, normally, if the robot turns
+ /// 90 degrees to the right, the gun turns, as does the radar. Hence, if the
+ /// robot turns 90 degrees to the right, then the gun and radar will turn
+ /// with it as the radar is mounted on top of the gun. To compensate for
+ /// this, you can call = true.
+ /// When this is set, the radar will turn independent from the robot's turn,
+ /// i.e. the radar will compensate for the robot's turn.
+ ///
+ /// Note: This method is additive until you reach the maximum the radar can
+ /// turn. The "adjust" is added to the amount you set for turning the robot,
+ /// then capped by the physics of the game. If you turn infinite, then the
+ /// adjust is ignored (and hence overridden).
+ ///
+ ///
+ /// Assuming the robot, gun, and radar all start Out facing up (0
+ /// degrees):
+ ///
+ /// // Set radar to turn with the robots's turn
+ /// SetAdjustRadarForRobotTurn(false); // This is the default
+ /// TurnRight(90);
+ /// // At this point, the body, gun, and radar are all facing right (90 degrees);
+ ///
+ /// -- or --
+ ///
+ /// // Set radar to turn independent from the robot's turn
+ /// SetAdjustRadarForRobotTurn(true);
+ /// TurnRight(90);
+ /// // At this point, the robot and gun are facing right (90 degrees), but the radar is still facing up.
+ ///
+ ///
+ ///
+ ///
+ ///
+ public bool IsAdjustRadarForRobotTurn
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return ((IStandardRobotPeer) peer).IsAdjustRadarForBodyTurn();
+ }
+ UninitializedException();
+ return false;
+ }
+ set
+ {
+ if (peer != null)
+ {
+ ((IStandardRobotPeer) peer).SetAdjustRadarForBodyTurn(value);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+ }
+
+ ///
+ /// Sets the radar to turn independent from the gun's turn.
+ ///
+ /// Ok, so this needs some explanation: The radar is mounted on the robot's
+ /// gun. So, normally, if the gun turns 90 degrees to the right, then the
+ /// radar will turn with it as it is mounted on top of the gun. To compensate
+ /// for this, you can call = (true).
+ /// When this is set, the radar will turn independent from the robot's turn,
+ /// i.e. the radar will compensate for the gun's turn.
+ ///
+ /// Note: This method is additive until you reach the maximum the radar can
+ /// turn. The "adjust" is added to the amount you set for turning the gun,
+ /// then capped by the physics of the game. If you turn infinite, then the
+ /// adjust is ignored (and hence overridden).
+ ///
+ ///
+ /// Assuming both the gun and radar start Out facing up (0 degrees):
+ ///
+ /// // Set radar to turn with the gun's turn
+ /// SetAdjustRadarForGunTurn(false); // This is the default
+ /// TurnGunRight(90);
+ /// // At this point, both the radar and gun are facing right (90 degrees);
+ ///
+ /// -- or --
+ ///
+ /// // Set radar to turn independent from the gun's turn
+ /// SetAdjustRadarForGunTurn(true);
+ /// TurnGunRight(90);
+ /// // At this point, the gun is facing right (90 degrees), but the radar is still facing up.
+ ///
+ ///
+ /// Note: Calling will automatically call
+ /// with the same value, unless you have
+ /// already called it earlier. This behavior is primarily for backward compatibility
+ /// with older Robocode robots.
+ ///
+ ///
+ ///
+ public bool IsAdjustRadarForGunTurn
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return ((IStandardRobotPeer) peer).IsAdjustRadarForGunTurn();
+ }
+ UninitializedException();
+ return false;
+ }
+ set
+ {
+ if (peer != null)
+ {
+ ((IStandardRobotPeer) peer).SetAdjustRadarForGunTurn(value);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+ }
+
+ ///
+ /// Sets the color of the robot's body, gun, and radar in the same time.
+ ///
+ /// You may only call this method one time per battle. A null
+ /// indicates the default (blue) color.
+ ///
+ ///
+ ///
+ /// // Don't forget to using System.Drawing at the top...
+ /// using System.Drawing;
+ /// ...
+ ///
+ /// public void Run()
+ /// {
+ /// SetColors(null, Color.Red, Color.fromArgb(150, 0, 150));
+ /// ...
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The new body color
+ /// The new gun color
+ /// The new radar color
+ public void SetColors(Color bodyColor, Color gunColor, Color radarColor)
+ {
+ if (peer != null)
+ {
+ peer.SetBodyColor(bodyColor);
+ peer.SetGunColor(gunColor);
+ peer.SetRadarColor(radarColor);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Sets the color of the robot's body, gun, radar, bullet, and scan arc in
+ /// the same time.
+ ///
+ /// You may only call this method one time per battle. A null
+ /// indicates the default (blue) color for the body, gun, radar, and scan
+ /// arc, but white for the bullet color.
+ ///
+ ///
+ ///
+ /// // Don't forget to using System.Drawing at the top...
+ /// using System.Drawing;
+ /// ...
+ ///
+ /// public void Run()
+ /// {
+ /// SetColors(null, Color.Red, Color.Greeen, null, Color.fromArgb(150, 0, 150));
+ /// ...
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The new body color
+ /// The new gun color
+ /// The new radar color
+ /// The new bullet color
+ /// The new scan arc color
+ public void SetColors(Color bodyColor, Color gunColor, Color radarColor, Color bulletColor, Color scanArcColor)
+ {
+ if (peer != null)
+ {
+ peer.SetBodyColor(bodyColor);
+ peer.SetGunColor(gunColor);
+ peer.SetRadarColor(radarColor);
+ peer.SetBulletColor(bulletColor);
+ peer.SetScanColor(scanArcColor);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Sets all the robot's color to the same color in the same time, i.e. the
+ /// color of the body, gun, radar, bullet, and scan arc.
+ ///
+ /// You may only call this method one time per battle. A null
+ /// indicates the default (blue) color for the body, gun, radar, and scan
+ /// arc, but white for the bullet color.
+ ///
+ ///
+ ///
+ /// // Don't forget to using System.Drawing at the top...
+ /// using System.Drawing;
+ /// ...
+ ///
+ /// public void Run()
+ /// {
+ /// SetAllColors(Color.Red);
+ /// ...
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The new color for all the colors of the robot
+ public void SetAllColors(Color color)
+ {
+ if (peer != null)
+ {
+ peer.SetBodyColor(color);
+ peer.SetGunColor(color);
+ peer.SetRadarColor(color);
+ peer.SetBulletColor(color);
+ peer.SetScanColor(color);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Sets the color of the robot's body.
+ ///
+ /// A null indicates the default (blue) color.
+ ///
+ ///
+ ///
+ /// // Don't forget to using System.Drawing at the top...
+ /// using System.Drawing;
+ /// ...
+ ///
+ /// public void Run()
+ /// {
+ /// SetBodyColor(Color.Black);
+ /// ...
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Color BodyColor
+ {
+ set
+ {
+ if (peer != null)
+ {
+ peer.SetBodyColor(value);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetBodyColor();
+ }
+ UninitializedException();
+ return default(Color);
+ }
+ }
+
+ ///
+ ///
+ /// Sets the color of the robot's gun.
+ ///
+ /// A null indicates the default (blue) color.
+ ///
+ ///
+ ///
+ /// // Don't forget to using System.Drawing at the top...
+ /// using System.Drawing;
+ /// ...
+ ///
+ /// public void Run()
+ /// {
+ /// SetGunColor(Color.Red);
+ /// ...
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Color GunColor
+ {
+ set
+ {
+ if (peer != null)
+ {
+ peer.SetGunColor(value);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetGunColor();
+ }
+ UninitializedException();
+ return default(Color);
+ }
+ }
+
+ ///
+ ///
+ /// Sets the color of the robot's radar.
+ ///
+ /// A null indicates the default (blue) color.
+ ///
+ ///
+ ///
+ /// // Don't forget to using System.Drawing at the top...
+ /// using System.Drawing;
+ /// ...
+ ///
+ /// public void Run()
+ /// {
+ /// SetRadarColor(Color.Yellow);
+ /// ...
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Color RadarColor
+ {
+ set
+ {
+ if (peer != null)
+ {
+ peer.SetRadarColor(value);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetRadarColor();
+ }
+ UninitializedException();
+ return default(Color);
+ }
+ }
+
+ ///
+ ///
+ /// Sets the color of the robot's bullets.
+ ///
+ /// A null indicates the default white color.
+ ///
+ ///
+ ///
+ /// // Don't forget to using System.Drawing at the top...
+ /// using System.Drawing;
+ /// ...
+ ///
+ /// public void Run()
+ /// {
+ /// SetBulletColor(Color.Green);
+ /// ...
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Color BulletColor
+ {
+ set
+ {
+ if (peer != null)
+ {
+ peer.SetBulletColor(value);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetBulletColor();
+ }
+ UninitializedException();
+ return default(Color);
+ }
+ }
+
+ ///
+ ///
+ /// Sets the color of the robot's scan arc.
+ ///
+ /// A null indicates the default (blue) color.
+ ///
+ ///
+ ///
+ /// // Don't forget to using System.Drawing at the top...
+ /// using System.Drawing;
+ /// ...
+ ///
+ /// public void Run()
+ /// {
+ /// SetScanColor(Color.White);
+ /// ...
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Color ScanColor
+ {
+ set
+ {
+ if (peer != null)
+ {
+ peer.SetScanColor(value);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetScanColor();
+ }
+ UninitializedException();
+ return default(Color);
+ }
+ }
+
+ ///
+ ///
+ /// Immediately stops all movement, and saves it for a call to .
+ /// If there is already movement saved from a previous stop, this will have no effect.
+ ///
+ /// This method is equivalent to Stop(false).
+ ///
+ ///
+ ///
+ public void Stop()
+ {
+ Stop(false);
+ }
+
+ ///
+ /// Immediately stops all movement, and saves it for a call to .
+ /// If there is already movement saved from a previous stop, you can overwrite it by
+ /// calling Stop(true).
+ ///
+ ///
+ ///
+ ///
+ /// If there is already movement saved from a previous stop, you can overwrite it by
+ /// calling Stop(true).
+ ///
+ public void Stop(bool overwrite)
+ {
+ if (peer != null)
+ {
+ ((IStandardRobotPeer) peer).Stop(overwrite);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Immediately resumes the movement you stopped by , if any.
+ ///
+ /// This call executes immediately, and does not return until it is complete.
+ ///
+ ///
+ ///
+ public void Resume()
+ {
+ if (peer != null)
+ {
+ ((IStandardRobotPeer) peer).Resume();
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ ///
+ /// Immediately turns the robot's gun to the left by degrees.
+ ///
+ /// This call executes immediately, and does not return until it is complete,
+ /// i.e. when the angle remaining in the gun's turn is 0.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's gun is set to turn right
+ /// instead of left.
+ ///
+ ///
+ ///
+ /// // Turn the robot's gun 180 degrees to the left
+ /// TurnGunLeft(180);
+ ///
+ /// // Afterwards, turn the robot's gun 90 degrees to the right
+ /// TurnGunLeft(-90);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of degrees to turn the robot's gun to the left.
+ /// If degrees > 0 the robot's gun will turn left.
+ /// If degrees < 0 the robot's gun will turn right.
+ /// If degrees = 0 the robot's gun will not turn, but execute.
+ ///
+ public void TurnGunLeft(double degrees)
+ {
+ if (peer != null)
+ {
+ peer.TurnGun(-Utils.ToRadians(degrees));
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ ///
+ /// Immediately turns the robot's gun to the right by degrees.
+ /// This call executes immediately, and does not return until it is complete,
+ /// i.e. when the angle remaining in the gun's turn is 0.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's gun is set to turn left
+ /// instead of right.
+ ///
+ ///
+ ///
+ /// // Turn the robot's gun 180 degrees to the right
+ /// TurnGunRight(180);
+ ///
+ /// // Afterwards, turn the robot's gun 90 degrees to the left
+ /// TurnGunRight(-90);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of degrees to turn the robot's gun to the right.
+ /// If degrees > 0 the robot's gun will turn right.
+ /// If degrees < 0 the robot's gun will turn left.
+ /// If degrees = 0 the robot's gun will not turn, but execute.
+ ///
+ public void TurnGunRight(double degrees)
+ {
+ if (peer != null)
+ {
+ peer.TurnGun(Utils.ToRadians(degrees));
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Immediately turns the robot's radar to the left by degrees.
+ ///
+ /// This call executes immediately, and does not return until it is complete,
+ /// i.e. when the angle remaining in the radar's turn is 0.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's radar is set to turn right
+ /// instead of left.
+ ///
+ ///
+ ///
+ /// // Turn the robot's radar 180 degrees to the left
+ /// TurnRadarLeft(180);
+ ///
+ /// // Afterwards, turn the robot's radar 90 degrees to the right
+ /// TurnRadarLeft(-90);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of degrees to turn the robot's radar to the left.
+ /// If degrees > 0 the robot's radar will turn left.
+ /// If degrees < 0 the robot's radar will turn right.
+ /// If degrees = 0 the robot's radar will not turn, but execute.
+ ///
+ public void TurnRadarLeft(double degrees)
+ {
+ if (peer != null)
+ {
+ ((IStandardRobotPeer) peer).TurnRadar(-Utils.ToRadians(degrees));
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ ///
+ /// Immediately turns the robot's radar to the right by degrees.
+ /// This call executes immediately, and does not return until it is complete,
+ /// i.e. when the angle remaining in the radar's turn is 0.
+ ///
+ /// Note that both positive and negative values can be given as input,
+ /// where negative values means that the robot's radar is set to turn left
+ /// instead of right.
+ ///
+ ///
+ ///
+ /// // Turn the robot's radar 180 degrees to the right
+ /// TurnRadarRight(180);
+ ///
+ /// // Afterwards, turn the robot's radar 90 degrees to the left
+ /// TurnRadarRight(-90);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of degrees to turn the robot's radar to the right.
+ /// If degrees > 0 the robot's radar will turn right.
+ /// If degrees < 0 the robot's radar will turn left.
+ /// If degrees = 0 the robot's radar will not turn, but execute.
+ ///
+ public void TurnRadarRight(double degrees)
+ {
+ if (peer != null)
+ {
+ ((IStandardRobotPeer) peer).TurnRadar(Utils.ToRadians(degrees));
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Returns the robot's current energy.
+ ///
+ public double Energy
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetEnergy();
+ }
+ UninitializedException();
+ return 0; // never called
+ }
+ }
+
+ ///
+ /// Returns a graphics context used for painting graphical items for the robot.
+ ///
+ /// This method is very useful for debugging your robot.
+ ///
+ /// Note that the robot will only be painted if the "Paint" is enabled on the
+ /// robot's console window; otherwise the robot will never get painted (the
+ /// reason being that all robots might have graphical items that must be
+ /// painted, and then you might not be able to tell what graphical items that
+ /// have been painted for your robot).
+ ///
+ /// Also note that the coordinate system for the graphical context where you
+ /// paint items fits for the Robocode coordinate system where (0, 0) is at
+ /// the bottom left corner of the battlefield, where X is towards right and Y
+ /// is upwards.
+ ///
+ ///
+ public IGraphics Graphics
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return peer.GetGraphics();
+ }
+ UninitializedException();
+ return null; // never called
+ }
+ }
+
+ ///
+ /// Sets the debug property with the specified key to the specified value.
+ ///
+ /// This method is very useful when debugging or reviewing your robot as you
+ /// will be able to see this property displayed in the robot console for your
+ /// robots under the Debug Properties tab page.
+ ///
+ public DebugPropertyH DebugProperty
+ {
+ get
+ {
+ if (peer != null)
+ {
+ if (debugProperty == null)
+ {
+ debugProperty = new DebugPropertyH(peer);
+ }
+ return debugProperty;
+ }
+ UninitializedException();
+ return null;
+ }
+ }
+
+ private DebugPropertyH debugProperty;
+
+ ///
+ /// Container class for debug properties
+ ///
+ public class DebugPropertyH
+ {
+ private readonly IBasicRobotPeer peer;
+
+ internal DebugPropertyH(IBasicRobotPeer peer)
+ {
+ this.peer = peer;
+ }
+
+ ///
+ /// Set the new value of the debug property, where null or
+ /// the empty string is used for removing this debug property.
+ ///
+ ///
+ /// The name/key of the debug property
+ ///
+ ///
+ public string this[string key]
+ {
+ set { peer.SetDebugProperty(key, value); }
+ }
+ }
+
+
+ ///
+ public virtual void OnPaint(IGraphics graphics)
+ {
+ }
+
+ ///
+ public virtual void OnKeyPressed(KeyEvent e)
+ {
+ }
+
+ ///
+ public virtual void OnKeyReleased(KeyEvent e)
+ {
+ }
+
+ ///
+ public virtual void OnKeyTyped(KeyEvent e)
+ {
+ }
+
+ ///
+ public virtual void OnMouseClicked(MouseEvent e)
+ {
+ }
+
+ ///
+ public virtual void OnMouseEntered(MouseEvent e)
+ {
+ }
+
+ ///
+ public virtual void OnMouseExited(MouseEvent e)
+ {
+ }
+
+ ///
+ public virtual void OnMousePressed(MouseEvent e)
+ {
+ }
+
+ ///
+ public virtual void OnMouseReleased(MouseEvent e)
+ {
+ }
+
+ ///
+ public virtual void OnMouseMoved(MouseEvent e)
+ {
+ }
+
+ ///
+ public virtual void OnMouseDragged(MouseEvent e)
+ {
+ }
+
+ ///
+ public virtual void OnMouseWheelMoved(MouseWheelMovedEvent e)
+ {
+ }
+
+ ///
+ public virtual void OnStatus(StatusEvent e)
+ {
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/RobotDeathEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/RobotDeathEvent.cs
new file mode 100644
index 0000000..e93c3cf
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/RobotDeathEvent.cs
@@ -0,0 +1,95 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using System.Drawing;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// This event is sent to
+ /// when another robot (not your robot) dies.
+ ///
+ [Serializable]
+ public sealed class RobotDeathEvent : Event
+ {
+ private const int DEFAULT_PRIORITY = 70;
+
+ private readonly string robotName;
+
+ ///
+ /// Called by the game to create a new RobotDeathEvent.
+ ///
+ /// the name of the robot that died
+ public RobotDeathEvent(string robotName)
+ {
+ this.robotName = robotName;
+ }
+
+ ///
+ /// Returns the name of the robot that died.
+ ///
+ public string Name
+ {
+ get { return robotName; }
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ IBasicEvents listener = robot.GetBasicEventListener();
+
+ if (listener != null)
+ {
+ listener.OnRobotDeath(this);
+ }
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.RobotDeathEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ var obj = (RobotDeathEvent) objec;
+
+ return RbSerializerN.SIZEOF_TYPEINFO + serializer.sizeOf(obj.robotName);
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (RobotDeathEvent) objec;
+
+ serializer.serialize(buffer, obj.robotName);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ string name = serializer.deserializeString(buffer);
+
+ return new RobotDeathEvent(name);
+ }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/RobotStatus.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/RobotStatus.cs
new file mode 100644
index 0000000..0d6be6e
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/RobotStatus.cs
@@ -0,0 +1,401 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.nio;
+using net.sf.robocode.security;
+using net.sf.robocode.serialization;
+using Robocode.Util;
+
+namespace Robocode
+{
+ ///
+ /// Contains the status of a robot for a specific time/turn returned by
+ /// .
+ ///
+ [Serializable]
+ public sealed class RobotStatus
+ {
+ private readonly double energy;
+ private readonly double x;
+ private readonly double y;
+ private readonly double bodyHeading;
+ private readonly double gunHeading;
+ private readonly double radarHeading;
+ private readonly double velocity;
+ private readonly double bodyTurnRemaining;
+ private readonly double radarTurnRemaining;
+ private readonly double gunTurnRemaining;
+ private readonly double distanceRemaining;
+ private readonly double gunHeat;
+ private readonly int others;
+ private readonly int numSentries;
+ private readonly int roundNum;
+ private readonly int numRounds;
+ private readonly long time;
+
+ ///
+ /// Returns the robot's current energy.
+ ///
+ public double Energy
+ {
+ get { return energy; }
+ }
+
+ ///
+ /// Returns the X position of the robot. (0,0) is at the bottom left of the
+ /// battlefield.
+ ///
+ ///
+ public double X
+ {
+ get { return x; }
+ }
+
+ ///
+ /// Returns the Y position of the robot. (0,0) is at the bottom left of the
+ /// battlefield.
+ ///
+ ///
+ public double Y
+ {
+ get { return y; }
+ }
+
+ ///
+ /// Returns the direction that the robot's body is facing, in radians.
+ /// The value returned will be between 0 and 2 * PI (is excluded).
+ ///
+ /// Note that the heading in Robocode is like a compass, where 0 means North,
+ /// PI / 2 means East, PI means South, and 3 * PI / 2 means West.
+ ///
+ public double HeadingRadians
+ {
+ get { return bodyHeading; }
+ }
+
+ ///
+ /// Returns the direction that the robot's body is facing, in degrees.
+ /// The value returned will be between 0 and 360 (is excluded).
+ ///
+ /// Note that the heading in Robocode is like a compass, where 0 means North,
+ /// 90 means East, 180 means South, and 270 means West.
+ ///
+ public double Heading
+ {
+ get { return Utils.ToDegrees(bodyHeading); }
+ }
+
+ ///
+ /// Returns the direction that the robot's gun is facing, in radians.
+ /// The value returned will be between 0 and 2 * PI (is excluded).
+ ///
+ /// Note that the heading in Robocode is like a compass, where 0 means North,
+ /// PI / 2 means East, PI means South, and 3 * PI / 2 means West.
+ ///
+ public double GunHeadingRadians
+ {
+ get { return gunHeading; }
+ }
+
+ ///
+ /// Returns the direction that the robot's gun is facing, in degrees.
+ /// The value returned will be between 0 and 360 (is excluded).
+ ///
+ /// Note that the heading in Robocode is like a compass, where 0 means North,
+ /// 90 means East, 180 means South, and 270 means West.
+ ///
+ public double GunHeading
+ {
+ get { return Utils.ToDegrees(gunHeading); }
+ }
+
+ ///
+ /// Returns the direction that the robot's radar is facing, in radians.
+ /// The value returned will be between 0 and 2 * PI (is excluded).
+ ///
+ /// Note that the heading in Robocode is like a compass, where 0 means North,
+ /// PI / 2 means East, PI means South, and 3 * PI / 2 means West.
+ ///
+ public double RadarHeadingRadians
+ {
+ get { return radarHeading; }
+ }
+
+ ///
+ /// Returns the direction that the robot's radar is facing, in degrees.
+ /// The value returned will be between 0 and 360 (is excluded).
+ ///
+ /// Note that the heading in Robocode is like a compass, where 0 means North,
+ /// 90 means East, 180 means South, and 270 means West.
+ ///
+ public double RadarHeading
+ {
+ get { return Utils.ToDegrees(radarHeading); }
+ }
+
+ ///
+ /// Returns the velocity of the robot measured in pixels/turn.
+ ///
+ /// The maximum velocity of a robot is defined by
+ /// (8 pixels / turn).
+ ///
+ ///
+ public double Velocity
+ {
+ get { return velocity; }
+ }
+
+ ///
+ /// Returns the angle remaining in the robots's turn, in radians.
+ ///
+ /// This call returns both positive and negative values.
+ /// Positive values means that the robot is currently turning to the right.
+ /// Negative values means that the robot is currently turning to the left.
+ ///
+ public double TurnRemainingRadians
+ {
+ get { return bodyTurnRemaining; }
+ }
+
+ ///
+ /// Returns the angle remaining in the robots's turn, in degrees.
+ ///
+ /// This call returns both positive and negative values.
+ /// Positive values means that the robot is currently turning to the right.
+ /// Negative values means that the robot is currently turning to the left.
+ ///
+ public double TurnRemaining
+ {
+ get { return Utils.ToDegrees(bodyTurnRemaining); }
+ }
+
+ ///
+ /// Returns the angle remaining in the radar's turn, in radians.
+ ///
+ /// This call returns both positive and negative values.
+ /// Positive values means that the radar is currently turning to the right.
+ /// Negative values means that the radar is currently turning to the left.
+ ///
+ public double RadarTurnRemainingRadians
+ {
+ get { return radarTurnRemaining; }
+ }
+
+ ///
+ /// Returns the angle remaining in the radar's turn, in degrees.
+ ///
+ /// This call returns both positive and negative values.
+ /// Positive values means that the radar is currently turning to the right.
+ /// Negative values means that the radar is currently turning to the left.
+ ///
+ public double RadarTurnRemaining
+ {
+ get { return Utils.ToDegrees(radarTurnRemaining); }
+ }
+
+ ///
+ /// Returns the angle remaining in the gun's turn, in radians.
+ ///
+ /// This call returns both positive and negative values.
+ /// Positive values means that the gun is currently turning to the right.
+ /// Negative values means that the gun is currently turning to the left.
+ ///
+ public double GunTurnRemainingRadians
+ {
+ get { return gunTurnRemaining; }
+ }
+
+ ///
+ /// Returns the angle remaining in the gun's turn, in degrees.
+ ///
+ /// This call returns both positive and negative values.
+ /// Positive values means that the gun is currently turning to the right.
+ /// Negative values means that the gun is currently turning to the left.
+ ///
+ public double GunTurnRemaining
+ {
+ get { return Utils.ToDegrees(gunTurnRemaining); }
+ }
+
+ ///
+ /// Returns the distance remaining in the robot's current move measured in
+ /// pixels.
+ ///
+ /// This call returns both positive and negative values.
+ /// Positive values means that the robot is currently moving forwards.
+ /// Negative values means that the robot is currently moving backwards.
+ ///
+ public double DistanceRemaining
+ {
+ get { return distanceRemaining; }
+ }
+
+ ///
+ /// Returns the current heat of the gun. The gun cannot Fire unless this is
+ /// 0. (Calls to Fire will succeed, but will not actually Fire unless
+ /// GetGunHeat() == 0).
+ ///
+ /// The amount of gun heat generated when the gun is fired is
+ /// 1 + (firePower / 5). Each turn the gun heat drops by the amount returned
+ /// by , which is a battle setup.
+ ///
+ /// Note that all guns are "hot" at the start of each round, where the gun
+ /// heat is 3.
+ ///
+ ///
+ ///
+ ///
+ public double GunHeat
+ {
+ get { return gunHeat; }
+ }
+
+ ///
+ /// Returns how many opponents that are left in the current round.
+ ///
+ public int Others
+ {
+ get { return others; }
+ }
+
+ ///
+ /// Returns how many sentry robots that are left in the current round.
+ ///
+ public int NumSentries
+ {
+ get { return numSentries; }
+ }
+
+ ///
+ /// Returns the number of rounds in the current battle.
+ ///
+ ///
+ public int NumRounds
+ {
+ get { return numRounds; }
+ }
+
+ ///
+ /// Returns the current round number (0 to - 1) of
+ /// the battle.
+ ///
+ ///
+ public int RoundNum
+ {
+ get { return roundNum; }
+ }
+
+ ///
+ /// Returns the game time of the round, where the time is equal to the current turn in the round.
+ ///
+ public long Time
+ {
+ get { return time; }
+ }
+
+ private RobotStatus(double energy, double x, double y, double bodyHeading, double gunHeading,
+ double radarHeading,
+ double velocity, double bodyTurnRemaining, double radarTurnRemaining,
+ double gunTurnRemaining,
+ double distanceRemaining, double gunHeat,
+ int others, int numSentries,
+ int roundNum, int numRounds, long time)
+ {
+ this.energy = energy;
+ this.x = x;
+ this.y = y;
+ this.bodyHeading = bodyHeading;
+ this.gunHeading = gunHeading;
+ this.radarHeading = radarHeading;
+ this.bodyTurnRemaining = bodyTurnRemaining;
+ this.velocity = velocity;
+ this.radarTurnRemaining = radarTurnRemaining;
+ this.gunTurnRemaining = gunTurnRemaining;
+ this.distanceRemaining = distanceRemaining;
+ this.gunHeat = gunHeat;
+ this.others = others;
+ this.numSentries = numSentries;
+ this.roundNum = roundNum;
+ this.numRounds = numRounds;
+ this.time = time;
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN, IHiddenStatusHelper
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ return RbSerializerN.SIZEOF_TYPEINFO + 12*RbSerializerN.SIZEOF_DOUBLE + 4*RbSerializerN.SIZEOF_INT
+ + RbSerializerN.SIZEOF_LONG;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (RobotStatus) objec;
+
+ serializer.serialize(buffer, obj.energy);
+ serializer.serialize(buffer, obj.x);
+ serializer.serialize(buffer, obj.y);
+ serializer.serialize(buffer, obj.bodyHeading);
+ serializer.serialize(buffer, obj.gunHeading);
+ serializer.serialize(buffer, obj.radarHeading);
+ serializer.serialize(buffer, obj.velocity);
+ serializer.serialize(buffer, obj.bodyTurnRemaining);
+ serializer.serialize(buffer, obj.radarTurnRemaining);
+ serializer.serialize(buffer, obj.gunTurnRemaining);
+ serializer.serialize(buffer, obj.distanceRemaining);
+ serializer.serialize(buffer, obj.gunHeat);
+ serializer.serialize(buffer, obj.others);
+ serializer.serialize(buffer, obj.numSentries);
+ serializer.serialize(buffer, obj.roundNum);
+ serializer.serialize(buffer, obj.numRounds);
+ serializer.serialize(buffer, obj.time);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ double energy = buffer.getDouble();
+ double x = buffer.getDouble();
+ double y = buffer.getDouble();
+ double bodyHeading = buffer.getDouble();
+ double gunHeading = buffer.getDouble();
+ double radarHeading = buffer.getDouble();
+ double velocity = buffer.getDouble();
+ double bodyTurnRemaining = buffer.getDouble();
+ double radarTurnRemaining = buffer.getDouble();
+ double gunTurnRemaining = buffer.getDouble();
+ double distanceRemaining = buffer.getDouble();
+ double gunHeat = buffer.getDouble();
+ int others = buffer.getInt();
+ int numSentries = buffer.getInt();
+ int roundNum = buffer.getInt();
+ int numRounds = buffer.getInt();
+ long time = buffer.getLong();
+
+ return new RobotStatus(energy, x, y, bodyHeading, gunHeading, radarHeading, velocity, bodyTurnRemaining,
+ radarTurnRemaining, gunTurnRemaining, distanceRemaining, gunHeat, others, numSentries,
+ roundNum, numRounds, time);
+ }
+
+ public RobotStatus createStatus(double energy, double x, double y, double bodyHeading, double gunHeading,
+ double radarHeading, double velocity, double bodyTurnRemaining,
+ double radarTurnRemaining, double gunTurnRemaining, double distanceRemaining,
+ double gunHeat, int others, int numSentries, int roundNum, int numRounds, long time)
+ {
+ return new RobotStatus(energy, x, y, bodyHeading, gunHeading, radarHeading, velocity, bodyTurnRemaining,
+ radarTurnRemaining, gunTurnRemaining, distanceRemaining, gunHeat, others, numSentries,
+ roundNum, numRounds, time);
+ }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/RoundEndedEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/RoundEndedEvent.cs
new file mode 100644
index 0000000..5554c77
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/RoundEndedEvent.cs
@@ -0,0 +1,134 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// A RoundEndedEvent is sent to when a round has ended.
+ /// You can use the information contained in this event to determine which round that has ended.
+ ///
+ ///
+ public class RoundEndedEvent : Event
+ {
+ private const int DEFAULT_PRIORITY = 110; // System event -> cannot be changed!
+
+ private readonly int round;
+ private readonly int turns;
+ private readonly int totalTurns;
+
+
+ ///
+ /// Called by the game to create a new RoundEndedEvent.
+ ///
+ /// The round that has ended (zero-indexed)
+ /// The number of turns that this round reached
+ /// The total number of turns reached in the battle when this round ended
+ public RoundEndedEvent(int round, int turns, int totalTurns)
+ {
+ this.round = round;
+ this.turns = turns;
+ this.totalTurns = totalTurns;
+ }
+
+ ///
+ /// The round that ended (zero-indexed).
+ ///
+ public int Round
+ {
+ get { return round; }
+ }
+
+ ///
+ /// The number of turns that this round reached.
+ ///
+ public int Turns
+ {
+ get { return turns; }
+ }
+
+ ///
+ /// The total number of turns reached in the battle when this round ended.
+ ///
+ public int TotalTurns
+ {
+ get { return totalTurns; }
+ }
+
+ internal override sealed int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ ///
+ public override sealed int Priority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override sealed void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ if (robot != null)
+ {
+ IBasicEvents3 listener = robot.GetBasicEventListener() as IBasicEvents3;
+
+
+ if (listener != null)
+ {
+ listener.OnRoundEnded(this);
+ }
+ }
+ }
+
+ internal override sealed bool IsCriticalEvent
+ {
+ get { return true; }
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.RoundEndedEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, Object obje)
+ {
+ return RbSerializerN.SIZEOF_TYPEINFO + 3*RbSerializerN.SIZEOF_INT;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, Object obje)
+ {
+ RoundEndedEvent evnt = (RoundEndedEvent) obje;
+
+ serializer.serialize(buffer, evnt.round);
+ serializer.serialize(buffer, evnt.turns);
+ serializer.serialize(buffer, evnt.totalTurns);
+ }
+
+ public Object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ int round = serializer.deserializeInt(buffer);
+ int turns = serializer.deserializeInt(buffer);
+ int totalTurns = serializer.deserializeInt(buffer);
+
+ return new RoundEndedEvent(round, turns, totalTurns);
+ }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/Rules.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/Rules.cs
new file mode 100644
index 0000000..50af6b4
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/Rules.cs
@@ -0,0 +1,214 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using Robocode.Util;
+
+namespace Robocode
+{
+ ///
+ /// Constants and methods that defines the rules of Robocode.
+ /// Constants are used for rules that will not change.
+ /// Methods are provided for rules that can be changed between battles or which depends
+ /// on some other factor.
+ ///
+ public static class Rules
+ {
+ // Hide the constructor in the docs as it should not be used
+
+ ///
+ /// The acceleration of a robot, i.e. the increase of velocity when the
+ /// robot moves forward, which is 1 pixel/turn.
+ ///
+ public static readonly double ACCELERATION = 1;
+
+ ///
+ /// The deceleration of a robot, i.e. the decrease of velocity when the
+ /// robot moves backwards (or brakes), which is 2 pixels/turn.
+ ///
+ public static readonly double DECELERATION = 2;
+
+ ///
+ /// The maximum velocity of a robot, which is 8 pixels/turn.
+ ///
+ public static readonly double MAX_VELOCITY = 8;
+
+ ///
+ /// The radar scan radius, which is 1200 pixels.
+ /// Robots which is more than 1200 pixels away cannot be seen on the radar.
+ ///
+ public static readonly double RADAR_SCAN_RADIUS = 1200;
+
+ ///
+ /// The minimum bullet power, i.e the amount of energy required for firing a
+ /// bullet, which is 0.1 energy points.
+ ///
+ public static readonly double MIN_BULLET_POWER = 0.1;
+
+ ///
+ /// The maximum bullet power, i.e. the maximum amount of energy that can be
+ /// transferred to a bullet when it is fired, which is 3 energy points.
+ ///
+ public static readonly double MAX_BULLET_POWER = 3;
+
+ ///
+ /// The maximum turning rate of the robot, in degrees, which is
+ /// 10 degress/turn.
+ /// Note, that the turn rate of the robot depends on it's velocity.
+ ///
+ ///
+ ///
+ ///
+ public static readonly double MAX_TURN_RATE = 10;
+
+ ///
+ /// The maximum turning rate of the robot measured in radians instead of
+ /// degrees.
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static readonly double MAX_TURN_RATE_RADIANS = Utils.ToRadians(MAX_TURN_RATE);
+
+ ///
+ /// The turning rate of the gun measured in degrees, which is 20 degrees/turn.
+ /// Note, that if AdjustGunForRobotTurn = true has been set, the gun turn is
+ /// independent of the robot turn. In this case the gun moves relatively to the screen.
+ ///
+ /// If AdjustGunForRobotTurn = false has been set or AdjustGunForRobotTurn has not
+ /// been called at all (this is the default), then the gun turn is dependent on
+ /// the robot turn, and in this case the gun moves relatively to the robot body.
+ ///
+ ///
+ ///
+ ///
+ public static readonly double GUN_TURN_RATE = 20;
+
+ ///
+ /// The turning rate of the gun measured in radians instead of degrees.
+ ///
+ ///
+ ///
+ public static readonly double GUN_TURN_RATE_RADIANS = Utils.ToRadians(GUN_TURN_RATE);
+
+ ///
+ /// The turning rate of the radar measured in degrees, which is 45 degrees/turn.
+ /// Note, that if AdjustRadarForRobotTurn = true and/or
+ /// AdjustRadarForGunTurn = true has been set, the radar turn is independent of
+ /// the robot and/or gun turn. If both properties hava been set to true, the radar
+ /// moves relatively to the screen.
+ ///
+ /// If AdjustRadarForRobotTurn = false and/or AdjustRadarForGunTurn = false
+ /// have been set or not set at all (this is the default), then the radar turn is
+ /// dependent on the robot and/or gun turn, and in this case the radar moves
+ /// relatively to the gun and/or robot body.
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static readonly double RADAR_TURN_RATE = 45;
+
+ ///
+ /// The turning rate of the radar measured in radians instead of degrees.
+ ///
+ ///
+ ///
+ public static readonly double RADAR_TURN_RATE_RADIANS = Utils.ToRadians(RADAR_TURN_RATE);
+
+ ///
+ /// The amount of damage taken when a robot hits or is hit by another robot,
+ /// which is 0.6 energy points.
+ ///
+ public static readonly double ROBOT_HIT_DAMAGE = 0.6;
+
+ ///
+ /// The amount of bonus given when a robot moving forward hits an opponent
+ /// robot (ramming), which is 1.2 energy points.
+ ///
+ public static readonly double ROBOT_HIT_BONUS = 1.2;
+
+ ///
+ /// Returns the turn rate of a robot given a specific velocity measured in
+ /// degrees/turn.
+ ///
+ ///
+ /// The velocity of the robot.
+ public static double GetTurnRate(double velocity)
+ {
+ return MAX_TURN_RATE - 0.75*velocity;
+ }
+
+ ///
+ /// Returns the turn rate of a robot given a specific velocity measured in
+ /// radians/turn.
+ ///
+ ///
+ /// the velocity of the robot.
+ public static double GetTurnRateRadians(double velocity)
+ {
+ return Utils.ToRadians(GetTurnRate(velocity));
+ }
+
+ ///
+ /// Returns the amount of damage taken when robot hits a wall with a
+ /// specific velocity.
+ ///
+ /// the velocity of the robot.
+ public static double GetWallHitDamage(double velocity)
+ {
+ return Math.Max(Math.Abs(velocity)/2 - 1, 0);
+ }
+
+ ///
+ /// Returns the amount of damage of a bullet given a specific bullet power.
+ ///
+ /// the energy power of the bullet.
+ public static double GetBulletDamage(double bulletPower)
+ {
+ double damage = 4*bulletPower;
+
+ if (bulletPower > 1)
+ {
+ damage += 2*(bulletPower - 1);
+ }
+ return damage;
+ }
+
+ ///
+ /// Returns the amount of bonus given when a robot's bullet hits an opponent
+ /// robot given a specific bullet power.
+ ///
+ /// the energy power of the bullet
+ public static double GetBulletHitBonus(double bulletPower)
+ {
+ return 3*bulletPower;
+ }
+
+ ///
+ /// Returns the speed of a bullet given a specific bullet power measured in
+ /// pixels/turn.
+ ///
+ /// the energy power of the bullet.
+ public static double GetBulletSpeed(double bulletPower)
+ {
+ bulletPower = Math.Min(Math.Max(bulletPower, MIN_BULLET_POWER), MAX_BULLET_POWER);
+ return 20 - 3 * bulletPower;
+ }
+
+ ///
+ /// Returns the heat produced by firing the gun given a specific bullet power.
+ ///
+ /// the energy power of the bullet
+ public static double GetGunHeat(double bulletPower)
+ {
+ return 1 + (bulletPower/5);
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/ScannedRobotEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/ScannedRobotEvent.cs
new file mode 100644
index 0000000..c76ff49
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/ScannedRobotEvent.cs
@@ -0,0 +1,238 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// A ScannedRobotEvent is sent to
+ /// OnScannedRobot()} when you scan a robot.
+ /// You can use the information contained in this event to determine what to do.
+ ///
+ /// Note: You should not inherit from this class in your own event class!
+ /// The internal logic of this event class might change. Hence, your robot might
+ /// not work in future Robocode versions, if you choose to inherit from this class.
+ ///
+ public class ScannedRobotEvent : Event
+ {
+ private const int DEFAULT_PRIORITY = 10;
+
+ private readonly string name;
+ private readonly double energy;
+ private readonly double heading;
+ private readonly double bearing;
+ private readonly double distance;
+ private readonly double velocity;
+ private readonly bool isSentryRobot;
+
+ [Obsolete("ScannedRobotEvent() is obsolete.\n" +
+ "Please use ScannedRobotEvent(string, double, double, double, double, double, bool) instead.")]
+ internal ScannedRobotEvent()
+ : this(null, 0, 0, 0, 0, 0, false)
+ {
+ }
+
+ ///
+ /// Called by the game to create a new ScannedRobotEvent.
+ ///
+ /// The name of the scanned robot
+ /// The energy of the scanned robot
+ /// The bearing of the scanned robot, in radians
+ /// The distance from your robot to the scanned robot
+ /// The heading of the scanned robot
+ /// The velocity of the scanned robot
+ [Obsolete("ScannedRobotEvent(string, double, double, double, double, double) is obsolete.\n" +
+ "Please use ScannedRobotEvent(string, double, double, double, double, double, bool) instead.")]
+ public ScannedRobotEvent(string name, double energy, double bearing, double distance, double heading, double velocity) :
+ this(name, energy, bearing, distance, heading, velocity, false)
+ {
+ }
+
+ ///
+ /// Called by the game to create a new ScannedRobotEvent.
+ ///
+ /// The name of the scanned robot
+ /// The energy of the scanned robot
+ /// The bearing of the scanned robot, in radians
+ /// The distance from your robot to the scanned robot
+ /// The heading of the scanned robot
+ /// The velocity of the scanned robot
+ /// Flag specifying if the scanned robot is a sentry robot
+ public ScannedRobotEvent(string name, double energy, double bearing, double distance, double heading, double velocity, bool isSentryRobot)
+ {
+ this.name = name;
+ this.energy = energy;
+ this.bearing = bearing;
+ this.distance = distance;
+ this.heading = heading;
+ this.velocity = velocity;
+ this.isSentryRobot = isSentryRobot;
+ }
+
+ ///
+ /// Returns the bearing to the robot you scanned, relative to your robot's
+ /// heading, in degrees (-180 <= getBearing() < 180)
+ ///
+ public double Bearing
+ {
+ get { return bearing*180.0/Math.PI; }
+ }
+
+ ///
+ /// Returns the bearing to the robot you scanned, relative to your robot's
+ /// heading, in radians (-PI <= getBearingRadians() < PI)
+ ///
+ public double BearingRadians
+ {
+ get { return bearing; }
+ }
+
+ ///
+ /// Returns the distance to the robot (your center to his center).
+ ///
+ public double Distance
+ {
+ get { return distance; }
+ }
+
+ ///
+ /// Returns the energy of the robot.
+ ///
+ public double Energy
+ {
+ get { return energy; }
+ }
+
+ ///
+ /// Returns the heading of the robot, in degrees (0 <= getHeading() < 360)
+ ///
+ public double Heading
+ {
+ get { return heading*180.0/Math.PI; }
+ }
+
+ ///
+ /// Returns the heading of the robot, in radians (0 <= getHeading() < 2 * PI)
+ ///
+ public double HeadingRadians
+ {
+ get { return heading; }
+ }
+
+
+ ///
+ /// Returns the name of the robot.
+ ///
+ public string Name
+ {
+ get { return name; }
+ }
+
+
+ ///
+ /// Returns the velocity of the robot.
+ ///
+ public double Velocity
+ {
+ get { return velocity; }
+ }
+
+ ///
+ /// true if the scanned robot is a sentry robot; false otherwise.
+ ///
+ public bool IsSentryRobot
+ {
+ get { return isSentryRobot; }
+ }
+
+ ///
+ public override sealed int CompareTo(Event evnt)
+ {
+ int res = base.CompareTo(evnt);
+
+ if (res != 0)
+ {
+ return res;
+ }
+ // Compare the distance, if the events are ScannedRobotEvents
+ // The shorter distance to the robot, the higher priority
+ if (evnt is ScannedRobotEvent)
+ {
+ return (int) (Distance - ((ScannedRobotEvent) evnt).Distance);
+ }
+ // No difference found
+ return 0;
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ IBasicEvents listener = robot.GetBasicEventListener();
+
+ if (listener != null)
+ {
+ listener.OnScannedRobot(this);
+ }
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.ScannedRobotEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ var obj = (ScannedRobotEvent) objec;
+
+ return RbSerializerN.SIZEOF_TYPEINFO + serializer.sizeOf(obj.name) + 5 * RbSerializerN.SIZEOF_DOUBLE + RbSerializerN.SIZEOF_BOOL;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (ScannedRobotEvent) objec;
+
+ serializer.serialize(buffer, obj.name);
+ serializer.serialize(buffer, obj.energy);
+ serializer.serialize(buffer, obj.heading);
+ serializer.serialize(buffer, obj.bearing);
+ serializer.serialize(buffer, obj.distance);
+ serializer.serialize(buffer, obj.velocity);
+ serializer.serialize(buffer, obj.isSentryRobot);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ string name = serializer.deserializeString(buffer);
+ double energy = buffer.getDouble();
+ double heading = buffer.getDouble();
+ double bearing = buffer.getDouble();
+ double distance = buffer.getDouble();
+ double velocity = buffer.getDouble();
+ bool isSentryRobot = serializer.deserializeBoolean(buffer);
+
+ return new ScannedRobotEvent(name, energy, bearing, distance, heading, velocity, isSentryRobot);
+ }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/SkippedTurnEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/SkippedTurnEvent.cs
new file mode 100644
index 0000000..a0aaef0
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/SkippedTurnEvent.cs
@@ -0,0 +1,125 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// A SkippedTurnEvent is sent to
+ /// OnSkippedTurn()} when your robot is forced to skipping a turn.
+ /// You must take an action every turn in order to participate in the game.
+ ///
+ ///
+ /// Thread.Sleep(1000);
+ ///
+ /// will cause many SkippedTurnEvents, because you are not responding to the game.
+ /// If you receive 30 SkippedTurnEvents, you will be removed from the round.
+ ///
+ /// Instead, you should do something such as:
+ ///
+ /// for (int i = 0; i < 30; i++)
+ /// {
+ /// DoNothing(); // or perhaps Scan();
+ /// }
+ ///
+ ///
+ ///
+ /// This event may also be generated if you are simply doing too much processing
+ /// between actions, that is using too much processing power for the calculations
+ /// etc. in your robot.
+ ///
+ ///
+ ///
+ public sealed class SkippedTurnEvent : Event
+ {
+ private const int DEFAULT_PRIORITY = 100; // System event -> cannot be changed!;
+
+ private readonly long skippedTurn;
+
+ ///
+ /// Called by the game to create a new SkippedTurnEvent.
+ ///
+ public SkippedTurnEvent(long skippedTurn)
+ {
+ this.skippedTurn = skippedTurn;
+ }
+
+ ///
+ /// Returns the turn that was skipped.
+ ///
+ public long SkippedTurn
+ {
+ get { return skippedTurn; }
+ }
+
+ ///
+ public override int Priority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ if (statics.IsAdvancedRobot())
+ {
+ IAdvancedEvents listener = ((IAdvancedRobot) robot).GetAdvancedEventListener();
+
+ if (listener != null)
+ {
+ listener.OnSkippedTurn(this);
+ }
+ }
+ }
+
+ internal override bool IsCriticalEvent
+ {
+ get { return true; }
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.SkippedTurnEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ return RbSerializerN.SIZEOF_TYPEINFO + RbSerializerN.SIZEOF_LONG;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ var obj = (SkippedTurnEvent)objec;
+
+ serializer.serialize(buffer, obj.skippedTurn);
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ long skippedTurn = buffer.getLong();
+
+ return new SkippedTurnEvent(skippedTurn);
+ }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/StatusEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/StatusEvent.cs
new file mode 100644
index 0000000..84bac6a
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/StatusEvent.cs
@@ -0,0 +1,66 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.peer;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// This event is sent to every
+ /// turn in a battle to provide the status of the robot.
+ ///
+ [Serializable]
+ public sealed class StatusEvent : Event
+ {
+ private const int DEFAULT_PRIORITY = 99;
+
+ private readonly RobotStatus status;
+
+ ///
+ /// This constructor is called internally from the game in order to create
+ /// a new .
+ ///
+ ///
+ /// the current states
+ public StatusEvent(RobotStatus status)
+ {
+ this.status = status;
+ }
+
+ ///
+ /// Returns the at the time defined by .
+ ///
+ ///
+ public RobotStatus Status
+ {
+ get { return status; }
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ IBasicEvents listener = robot.GetBasicEventListener();
+
+ if (listener != null)
+ {
+ listener.OnStatus(this);
+ }
+ }
+
+ internal override byte SerializationType
+ {
+ get { throw new System.Exception("Serialization of this type is not supported"); }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/TeamRobot.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/TeamRobot.cs
new file mode 100644
index 0000000..bfa6eda
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/TeamRobot.cs
@@ -0,0 +1,193 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System.Collections.Generic;
+using Robocode.RobotInterfaces;
+using Robocode.RobotInterfaces.Peer;
+
+namespace Robocode
+{
+ ///
+ /// An advanced type of robot that supports sending messages between team
+ /// mates in a robot team.
+ ///
+ /// If you have not done already, you should create a or
+ /// first.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public abstract class TeamRobot : AdvancedRobot, ITeamRobot, ITeamEvents
+ {
+
+ ///
+ /// Broadcasts a message to all teammates.
+ ///
+ ///
+ ///
+ /// public void Run()
+ /// {
+ /// BroadcastMessage("I'm here!");
+ /// }
+ ///
+ ///
+ ///
+ /// The message to broadcast to all teammates
+ /// if the message could not be broadcasted to the teammates.
+ ///
+ ///
+ ///
+ ///
+ public void BroadcastMessage(object message)
+ {
+ if (peer != null)
+ {
+ ((ITeamRobotPeer) peer).BroadcastMessage(message);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+
+ ///
+ /// Returns a list containing all MessageEvents currently in the robot's queue.
+ /// You might, for example, call this while processing another event.
+ ///
+ ///
+ ///
+ /// foreach (MessageEvent e in GetMessageEvents())
+ /// {
+ /// // do something with e
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ public IList GetMessageEvents()
+ {
+ if (peer != null)
+ {
+ return new List(((ITeamRobotPeer) peer).GetMessageEvents());
+ }
+ UninitializedException();
+ return null; // never called
+ }
+
+ ///
+ ITeamEvents ITeamRobot.GetTeamEventListener()
+ {
+ return this; // this robot is listening
+ }
+
+ ///
+ /// Returns the names of all teammates, or null there is no teammates.
+ /// The length of the string array is equal to the number of teammates.
+ ///
+ ///
+ ///
+ /// public void Run()
+ /// {
+ /// // Prints Out all teammates
+ /// string[] teammates = GetTeammates();
+ /// if (teammates != null)
+ /// {
+ /// foreach (string member in teammates)
+ /// {
+ /// Out.WriteLine(member);
+ /// }
+ /// }
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string[] Teammates
+ {
+ get
+ {
+ if (peer != null)
+ {
+ return ((ITeamRobotPeer) peer).GetTeammates();
+ }
+ UninitializedException();
+ return null;
+ }
+ }
+
+ ///
+ /// Checks if a given robot name is the name of one of your teammates.
+ ///
+ ///
+ ///
+ /// public void OnScannedRobot(ScannedRobotEvent e)
+ /// {
+ /// if (IsTeammate(e.Name)
+ /// {
+ /// return;
+ /// }
+ /// Fire(1);
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The robot name to check
+ public bool IsTeammate(string name)
+ {
+ if (peer != null)
+ {
+ return ((ITeamRobotPeer) peer).IsTeammate(name);
+ }
+ UninitializedException();
+ return false;
+ }
+
+ ///
+ public virtual void OnMessageReceived(MessageEvent evnt)
+ {
+ }
+
+ ///
+ /// Sends a message to one (or more) teammates.
+ ///
+ ///
+ ///
+ /// public void Run()
+ /// {
+ /// SendMessage("Sample.DroidBot", "I'm here!");
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The name of the intended recipient of the message
+ /// The message to send
+ public void SendMessage(string name, object message)
+ {
+ if (peer != null)
+ {
+ ((ITeamRobotPeer) peer).SendMessage(name, message);
+ }
+ else
+ {
+ UninitializedException();
+ }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/Thread.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/Thread.cs
new file mode 100644
index 0000000..3bcdfdd
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/Thread.cs
@@ -0,0 +1,134 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+
+
+using System;
+using System.Threading;
+using net.sf.robocode.io;
+using net.sf.robocode.security;
+
+namespace Robocode
+{
+ ///
+ /// Wrapper for .NET Thread, secured according to robocode rules.
+ ///
+ public class Thread
+ {
+ private static readonly object syncRoot=new object();
+ private static int runningCounter;
+
+ private readonly System.Threading.Thread thread;
+ private readonly ParameterizedThreadStart real1;
+ private readonly ThreadStart real2;
+
+ ///
+ /// Initializes a new instance of the Thread class
+ ///
+ /// A ThreadStart delegate that represents the methods to be invoked when this thread begins executing.
+ public Thread(ParameterizedThreadStart start)
+ {
+ if (start == null)
+ {
+ throw new ArgumentException("start");
+ }
+ int id = CheckCount();
+ real1 = start;
+ thread = new System.Threading.Thread(main);
+ string name = (string) AppDomain.CurrentDomain.GetData("robotName");
+ if (!string.IsNullOrEmpty(name))
+ {
+ thread.Name = name + " [" + id + "]";
+ }
+ }
+
+ ///
+ /// Initializes a new instance of the Thread class
+ ///
+ /// A ThreadStart delegate that represents the methods to be invoked when this thread begins executing.
+ public Thread(ThreadStart start)
+ {
+ if (start==null)
+ {
+ throw new ArgumentException("start");
+ }
+ int id = CheckCount();
+ real2 = start;
+ thread = new System.Threading.Thread(main);
+ string name = (string)AppDomain.CurrentDomain.GetData("robotName");
+ if (!string.IsNullOrEmpty(name))
+ {
+ thread.Name = name + " [" + id + "]";
+ }
+ }
+
+ private static int CheckCount()
+ {
+ lock (syncRoot)
+ {
+ if (runningCounter > 5)
+ {
+ string message = "Preventing " + HiddenAccessN.GetRobotName() + "from thread creation. You may only create 5 threads at same time.";
+ LoggerN.logError(message);
+ LoggerN.WriteLineToRobotsConsole(message);
+ throw new AccessViolationException(message);
+ }
+ runningCounter++;
+ return runningCounter;
+ }
+ }
+
+ ///
+ /// Blocks the current thread for the specified number of milliseconds.
+ ///
+ public static void Sleep(int millisecondsTimeout)
+ {
+ System.Threading.Thread.Sleep(millisecondsTimeout);
+ }
+
+ ///
+ /// Causes a thread to be scheduled for execution.
+ ///
+ public void Start(object param)
+ {
+ thread.Start(param);
+ }
+
+ ///
+ /// Causes a thread to be scheduled for execution.
+ ///
+ public void Start()
+ {
+ thread.Start(null);
+ }
+
+ private void main(object param)
+ {
+ try
+ {
+ if (real1!=null)
+ {
+ real1.Invoke(param);
+ }
+ real2.Invoke();
+ }
+ catch (System.Exception ex)
+ {
+ Console.WriteLine("Undandled exception on thread " + thread.Name);
+ Console.WriteLine(ex);
+ }
+ finally
+ {
+ lock (syncRoot)
+ {
+ runningCounter--;
+ }
+ }
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/TurnCompleteCondition.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/TurnCompleteCondition.cs
new file mode 100644
index 0000000..4a5af67
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/TurnCompleteCondition.cs
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+namespace Robocode
+{
+ ///
+ /// A prebuilt condition you can use that indicates your robot has finished turning.
+ ///
+ ///
+ public class TurnCompleteCondition : Condition
+ {
+ private readonly AdvancedRobot robot;
+
+ ///
+ /// Creates a new TurnCompleteCondition with default priority.
+ /// The default priority is 80.
+ ///
+ /// Your robot, which must be an
+ public TurnCompleteCondition(AdvancedRobot robot)
+ {
+ this.robot = robot;
+ }
+
+ ///
+ /// Creates a new TurnCompleteCondition with the specified priority.
+ /// A condition priority is a value from 0 - 99. The higher value, the
+ /// higher priority. The default priority is 80.
+ ///
+ /// Your robot, which must be an
+ /// The priority of this condition
+ ///
+ public TurnCompleteCondition(AdvancedRobot robot, int priority)
+ {
+ this.robot = robot;
+ this.priority = priority;
+ }
+
+ ///
+ /// Tests if the robot has finished turning.
+ /// Returns true if the robot has stopped turning; false otherwise
+ ///
+ public override bool Test()
+ {
+ return (robot.TurnRemaining == 0);
+ }
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/WinEvent.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/WinEvent.cs
new file mode 100644
index 0000000..2cd83be
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/WinEvent.cs
@@ -0,0 +1,80 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.nio;
+using net.sf.robocode.peer;
+using net.sf.robocode.serialization;
+using Robocode.RobotInterfaces;
+
+namespace Robocode
+{
+ ///
+ /// This event is sent to when your robot
+ /// wins the round in a battle.
+ ///
+ [Serializable]
+ public sealed class WinEvent : Event
+ {
+ private const int DEFAULT_PRIORITY = 100; // System event -> cannot be changed!;
+
+ ///
+ public override int Priority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override int DefaultPriority
+ {
+ get { return DEFAULT_PRIORITY; }
+ }
+
+ internal override void Dispatch(IBasicRobot robot, IRobotStaticsN statics, IGraphics graphics)
+ {
+ IBasicEvents listener = robot.GetBasicEventListener();
+
+ if (listener != null)
+ {
+ listener.OnWin(this);
+ }
+ }
+
+ internal override bool IsCriticalEvent
+ {
+ get { return true; }
+ }
+
+ internal override byte SerializationType
+ {
+ get { return RbSerializerN.WinEvent_TYPE; }
+ }
+
+ private static ISerializableHelperN createHiddenSerializer()
+ {
+ return new SerializableHelper();
+ }
+
+ private class SerializableHelper : ISerializableHelperN
+ {
+ public int sizeOf(RbSerializerN serializer, object objec)
+ {
+ return RbSerializerN.SIZEOF_TYPEINFO;
+ }
+
+ public void serialize(RbSerializerN serializer, ByteBuffer buffer, object objec)
+ {
+ }
+
+ public object deserialize(RbSerializerN serializer, ByteBuffer buffer)
+ {
+ return new WinEvent();
+ }
+ }
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/exception/EventInterruptedException.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/exception/EventInterruptedException.cs
new file mode 100644
index 0000000..b7891db
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/exception/EventInterruptedException.cs
@@ -0,0 +1,48 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using System.Runtime.Serialization;
+
+namespace Robocode.Exception
+{
+ ///
+ [Serializable]
+ public class EventInterruptedException : System.Exception
+ {
+ private readonly int priority = int.MinValue;
+
+ ///
+ /// Used by game
+ ///
+ public EventInterruptedException(int priority)
+ {
+ this.priority = priority;
+ }
+
+ ///
+ /// Last top priority
+ ///
+ public int Priority
+ {
+ get
+ {
+ return priority;
+ }
+ }
+
+ ///
+ /// Serialization constructor
+ ///
+ protected EventInterruptedException(SerializationInfo info, StreamingContext context) :
+ base(info, context)
+ {
+ }
+
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/exception/RobotException.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/exception/RobotException.cs
new file mode 100644
index 0000000..4d37cf6
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/exception/RobotException.cs
@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using System.Runtime.Serialization;
+
+namespace Robocode.Exception
+{
+ ///
+ /// Throw this exception to stop robot
+ ///
+ ///
+ [Serializable]
+ public class RobotException : System.Exception
+ {
+ ///
+ /// Default constructor
+ ///
+ public RobotException()
+ {
+ }
+
+ ///
+ /// Constructor with message
+ ///
+ public RobotException(string s)
+ : base(s)
+ {
+ }
+
+ ///
+ /// Deserialization constructor
+ ///
+ protected RobotException(SerializationInfo info, StreamingContext context) :
+ base(info, context)
+ {
+ }
+
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IAdvancedEvents.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IAdvancedEvents.cs
new file mode 100644
index 0000000..e7579e1
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IAdvancedEvents.cs
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using Robocode;
+
+namespace Robocode.RobotInterfaces
+{
+ ///
+ /// An event interface for receiving advanced robot events with an
+ ///
+ ///
+ ///
+ public interface IAdvancedEvents
+ {
+ ///
+ /// This method is called if the robot is using too much time between
+ /// actions. When this event occur, the robot's turn is skipped, meaning that
+ /// it cannot take action anymore in this turn.
+ ///
+ /// If you receive 30 skipped turn event, your robot will be removed from the
+ /// round and loose the round.
+ ///
+ /// You will only receive this event after taking an action. So a robot in an
+ /// infinite loop will not receive any events, and will simply be stopped.
+ ///
+ /// No correctly working, reasonable robot should ever receive this event
+ /// unless it is using too many CPU cycles.
+ ///
+ ///
+ ///
+ /// The skipped turn event set by the game
+ void OnSkippedTurn(SkippedTurnEvent evnt);
+
+ ///
+ /// This method is called when a custom condition is met.
+ ///
+ /// See the sample robots for examples of use, e.g. the Sample.Target
+ /// robot.
+ ///
+ ///
+ ///
+ ///
+ /// The custom event that occurred
+ void OnCustomEvent(CustomEvent evnt);
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IAdvancedRobot.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IAdvancedRobot.cs
new file mode 100644
index 0000000..392ab8d
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IAdvancedRobot.cs
@@ -0,0 +1,32 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+namespace Robocode.RobotInterfaces
+{
+ ///
+ /// A robot interface for creating a more advanced type of robot like
+ /// that is able to handle advanced robot events.
+ /// An advanced robot allows non-blocking calls, custom events, get notifications
+ /// about skipped turns, and also allow writes to the file system.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public interface IAdvancedRobot : IBasicRobot
+ {
+ ///
+ /// This method is called by the game to notify this robot about advanced
+ /// robot event. Hence, this method must be implemented so it returns your
+ /// listener.
+ ///
+ IAdvancedEvents GetAdvancedEventListener();
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IBasicEvents.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IBasicEvents.cs
new file mode 100644
index 0000000..2d15b9c
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IBasicEvents.cs
@@ -0,0 +1,270 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using Robocode;
+
+namespace Robocode.RobotInterfaces
+{
+ ///
+ /// An event interface for receiving basic robot events with an
+ /// .
+ ///
+ ///
+ public interface IBasicEvents
+ {
+ ///
+ /// This method is called every turn in a battle round in order to provide
+ /// the robot status as a complete snapshot of the robot's current state at
+ /// that specific time.
+ ///
+ /// The main benefit of this method is that you'll automatically receive all
+ /// current data values of the robot like e.g. the x and y coordinate,
+ /// heading, gun heat etc., which are grouped into the exact same time/turn.
+ ///
+ /// This is the only way to map the robots data values to a specific time.
+ /// For example, it is not possible to determine the exact time of the
+ /// robot's heading by calling first calling and then
+ /// afterwards, as the time might change
+ /// after between the and
+ /// call.
+ ///
+ ///
+ ///
+ void OnStatus(StatusEvent evnt);
+
+ ///
+ /// This method is called when one of your bullets hits another robot.
+ /// You should override it in your robot if you want to be informed of this
+ /// event.
+ ///
+ ///
+ ///
+ /// public void OnBulletHit(BulletHitEvent evnt)
+ /// {
+ /// Out.WriteLine("I hit " + evnt.Name + "!");
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ void OnBulletHit(BulletHitEvent evnt);
+
+ ///
+ /// This method is called when one of your bullets hits another bullet.
+ /// You should override it in your robot if you want to be informed of this
+ /// event.
+ ///
+ ///
+ ///
+ /// public void OnBulletHitBullet(BulletHitBulletEvent evnt)
+ /// {
+ /// Out.WriteLine("I hit a bullet fired by " + evnt.Bullet.Name + "!");
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ void OnBulletHitBullet(BulletHitBulletEvent evnt);
+
+ ///
+ /// This method is called when one of your bullets misses, i.e. hits a wall.
+ /// You should override it in your robot if you want to be informed of this
+ /// event.
+ ///
+ ///
+ ///
+ /// public void OnBulletMissed(BulletMissedEvent evnt)
+ /// {
+ /// Out.WriteLine("Drat, I missed.");
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ void OnBulletMissed(BulletMissedEvent evnt);
+
+ ///
+ /// This method is called if your robot dies.
+ ///
+ /// You should override it in your robot if you want to be informed of this
+ /// event. Actions will have no effect if called from this section. The
+ /// intent is to allow you to perform calculations or print something out
+ /// when the robot is killed.
+ ///
+ ///
+ ///
+ ///
+ ///
+ void OnDeath(DeathEvent evnt);
+
+ ///
+ /// This method is called when your robot is hit by a bullet.
+ /// You should override it in your robot if you want to be informed of this
+ /// event.
+ ///
+ ///
+ ///
+ /// void OnHitByBullet(HitByBulletEvent evnt)
+ /// {
+ /// Out.WriteLine(event.RobotName + " hit me!");
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ void OnHitByBullet(HitByBulletEvent evnt);
+
+ ///
+ /// This method is called when your robot collides with another robot.
+ /// You should override it in your robot if you want to be informed of this
+ /// event.
+ ///
+ ///
+ ///
+ /// void OnHitRobot(HitRobotEvent evnt)
+ /// {
+ /// if (event.Bearing > -90 && evnt.Bearing <= 90)
+ /// {
+ /// Back(100);
+ /// }
+ /// else
+ /// {
+ /// Ahead(100);
+ /// }
+ /// }
+ ///
+ /// -- or perhaps, for a more advanced robot --
+ ///
+ /// public void OnHitRobot(HitRobotEvent evnt)
+ /// {
+ /// if (event.Bearing > -90 && evnt.Bearing <= 90)
+ /// {
+ /// SetBack(100);
+ /// }
+ /// else
+ /// {
+ /// SetAhead(100);
+ /// }
+ /// }
+ ///
+ ///
+ ///
+ /// The angle is relative to your robot's facing. So 0 is straight ahead of
+ /// you.
+ ///
+ /// This event can be generated if another robot hits you, in which case
+ /// will return false.
+ /// In this case, you will not be automatically stopped by the game --
+ /// but if you continue moving toward the robot you will hit it (and
+ /// generate another event). If you are moving away, then you won't hit it.
+ ///
+ ///
+ ///
+ void OnHitRobot(HitRobotEvent evnt);
+
+ ///
+ /// This method is called when your robot collides with a wall.
+ /// You should override it in your robot if you want to be informed of this
+ /// event.
+ ///
+ /// The wall at the top of the screen is 0 degrees, right is 90 degrees,
+ /// bottom is 180 degrees, left is 270 degrees. But this event is relative to
+ /// your heading, so: The bearing is such that
+ /// will point you perpendicular to the wall.
+ ///
+ ///
+ ///
+ /// void OnHitWall(HitWallEvent evnt)
+ /// {
+ /// Out.WriteLine("Ouch, I hit a wall bearing " + evnt.Bearing + " degrees.");
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ void OnHitWall(HitWallEvent evnt);
+
+ ///
+ /// This method is called when your robot sees another robot, i.e. when the
+ /// robot's radar scan "hits" another robot.
+ /// You should override it in your robot if you want to be informed of this
+ /// event. (Almost all robots should override this!)
+ ///
+ /// This event is automatically called if there is a robot in range of your
+ /// radar.
+ ///
+ /// Note that the robot's radar can only see robot within the range defined
+ /// by (1200 pixels).
+ ///
+ /// Also not that the bearing of the scanned robot is relative to your
+ /// robot's heading.
+ ///
+ ///
+ ///
+ /// void OnScannedRobot(ScannedRobotEvent evnt)
+ /// {
+ /// // Assuming radar and gun are aligned...
+ /// if (event.Distance < 100)
+ /// {
+ /// Fire(3);
+ /// }
+ /// else
+ /// {
+ /// Fire(1);
+ /// }
+ /// }
+ ///
+ ///
+ ///
+ /// Note:
+ /// The game assists Robots in firing, as follows:
+ ///
+ ///
If the gun and radar are aligned (and were aligned last turn),
+ ///
and the event is current,
+ ///
and you call Fire() before taking any other actions, Robot.Fire(double) will Fire directly at the robot.
+ ///
+ ///
+ /// In essence, this means that if you can see a robot, and it doesn't move,
+ /// then Fire will hit it.
+ ///
+ /// AdvancedRobots will NOT be assisted in this manner, and are expected to
+ /// examine the event to determine if would
+ /// hit. (i.e. you are spinning your gun around, but by the time you get the
+ /// event, your gun is 5 degrees past the robot).
+ ///
+ ///
+ ///
+ ///
+ void OnScannedRobot(ScannedRobotEvent evnt);
+
+ ///
+ /// This method is called when another robot dies.
+ /// You should override it in your robot if you want to be informed of this
+ /// event.
+ ///
+ ///
+ ///
+ void OnRobotDeath(RobotDeathEvent evnt);
+
+ ///
+ /// This method is called if your robot wins a battle.
+ ///
+ /// Your robot could perform a victory dance here! :-)
+ ///
+ ///
+ ///
+ ///
+ void OnWin(WinEvent evnt);
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IBasicEvents2.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IBasicEvents2.cs
new file mode 100644
index 0000000..e08397c
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IBasicEvents2.cs
@@ -0,0 +1,38 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using Robocode;
+
+namespace Robocode.RobotInterfaces
+{
+ ///
+ /// First extended version of the interface.
+ ///
+ public interface IBasicEvents2 : IBasicEvents
+ {
+ ///
+ /// This method is called after end of the battle, even when the battle is aborted.
+ /// You should override it in your robot if you want to be informed of this event.
+ ///
+ ///
+ ///
+ /// public void OnBattleEnded(BattleEndedEvent evnt)
+ /// {
+ /// Out.WriteLine("The battle has ended");
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ void OnBattleEnded(BattleEndedEvent evnt);
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IBasicEvents3.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IBasicEvents3.cs
new file mode 100644
index 0000000..1352a47
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IBasicEvents3.cs
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+
+
+using Robocode;
+
+namespace Robocode.RobotInterfaces
+{
+ ///
+ /// Second extended version of the interface.
+ ///
+ public interface IBasicEvents3 : IBasicEvents2
+ {
+ ///
+ /// This method is called after the end of a round.
+ /// You should override it in your robot if you want to be informed of this event.
+ ///
+ ///
+ ///
+ /// public void OnRoundEnded(RoundEndedEvent event)
+ /// {
+ /// Out.WriteLine("The round has ended");
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ void OnRoundEnded(RoundEndedEvent evnt);
+ }
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IBasicRobot.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IBasicRobot.cs
new file mode 100644
index 0000000..ef3dfad
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IBasicRobot.cs
@@ -0,0 +1,59 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System.IO;
+using Robocode.RobotInterfaces.Peer;
+
+namespace Robocode.RobotInterfaces
+{
+ ///
+ /// A robot interface for creating a basic type of robot like
+ /// that is able to receive common robot events, but not interactive events as
+ /// with the class.
+ /// A basic robot allows blocking calls only and cannot handle custom events nor
+ /// writes to the file system like an advanced robot.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public interface IBasicRobot
+ {
+ ///
+ /// This method is called by the game to invoke the
+ /// method of your robot, where the program of your robot is implemented.
+ ///
+ IRunnable GetRobotRunnable();
+
+ ///
+ /// This method is called by the game to notify this robot about basic
+ /// robot event. Hence, this method must be implemented so it returns your
+ /// listener.
+ ///
+ IBasicEvents GetBasicEventListener();
+
+ ///
+ /// Do not call this method! Your robot will simply stop interacting with
+ /// the game.
+ ///
+ /// This method is called by the game. A robot peer is the object that deals
+ /// with game mechanics and rules, and makes sure your robot abides by them.
+ ///
+ void SetPeer(IBasicRobotPeer peer);
+
+ ///
+ /// Do not call this method!
+ ///
+ /// This method is called by the game when setting the Out stream for your
+ /// robot.
+ ///
+ void SetOut(TextWriter output);
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IInteractiveEvents.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IInteractiveEvents.cs
new file mode 100644
index 0000000..b49ec7e
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IInteractiveEvents.cs
@@ -0,0 +1,183 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using Robocode;
+
+namespace Robocode.RobotInterfaces
+{
+ ///
+ /// An event interface for receiving interactive events with an .
+ ///
+ ///
+ public interface IInteractiveEvents
+ {
+ ///
+ /// This method is called when a key has been pressed.
+ ///
+ /// See the Sample.Interactive robot for an example of how to use
+ /// key events.
+ ///
+ ///
+ ///
+ /// Holds details about current event
+ void OnKeyPressed(KeyEvent evnt);
+
+ ///
+ /// This method is called when a key has been released.
+ ///
+ /// See the Sample.Interactive robot for an example of how to use
+ /// key events.
+ ///
+ ///
+ ///
+ /// Holds details about current event
+ void OnKeyReleased(KeyEvent evnt);
+
+ ///
+ /// This method is called when a key has been typed (pressed and released).
+ ///
+ /// See the Sample.Interactive robot for an example of how to use
+ /// key events.
+ ///
+ ///
+ ///
+ /// Holds details about current event
+ void OnKeyTyped(KeyEvent evnt);
+
+ ///
+ /// This method is called when a mouse button has been clicked (pressed and
+ /// released).
+ ///
+ /// See the Sample.Interactive robot for an example of how to use
+ /// mouse events.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Holds details about current event
+ void OnMouseClicked(MouseEvent evnt);
+
+ ///
+ /// This method is called when the mouse has entered the battle view.
+ ///
+ /// See the Sample.Interactive robot for an example of how to use
+ /// mouse events.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Holds details about current event
+ void OnMouseEntered(MouseEvent evnt);
+
+ ///
+ /// This method is called when the mouse has exited the battle view.
+ ///
+ /// See the Sample.Interactive robot for an example of how to use
+ /// mouse events.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Holds details about current event
+ void OnMouseExited(MouseEvent evnt);
+
+ ///
+ /// This method is called when a mouse button has been pressed.
+ ///
+ /// See the Sample.Interactive robot for an example of how to use
+ /// mouse events.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Holds details about current event
+ void OnMousePressed(MouseEvent evnt);
+
+ ///
+ /// This method is called when a mouse button has been released.
+ ///
+ /// See the Sample.Interactive robot for an example of how to use
+ /// mouse events.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Holds details about current event
+ void OnMouseReleased(MouseEvent evnt);
+
+ ///
+ /// This method is called when the mouse has been moved.
+ ///
+ /// See the Sample.Interactive robot for an example of how to use
+ /// mouse events.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Holds details about current event
+ void OnMouseMoved(MouseEvent evnt);
+
+ ///
+ /// This method is called when a mouse button has been pressed and then
+ /// dragged.
+ ///
+ /// See the Sample.Interactive robot for an example of how to use
+ /// mouse events.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Holds details about current event
+ void OnMouseDragged(MouseEvent evnt);
+
+ ///
+ /// This method is called when the mouse wheel has been rotated.
+ ///
+ /// See the Sample.Interactive robot for an example of how to use
+ /// mouse events.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Holds details about current event
+ void OnMouseWheelMoved(MouseWheelMovedEvent evnt);
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IInteractiveRobot.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IInteractiveRobot.cs
new file mode 100644
index 0000000..d2d0ad9
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IInteractiveRobot.cs
@@ -0,0 +1,36 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+namespace Robocode.RobotInterfaces
+{
+ ///
+ /// A robot interface for creating an interactive type of robot like
+ /// and that is able to
+ /// receive interactive events from the keyboard or mouse.
+ /// If a robot is directly inherited from this class it will behave as similar to
+ /// a . If you need it to behave similar to an
+ /// or , you should inherit from these
+ /// interfaces instead, as these are inherited from this interface.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public interface IInteractiveRobot : IBasicRobot
+ {
+ ///
+ /// This method is called by the game to notify this robot about interactive
+ /// events, i.e. keyboard and mouse events. Hence, this method must be
+ /// implemented so it returns your listener.
+ ///
+ IInteractiveEvents GetInteractiveEventListener();
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IJuniorRobot.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IJuniorRobot.cs
new file mode 100644
index 0000000..127970e
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IJuniorRobot.cs
@@ -0,0 +1,38 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+namespace Robocode.RobotInterfaces
+{
+ ///
+ /// A robot interface for creating the most primitive robot type, which is a
+ /// . A junior robot is simpler than the
+ /// class.
+ ///
+ /// A junior robot has a simplified model, in purpose of teaching programming
+ /// skills to inexperienced in programming students.
+ /// The simplified robot model will keep player from overwhelming of Robocode's
+ /// rules, programming syntax and programming concept.
+ ///
+ /// Instead of using getters and setters, public fields are provided for
+ /// receiving information like the last scanned robot, the coordinate of the
+ /// robot etc.
+ ///
+ /// All methods on a junior robot are blocking calls, i.e. they do not return
+ /// before their action has been completed and will at least take one turn to
+ /// Execute.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public interface IJuniorRobot : IBasicRobot
+ {
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IPaintEvents.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IPaintEvents.cs
new file mode 100644
index 0000000..c423597
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IPaintEvents.cs
@@ -0,0 +1,42 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using Robocode;
+
+namespace Robocode.RobotInterfaces
+{
+ ///
+ /// An event interface for receiving paint events with an .
+ ///
+ ///
+ public interface IPaintEvents
+ {
+ ///
+ /// This method is called every time the robot is painted. You should
+ /// override this method if you want to draw items for your robot on the
+ /// battle field, e.g. targets, virtual bullets etc.
+ ///
+ /// This method is very useful for debugging your robot.
+ ///
+ /// Note that the robot will only be painted if the "Paint" is enabled on the
+ /// robot's console window; otherwise the robot will never get painted (the
+ /// reason being that all robots might have graphical items that must be
+ /// painted, and then you might not be able to tell what graphical items that
+ /// have been painted for your robot).
+ ///
+ /// Also note that the coordinate system for the graphical context where you
+ /// paint items fits for the Robocode coordinate system where (0, 0) is at
+ /// the bottom left corner of the battlefield, where X is towards right and Y
+ /// is upwards.
+ ///
+ ///
+ /// The graphics context to use for painting graphical items for the robot
+ void OnPaint(IGraphics graphics);
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IPaintRobot.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IPaintRobot.cs
new file mode 100644
index 0000000..f23f9fc
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IPaintRobot.cs
@@ -0,0 +1,24 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+namespace Robocode.RobotInterfaces
+{
+ ///
+ /// A robot interface that makes it possible for a robot to receive paint events.
+ ///
+ public interface IPaintRobot : IBasicRobot
+ {
+ ///
+ /// This method is called by the game to notify this robot about painting
+ /// events. Hence, this method must be implemented so it returns your
+ /// listener.
+ ///
+ IPaintEvents GetPaintEventListener();
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IRunnable.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IRunnable.cs
new file mode 100644
index 0000000..a389814
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/IRunnable.cs
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+namespace Robocode.RobotInterfaces
+{
+ ///
+ /// Interface to anything what could run
+ ///
+ public interface IRunnable
+ {
+ ///
+ /// Robot main loop or anything what could run.
+ ///
+ void Run();
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/ITeamEvents.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/ITeamEvents.cs
new file mode 100644
index 0000000..16723c4
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/ITeamEvents.cs
@@ -0,0 +1,38 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using Robocode;
+
+namespace Robocode.RobotInterfaces
+{
+ ///
+ /// An event interface for receiving robot team events with an .
+ ///
+ ///
+ public interface ITeamEvents
+ {
+ ///
+ /// This method is called when your robot receives a message from a teammate.
+ /// You should override it in your robot if you want to be informed of this
+ /// event.
+ ///
+ ///
+ ///
+ /// public void OnMessageReceived(MessageEvent evnt)
+ /// {
+ /// Out.WriteLine(event.Sender + " sent me: " + evnt.Message);
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The message event sent by the game
+ void OnMessageReceived(MessageEvent evnt);
+ }
+}
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/ITeamRobot.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/ITeamRobot.cs
new file mode 100644
index 0000000..e0b3ceb
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/ITeamRobot.cs
@@ -0,0 +1,33 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+namespace Robocode.RobotInterfaces
+{
+ ///
+ /// A robot interface for creating a team robot like
+ /// that is able to receive team events.
+ /// A team robot is an advanced type of robot that supports sending messages
+ /// between teammates that participates in a team.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public interface ITeamRobot : IAdvancedRobot
+ {
+ ///
+ /// This method is called by the game to notify this robot about team events.
+ /// Hence, this method must be implemented so it returns your
+ /// listener.
+ ///
+ ITeamEvents GetTeamEventListener();
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/peer/IAdvancedRobotPeer.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/peer/IAdvancedRobotPeer.cs
new file mode 100644
index 0000000..e84346e
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/peer/IAdvancedRobotPeer.cs
@@ -0,0 +1,659 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System.Collections.Generic;
+using System.IO;
+
+namespace Robocode.RobotInterfaces.Peer
+{
+ ///
+ /// The advanced robot peer for advanced robot types like
+ /// and .
+ ///
+ /// A robot peer is the object that deals with game mechanics and rules, and
+ /// makes sure your robot abides by them.
+ ///
+ ///
+ ///
+ ///
+ ///
+ public interface IAdvancedRobotPeer : IStandardRobotPeer
+ {
+ ///
+ /// This call is identical to ,
+ /// but returns immediately, and will not execute until you
+ /// call or take an action that executes.
+ ///
+ /// If there is already movement saved from a previous stop, you can
+ /// overwrite it by calling SetStop(true).
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// true if the movement saved from a previous stop
+ /// should be overwritten; false otherwise.
+ void SetStop(bool overwrite);
+
+ ///
+ /// Sets the robot to Resume the movement stopped by
+ /// or , if any.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// or take an action that executes.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ void SetResume();
+
+ ///
+ /// Sets the robot to move forward or backward by distance measured in pixels
+ /// when the next execution takes place.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// or take an action that executes.
+ ///
+ /// Note that both positive and negative values can be given as input, where
+ /// positive values means that the robot is set to move forward, and negative
+ /// values means that the robot is set to move backward. If 0 is given as
+ /// input, the robot will stop its movement, but will have to decelerate
+ /// till it stands still, and will thus not be able to stop its movement
+ /// immediately, but eventually.
+ ///
+ ///
+ ///
+ /// // Set the robot to move 50 pixels forward
+ /// SetMove(50);
+ ///
+ /// // Set the robot to move 100 pixels backward
+ /// // (overrides the previous order)
+ /// SetMove(-100);
+ ///
+ /// ...
+ /// // Executes the last SetMove()
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The distance to move measured in pixels.
+ /// If distance > 0 the robot is set to move forward.
+ /// If distance < 0 the robot is set to move backward.
+ /// If distance = 0 the robot is set to stop its movement.
+ ///
+ void SetMove(double distance);
+
+ ///
+ /// Sets the robot's body to turn right or left by radians when the next
+ /// execution takes place.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// or take an action that
+ /// executes.
+ ///
+ /// Note that both positive and negative values can be given as input, where
+ /// positive values means that the robot's body is set to turn right, and
+ /// negative values means that the robot's body is set to turn left.
+ /// If 0 is given as input, the robot's body will stop turning.
+ ///
+ ///
+ ///
+ /// // Set the robot's body to turn 180 degrees to the right
+ /// SetTurnBody(Math.PI);
+ ///
+ /// // Set the robot's body to turn 90 degrees to the left instead of right
+ /// // (overrides the previous order)
+ /// SetTurnBody(-Math.PI / 2);
+ ///
+ /// ...
+ /// // Executes the last SetTurnBody()
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// T
+ /// The amount of radians to turn the robot's body.
+ /// If radians > 0 the robot's body is set to turn right.
+ /// If radians < 0 the robot's body is set to turn left.
+ /// If radians = 0 the robot's body is set to stop turning.
+ ///
+ void SetTurnBody(double radians);
+
+ ///
+ /// Sets the robot's gun to turn right or left by radians when the next
+ /// execution takes place.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// or take an action that
+ /// executes.
+ ///
+ /// Note that both positive and negative values can be given as input, where
+ /// positive values means that the robot's gun is set to turn right, and
+ /// negative values means that the robot's gun is set to turn left.
+ /// If 0 is given as input, the robot's gun will stop turning.
+ ///
+ ///
+ ///
+ /// // Set the robot's gun to turn 180 degrees to the right
+ /// SetTurnGun(Math.PI);
+ ///
+ /// // Set the robot's gun to turn 90 degrees to the left instead of right
+ /// // (overrides the previous order)
+ /// SetTurnGun(-Math.PI / 2);
+ ///
+ /// ...
+ /// // Executes the last setTurnFun()
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of radians to turn the robot's gun.
+ /// If radians > 0 the robot's gun is set to turn right.
+ /// If radians < 0 the robot's gun is set to turn left.
+ /// If radians = 0 the robot's gun is set to stop turning.
+ ///
+ void SetTurnGun(double radians);
+
+ ///
+ /// Sets the robot's radar to turn right or left by radians when the next
+ /// execution takes place.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// or take an action that
+ /// executes.
+ ///
+ /// Note that both positive and negative values can be given as input, where
+ /// positive values means that the robot's radar is set to turn right, and
+ /// negative values means that the robot's radar is set to turn left.
+ /// If 0 is given as input, the robot's radar will stop turning.
+ ///
+ ///
+ ///
+ /// // Set the robot's radar to turn 180 degrees to the right
+ /// SetTurnRadar(Math.PI);
+ ///
+ /// // Set the robot's radar to turn 90 degrees to the left instead of right
+ /// // (overrides the previous order)
+ /// SetTurnRadar(-Math.PI / 2);
+ ///
+ /// ...
+ /// // Executes the last SetTurnRadar()
+ /// Execute();
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of radians to turn the robot's radar.
+ /// If radians > 0 the robot's radar is set to turn right.
+ /// If radians < 0 the robot's radar is set to turn left.
+ /// If radians = 0 the robot's radar is set to stop turning.
+ ///
+ void SetTurnRadar(double radians);
+
+ ///
+ /// Sets the maximum turn rate of the robot measured in degrees if the robot
+ /// should turn slower than (10 degress/turn).
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The new maximum turn rate of the robot measured in degrees.
+ /// Valid values are 0 -
+ ///
+ void SetMaxTurnRate(double newMaxTurnRate);
+
+ ///
+ /// Sets the maximum velocity of the robot measured in pixels/turn if the
+ /// robot should move slower than (8 pixels/turn).
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The new maximum turn rate of the robot measured in pixels/turn.
+ /// Valid values are 0 -
+ ///
+ void SetMaxVelocity(double newMaxVelocity);
+
+ ///
+ /// Does not return until a condition is met, i.e. when a returns true.
+ ///
+ /// This call executes immediately.
+ ///
+ /// See the Sample.Crazy robot for how this method can be used.
+ ///
+ ///
+ ///
+ /// The condition that must be met before this call returns
+ void WaitFor(Condition condition);
+
+ ///
+ /// Call this during an event handler to allow new events of the same
+ /// priority to restart the event handler.
+ ///
+ ///
+ ///
+ /// public void OnScannedRobot(ScannedRobotEvent e)
+ /// {
+ /// Fire(1);
+ /// SetInterruptible(true);
+ /// Move(100); // If you see a robot while moving ahead,
+ /// // this handler will start from the top
+ /// // Without SetInterruptible(true), we wouldn't
+ /// // receive scan events at all!
+ /// // We'll only get here if we don't see a robot during the move.
+ /// Out().WriteLine("Ok, I can't see anyone");
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// true if the event handler should be interrupted if new events of
+ /// the same priority occurs; false otherwise
+ ///
+ void SetInterruptible(bool interruptible);
+
+ ///
+ /// Sets the priority of a class of events.
+ ///
+ /// Events are sent to the onXXX handlers in order of priority.
+ /// Higher priority events can interrupt lower priority events.
+ /// For events with the same priority, newer events are always sent first.
+ /// Valid priorities are 0 - 99, where 100 is reserved and 80 is the default
+ /// priority.
+ ///
+ ///
+ ///
+ /// SetEventPriority("RobotDeathEvent", 15);
+ ///
+ ///
+ ///
+ /// The default priorities are, from highest to lowest:
+ ///
+ /// : 100 (reserved)
+ /// : 100 (reserved)
+ /// : 100 (reserved)
+ /// : 99
+ /// Key and mouse events: 98
+ /// : 80 (default value)
+ /// : 75
+ /// : 70
+ /// : 60
+ /// : 55
+ /// : 50
+ /// : 40
+ /// : 30
+ /// : 20
+ /// : 10
+ /// : 5
+ /// : -1 (reserved)
+ ///
+ ///
+ /// Note that you cannot change the priority for events with the special
+ /// priority value -1 or 100 (reserved) as these event are system events.
+ /// Also note that you cannot change the priority of CustomEvent.
+ /// Instead you must change the priority of the condition(s) for your custom
+ /// event(s).
+ ///
+ ///
+ ///
+ /// The name of the event class (string) to set the priority for
+ /// The new priority for that event class
+ void SetEventPriority(string eventClass, int priority);
+
+ ///
+ /// Returns the current priority of a class of events.
+ /// An event priority is a value from 0 - 99. The higher value, the higher
+ /// priority.
+ ///
+ ///
+ ///
+ /// int myHitRobotPriority = GetEventPriority("HitRobotEvent");
+ ///
+ ///
+ ///
+ /// The default priorities are, from highest to lowest:
+ ///
+ /// : 100 (reserved)
+ /// : 100 (reserved)
+ /// : 100 (reserved)
+ /// : 99
+ /// Key and mouse events: 98
+ /// : 80 (default value)
+ /// : 75
+ /// : 70
+ /// : 60
+ /// : 55
+ /// : 50
+ /// : 40
+ /// : 30
+ /// : 20
+ /// : 10
+ /// : 5
+ /// : -1 (reserved)
+ ///
+ ///
+ ///
+ /// The name of the event class (string)
+ int GetEventPriority(string eventClass);
+
+ ///
+ /// Registers a custom event to be called when a condition is met.
+ /// When you are finished with your condition or just want to remove it you
+ /// must call .
+ ///
+ ///
+ ///
+ /// AddCustomEvent(
+ /// new Condition("triggerhit", (c) =>
+ /// {
+ /// return Energy <= trigger;
+ /// }));
+ ///
+ /// // Add our custom event based on our condition
+ /// AddCustomEvent(triggerHitCondition);
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The condition that must be met.
+ void AddCustomEvent(Condition condition);
+
+ ///
+ /// Removes a custom event that was previously added by calling .
+ ///
+ ///
+ ///
+ /// AddCustomEvent(
+ /// new Condition("triggerhit", (c) =>
+ /// {
+ /// return Energy <= trigger;
+ /// }));
+ ///
+ /// // Add our custom event based on our condition
+ /// AddCustomEvent(triggerHitCondition);
+ /// ...
+ /// // do something with your robot
+ /// ...
+ /// // Remove the custom event based on our condition
+ /// RemoveCustomEvent(triggerHitCondition);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The condition that was previous added and that must be removed now.
+ ///
+ void RemoveCustomEvent(Condition condition);
+
+ ///
+ /// Clears Out any pending events in the robot's event queue immediately.
+ ///
+ ///
+ ///
+ void clearAllEvents();
+
+ ///
+ /// Returns a list containing all events currently in the robot's queue.
+ /// You might, for example, call this while processing another event.
+ ///
+ ///
+ ///
+ /// foreach (Event evnt in GetAllEvents())
+ /// {
+ /// if (event is HitRobotEvent)
+ /// {
+ /// // do something with the event
+ /// }
+ /// else if (event is HitByBulletEvent)
+ /// {
+ /// // do something with the event
+ /// }
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ IList GetAllEvents();
+
+ ///
+ /// Returns a list containing all StatusEvents currently in the robot's
+ /// queue. You might, for example, call this while processing another event.
+ ///
+ ///
+ ///
+ /// foreach (StatusEvent evnt inGetStatusEvents())
+ /// {
+ /// // do something with the event
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ IList GetStatusEvents();
+
+ ///
+ /// Returns a list containing all BulletMissedEvents currently in the
+ /// robot's queue. You might, for example, call this while processing another
+ /// event.
+ ///
+ ///
+ ///
+ /// foreach (BulletMissedEvent evnt inGetBulletMissedEvents())
+ /// {
+ /// // do something with the event
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ IList GetBulletMissedEvents();
+
+ ///
+ /// Returns a list containing all BulletHitBulletEvents currently in the
+ /// robot's queue. You might, for example, call this while processing another
+ /// event.
+ ///
+ ///
+ ///
+ /// foreach (BulletHitBulletEvent evnt inGetBulletHitBulletEvents())
+ /// {
+ /// // do something with the event
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ IList GetBulletHitBulletEvents();
+
+ ///
+ /// Returns a list containing all BulletHitEvents currently in the robot's
+ /// queue. You might, for example, call this while processing another event.
+ ///
+ ///
+ ///
+ /// foreach (BulletHitEvent event: GetBulletHitEvents())
+ /// {
+ /// // do something with the event
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ IList GetBulletHitEvents();
+
+ ///
+ /// Returns a list containing all HitByBulletEvents currently in the
+ /// robot's queue. You might, for example, call this while processing
+ /// another event.
+ ///
+ ///
+ ///
+ /// foreach (HitByBulletEvent evnt inGetHitByBulletEvents())
+ /// {
+ /// // do something with the event
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ IList GetHitByBulletEvents();
+
+ ///
+ /// Returns a list containing all HitRobotEvents currently in the robot's
+ /// queue. You might, for example, call this while processing another event.
+ ///
+ ///
+ ///
+ /// foreach (HitRobotEvent evnt inGetHitRobotEvents())
+ /// {
+ /// // do something with the event
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ IList GetHitRobotEvents();
+
+ ///
+ /// Returns a list containing all HitWallEvents currently in the robot's
+ /// queue. You might, for example, call this while processing another event.
+ ///
+ ///
+ ///
+ /// foreach (HitWallEvent evnt inGetHitWallEvents())
+ /// {
+ /// // do something with the event
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ IList GetHitWallEvents();
+
+ ///
+ /// Returns a list containing all RobotDeathEvents currently in the robot's
+ /// queue. You might, for example, call this while processing another event.
+ ///
+ ///
+ ///
+ /// foreach (RobotDeathEvent evnt inGetRobotDeathEvents())
+ /// {
+ /// // do something with the event
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ IList GetRobotDeathEvents();
+
+ ///
+ /// Returns a list containing all ScannedRobotEvents currently in the
+ /// robot's queue. You might, for example, call this while processing another
+ /// event.
+ ///
+ ///
+ ///
+ /// foreach (ScannedRobotEvent evnt inGetScannedRobotEvents())
+ /// {
+ /// // do something with the event
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ IList GetScannedRobotEvents();
+
+ ///
+ /// Returns a file representing a data directory for the robot, which can be
+ /// written to.
+ ///
+ /// The system will automatically create the directory for you, so you do not
+ /// need to create it by yourself.
+ ///
+ ///
+ string GetDataDirectory();
+
+ ///
+ /// Returns a file in your data directory that you can write to.
+ ///
+ /// The system will automatically create the directory for you, so you do not
+ /// need to create it by yourself.
+ ///
+ /// Please notice that the max. size of your data file is set to 200000
+ /// (~195 KB).
+ ///
+ /// See the Sample.SittingDuck to see an example of how to use this
+ /// method.
+ ///
+ ///
+ /// The file name of the data file for your robot
+ Stream GetDataFile(string filename);
+
+ ///
+ /// Returns the data quota available in your data directory, i.e. the amount
+ /// of bytes left in the data directory for the robot.
+ ///
+ ///
+ ///
+ long GetDataQuotaAvailable();
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/peer/IBasicRobotPeer.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/peer/IBasicRobotPeer.cs
new file mode 100644
index 0000000..f5b5822
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/peer/IBasicRobotPeer.cs
@@ -0,0 +1,698 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System.Drawing;
+using Robocode;
+using Robocode.RobotInterfaces;
+
+namespace Robocode.RobotInterfaces.Peer
+{
+ ///
+ /// The basic robot peer for all robot types.
+ ///
+ /// A robot peer is the obj that deals with game mechanics and rules, and
+ /// makes sure your robot abides by them.
+ ///
+ ///
+ ///
+ ///
+ ///
+ public interface IBasicRobotPeer
+ {
+ ///
+ /// Returns the robot's name.
+ ///
+ string GetName();
+
+ ///
+ /// Returns the game time of the current round, where the time is equal to
+ /// the current turn in the round.
+ ///
+ /// A battle consists of multiple rounds.
+ ///
+ /// Time is reset to 0 at the beginning of every round.
+ ///
+ long GetTime();
+
+ ///
+ /// Returns the robot's current energy.
+ ///
+ double GetEnergy();
+
+ ///
+ /// Returns the X position of the robot. (0,0) is at the bottom left of the
+ /// battlefield.
+ ///
+ ///
+ double GetX();
+
+ ///
+ /// Returns the Y position of the robot. (0,0) is at the bottom left of the
+ /// battlefield.
+ ///
+ ///
+ double GetY();
+
+ ///
+ /// Returns the velocity of the robot measured in pixels/turn.
+ ///
+ /// The maximum velocity of a robot is defined by
+ /// (8 pixels / turn).
+ ///
+ ///
+ double GetVelocity();
+
+ ///
+ /// Returns the direction that the robot's body is facing, in radians.
+ /// The value returned will be between 0 and 2 * PI (is excluded).
+ ///
+ /// Note that the heading in Robocode is like a compass, where 0 means North,
+ /// PI / 2 means East, PI means South, and 3 * PI / 2 means West.
+ ///
+ ///
+ ///
+ double GetBodyHeading();
+
+ ///
+ /// Returns the direction that the robot's gun is facing, in radians.
+ /// The value returned will be between 0 and 2 * PI (is excluded).
+ ///
+ /// Note that the heading in Robocode is like a compass, where 0 means North,
+ /// PI / 2 means East, PI means South, and 3 * PI / 2 means West.
+ ///
+ ///
+ ///
+ double GetGunHeading();
+
+ ///
+ /// Returns the direction that the robot's radar is facing, in radians.
+ /// The value returned will be between 0 and 2 * PI (is excluded).
+ ///
+ /// Note that the heading in Robocode is like a compass, where 0 means North,
+ /// PI / 2 means East, PI means South, and 3 * PI / 2 means West.
+ ///
+ ///
+ ///
+ double GetRadarHeading();
+
+ ///
+ /// Returns the current heat of the gun. The gun cannot Fire unless this is
+ /// 0. (Calls to Fire will succeed, but will not actually Fire unless
+ /// GetGunHeat() == 0).
+ ///
+ /// The amount of gun heat generated when the gun is fired is
+ /// 1 + (firePower / 5). Each turn the gun heat drops by the amount returned
+ /// by , which is a battle setup.
+ ///
+ /// Note that all guns are "hot" at the start of each round, where the gun
+ /// heat is 3.
+ ///
+ ///
+ ///
+ double GetGunHeat();
+
+ ///
+ /// Returns the width of the current battlefield measured in pixels.
+ ///
+ double GetBattleFieldWidth();
+
+ ///
+ /// Returns the height of the current battlefield measured in pixels.
+ ///
+ double GetBattleFieldHeight();
+
+ ///
+ /// Returns how many opponents that are left in the current round.
+ ///
+ int GetOthers();
+
+ ///
+ /// Returns how many sentry robots that are left in the current round.
+ ///
+ int GetNumSentries();
+
+ ///
+ /// Returns the number of rounds in the current battle.
+ ///
+ ///
+ int GetNumRounds();
+
+ ///
+ /// Returns the number of the current round (0 to - 1)
+ /// in the battle.
+ ///
+ ///
+ int GetRoundNum();
+
+ ///
+ /// Returns the sentry border size for a BorderSentry that defines the how
+ /// far a BorderSentry is allowed to move from the border edges measured in units.
+ /// Hence, the sentry border size defines the width/range of the border area surrounding the battlefield that
+ /// BorderSentrys cannot leave (sentry robots robots must stay in the border area), but it also define the
+ /// distance from the border edges where BorderSentrys are allowed/able to make damage to robots entering this
+ /// border area.
+ ///
+ int GetSentryBorderSize();
+
+ ///
+ /// Returns the rate at which the gun will cool down, i.e. the amount of heat
+ /// the gun heat will drop per turn.
+ ///
+ /// The gun cooling rate is default 0.1 / turn, but can be changed by the
+ /// battle setup. So don't count on the cooling rate being 0.1!
+ ///
+ ///
+ ///
+ double GetGunCoolingRate();
+
+ ///
+ /// Returns the distance remaining in the robot's current move measured in
+ /// pixels.
+ ///
+ /// This call returns both positive and negative values. Positive values
+ /// means that the robot is currently moving forwards. Negative values means
+ /// that the robot is currently moving backwards. If the returned value is 0,
+ /// the robot currently stands still.
+ ///
+ ///
+ ///
+ ///
+ double GetDistanceRemaining();
+
+ ///
+ /// Returns the angle remaining in the robot's turn, in radians.
+ ///
+ /// This call returns both positive and negative values. Positive values
+ /// means that the robot is currently turning to the right. Negative values
+ /// means that the robot is currently turning to the left.
+ ///
+ ///
+ ///
+ ///
+ double GetBodyTurnRemaining();
+
+ ///
+ /// Returns the angle remaining in the gun's turn, in radians.
+ ///
+ /// This call returns both positive and negative values. Positive values
+ /// means that the gun is currently turning to the right. Negative values
+ /// means that the gun is currently turning to the left.
+ ///
+ ///
+ ///
+ ///
+ double GetGunTurnRemaining();
+
+ ///
+ /// Returns the angle remaining in the radar's turn, in radians.
+ ///
+ /// This call returns both positive and negative values. Positive values
+ /// means that the radar is currently turning to the right. Negative values
+ /// means that the radar is currently turning to the left.
+ ///
+ ///
+ ///
+ ///
+ double GetRadarTurnRemaining();
+
+ ///
+ /// Executes any pending actions, or continues executing actions that are
+ /// in process. This call returns after the actions have been started.
+ ///
+ /// Note that advanced robots must call this function in order to
+ /// Execute pending set* calls like e.g.
+ /// , etc.
+ /// Otherwise, these calls will never get executed.
+ ///
+ /// In this example the robot will move while turning:
+ ///
+ ///
+ /// SetTurnBody(90);
+ /// SetMove(100);
+ /// Execute();
+ ///
+ /// while (GetDistanceRemaining() > 0 && GetTurnRemaining() > 0)
+ /// {
+ /// Execute();
+ /// }
+ ///
+ ///
+ ///
+ void Execute();
+
+ ///
+ /// Immediately moves your robot forward or backward by distance measured in
+ /// pixels.
+ ///
+ /// This call executes immediately, and does not return until it is complete,
+ /// i.e. when the remaining distance to move is 0.
+ ///
+ /// If the robot collides with a wall, the move is complete, meaning that the
+ /// robot will not move any further. If the robot collides with another
+ /// robot, the move is complete if you are heading toward the other robot.
+ ///
+ /// Note that both positive and negative values can be given as input, where
+ /// positive values means that the robot is set to move forward, and negative
+ /// values means that the robot is set to move backward.
+ ///
+ ///
+ ///
+ /// // Move the robot 100 pixels forward
+ /// Ahead(100);
+ ///
+ /// // Afterwards, move the robot 50 pixels backward
+ /// Ahead(-50);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The distance to move measured in pixels.
+ /// If distance > 0 the robot is set to move forward.
+ /// If distance < 0 the robot is set to move backward.
+ /// If distance = 0 the robot will not move anywhere, but just finish its turn.
+ ///
+ void Move(double distance);
+
+ ///
+ /// Immediately turns the robot's body to the right or left by radians.
+ /// This call executes immediately, and does not return until it is complete,
+ /// i.e. when the angle remaining in the body's turn is 0.
+ ///
+ /// Note that both positive and negative values can be given as input, where
+ /// positive values means that the robot's body is set to turn right, and
+ /// negative values means that the robot's body is set to turn left.
+ /// If 0 is given as input, the robot's body will stop turning.
+ ///
+ ///
+ ///
+ /// // Turn the robot's body 180 degrees to the right
+ /// TurnBody(Math.PI);
+ ///
+ /// // Afterwards, turn the robot's body 90 degrees to the left
+ /// TurnBody(-Math.PI / 2);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of radians to turn the robot's body.
+ /// If radians > 0 the robot's body is set to turn right.
+ /// If radians < 0 the robot's body is set to turn left.
+ /// If radians = 0 the robot's body is set to stop turning.
+ ///
+ void TurnBody(double radians);
+
+ ///
+ /// Immediately turns the robot's gun to the right or left by radians.
+ /// This call executes immediately, and does not return until it is complete,
+ /// i.e. when the angle remaining in the gun's turn is 0.
+ ///
+ /// Note that both positive and negative values can be given as input, where
+ /// positive values means that the robot's gun is set to turn right, and
+ /// negative values means that the robot's gun is set to turn left.
+ /// If 0 is given as input, the robot's gun will stop turning.
+ ///
+ ///
+ ///
+ /// // Turn the robot's gun 180 degrees to the right
+ /// TurnGun(Math.PI);
+ ///
+ /// // Afterwards, turn the robot's gun 90 degrees to the left
+ /// TurnGun(-Math.PI / 2);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of radians to turn the robot's gun.
+ /// If radians > 0 the robot's gun is set to turn right.
+ /// If radians < 0 the robot's gun is set to turn left.
+ /// If radians = 0 the robot's gun is set to stop turning.
+ ///
+ void TurnGun(double radians);
+
+ ///
+ /// Immediately fires a bullet. The bullet will travel in the direction the
+ /// gun is pointing.
+ ///
+ /// The specified bullet power is an amount of energy that will be taken from
+ /// the robot's energy. Hence, the more power you want to spend on the
+ /// bullet, the more energy is taken from your robot.
+ ///
+ /// The bullet will do (4 * power) damage if it hits another robot. If power
+ /// is greater than 1, it will do an additional 2 * (power - 1) damage.
+ /// You will get (3 * power) back if you hit the other robot. You can call
+ /// for getting the damage that a
+ /// bullet with a specific bullet power will do.
+ ///
+ /// The specified bullet power should be between
+ /// and .
+ ///
+ /// Note that the gun cannot Fire if the gun is overheated, meaning that
+ /// returns a value > 0.
+ ///
+ /// An event is generated when the bullet hits a robot
+ /// ("/>, wall (), or another
+ /// bullet ().
+ ///
+ ///
+ ///
+ /// // Fire a bullet with maximum power if the gun is ready
+ /// if (GetGunHeat() == 0)
+ /// {
+ /// Bullet bullet = Fire(Rules.MAX_BULLET_POWER);
+ ///
+ /// // Get the velocity of the bullet
+ /// if (bullet != null)
+ /// {
+ /// double bulletVelocity = bullet.Velocity;
+ /// }
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of energy given to the bullet, and subtracted from the robot's energy.
+ ///
+ Bullet Fire(double power);
+
+ ///
+ /// Sets the gun to Fire a bullet when the next execution takes place.
+ /// The bullet will travel in the direction the gun is pointing.
+ ///
+ /// This call returns immediately, and will not execute until you call
+ /// Execute() or take an action that executes.
+ ///
+ /// The specified bullet power is an amount of energy that will be taken from
+ /// the robot's energy. Hence, the more power you want to spend on the
+ /// bullet, the more energy is taken from your robot.
+ ///
+ /// The bullet will do (4 * power) damage if it hits another robot. If power
+ /// is greater than 1, it will do an additional 2 * (power - 1) damage.
+ /// You will get (3 * power) back if you hit the other robot. You can call
+ /// for getting the damage that a
+ /// bullet with a specific bullet power will do.
+ ///
+ /// The specified bullet power should be between
+ /// and .
+ ///
+ /// Note that the gun cannot Fire if the gun is overheated, meaning that
+ /// returns a value > 0.
+ ///
+ /// An event is generated when the bullet hits a robot
+ /// (), wall (), or another
+ /// bullet ().
+ ///
+ ///
+ ///
+ /// Bullet bullet = null;
+ ///
+ /// // Fire a bullet with maximum power if the gun is ready
+ /// if (GetGunHeat() == 0)
+ /// {
+ /// bullet = SetFireBullet(Rules.MAX_BULLET_POWER);
+ /// }
+ /// ...
+ /// Execute();
+ /// ...
+ /// // Get the velocity of the bullet
+ /// if (bullet != null)
+ /// {
+ /// double bulletVelocity = bullet.Velocity;
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of energy given to the bullet, and subtracted from the robot's energy.
+ ///
+ Bullet SetFire(double power);
+
+ ///
+ /// Sets the color of the robot's body.
+ ///
+ /// A null indicates the default (blue) color.
+ ///
+ ///
+ ///
+ /// // Don't forget to using System.Drawing at the top...
+ /// using System.Drawing;
+ /// ...
+ ///
+ /// public void Run()
+ /// {
+ /// SetBodyColor(Color.BLACK);
+ /// ...
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The new body color
+ ///
+ void SetBodyColor(Color color);
+
+ ///
+ /// Returns current color of body
+ ///
+ Color GetBodyColor();
+
+ ///
+ /// Sets the color of the robot's gun.
+ ///
+ /// A null indicates the default (blue) color.
+ ///
+ ///
+ ///
+ /// // Don't forget to using System.Drawing at the top...
+ /// using System.Drawing;
+ /// ...
+ ///
+ /// public void Run()
+ /// {
+ /// SetGunColor(Color.RED);
+ /// ...
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The new gun color
+ void SetGunColor(Color color);
+
+ ///
+ /// Returns current color of gun
+ ///
+ Color GetGunColor();
+
+ ///
+ /// Sets the color of the robot's radar.
+ ///
+ /// A null indicates the default (blue) color.
+ ///
+ ///
+ ///
+ /// // Don't forget to using System.Drawing at the top...
+ /// using System.Drawing;
+ /// ...
+ ///
+ /// public void Run()
+ /// {
+ /// SetRadarColor(Color.YELLOW);
+ /// ...
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The new radar color
+ void SetRadarColor(Color color);
+
+ ///
+ /// Returns current color of radar
+ ///
+ Color GetRadarColor();
+
+ ///
+ /// Sets the color of the robot's bullets.
+ ///
+ /// A null indicates the default white color.
+ ///
+ ///
+ ///
+ /// // Don't forget to using System.Drawing at the top...
+ /// using System.Drawing;
+ /// ...
+ ///
+ /// public void Run()
+ /// {
+ /// SetBulletColor(Color.GREEN);
+ /// ...
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The new bullet color
+ void SetBulletColor(Color color);
+
+ ///
+ /// Returns current color of bullet
+ ///
+ Color GetBulletColor();
+
+ ///
+ /// Sets the color of the robot's scan arc.
+ ///
+ /// A null indicates the default (blue) color.
+ ///
+ ///
+ ///
+ /// // Don't forget to using System.Drawing at the top...
+ /// using System.Drawing;
+ /// ...
+ ///
+ /// public void Run()
+ /// {
+ /// SetScanColor(Color.WHITE);
+ /// ...
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// the new scan arc color
+ void SetScanColor(Color color);
+
+ ///
+ /// Returns current color of scan beam
+ ///
+ Color GetScanColor();
+
+ ///
+ /// This call must be made from a robot call to inform the game
+ /// that the robot made a Get* call like e.g. or
+ /// .
+ ///
+ /// This method is used by the game to determine if the robot is inactive or
+ /// not. Note: You should only make this call once in a Get* method!
+ ///
+ ///
+ void GetCall();
+
+ ///
+ /// This call must be made from a robot call to inform the game
+ /// that the robot made a Set* call like e.g.
+ /// or .
+ ///
+ /// This method is used by the game to determine if the robot is inactive or
+ /// not. Note: You should only make this call once in a Set* method!
+ ///
+ ///
+ ///
+ void SetCall();
+
+ ///
+ /// Returns a graphics context used for painting graphical items for the robot.
+ ///
+ /// This method is very useful for debugging your robot.
+ ///
+ /// Note that the robot will only be painted if the "Paint" is enabled on the
+ /// robot's console window; otherwise the robot will never get painted (the
+ /// reason being that all robots might have graphical items that must be
+ /// painted, and then you might not be able to tell what graphical items that
+ /// have been painted for your robot).
+ ///
+ /// Also note that the coordinate system for the graphical context where you
+ /// paint items fits for the Robocode coordinate system where (0, 0) is at
+ /// the bottom left corner of the battlefield, where X is towards right and Y
+ /// is upwards.
+ ///
+ ///
+ IGraphics GetGraphics();
+
+ ///
+ /// Sets the debug property with the specified key to the specified value.
+ ///
+ /// This method is very useful when debugging or reviewing your robot as you
+ /// will be able to see this property displayed in the robot console for your
+ /// robots under the Debug Properties tab page.
+ ///
+ /// The name/key of the debug property.
+ ///
+ /// The new value of the debug property, where null or the empty string is used
+ /// for removing this debug property.
+ ///
+ void SetDebugProperty(string key, string value);
+
+ ///
+ /// Rescan for other robots. This method is called automatically by the game,
+ /// as long as the robot is moving, turning its body, turning its gun, or
+ /// turning its radar.
+ ///
+ /// Rescan will cause
+ /// to be called if you see a robot.
+ ///
+ /// There are 2 reasons to call Rescan() manually:
+ ///
+ ///
You want to scan after you stop moving.
+ ///
You want to interrupt the OnScannedRobot event. This is more
+ /// likely. If you are in OnScannedRobot and call Scan(),
+ /// and you still see a robot, then the system will interrupt your
+ /// OnScannedRobot event immediately and start it from the top.
+ ///
+ ///
+ /// This call executes immediately.
+ ///
+ ///
+ ///
+ ///
+ void Rescan();
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/peer/IJuniorRobotPeer.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/peer/IJuniorRobotPeer.cs
new file mode 100644
index 0000000..f07e86d
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/peer/IJuniorRobotPeer.cs
@@ -0,0 +1,65 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+namespace Robocode.RobotInterfaces.Peer
+{
+ ///
+ /// The junior robot peer for junior robot types like .
+ ///
+ /// A robot peer is the obj that deals with game mechanics and rules, and
+ /// makes sure your robot abides by them.
+ ///
+ ///
+ ///
+ ///
+ ///
+ public interface IJuniorRobotPeer : IBasicRobotPeer
+ {
+ ///
+ /// Moves this robot forward or backwards by pixels and turns this robot
+ /// right or left by degrees at the same time. The robot will move in a curve
+ /// that follows a perfect circle, and the moving and turning will end at
+ /// exactly the same time.
+ ///
+ /// Note that the max. velocity and max. turn rate is automatically adjusted,
+ /// which means that the robot will move slower the sharper the turn is
+ /// compared to the distance.
+ ///
+ /// Note that both positive and negative values can be given as input:
+ ///
+ ///
If the distance parameter is set to a positive value, it
+ /// means that the robot is set to move forward, and a negative value means
+ /// that the robot is set to move backward. If set to 0, the robot will not
+ /// move, but will be able to turn.
+ ///
If the radians parameter is set to a positive value, it means
+ /// that the robot is set to turn to the right, and a negative value means
+ /// that the robot is set to turn to the left. If set to 0, the robot will
+ /// not turn, but will be able to move.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The distance to move measured in pixels.
+ /// If distance > 0 the robot is set to move forward.
+ /// If distance < 0 the robot is set to move backward.
+ /// If distance = 0 the robot will not move anywhere, but just finish its turn.
+ ///
+ ///
+ /// The amount of radians to turn the robot's body.
+ /// If radians > 0 the robot's body is set to turn right.
+ /// If radians < 0 the robot's body is set to turn left.
+ /// If radians = 0 the robot's body is set to stop turning.
+ ///
+ void TurnAndMove(double distance, double radians);
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/peer/IStandardRobotPeer.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/peer/IStandardRobotPeer.cs
new file mode 100644
index 0000000..5b785c5
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/peer/IStandardRobotPeer.cs
@@ -0,0 +1,248 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+namespace Robocode.RobotInterfaces.Peer
+{
+ ///
+ /// The standard robot peer for standard robot types like ,
+ /// , and .
+ ///
+ /// A robot peer is the obj that deals with game mechanics and rules, and
+ /// makes sure your robot abides by them.
+ ///
+ ///
+ ///
+ ///
+ ///
+ public interface IStandardRobotPeer : IBasicRobotPeer
+ {
+ ///
+ /// Immediately stops all movement, and saves it for a call to
+ /// . If there is already movement saved from a previous
+ /// stop, you can overwrite it by calling Stop(true).
+ ///
+ ///
+ ///
+ /// If there is already movement saved from a previous stop,
+ /// you can overwrite it by calling Stop(true).
+ ///
+ void Stop(bool overwrite);
+
+ ///
+ /// Immediately resumes the movement you stopped by , if any.
+ ///
+ /// This call executes immediately, and does not return until it is complete.
+ ///
+ ///
+ ///
+ void Resume();
+
+ ///
+ /// Immediately turns the robot's radar to the right or left by radians.
+ /// This call executes immediately, and does not return until it is complete,
+ /// i.e. when the angle remaining in the radar's turn is 0.
+ ///
+ /// Note that both positive and negative values can be given as input, where
+ /// positive values means that the robot's radar is set to turn right, and
+ /// negative values means that the robot's radar is set to turn left.
+ /// If 0 is given as input, the robot's radar will stop turning.
+ ///
+ ///
+ ///
+ /// // Turn the robot's radar 180 degrees to the right
+ /// TurnRadar(Math.PI);
+ ///
+ /// // Afterwards, turn the robot's radar 90 degrees to the left
+ /// TurnRadar(-Math.PI / 2);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The amount of radians to turn the robot's radar.
+ /// If radians > 0 the robot's radar is set to turn right.
+ /// If radians < 0 the robot's radar is set to turn left.
+ /// If radians = 0 the robot's radar is set to stop turning.
+ ///
+ void TurnRadar(double radians);
+
+ ///
+ /// Sets the gun to turn independent from the robot's turn.
+ ///
+ /// Ok, so this needs some explanation: The gun is mounted on the robot's
+ /// body. So, normally, if the robot turns 90 degrees to the right, then the
+ /// gun will turn with it as it is mounted on top of the robot's body. To
+ /// compensate for this, you can call IsAdjustGunForBodyTurn(true).
+ /// When this is set, the gun will turn independent from the robot's turn,
+ /// i.e. the gun will compensate for the robot's body turn.
+ ///
+ /// Note: This method is additive until you reach the maximum the gun can
+ /// turn. The "adjust" is added to the amount you set for turning the robot,
+ /// then capped by the physics of the game. If you turn infinite, then the
+ /// adjust is ignored (and hence overridden).
+ ///
+ ///
+ /// Assuming both the robot and gun start Out facing up (0 degrees):
+ ///
+ /// // Set gun to turn with the robot's turn
+ /// SetAdjustGunForBodyTurn(false); // This is the default
+ /// TurnBodyRight(Math.PI / 2);
+ /// // At this point, both the robot and gun are facing right (90 degrees)
+ /// TurnBodyLeft(Math.PI / 2);
+ /// // Both are back to 0 degrees
+ ///
+ /// -- or --
+ ///
+ /// // Set gun to turn independent from the robot's turn
+ /// SetAdjustGunForBodyTurn(true);
+ /// TurnBodyRight(Math.PI / 2);
+ /// // At this point, the robot is facing right (90 degrees), but the gun is still facing up.
+ /// TurnBodyLeft(Math.PI / 2);
+ /// // Both are back to 0 degrees.
+ ///
+ ///
+ ///
+ /// Note: The gun compensating this way does count as "turning the gun".
+ /// See for details.
+ ///
+ ///
+ ///
+ /// true if the gun must turn independent from the robot's turn;
+ /// false if the gun must turn with the robot's turn.
+ ///
+ void SetAdjustGunForBodyTurn(bool independent);
+
+ ///
+ /// Sets the radar to turn independent from the gun's turn.
+ ///
+ /// Ok, so this needs some explanation: The radar is mounted on the robot's
+ /// gun. So, normally, if the gun turns 90 degrees to the right, then the
+ /// radar will turn with it as it is mounted on top of the gun. To compensate
+ /// for this, you can call IsAdjustRadarForGunTurn(true). When this
+ /// is set, the radar will turn independent from the robot's turn, i.e. the
+ /// radar will compensate for the gun's turn.
+ ///
+ /// Note: This method is additive until you reach the maximum the radar can
+ /// turn. The "adjust" is added to the amount you set for turning the robot,
+ /// then capped by the physics of the game. If you turn infinite, then the
+ /// adjust is ignored (and hence overridden).
+ ///
+ ///
+ /// Assuming both the gun and radar start Out facing up (0 degrees):
+ ///
+ /// // Set radar to turn with the gun's turn
+ /// SetAdjustRadarForGunTurn(false); // This is the default
+ /// TurnGunRight(Math.PI / 2);
+ /// // At this point, both the radar and gun are facing right (90 degrees);
+ ///
+ /// -- or --
+ ///
+ /// // Set radar to turn independent from the gun's turn
+ /// SetAdjustRadarForGunTurn(true);
+ /// TurnGunRight(Math.PI / 2);
+ /// // At this point, the gun is facing right (90 degrees), but the radar is still facing up.
+ ///
+ ///
+ /// Note: Calling IsAdjustRadarForGunTurn(bool) will
+ /// automatically call with the
+ /// same value, unless you have already called it earlier. This behavior is
+ /// primarily for backward compatibility with older Robocode robots.
+ ///
+ ///
+ ///
+ ///
+ /// true if the radar must turn independent from the gun's turn;
+ /// false if the radar must turn with the gun's turn.
+ ///
+ void SetAdjustRadarForGunTurn(bool independent);
+
+ ///
+ /// Sets the radar to turn independent from the robot's turn.
+ ///
+ /// Ok, so this needs some explanation: The radar is mounted on the gun, and
+ /// the gun is mounted on the robot's body. So, normally, if the robot turns
+ /// 90 degrees to the right, the gun turns, as does the radar. Hence, if the
+ /// robot turns 90 degrees to the right, then the gun and radar will turn
+ /// with it as the radar is mounted on top of the gun. To compensate for
+ /// this, you can call IsAdjustRadarForBodyTurn(true). When this is
+ /// set, the radar will turn independent from the robot's turn, i.e. the
+ /// radar will compensate for the robot's turn.
+ ///
+ /// Note: This method is additive until you reach the maximum the radar can
+ /// turn. The "adjust" is added to the amount you set for turning the gun,
+ /// then capped by the physics of the game. If you turn infinite, then the
+ /// adjust is ignored (and hence overridden).
+ ///
+ ///
+ /// Assuming the robot, gun, and radar all start Out facing up (0 degrees):
+ ///
+ /// // Set radar to turn with the robots's turn
+ /// SetAdjustRadarForBodyTurn(false); // This is the default
+ /// TurnRight(Math.PI / 2);
+ /// // At this point, the body, gun, and radar are all facing right (90 degrees);
+ ///
+ /// -- or --
+ ///
+ /// // Set radar to turn independent from the robot's turn
+ /// SetAdjustRadarForBodyTurn(true);
+ /// TurnRight(Math.PI / 2);
+ /// // At this point, the robot and gun are facing right (90 degrees), but the radar is still facing up.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// true if the radar must turn independent from the robots's turn;
+ /// false if the radar must turn with the robot's turn.
+ ///
+ void SetAdjustRadarForBodyTurn(bool independent);
+
+ ///
+ /// Checks if the gun is set to adjust for the robot turning, i.e. to turn
+ /// independent from the robot's body turn.
+ ///
+ /// This call returns true if the gun is set to turn independent of
+ /// the turn of the robot's body. Otherwise, false is returned,
+ /// meaning that the gun is set to turn with the robot's body turn.
+ ///
+ ///
+ ///
+ ///
+ bool IsAdjustGunForBodyTurn();
+
+ ///
+ /// Checks if the radar is set to adjust for the robot turning, i.e. to turn
+ /// independent from the robot's body turn.
+ ///
+ /// This call returns true if the radar is set to turn independent of
+ /// the turn of the robot. Otherwise, false is returned, meaning that
+ /// the radar is set to turn with the robot's turn.
+ ///
+ ///
+ ///
+ ///
+ bool IsAdjustRadarForGunTurn();
+
+ ///
+ /// Checks if the radar is set to adjust for the gun turning, i.e. to turn
+ /// independent from the gun's turn.
+ ///
+ /// This call returns true if the radar is set to turn independent of
+ /// the turn of the gun. Otherwise, false is returned, meaning that
+ /// the radar is set to turn with the gun's turn.
+ ///
+ ///
+ ///
+ ///
+ bool IsAdjustRadarForBodyTurn();
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/peer/ITeamRobotPeer.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/peer/ITeamRobotPeer.cs
new file mode 100644
index 0000000..cdd4872
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/robotinterfaces/peer/ITeamRobotPeer.cs
@@ -0,0 +1,129 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System.Collections.Generic;
+using Robocode;
+
+namespace Robocode.RobotInterfaces.Peer
+{
+ ///
+ /// The team robot peer for team robots like .
+ ///
+ /// A robot peer is the object that deals with game mechanics and rules, and
+ /// makes sure your robot abides by them.
+ ///
+ ///
+ ///
+ ///
+ ///
+ public interface ITeamRobotPeer : IAdvancedRobotPeer
+ {
+ ///
+ /// Returns the names of all teammates, or null there is no teammates.
+ ///
+ ///
+ ///
+ /// public void Run()
+ /// {
+ /// // Prints Out all teammates
+ /// string[] teammates = GetTeammates();
+ /// if (teammates != null)
+ /// {
+ /// foreach (string member in teammates)
+ /// {
+ /// Out.WriteLine(member);
+ /// }
+ /// }
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ string[] GetTeammates();
+
+ ///
+ /// Checks if a given robot name is the name of one of your teammates.
+ ///
+ ///
+ ///
+ /// public void OnScannedRobot(ScannedRobotEvent e)
+ /// {
+ /// if (IsTeammate(e.Name)
+ /// {
+ /// return;
+ /// }
+ /// Fire(1);
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The robot name to check
+ bool IsTeammate(string name);
+
+ ///
+ /// Broadcasts a message to all teammates.
+ ///
+ ///
+ ///
+ /// public void Run()
+ /// {
+ /// BroadcastMessage("I'm here!");
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The message to broadcast to all teammates
+ void BroadcastMessage(object message);
+
+ ///
+ /// Sends a message to one (or more) teammates.
+ ///
+ ///
+ ///
+ /// public void Run()
+ /// {
+ /// SendMessage("Sample.DroidBot", "I'm here!");
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The name of the intended recipient of the message
+ /// The message to send
+ void SendMessage(string name, object message);
+
+ ///
+ /// Returns a list containing all MessageEvents currently in the robot's
+ /// queue. You might, for example, call this while processing another event.
+ ///
+ ///
+ ///
+ /// foreach (MessageEvent e in GetMessageEvents())
+ /// {
+ /// // do something with e
+ /// }
+ ///
+ ///
+ ///
+ ///
+ ///
+ IList GetMessageEvents();
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/util/Utils.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/util/Utils.cs
new file mode 100644
index 0000000..fa1fdb5
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.api/src/robocode/util/Utils.cs
@@ -0,0 +1,206 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using net.sf.robocode.security;
+
+namespace Robocode.Util
+{
+ ///
+ /// Utility class that provide methods for normalizing angles.
+ ///
+ public static class Utils
+ {
+ private const double TWO_PI = 2*Math.PI;
+ private const double THREE_PI_OVER_TWO = 3*Math.PI/2;
+ private const double PI_OVER_TWO = Math.PI/2;
+ private const double NEAR_DELTA = .00001;
+
+ ///
+ /// Normalizes an angle to an absolute angle.
+ /// The normalized angle will be in the range from 0 to 2*PI, where 2*PI
+ /// itself is not included.
+ ///
+ /// the angle in radians to normalize
+ public static double NormalAbsoluteAngle(double angle)
+ {
+ return (angle %= TWO_PI) >= 0 ? angle : (angle + TWO_PI);
+ }
+
+ ///
+ /// Normalizes an angle to an absolute angle.
+ /// The normalized angle will be in the range from 0 to 360, where 360
+ /// itself is not included.
+ ///
+ /// the angle in degrees to normalize
+ public static double NormalAbsoluteAngleDegrees(double angle)
+ {
+ return (angle %= 360) >= 0 ? angle : (angle + 360);
+ }
+
+ ///
+ /// Normalizes an angle to a relative angle.
+ /// The normalized angle will be in the range from -PI to PI, where PI
+ /// itself is not included.
+ ///
+ /// the angle in radinas to normalize
+ public static double NormalRelativeAngle(double angle)
+ {
+ return (angle %= TWO_PI) >= 0
+ ? (angle < Math.PI) ? angle : angle - TWO_PI
+ : (angle >= -Math.PI) ? angle : angle + TWO_PI;
+ }
+
+ ///
+ /// Normalizes an angle to a relative angle.
+ /// The normalized angle will be in the range from -180 to 180, where 180
+ /// itself is not included.
+ ///
+ /// the angle to normalize
+ public static double NormalRelativeAngleDegrees(double angle)
+ {
+ return (angle %= 360) >= 0 ? (angle < 180) ? angle : angle - 360 : (angle >= -180) ? angle : angle + 360;
+ }
+
+ ///
+ /// Normalizes an angle to be near an absolute angle.
+ /// The normalized angle will be in the range from 0 to 360, where 360
+ /// itself is not included.
+ /// If the normalized angle is near to 0, 90, 180, 270 or 360, that
+ /// angle will be returned. The
+ /// method is used for defining when the angle is near one of angles listed
+ /// above.
+ ///
+ ///
+ ///
+ /// the angle to normalize
+ public static double NormalNearAbsoluteAngleDegrees(double angle)
+ {
+ angle = (angle %= 360) >= 0 ? angle : (angle + 360);
+
+ if (IsNear(angle, 180))
+ {
+ return 180;
+ }
+ if (angle < 180)
+ {
+ if (IsNear(angle, 0))
+ {
+ return 0;
+ }
+ if (IsNear(angle, 90))
+ {
+ return 90;
+ }
+ }
+ else
+ {
+ if (IsNear(angle, 270))
+ {
+ return 270;
+ }
+ if (IsNear(angle, 360))
+ {
+ return 0;
+ }
+ }
+ return angle;
+ }
+
+ ///
+ /// Normalizes an angle to be near an absolute angle.
+ /// The normalized angle will be in the range from 0 to 2*PI, where 2*PI
+ /// itself is not included.
+ /// If the normalized angle is near to 0, PI/2, PI, 3*PI/2 or 2*PI, that
+ /// angle will be returned. The
+ /// method is used for defining when the angle is near one of angles listed
+ /// above.
+ ///
+ ///
+ ///
+ /// the angle to normalize
+ public static double NormalNearAbsoluteAngle(double angle)
+ {
+ angle = (angle %= TWO_PI) >= 0 ? angle : (angle + TWO_PI);
+
+ if (IsNear(angle, Math.PI))
+ {
+ return Math.PI;
+ }
+ if (angle < Math.PI)
+ {
+ if (IsNear(angle, 0))
+ {
+ return 0;
+ }
+ if (IsNear(angle, PI_OVER_TWO))
+ {
+ return PI_OVER_TWO;
+ }
+ }
+ else
+ {
+ if (IsNear(angle, THREE_PI_OVER_TWO))
+ {
+ return THREE_PI_OVER_TWO;
+ }
+ if (IsNear(angle, TWO_PI))
+ {
+ return 0;
+ }
+ }
+ return angle;
+ }
+
+ ///
+ /// Tests if the two double values are near to each other.
+ /// It is recommended to use this method instead of testing if the two
+ /// doubles are equal using an this expression: value1 == value2.
+ /// The reason being, that this expression might never become
+ /// true due to the precision of double values.
+ /// Whether or not the specified doubles are near to each other is defined by
+ /// the following expression:
+ /// (Math.abs(value1 - value2) < .00001)
+ ///
+ /// the first double value
+ /// the second double value
+ public static bool IsNear(double value1, double value2)
+ {
+ return (Math.Abs(value1 - value2) < NEAR_DELTA);
+ }
+
+ ///
+ /// Returns random number generator. It might be configured for repeatable behavior by setting -DRANDOMSEED option.
+ ///
+ public static Random GetRandom()
+ {
+ return HiddenAccessN.randomHelper.GetRandom();
+ }
+
+ ///
+ /// Conversion from degrees to radians
+ ///
+ /// in degrees
+ /// angle in radians
+ public static double ToRadians(double angle)
+ {
+ return Math.PI*angle/180.0;
+ }
+
+ ///
+ /// Conversion from radians to degrees
+ ///
+ /// in radians
+ /// angle in degrees
+ public static double ToDegrees(double angle)
+ {
+ return angle*(180.0/Math.PI);
+ }
+ }
+}
+
+//doc
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/.classpath b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/.classpath
new file mode 100644
index 0000000..37239ec
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/.classpath
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/.project b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/.project
new file mode 100644
index 0000000..70b6969
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/.project
@@ -0,0 +1,19 @@
+
+
+ robocode.dotnet.content
+ NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.
+
+ robocode.dotnet.host
+ robocode.dotnet.nhost
+ robocode.dotnet.api
+ robocode.dotnet.control.api
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/.settings/org.eclipse.jdt.core.prefs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..764c3ab
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,9 @@
+#Tue Nov 27 22:34:11 CET 2012
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+eclipse.preferences.version=1
+encoding/src/main/java=8859_1
+org.eclipse.jdt.core.compiler.source=1.6
+encoding/src/test/resources=8859_1
+encoding/src/test/java=8859_1
+encoding/src/main/resources=8859_1
+org.eclipse.jdt.core.compiler.compliance=1.6
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/pom.xml b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/pom.xml
new file mode 100644
index 0000000..f67bbeb
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/pom.xml
@@ -0,0 +1,33 @@
+
+
+ 4.0.0
+ robocode.dotnet.content
+ Robocode .NET Content
+
+ net.sf.robocode
+ robocode.dotnet
+ ${robocode.dotnet.version}
+
+
+
+ net.sf.robocode
+ robocode.dotnet.host
+ ${robocode.version}
+
+
+ net.sf.robocode
+ robocode.api
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/robocode.dotnet.content.iml b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/robocode.dotnet.content.iml
new file mode 100644
index 0000000..98715be
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/robocode.dotnet.content.iml
@@ -0,0 +1,147 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/src/main/resources/libs/control/.gitignore b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/src/main/resources/libs/control/.gitignore
new file mode 100644
index 0000000..4a3496d
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/src/main/resources/libs/control/.gitignore
@@ -0,0 +1,3 @@
+obj
+Properties
+BattleRunnnerSample.suo
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/src/main/resources/libs/control/BattleRunnnerSample.csproj b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/src/main/resources/libs/control/BattleRunnnerSample.csproj
new file mode 100644
index 0000000..b5fb8dd
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/src/main/resources/libs/control/BattleRunnnerSample.csproj
@@ -0,0 +1,69 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {9826B19C-0C68-4D4A-B6CE-6F2A80B4B114}
+ Exe
+ Properties
+ BattleRunnner
+ BattleRunnner
+ v3.5
+ 512
+
+
+
+
+ 3.5
+
+
+ true
+ full
+ false
+ ..\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ False
+ C:\robocode\libs\jni4net.n-0.8.7.0.dll
+
+
+ False
+ C:\robocode\libs\robocode.dll
+
+
+ False
+ C:\robocode\libs\robocode.control.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/src/main/resources/libs/control/BattleRunnnerSample.sln b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/src/main/resources/libs/control/BattleRunnnerSample.sln
new file mode 100644
index 0000000..67b675a
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/src/main/resources/libs/control/BattleRunnnerSample.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual C# Express 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BattleRunnnerSample", "BattleRunnnerSample.csproj", "{9826B19C-0C68-4D4A-B6CE-6F2A80B4B114}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {9826B19C-0C68-4D4A-B6CE-6F2A80B4B114}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9826B19C-0C68-4D4A-B6CE-6F2A80B4B114}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9826B19C-0C68-4D4A-B6CE-6F2A80B4B114}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9826B19C-0C68-4D4A-B6CE-6F2A80B4B114}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/src/main/resources/libs/control/Program.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/src/main/resources/libs/control/Program.cs
new file mode 100644
index 0000000..e757cab
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/src/main/resources/libs/control/Program.cs
@@ -0,0 +1,82 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+
+
+// Application that demonstrates how to run two sample robots in Robocode with the RobocodeEngine using the
+// Robocode.Control package.
+//
+// NOTE: this application assumes that Robocode and the .NET plugin has been installed at C:\robocode, and that this
+// application is run from the file path C:\robocode\libs\control. If this is not the case, the references for this
+// solution must be changed to point at [your robocode dir]\libs directory where these references are located.
+// Also note that the application will need some time to start up and initialize Robocode before the battle can begin.
+//
+// Author: Flemming N. Larsen
+
+using System;
+using Robocode;
+using Robocode.Control;
+using Robocode.Control.Events;
+
+class BattleRunner
+{
+ static void Main(string[] args)
+ {
+ // Create the RobocodeEngine
+ RobocodeEngine engine = new RobocodeEngine("C:\\robocode"); // Run from C:\Robocode
+
+ // Add battle event handlers
+ engine.BattleCompleted += new BattleCompletedEventHandler(BattleCompleted);
+ engine.BattleMessage += new BattleMessageEventHandler(BattleMessage);
+ engine.BattleError += new BattleErrorEventHandler(BattleError);
+
+ // Show the Robocode battle view
+ engine.Visible = true;
+
+ // Disable log messages from Robocode
+ RobocodeEngine.LogMessagesEnabled = false;
+
+ // Setup the battle specification
+
+ int numberOfRounds = 5;
+ BattlefieldSpecification battlefield = new BattlefieldSpecification(800, 600); // 800x600
+ RobotSpecification[] selectedRobots = engine.GetLocalRepository("sample.RamFire,sample.Corners");
+
+ BattleSpecification battleSpec = new BattleSpecification(numberOfRounds, battlefield, selectedRobots);
+
+ // Run our specified battle and let it run till it is over
+ engine.RunBattle(battleSpec, true /* wait till the battle is over */);
+
+ // Cleanup our RobocodeEngine
+ engine.Close();
+ }
+
+ // Called when the battle is completed successfully with battle results
+ private static void BattleCompleted(BattleCompletedEvent e)
+ {
+ Console.WriteLine("-- Battle has completed --");
+
+ // Print out the sorted results with the robot names
+ Console.WriteLine("Battle results:");
+ foreach (BattleResults result in e.SortedResults)
+ {
+ Console.WriteLine(" " + result.TeamLeaderName + ": " + result.Score);
+ }
+ }
+
+ // Called when the game sends out an information message during the battle
+ private static void BattleMessage(BattleMessageEvent e)
+ {
+ Console.WriteLine("Msg> " + e.Message);
+ }
+
+ // Called when the game sends out an error message during the battle
+ private static void BattleError(BattleErrorEvent e)
+ {
+ Console.WriteLine("Err> " + e.Error);
+ }
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/src/main/resources/robocode.bat b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/src/main/resources/robocode.bat
new file mode 100644
index 0000000..af55147
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/src/main/resources/robocode.bat
@@ -0,0 +1,9 @@
+@REM
+@REM Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+@REM All rights reserved. This program and the accompanying materials
+@REM are made available under the terms of the Eclipse Public License v1.0
+@REM which accompanies this distribution, and is available at
+@REM http://robocode.sourceforge.net/license/epl-v10.html
+@REM
+
+java -Xmx512M -cp libs/robocode.jar;libs/jni4net.j-0.8.7.0.jar robocode.Robocode %*
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/src/main/resources/robots/SamplesCs.csproj b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/src/main/resources/robots/SamplesCs.csproj
new file mode 100644
index 0000000..58786f6
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.content/src/main/resources/robots/SamplesCs.csproj
@@ -0,0 +1,89 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {80857B97-6397-487B-A9F5-B07026DCB666}
+ Library
+ SampleCs
+ samplescs-1.9.2.4
+ v2.0
+ 512
+
+
+
+
+ true
+ full
+ false
+ .\
+ obj\
+ DEBUG;TRACE
+ prompt
+ 4
+ false
+ false
+
+
+ pdbonly
+ true
+ .\
+ obj\
+
+
+ prompt
+ 4
+ true
+
+
+
+ False
+ ..\libs\robocode.dll
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PreserveNewest
+
+
+
+
+
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/.project b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/.project
new file mode 100644
index 0000000..41b449a
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/.project
@@ -0,0 +1,10 @@
+
+
+ robocode.dotnet.control.api
+ .NET Control API for Robocode. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.
+
+ robocode.dotnet.api
+
+
+
+
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/.settings/org.eclipse.jdt.core.prefs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..070758f
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,10 @@
+#Tue Nov 27 22:34:10 CET 2012
+encoding/src/test/java=8859_1
+org.eclipse.jdt.core.compiler.compliance=1.6
+encoding/src/main/resources=8859_1
+encoding/src/main/java=8859_1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+eclipse.preferences.version=1
+encoding/src/test/resources=8859_1
+encoding/src=8859_1
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/Content Layout.content b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/Content Layout.content
new file mode 100644
index 0000000..31aca23
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/Content Layout.content
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/Introduction.aml b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/Introduction.aml
new file mode 100644
index 0000000..09788c4
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/Introduction.aml
@@ -0,0 +1,113 @@
+
+
+
+ Introduction
+
+ The Robocode Control API is used for controlling the Robocode
+ application from another external application. Basically, it is possible
+ to run battles between selected robots and retrieve the results. However,
+ it is also possible to get detailed information as snapshots during the
+ battles regarding e.g. the positions and headings of the individual robots
+ and bullets at a specific time during a battle.
+
+
+ The main entry class is the Robocode.Control.RobocodeEngine class, which
+ must be instantiated by the application controlling Robocode. With the
+ RobocodeEngine, a battle specification must be provided in order to run a
+ battle. The battle specification specify the size of the battlefield, and
+ which rules that must be used. In addition, the participant robots must be
+ selected, which must exist in the robot directory of Robocode in
+ advantage.
+
+
+
+ Example
+
+
+ Here is a simple sample application that runs a battle in Robocode for 5
+ rounds on the default battlefield of 800x600 pixels. The robots selected
+ for the battle are sample.RamFire and sample.Corners.
+
+
+ A Visual Studio solution containing this BattleRunner can be found in
+ [your robocode dir]\lib\control if you have installed Robocode and the
+ .NET plugin for Robocode, where [your robocode dir] is your Robocode
+ installation directory, which could be C:\robocode like this example
+ assumes.
+
+
+// Application that demonstrates how to run two sample robots in Robocode with the RobocodeEngine using the
+// Robocode.Control package.
+//
+// NOTE: this application assumes that Robocode and the .NET plugin has been installed at C:\robocode, and that this
+// application is run from the file path C:\robocode\libs\control. If this is not the case, the references for this
+// solution must be changed to point at [your robocode dir]\libs directory where these references are located.
+// Also note that the application will need some time to start up and initialize Robocode before the battle can begin.
+//
+// Author: Flemming N. Larsen
+
+using System;
+using Robocode;
+using Robocode.Control;
+using Robocode.Control.Events;
+
+class BattleRunner
+{
+ static void Main(string[] args)
+ {
+ // Create the RobocodeEngine
+ RobocodeEngine engine = new RobocodeEngine("C:\\robocode"); // Run from C:\Robocode
+
+ // Add battle event handlers
+ engine.BattleCompleted += new BattleCompletedEventHandler(BattleCompleted);
+ engine.BattleMessage += new BattleMessageEventHandler(BattleMessage);
+ engine.BattleError += new BattleErrorEventHandler(BattleError);
+
+ // Show the Robocode battle view
+ engine.Visible = true;
+
+ // Setup the battle specification
+
+ int numberOfRounds = 5;
+ BattlefieldSpecification battlefield = new BattlefieldSpecification(800, 600); // 800x600
+ RobotSpecification[] selectedRobots = engine.GetLocalRepository("sample.RamFire,sample.Corners");
+
+ BattleSpecification battleSpec = new BattleSpecification(numberOfRounds, battlefield, selectedRobots);
+
+ // Run our specified battle and let it run till it is over
+ engine.RunBattle(battleSpec, true /* wait till the battle is over */);
+
+ // Cleanup our RobocodeEngine
+ engine.Close();
+ }
+
+ // Called when the battle is completed successfully with battle results
+ private static void BattleCompleted(BattleCompletedEvent e)
+ {
+ Console.WriteLine("-- Battle has completed --");
+
+ // Print out the sorted results with the robot names
+ Console.WriteLine("Battle results:");
+ foreach (BattleResults result in e.SortedResults)
+ {
+ Console.WriteLine(" " + result.TeamLeaderName + ": " + result.Score);
+ }
+ }
+
+ // Called when the game sends out an information message during the battle
+ private static void BattleMessage(BattleMessageEvent e)
+ {
+ Console.WriteLine("Msg> " + e.Message);
+ }
+
+ // Called when the game sends out an error message during the battle
+ private static void BattleError(BattleErrorEvent e)
+ {
+ Console.WriteLine("Err> " + e.Error);
+ }
+}
+
+
+
+
+
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/controlAPI.shfbproj b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/controlAPI.shfbproj
new file mode 100644
index 0000000..15f8d16
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/controlAPI.shfbproj
@@ -0,0 +1,81 @@
+
+
+
+
+ Debug
+ AnyCPU
+ 2.0
+ {90f0d09b-f58d-4f2e-ac8a-164d89979ef1}
+ 1.9.5.0
+
+ Documentation
+ Documentation
+ Documentation
+
+ .\target\Help\
+ ControlAPI
+
+
+
+
+ AutoDocumentCtors, AutoDocumentDispose
+ Robocode Control API for .NET
+ .NET Framework 3.5
+ HtmlHelp1, Website
+
+
+
+
+
+
+ InheritedMembers, Protected, SealedProtected
+
+ Control API used for controlling Robocode from an external .NET application.
+ Control API used for controlling Robocode from an external .NET application.
+ Control API used for controlling Robocode from an external .NET application.
+
+ Copyright %28c%29 2001-2016 Mathew A. Nelson and Robocode contributors
+ fnl%40users.sourceforge.net
+ administator and maintainer of Robocode
+ Robocode Control API for .NET
+ vs2010
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ..\tools\lib\jni4net.n-0.8.7.0.dll
+
+
+ ..\robocode.dotnet.api\target\robocode.dll
+
+
+
+
+
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/pom.xml b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/pom.xml
new file mode 100644
index 0000000..81f54e7
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/pom.xml
@@ -0,0 +1,66 @@
+
+
+ 4.0.0
+ robocode.dotnet.control.api
+ Robocode .NET Control API
+ .NET Control API for Robocode
+ dotnet:library
+
+ robocode.dotnet
+ net.sf.robocode
+ ${robocode.dotnet.version}
+
+
+
+ net.sf.jni4net
+ jni4net.n
+ 0.8.7.0
+ dotnet:library
+
+
+ net.sf.robocode
+ robocode.dotnet.api
+ ${project.version}
+ dotnet:library
+
+
+
+ robocode.control
+ src
+
+
+ org.sonatype.nmaven.plugins
+ maven-dotnet-compiler-plugin
+
+ /unsafe /warn:0 /nowarn:1591 /keyfile:"${basedir}/../tools/keys/robocode.snk"
+ robocode.control.dll
+
+
+
+ org.jvnet.maven-antrun-extended-plugin
+ maven-antrun-extended-plugin
+
+
+ process-classes
+
+
+
+
+
+
+
+
+
+
+ run
+
+
+
+
+
+
+
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/robocode.dotnet.control.api.iml b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/robocode.dotnet.control.api.iml
new file mode 100644
index 0000000..64ccd25
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/robocode.dotnet.control.api.iml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/.gitignore b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/.gitignore
new file mode 100644
index 0000000..dcb7ccb
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/.gitignore
@@ -0,0 +1,3 @@
+/obj
+/robocode.dotnet.control.api.sln
+/robocode.dotnet.control.api.suo
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/java/util/Random.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/java/util/Random.generated.cs
new file mode 100644
index 0000000..6b73e37
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/java/util/Random.generated.cs
@@ -0,0 +1,172 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace java.util {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaClassAttribute()]
+ public partial class Random : global::java.lang.Object, global::java.io.Serializable {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_nextInt0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_nextInt1;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_nextLong2;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_nextDouble3;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_nextBoolean4;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_nextBytes5;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_nextFloat6;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_nextGaussian7;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_setSeed8;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorRandom9;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorRandom10;
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(J)V")]
+ public Random(long par0) :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.NewObject(global::java.util.Random.staticClass, global::java.util.Random.j4n__ctorRandom9, this, global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par0));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()V")]
+ public Random() :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ @__env.NewObject(global::java.util.Random.staticClass, global::java.util.Random.j4n__ctorRandom10, this);
+ }
+ }
+
+ protected Random(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::java.util.Random.staticClass;
+ }
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::java.util.Random.staticClass = @__class;
+ global::java.util.Random.j4n_nextInt0 = @__env.GetMethodID(global::java.util.Random.staticClass, "nextInt", "(I)I");
+ global::java.util.Random.j4n_nextInt1 = @__env.GetMethodID(global::java.util.Random.staticClass, "nextInt", "()I");
+ global::java.util.Random.j4n_nextLong2 = @__env.GetMethodID(global::java.util.Random.staticClass, "nextLong", "()J");
+ global::java.util.Random.j4n_nextDouble3 = @__env.GetMethodID(global::java.util.Random.staticClass, "nextDouble", "()D");
+ global::java.util.Random.j4n_nextBoolean4 = @__env.GetMethodID(global::java.util.Random.staticClass, "nextBoolean", "()Z");
+ global::java.util.Random.j4n_nextBytes5 = @__env.GetMethodID(global::java.util.Random.staticClass, "nextBytes", "([B)V");
+ global::java.util.Random.j4n_nextFloat6 = @__env.GetMethodID(global::java.util.Random.staticClass, "nextFloat", "()F");
+ global::java.util.Random.j4n_nextGaussian7 = @__env.GetMethodID(global::java.util.Random.staticClass, "nextGaussian", "()D");
+ global::java.util.Random.j4n_setSeed8 = @__env.GetMethodID(global::java.util.Random.staticClass, "setSeed", "(J)V");
+ global::java.util.Random.j4n__ctorRandom9 = @__env.GetMethodID(global::java.util.Random.staticClass, "", "(J)V");
+ global::java.util.Random.j4n__ctorRandom10 = @__env.GetMethodID(global::java.util.Random.staticClass, "", "()V");
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(I)I")]
+ public virtual int nextInt(int par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ return ((int)(@__env.CallIntMethod(this, global::java.util.Random.j4n_nextInt0, global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par0))));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ public virtual int nextInt() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::java.util.Random.j4n_nextInt1)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()J")]
+ public virtual long nextLong() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((long)(@__env.CallLongMethod(this, global::java.util.Random.j4n_nextLong2)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ public virtual double nextDouble() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::java.util.Random.j4n_nextDouble3)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Z")]
+ public virtual bool nextBoolean() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((bool)(@__env.CallBooleanMethod(this, global::java.util.Random.j4n_nextBoolean4)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("([B)V")]
+ public virtual void nextBytes(byte[] par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.CallVoidMethod(this, global::java.util.Random.j4n_nextBytes5, global::net.sf.jni4net.utils.Convertor.ParArrayPrimC2J(@__env, par0));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()F")]
+ public virtual float nextFloat() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((float)(@__env.CallFloatMethod(this, global::java.util.Random.j4n_nextFloat6)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ public virtual double nextGaussian() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::java.util.Random.j4n_nextGaussian7)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(J)V")]
+ public virtual void setSeed(long par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.CallVoidMethod(this, global::java.util.Random.j4n_setSeed8, global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par0));
+ }
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::java.util.Random(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/BattleSpecification.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/BattleSpecification.generated.cs
new file mode 100644
index 0000000..c714d62
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/BattleSpecification.generated.cs
@@ -0,0 +1,207 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaClassAttribute()]
+ public partial class BattleSpecification : global::java.lang.Object, global::java.io.Serializable {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getInactivityTime0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getGunCoolingRate1;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getBattlefield2;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getNumRounds3;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getHideEnemyNames4;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getSentryBorderSize5;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getRobots6;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getInitialSetups7;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorBattleSpecification8;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorBattleSpecification9;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorBattleSpecification10;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorBattleSpecification11;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorBattleSpecification12;
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(IJDLrobocode/control/BattlefieldSpecification;[Lrobocode/control/RobotSpecificat" +
+ "ion;)V")]
+ public BattleSpecification(int par0, long par1, double par2, global::robocode.control.BattlefieldSpecification par3, robocode.control.RobotSpecification[] par4) :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 20)){
+ @__env.NewObject(global::robocode.control.BattleSpecification.staticClass, global::robocode.control.BattleSpecification.j4n__ctorBattleSpecification8, this, global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par0), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par1), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par2), global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par3), global::net.sf.jni4net.utils.Convertor.ParArrayStrongCp2J(@__env, par4));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(IJDZLrobocode/control/BattlefieldSpecification;[Lrobocode/control/RobotSpecifica" +
+ "tion;)V")]
+ public BattleSpecification(int par0, long par1, double par2, bool par3, global::robocode.control.BattlefieldSpecification par4, robocode.control.RobotSpecification[] par5) :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 22)){
+ @__env.NewObject(global::robocode.control.BattleSpecification.staticClass, global::robocode.control.BattleSpecification.j4n__ctorBattleSpecification9, this, global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par0), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par1), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par2), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par3), global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par4), global::net.sf.jni4net.utils.Convertor.ParArrayStrongCp2J(@__env, par5));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/BattlefieldSpecification;IJDIZ[Lrobocode/control/RobotSpecific" +
+ "ation;)V")]
+ public BattleSpecification(global::robocode.control.BattlefieldSpecification par0, int par1, long par2, double par3, int par4, bool par5, robocode.control.RobotSpecification[] par6) :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 24)){
+ @__env.NewObject(global::robocode.control.BattleSpecification.staticClass, global::robocode.control.BattleSpecification.j4n__ctorBattleSpecification10, this, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par1), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par2), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par3), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par4), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par5), global::net.sf.jni4net.utils.Convertor.ParArrayStrongCp2J(@__env, par6));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/BattlefieldSpecification;IJDIZ[Lrobocode/control/RobotSpecific" +
+ "ation;[Lrobocode/control/RobotSetup;)V")]
+ public BattleSpecification(global::robocode.control.BattlefieldSpecification par0, int par1, long par2, double par3, int par4, bool par5, robocode.control.RobotSpecification[] par6, robocode.control.RobotSetup[] par7) :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 26)){
+ @__env.NewObject(global::robocode.control.BattleSpecification.staticClass, global::robocode.control.BattleSpecification.j4n__ctorBattleSpecification11, this, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par1), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par2), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par3), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par4), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par5), global::net.sf.jni4net.utils.Convertor.ParArrayStrongCp2J(@__env, par6), global::net.sf.jni4net.utils.Convertor.ParArrayStrongCp2J(@__env, par7));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(ILrobocode/control/BattlefieldSpecification;[Lrobocode/control/RobotSpecificatio" +
+ "n;)V")]
+ public BattleSpecification(int par0, global::robocode.control.BattlefieldSpecification par1, robocode.control.RobotSpecification[] par2) :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 16)){
+ @__env.NewObject(global::robocode.control.BattleSpecification.staticClass, global::robocode.control.BattleSpecification.j4n__ctorBattleSpecification12, this, global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par0), global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par1), global::net.sf.jni4net.utils.Convertor.ParArrayStrongCp2J(@__env, par2));
+ }
+ }
+
+ protected BattleSpecification(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.BattleSpecification.staticClass;
+ }
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.BattleSpecification.staticClass = @__class;
+ global::robocode.control.BattleSpecification.j4n_getInactivityTime0 = @__env.GetMethodID(global::robocode.control.BattleSpecification.staticClass, "getInactivityTime", "()J");
+ global::robocode.control.BattleSpecification.j4n_getGunCoolingRate1 = @__env.GetMethodID(global::robocode.control.BattleSpecification.staticClass, "getGunCoolingRate", "()D");
+ global::robocode.control.BattleSpecification.j4n_getBattlefield2 = @__env.GetMethodID(global::robocode.control.BattleSpecification.staticClass, "getBattlefield", "()Lrobocode/control/BattlefieldSpecification;");
+ global::robocode.control.BattleSpecification.j4n_getNumRounds3 = @__env.GetMethodID(global::robocode.control.BattleSpecification.staticClass, "getNumRounds", "()I");
+ global::robocode.control.BattleSpecification.j4n_getHideEnemyNames4 = @__env.GetMethodID(global::robocode.control.BattleSpecification.staticClass, "getHideEnemyNames", "()Z");
+ global::robocode.control.BattleSpecification.j4n_getSentryBorderSize5 = @__env.GetMethodID(global::robocode.control.BattleSpecification.staticClass, "getSentryBorderSize", "()I");
+ global::robocode.control.BattleSpecification.j4n_getRobots6 = @__env.GetMethodID(global::robocode.control.BattleSpecification.staticClass, "getRobots", "()[Lrobocode/control/RobotSpecification;");
+ global::robocode.control.BattleSpecification.j4n_getInitialSetups7 = @__env.GetMethodID(global::robocode.control.BattleSpecification.staticClass, "getInitialSetups", "()[Lrobocode/control/RobotSetup;");
+ global::robocode.control.BattleSpecification.j4n__ctorBattleSpecification8 = @__env.GetMethodID(global::robocode.control.BattleSpecification.staticClass, "", "(IJDLrobocode/control/BattlefieldSpecification;[Lrobocode/control/RobotSpecificat" +
+ "ion;)V");
+ global::robocode.control.BattleSpecification.j4n__ctorBattleSpecification9 = @__env.GetMethodID(global::robocode.control.BattleSpecification.staticClass, "", "(IJDZLrobocode/control/BattlefieldSpecification;[Lrobocode/control/RobotSpecifica" +
+ "tion;)V");
+ global::robocode.control.BattleSpecification.j4n__ctorBattleSpecification10 = @__env.GetMethodID(global::robocode.control.BattleSpecification.staticClass, "", "(Lrobocode/control/BattlefieldSpecification;IJDIZ[Lrobocode/control/RobotSpecific" +
+ "ation;)V");
+ global::robocode.control.BattleSpecification.j4n__ctorBattleSpecification11 = @__env.GetMethodID(global::robocode.control.BattleSpecification.staticClass, "", "(Lrobocode/control/BattlefieldSpecification;IJDIZ[Lrobocode/control/RobotSpecific" +
+ "ation;[Lrobocode/control/RobotSetup;)V");
+ global::robocode.control.BattleSpecification.j4n__ctorBattleSpecification12 = @__env.GetMethodID(global::robocode.control.BattleSpecification.staticClass, "", "(ILrobocode/control/BattlefieldSpecification;[Lrobocode/control/RobotSpecificatio" +
+ "n;)V");
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()J")]
+ public virtual long getInactivityTime() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((long)(@__env.CallLongMethod(this, global::robocode.control.BattleSpecification.j4n_getInactivityTime0)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ public virtual double getGunCoolingRate() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.BattleSpecification.j4n_getGunCoolingRate1)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Lrobocode/control/BattlefieldSpecification;")]
+ public virtual global::robocode.control.BattlefieldSpecification getBattlefield() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.BattleSpecification.j4n_getBattlefield2));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ public virtual int getNumRounds() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.BattleSpecification.j4n_getNumRounds3)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Z")]
+ public virtual bool getHideEnemyNames() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((bool)(@__env.CallBooleanMethod(this, global::robocode.control.BattleSpecification.j4n_getHideEnemyNames4)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ public virtual int getSentryBorderSize() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.BattleSpecification.j4n_getSentryBorderSize5)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()[Lrobocode/control/RobotSpecification;")]
+ public virtual robocode.control.RobotSpecification[] getRobots() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.ArrayStrongJ2Cp(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.BattleSpecification.j4n_getRobots6));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()[Lrobocode/control/RobotSetup;")]
+ public virtual robocode.control.RobotSetup[] getInitialSetups() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.ArrayStrongJ2Cp(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.BattleSpecification.j4n_getInitialSetups7));
+ }
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.BattleSpecification(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/BattlefieldSpecification.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/BattlefieldSpecification.generated.cs
new file mode 100644
index 0000000..e7f0867
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/BattlefieldSpecification.generated.cs
@@ -0,0 +1,95 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaClassAttribute()]
+ public partial class BattlefieldSpecification : global::java.lang.Object, global::java.io.Serializable {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getWidth0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getHeight1;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorBattlefieldSpecification2;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorBattlefieldSpecification3;
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()V")]
+ public BattlefieldSpecification() :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ @__env.NewObject(global::robocode.control.BattlefieldSpecification.staticClass, global::robocode.control.BattlefieldSpecification.j4n__ctorBattlefieldSpecification2, this);
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(II)V")]
+ public BattlefieldSpecification(int par0, int par1) :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 14)){
+ @__env.NewObject(global::robocode.control.BattlefieldSpecification.staticClass, global::robocode.control.BattlefieldSpecification.j4n__ctorBattlefieldSpecification3, this, global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par0), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par1));
+ }
+ }
+
+ protected BattlefieldSpecification(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.BattlefieldSpecification.staticClass;
+ }
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.BattlefieldSpecification.staticClass = @__class;
+ global::robocode.control.BattlefieldSpecification.j4n_getWidth0 = @__env.GetMethodID(global::robocode.control.BattlefieldSpecification.staticClass, "getWidth", "()I");
+ global::robocode.control.BattlefieldSpecification.j4n_getHeight1 = @__env.GetMethodID(global::robocode.control.BattlefieldSpecification.staticClass, "getHeight", "()I");
+ global::robocode.control.BattlefieldSpecification.j4n__ctorBattlefieldSpecification2 = @__env.GetMethodID(global::robocode.control.BattlefieldSpecification.staticClass, "", "()V");
+ global::robocode.control.BattlefieldSpecification.j4n__ctorBattlefieldSpecification3 = @__env.GetMethodID(global::robocode.control.BattlefieldSpecification.staticClass, "", "(II)V");
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ public virtual int getWidth() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.BattlefieldSpecification.j4n_getWidth0)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ public virtual int getHeight() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.BattlefieldSpecification.j4n_getHeight1)));
+ }
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.BattlefieldSpecification(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/RandomFactory.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/RandomFactory.generated.cs
new file mode 100644
index 0000000..0309397
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/RandomFactory.generated.cs
@@ -0,0 +1,105 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaClassAttribute()]
+ public partial class RandomFactory : global::java.lang.Object {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_isDeterministic0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getRandom1;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_setRandom2;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_resetDeterministic3;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorRandomFactory4;
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()V")]
+ public RandomFactory() :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ @__env.NewObject(global::robocode.control.RandomFactory.staticClass, global::robocode.control.RandomFactory.j4n__ctorRandomFactory4, this);
+ }
+ }
+
+ protected RandomFactory(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.RandomFactory.staticClass;
+ }
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.RandomFactory.staticClass = @__class;
+ global::robocode.control.RandomFactory.j4n_isDeterministic0 = @__env.GetMethodID(global::robocode.control.RandomFactory.staticClass, "isDeterministic", "()Z");
+ global::robocode.control.RandomFactory.j4n_getRandom1 = @__env.GetStaticMethodID(global::robocode.control.RandomFactory.staticClass, "getRandom", "()Ljava/util/Random;");
+ global::robocode.control.RandomFactory.j4n_setRandom2 = @__env.GetStaticMethodID(global::robocode.control.RandomFactory.staticClass, "setRandom", "(Ljava/util/Random;)V");
+ global::robocode.control.RandomFactory.j4n_resetDeterministic3 = @__env.GetStaticMethodID(global::robocode.control.RandomFactory.staticClass, "resetDeterministic", "(J)V");
+ global::robocode.control.RandomFactory.j4n__ctorRandomFactory4 = @__env.GetMethodID(global::robocode.control.RandomFactory.staticClass, "", "()V");
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Z")]
+ public virtual bool isDeterministic() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((bool)(@__env.CallBooleanMethod(this, global::robocode.control.RandomFactory.j4n_isDeterministic0)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/util/Random;")]
+ public static global::java.util.Random getRandom() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.CallStaticObjectMethodPtr(global::robocode.control.RandomFactory.staticClass, global::robocode.control.RandomFactory.j4n_getRandom1));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Ljava/util/Random;)V")]
+ public static void setRandom(global::java.util.Random par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.CallStaticVoidMethod(global::robocode.control.RandomFactory.staticClass, global::robocode.control.RandomFactory.j4n_setRandom2, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(J)V")]
+ public static void resetDeterministic(long par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.CallStaticVoidMethod(global::robocode.control.RandomFactory.staticClass, global::robocode.control.RandomFactory.j4n_resetDeterministic3, global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par0));
+ }
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.RandomFactory(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/RobocodeEngine.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/RobocodeEngine.generated.cs
new file mode 100644
index 0000000..fe32567
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/RobocodeEngine.generated.cs
@@ -0,0 +1,296 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaClassAttribute()]
+ public partial class RobocodeEngine : global::java.lang.Object {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_close0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getVersion1;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_addBattleListener2;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_removeBattleListener3;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_setVisible4;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getLocalRepository5;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getLocalRepository6;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_runBattle7;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_runBattle8;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_runBattle9;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_waitTillBattleOver10;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_abortCurrentBattle11;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getCurrentWorkingDir12;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getRobotsDir13;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_printRunningThreads14;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_setLogMessagesEnabled15;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_setLogErrorsEnabled16;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorRobocodeEngine17;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorRobocodeEngine18;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorRobocodeEngine19;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorRobocodeEngine20;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorRobocodeEngine21;
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Ljava/io/File;)V")]
+ public RobocodeEngine(global::java.io.File par0) :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.NewObject(global::robocode.control.RobocodeEngine.staticClass, global::robocode.control.RobocodeEngine.j4n__ctorRobocodeEngine17, this, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Ljava/io/File;Lrobocode/control/RobocodeListener;)V")]
+ public RobocodeEngine(global::java.io.File par0, global::java.lang.Object par1) :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 14)){
+ @__env.NewObject(global::robocode.control.RobocodeEngine.staticClass, global::robocode.control.RobocodeEngine.j4n__ctorRobocodeEngine18, this, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0), global::net.sf.jni4net.utils.Convertor.ParFullC2J(@__env, par1));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/RobocodeListener;)V")]
+ public RobocodeEngine(global::java.lang.Object par0) :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.NewObject(global::robocode.control.RobocodeEngine.staticClass, global::robocode.control.RobocodeEngine.j4n__ctorRobocodeEngine19, this, global::net.sf.jni4net.utils.Convertor.ParFullC2J(@__env, par0));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/events/IBattleListener;)V")]
+ public RobocodeEngine(global::robocode.control.events.IBattleListener par0) :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.NewObject(global::robocode.control.RobocodeEngine.staticClass, global::robocode.control.RobocodeEngine.j4n__ctorRobocodeEngine20, this, global::net.sf.jni4net.utils.Convertor.ParFullC2J(@__env, par0));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()V")]
+ public RobocodeEngine() :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ @__env.NewObject(global::robocode.control.RobocodeEngine.staticClass, global::robocode.control.RobocodeEngine.j4n__ctorRobocodeEngine21, this);
+ }
+ }
+
+ protected RobocodeEngine(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.RobocodeEngine.staticClass;
+ }
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.RobocodeEngine.staticClass = @__class;
+ global::robocode.control.RobocodeEngine.j4n_close0 = @__env.GetMethodID(global::robocode.control.RobocodeEngine.staticClass, "close", "()V");
+ global::robocode.control.RobocodeEngine.j4n_getVersion1 = @__env.GetMethodID(global::robocode.control.RobocodeEngine.staticClass, "getVersion", "()Ljava/lang/String;");
+ global::robocode.control.RobocodeEngine.j4n_addBattleListener2 = @__env.GetMethodID(global::robocode.control.RobocodeEngine.staticClass, "addBattleListener", "(Lrobocode/control/events/IBattleListener;)V");
+ global::robocode.control.RobocodeEngine.j4n_removeBattleListener3 = @__env.GetMethodID(global::robocode.control.RobocodeEngine.staticClass, "removeBattleListener", "(Lrobocode/control/events/IBattleListener;)V");
+ global::robocode.control.RobocodeEngine.j4n_setVisible4 = @__env.GetMethodID(global::robocode.control.RobocodeEngine.staticClass, "setVisible", "(Z)V");
+ global::robocode.control.RobocodeEngine.j4n_getLocalRepository5 = @__env.GetMethodID(global::robocode.control.RobocodeEngine.staticClass, "getLocalRepository", "()[Lrobocode/control/RobotSpecification;");
+ global::robocode.control.RobocodeEngine.j4n_getLocalRepository6 = @__env.GetMethodID(global::robocode.control.RobocodeEngine.staticClass, "getLocalRepository", "(Ljava/lang/String;)[Lrobocode/control/RobotSpecification;");
+ global::robocode.control.RobocodeEngine.j4n_runBattle7 = @__env.GetMethodID(global::robocode.control.RobocodeEngine.staticClass, "runBattle", "(Lrobocode/control/BattleSpecification;Z)V");
+ global::robocode.control.RobocodeEngine.j4n_runBattle8 = @__env.GetMethodID(global::robocode.control.RobocodeEngine.staticClass, "runBattle", "(Lrobocode/control/BattleSpecification;Ljava/lang/String;Z)V");
+ global::robocode.control.RobocodeEngine.j4n_runBattle9 = @__env.GetMethodID(global::robocode.control.RobocodeEngine.staticClass, "runBattle", "(Lrobocode/control/BattleSpecification;)V");
+ global::robocode.control.RobocodeEngine.j4n_waitTillBattleOver10 = @__env.GetMethodID(global::robocode.control.RobocodeEngine.staticClass, "waitTillBattleOver", "()V");
+ global::robocode.control.RobocodeEngine.j4n_abortCurrentBattle11 = @__env.GetMethodID(global::robocode.control.RobocodeEngine.staticClass, "abortCurrentBattle", "()V");
+ global::robocode.control.RobocodeEngine.j4n_getCurrentWorkingDir12 = @__env.GetStaticMethodID(global::robocode.control.RobocodeEngine.staticClass, "getCurrentWorkingDir", "()Ljava/io/File;");
+ global::robocode.control.RobocodeEngine.j4n_getRobotsDir13 = @__env.GetStaticMethodID(global::robocode.control.RobocodeEngine.staticClass, "getRobotsDir", "()Ljava/io/File;");
+ global::robocode.control.RobocodeEngine.j4n_printRunningThreads14 = @__env.GetStaticMethodID(global::robocode.control.RobocodeEngine.staticClass, "printRunningThreads", "()V");
+ global::robocode.control.RobocodeEngine.j4n_setLogMessagesEnabled15 = @__env.GetStaticMethodID(global::robocode.control.RobocodeEngine.staticClass, "setLogMessagesEnabled", "(Z)V");
+ global::robocode.control.RobocodeEngine.j4n_setLogErrorsEnabled16 = @__env.GetStaticMethodID(global::robocode.control.RobocodeEngine.staticClass, "setLogErrorsEnabled", "(Z)V");
+ global::robocode.control.RobocodeEngine.j4n__ctorRobocodeEngine17 = @__env.GetMethodID(global::robocode.control.RobocodeEngine.staticClass, "", "(Ljava/io/File;)V");
+ global::robocode.control.RobocodeEngine.j4n__ctorRobocodeEngine18 = @__env.GetMethodID(global::robocode.control.RobocodeEngine.staticClass, "", "(Ljava/io/File;Lrobocode/control/RobocodeListener;)V");
+ global::robocode.control.RobocodeEngine.j4n__ctorRobocodeEngine19 = @__env.GetMethodID(global::robocode.control.RobocodeEngine.staticClass, "", "(Lrobocode/control/RobocodeListener;)V");
+ global::robocode.control.RobocodeEngine.j4n__ctorRobocodeEngine20 = @__env.GetMethodID(global::robocode.control.RobocodeEngine.staticClass, "", "(Lrobocode/control/events/IBattleListener;)V");
+ global::robocode.control.RobocodeEngine.j4n__ctorRobocodeEngine21 = @__env.GetMethodID(global::robocode.control.RobocodeEngine.staticClass, "", "()V");
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()V")]
+ public virtual void close() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ @__env.CallVoidMethod(this, global::robocode.control.RobocodeEngine.j4n_close0);
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/String;")]
+ public virtual global::java.lang.String getVersion() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2CpString(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.RobocodeEngine.j4n_getVersion1));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/events/IBattleListener;)V")]
+ public virtual void addBattleListener(global::robocode.control.events.IBattleListener par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.CallVoidMethod(this, global::robocode.control.RobocodeEngine.j4n_addBattleListener2, global::net.sf.jni4net.utils.Convertor.ParFullC2J(@__env, par0));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/events/IBattleListener;)V")]
+ public virtual void removeBattleListener(global::robocode.control.events.IBattleListener par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.CallVoidMethod(this, global::robocode.control.RobocodeEngine.j4n_removeBattleListener3, global::net.sf.jni4net.utils.Convertor.ParFullC2J(@__env, par0));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Z)V")]
+ public virtual void setVisible(bool par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.CallVoidMethod(this, global::robocode.control.RobocodeEngine.j4n_setVisible4, global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par0));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()[Lrobocode/control/RobotSpecification;")]
+ public virtual robocode.control.RobotSpecification[] getLocalRepository() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.ArrayStrongJ2Cp(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.RobocodeEngine.j4n_getLocalRepository5));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Ljava/lang/String;)[Lrobocode/control/RobotSpecification;")]
+ public virtual robocode.control.RobotSpecification[] getLocalRepository(global::java.lang.String par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ return global::net.sf.jni4net.utils.Convertor.ArrayStrongJ2Cp(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.RobocodeEngine.j4n_getLocalRepository6, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/BattleSpecification;Z)V")]
+ public virtual void runBattle(global::robocode.control.BattleSpecification par0, bool par1) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 14)){
+ @__env.CallVoidMethod(this, global::robocode.control.RobocodeEngine.j4n_runBattle7, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par1));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/BattleSpecification;Ljava/lang/String;Z)V")]
+ public virtual void runBattle(global::robocode.control.BattleSpecification par0, global::java.lang.String par1, bool par2) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 16)){
+ @__env.CallVoidMethod(this, global::robocode.control.RobocodeEngine.j4n_runBattle8, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0), global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par1), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par2));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/BattleSpecification;)V")]
+ public virtual void runBattle(global::robocode.control.BattleSpecification par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.CallVoidMethod(this, global::robocode.control.RobocodeEngine.j4n_runBattle9, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()V")]
+ public virtual void waitTillBattleOver() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ @__env.CallVoidMethod(this, global::robocode.control.RobocodeEngine.j4n_waitTillBattleOver10);
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()V")]
+ public virtual void abortCurrentBattle() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ @__env.CallVoidMethod(this, global::robocode.control.RobocodeEngine.j4n_abortCurrentBattle11);
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/io/File;")]
+ public static global::java.io.File getCurrentWorkingDir() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.CallStaticObjectMethodPtr(global::robocode.control.RobocodeEngine.staticClass, global::robocode.control.RobocodeEngine.j4n_getCurrentWorkingDir12));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/io/File;")]
+ public static global::java.io.File getRobotsDir() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.CallStaticObjectMethodPtr(global::robocode.control.RobocodeEngine.staticClass, global::robocode.control.RobocodeEngine.j4n_getRobotsDir13));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()V")]
+ public static void printRunningThreads() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ @__env.CallStaticVoidMethod(global::robocode.control.RobocodeEngine.staticClass, global::robocode.control.RobocodeEngine.j4n_printRunningThreads14);
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Z)V")]
+ public static void setLogMessagesEnabled(bool par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.CallStaticVoidMethod(global::robocode.control.RobocodeEngine.staticClass, global::robocode.control.RobocodeEngine.j4n_setLogMessagesEnabled15, global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par0));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Z)V")]
+ public static void setLogErrorsEnabled(bool par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.CallStaticVoidMethod(global::robocode.control.RobocodeEngine.staticClass, global::robocode.control.RobocodeEngine.j4n_setLogErrorsEnabled16, global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par0));
+ }
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.RobocodeEngine(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/RobotResults.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/RobotResults.generated.cs
new file mode 100644
index 0000000..7f246be
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/RobotResults.generated.cs
@@ -0,0 +1,95 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaClassAttribute()]
+ public partial class RobotResults : global::java.lang.Object {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getRobot0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_convertResults1;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorRobotResults2;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorRobotResults3;
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/RobotSpecification;Ljava/lang/String;IDDDDDDDIII)V")]
+ public RobotResults(global::robocode.control.RobotSpecification par0, global::java.lang.String par1, int par2, double par3, double par4, double par5, double par6, double par7, double par8, double par9, int par10, int par11, int par12) :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 36)){
+ @__env.NewObject(global::robocode.control.RobotResults.staticClass, global::robocode.control.RobotResults.j4n__ctorRobotResults2, this, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0), global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par1), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par2), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par3), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par4), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par5), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par6), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par7), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par8), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par9), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par10), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par11), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par12));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/RobotSpecification;Lrobocode/BattleResults;)V")]
+ public RobotResults(global::robocode.control.RobotSpecification par0, global::java.lang.Object par1) :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 14)){
+ @__env.NewObject(global::robocode.control.RobotResults.staticClass, global::robocode.control.RobotResults.j4n__ctorRobotResults3, this, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0), global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par1));
+ }
+ }
+
+ protected RobotResults(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.RobotResults.staticClass;
+ }
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.RobotResults.staticClass = @__class;
+ global::robocode.control.RobotResults.j4n_getRobot0 = @__env.GetMethodID(global::robocode.control.RobotResults.staticClass, "getRobot", "()Lrobocode/control/RobotSpecification;");
+ global::robocode.control.RobotResults.j4n_convertResults1 = @__env.GetStaticMethodID(global::robocode.control.RobotResults.staticClass, "convertResults", "([Lrobocode/BattleResults;)[Lrobocode/control/RobotResults;");
+ global::robocode.control.RobotResults.j4n__ctorRobotResults2 = @__env.GetMethodID(global::robocode.control.RobotResults.staticClass, "", "(Lrobocode/control/RobotSpecification;Ljava/lang/String;IDDDDDDDIII)V");
+ global::robocode.control.RobotResults.j4n__ctorRobotResults3 = @__env.GetMethodID(global::robocode.control.RobotResults.staticClass, "", "(Lrobocode/control/RobotSpecification;Lrobocode/BattleResults;)V");
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Lrobocode/control/RobotSpecification;")]
+ public virtual global::robocode.control.RobotSpecification getRobot() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.RobotResults.j4n_getRobot0));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("([Lrobocode/BattleResults;)[Lrobocode/control/RobotResults;")]
+ public static robocode.control.RobotResults[] convertResults(java.lang.Object[] par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ return global::net.sf.jni4net.utils.Convertor.ArrayStrongJ2Cp(@__env, @__env.CallStaticObjectMethodPtr(global::robocode.control.RobotResults.staticClass, global::robocode.control.RobotResults.j4n_convertResults1, global::net.sf.jni4net.utils.Convertor.ParArrayStrongCp2J(@__env, par0)));
+ }
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.RobotResults(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/RobotSetup.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/RobotSetup.generated.cs
new file mode 100644
index 0000000..38ee1c2
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/RobotSetup.generated.cs
@@ -0,0 +1,94 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaClassAttribute()]
+ public partial class RobotSetup : global::java.lang.Object, global::java.io.Serializable {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getX0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getY1;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getHeading2;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorRobotSetup3;
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Ljava/lang/Double;Ljava/lang/Double;Ljava/lang/Double;)V")]
+ public RobotSetup(global::java.lang.Double par0, global::java.lang.Double par1, global::java.lang.Double par2) :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 16)){
+ @__env.NewObject(global::robocode.control.RobotSetup.staticClass, global::robocode.control.RobotSetup.j4n__ctorRobotSetup3, this, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0), global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par1), global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par2));
+ }
+ }
+
+ protected RobotSetup(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.RobotSetup.staticClass;
+ }
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.RobotSetup.staticClass = @__class;
+ global::robocode.control.RobotSetup.j4n_getX0 = @__env.GetMethodID(global::robocode.control.RobotSetup.staticClass, "getX", "()Ljava/lang/Double;");
+ global::robocode.control.RobotSetup.j4n_getY1 = @__env.GetMethodID(global::robocode.control.RobotSetup.staticClass, "getY", "()Ljava/lang/Double;");
+ global::robocode.control.RobotSetup.j4n_getHeading2 = @__env.GetMethodID(global::robocode.control.RobotSetup.staticClass, "getHeading", "()Ljava/lang/Double;");
+ global::robocode.control.RobotSetup.j4n__ctorRobotSetup3 = @__env.GetMethodID(global::robocode.control.RobotSetup.staticClass, "", "(Ljava/lang/Double;Ljava/lang/Double;Ljava/lang/Double;)V");
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/Double;")]
+ public virtual global::java.lang.Double getX() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.RobotSetup.j4n_getX0));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/Double;")]
+ public virtual global::java.lang.Double getY() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.RobotSetup.j4n_getY1));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/Double;")]
+ public virtual global::java.lang.Double getHeading() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.RobotSetup.j4n_getHeading2));
+ }
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.RobotSetup(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/RobotSpecification.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/RobotSpecification.generated.cs
new file mode 100644
index 0000000..6978fbc
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/RobotSpecification.generated.cs
@@ -0,0 +1,159 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaClassAttribute()]
+ public partial class RobotSpecification : global::java.lang.Object, global::java.io.Serializable {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getName0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getClassName1;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getJarFile2;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getVersion3;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getNameAndVersion4;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getDescription5;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getRobocodeVersion6;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getWebpage7;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getAuthorName8;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getTeamId9;
+
+ protected RobotSpecification(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.RobotSpecification.staticClass;
+ }
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.RobotSpecification.staticClass = @__class;
+ global::robocode.control.RobotSpecification.j4n_getName0 = @__env.GetMethodID(global::robocode.control.RobotSpecification.staticClass, "getName", "()Ljava/lang/String;");
+ global::robocode.control.RobotSpecification.j4n_getClassName1 = @__env.GetMethodID(global::robocode.control.RobotSpecification.staticClass, "getClassName", "()Ljava/lang/String;");
+ global::robocode.control.RobotSpecification.j4n_getJarFile2 = @__env.GetMethodID(global::robocode.control.RobotSpecification.staticClass, "getJarFile", "()Ljava/io/File;");
+ global::robocode.control.RobotSpecification.j4n_getVersion3 = @__env.GetMethodID(global::robocode.control.RobotSpecification.staticClass, "getVersion", "()Ljava/lang/String;");
+ global::robocode.control.RobotSpecification.j4n_getNameAndVersion4 = @__env.GetMethodID(global::robocode.control.RobotSpecification.staticClass, "getNameAndVersion", "()Ljava/lang/String;");
+ global::robocode.control.RobotSpecification.j4n_getDescription5 = @__env.GetMethodID(global::robocode.control.RobotSpecification.staticClass, "getDescription", "()Ljava/lang/String;");
+ global::robocode.control.RobotSpecification.j4n_getRobocodeVersion6 = @__env.GetMethodID(global::robocode.control.RobotSpecification.staticClass, "getRobocodeVersion", "()Ljava/lang/String;");
+ global::robocode.control.RobotSpecification.j4n_getWebpage7 = @__env.GetMethodID(global::robocode.control.RobotSpecification.staticClass, "getWebpage", "()Ljava/lang/String;");
+ global::robocode.control.RobotSpecification.j4n_getAuthorName8 = @__env.GetMethodID(global::robocode.control.RobotSpecification.staticClass, "getAuthorName", "()Ljava/lang/String;");
+ global::robocode.control.RobotSpecification.j4n_getTeamId9 = @__env.GetMethodID(global::robocode.control.RobotSpecification.staticClass, "getTeamId", "()Ljava/lang/String;");
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/String;")]
+ public virtual global::java.lang.String getName() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2CpString(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.RobotSpecification.j4n_getName0));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/String;")]
+ public virtual global::java.lang.String getClassName() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2CpString(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.RobotSpecification.j4n_getClassName1));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/io/File;")]
+ public virtual global::java.io.File getJarFile() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.RobotSpecification.j4n_getJarFile2));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/String;")]
+ public virtual global::java.lang.String getVersion() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2CpString(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.RobotSpecification.j4n_getVersion3));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/String;")]
+ public virtual global::java.lang.String getNameAndVersion() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2CpString(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.RobotSpecification.j4n_getNameAndVersion4));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/String;")]
+ public virtual global::java.lang.String getDescription() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2CpString(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.RobotSpecification.j4n_getDescription5));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/String;")]
+ public virtual global::java.lang.String getRobocodeVersion() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2CpString(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.RobotSpecification.j4n_getRobocodeVersion6));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/String;")]
+ public virtual global::java.lang.String getWebpage() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2CpString(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.RobotSpecification.j4n_getWebpage7));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/String;")]
+ public virtual global::java.lang.String getAuthorName() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2CpString(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.RobotSpecification.j4n_getAuthorName8));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/String;")]
+ public virtual global::java.lang.String getTeamId() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2CpString(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.RobotSpecification.j4n_getTeamId9));
+ }
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.RobotSpecification(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattleCompletedEvent.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattleCompletedEvent.generated.cs
new file mode 100644
index 0000000..025761f
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattleCompletedEvent.generated.cs
@@ -0,0 +1,94 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control.events {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaClassAttribute()]
+ public partial class BattleCompletedEvent : global::robocode.control.events.BattleEvent {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getBattleRules0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getSortedResults1;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getIndexedResults2;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorBattleCompletedEvent3;
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/BattleRules;[Lrobocode/BattleResults;)V")]
+ public BattleCompletedEvent(global::java.lang.Object par0, java.lang.Object[] par1) :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 14)){
+ @__env.NewObject(global::robocode.control.events.BattleCompletedEvent.staticClass, global::robocode.control.events.BattleCompletedEvent.j4n__ctorBattleCompletedEvent3, this, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0), global::net.sf.jni4net.utils.Convertor.ParArrayStrongCp2J(@__env, par1));
+ }
+ }
+
+ protected BattleCompletedEvent(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.events.BattleCompletedEvent.staticClass;
+ }
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.events.BattleCompletedEvent.staticClass = @__class;
+ global::robocode.control.events.BattleCompletedEvent.j4n_getBattleRules0 = @__env.GetMethodID(global::robocode.control.events.BattleCompletedEvent.staticClass, "getBattleRules", "()Lrobocode/BattleRules;");
+ global::robocode.control.events.BattleCompletedEvent.j4n_getSortedResults1 = @__env.GetMethodID(global::robocode.control.events.BattleCompletedEvent.staticClass, "getSortedResults", "()[Lrobocode/BattleResults;");
+ global::robocode.control.events.BattleCompletedEvent.j4n_getIndexedResults2 = @__env.GetMethodID(global::robocode.control.events.BattleCompletedEvent.staticClass, "getIndexedResults", "()[Lrobocode/BattleResults;");
+ global::robocode.control.events.BattleCompletedEvent.j4n__ctorBattleCompletedEvent3 = @__env.GetMethodID(global::robocode.control.events.BattleCompletedEvent.staticClass, "", "(Lrobocode/BattleRules;[Lrobocode/BattleResults;)V");
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Lrobocode/BattleRules;")]
+ public virtual global::java.lang.Object getBattleRules() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.events.BattleCompletedEvent.j4n_getBattleRules0));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()[Lrobocode/BattleResults;")]
+ public virtual java.lang.Object[] getSortedResults() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.ArrayStrongJ2Cp(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.events.BattleCompletedEvent.j4n_getSortedResults1));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()[Lrobocode/BattleResults;")]
+ public virtual java.lang.Object[] getIndexedResults() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.ArrayStrongJ2Cp(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.events.BattleCompletedEvent.j4n_getIndexedResults2));
+ }
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.events.BattleCompletedEvent(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattleErrorEvent.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattleErrorEvent.generated.cs
new file mode 100644
index 0000000..0b4b42d
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattleErrorEvent.generated.cs
@@ -0,0 +1,72 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control.events {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaClassAttribute()]
+ public partial class BattleErrorEvent : global::robocode.control.events.BattleEvent {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getError0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorBattleErrorEvent1;
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Ljava/lang/String;)V")]
+ public BattleErrorEvent(global::java.lang.String par0) :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.NewObject(global::robocode.control.events.BattleErrorEvent.staticClass, global::robocode.control.events.BattleErrorEvent.j4n__ctorBattleErrorEvent1, this, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0));
+ }
+ }
+
+ protected BattleErrorEvent(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.events.BattleErrorEvent.staticClass;
+ }
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.events.BattleErrorEvent.staticClass = @__class;
+ global::robocode.control.events.BattleErrorEvent.j4n_getError0 = @__env.GetMethodID(global::robocode.control.events.BattleErrorEvent.staticClass, "getError", "()Ljava/lang/String;");
+ global::robocode.control.events.BattleErrorEvent.j4n__ctorBattleErrorEvent1 = @__env.GetMethodID(global::robocode.control.events.BattleErrorEvent.staticClass, "", "(Ljava/lang/String;)V");
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/String;")]
+ public virtual global::java.lang.String getError() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2CpString(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.events.BattleErrorEvent.j4n_getError0));
+ }
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.events.BattleErrorEvent(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattleEvent.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattleEvent.generated.cs
new file mode 100644
index 0000000..0698cd0
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattleEvent.generated.cs
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control.events {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaClassAttribute()]
+ public partial class BattleEvent : global::java.lang.Object {
+
+ internal new static global::java.lang.Class staticClass;
+
+ protected BattleEvent(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.events.BattleEvent.staticClass;
+ }
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.events.BattleEvent.staticClass = @__class;
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.events.BattleEvent(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattleFinishedEvent.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattleFinishedEvent.generated.cs
new file mode 100644
index 0000000..af8c2a8
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattleFinishedEvent.generated.cs
@@ -0,0 +1,72 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control.events {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaClassAttribute()]
+ public partial class BattleFinishedEvent : global::robocode.control.events.BattleEvent {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_isAborted0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorBattleFinishedEvent1;
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Z)V")]
+ public BattleFinishedEvent(bool par0) :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.NewObject(global::robocode.control.events.BattleFinishedEvent.staticClass, global::robocode.control.events.BattleFinishedEvent.j4n__ctorBattleFinishedEvent1, this, global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par0));
+ }
+ }
+
+ protected BattleFinishedEvent(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.events.BattleFinishedEvent.staticClass;
+ }
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.events.BattleFinishedEvent.staticClass = @__class;
+ global::robocode.control.events.BattleFinishedEvent.j4n_isAborted0 = @__env.GetMethodID(global::robocode.control.events.BattleFinishedEvent.staticClass, "isAborted", "()Z");
+ global::robocode.control.events.BattleFinishedEvent.j4n__ctorBattleFinishedEvent1 = @__env.GetMethodID(global::robocode.control.events.BattleFinishedEvent.staticClass, "", "(Z)V");
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Z")]
+ public virtual bool isAborted() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((bool)(@__env.CallBooleanMethod(this, global::robocode.control.events.BattleFinishedEvent.j4n_isAborted0)));
+ }
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.events.BattleFinishedEvent(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattleMessageEvent.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattleMessageEvent.generated.cs
new file mode 100644
index 0000000..27bf827
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattleMessageEvent.generated.cs
@@ -0,0 +1,72 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control.events {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaClassAttribute()]
+ public partial class BattleMessageEvent : global::robocode.control.events.BattleEvent {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getMessage0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorBattleMessageEvent1;
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Ljava/lang/String;)V")]
+ public BattleMessageEvent(global::java.lang.String par0) :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.NewObject(global::robocode.control.events.BattleMessageEvent.staticClass, global::robocode.control.events.BattleMessageEvent.j4n__ctorBattleMessageEvent1, this, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0));
+ }
+ }
+
+ protected BattleMessageEvent(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.events.BattleMessageEvent.staticClass;
+ }
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.events.BattleMessageEvent.staticClass = @__class;
+ global::robocode.control.events.BattleMessageEvent.j4n_getMessage0 = @__env.GetMethodID(global::robocode.control.events.BattleMessageEvent.staticClass, "getMessage", "()Ljava/lang/String;");
+ global::robocode.control.events.BattleMessageEvent.j4n__ctorBattleMessageEvent1 = @__env.GetMethodID(global::robocode.control.events.BattleMessageEvent.staticClass, "", "(Ljava/lang/String;)V");
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/String;")]
+ public virtual global::java.lang.String getMessage() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2CpString(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.events.BattleMessageEvent.j4n_getMessage0));
+ }
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.events.BattleMessageEvent(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattlePausedEvent.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattlePausedEvent.generated.cs
new file mode 100644
index 0000000..4cb8dfd
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattlePausedEvent.generated.cs
@@ -0,0 +1,61 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control.events {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaClassAttribute()]
+ public partial class BattlePausedEvent : global::robocode.control.events.BattleEvent {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorBattlePausedEvent0;
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()V")]
+ public BattlePausedEvent() :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ @__env.NewObject(global::robocode.control.events.BattlePausedEvent.staticClass, global::robocode.control.events.BattlePausedEvent.j4n__ctorBattlePausedEvent0, this);
+ }
+ }
+
+ protected BattlePausedEvent(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.events.BattlePausedEvent.staticClass;
+ }
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.events.BattlePausedEvent.staticClass = @__class;
+ global::robocode.control.events.BattlePausedEvent.j4n__ctorBattlePausedEvent0 = @__env.GetMethodID(global::robocode.control.events.BattlePausedEvent.staticClass, "", "()V");
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.events.BattlePausedEvent(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattleResumedEvent.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattleResumedEvent.generated.cs
new file mode 100644
index 0000000..e3de918
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattleResumedEvent.generated.cs
@@ -0,0 +1,61 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control.events {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaClassAttribute()]
+ public partial class BattleResumedEvent : global::robocode.control.events.BattleEvent {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorBattleResumedEvent0;
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()V")]
+ public BattleResumedEvent() :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ @__env.NewObject(global::robocode.control.events.BattleResumedEvent.staticClass, global::robocode.control.events.BattleResumedEvent.j4n__ctorBattleResumedEvent0, this);
+ }
+ }
+
+ protected BattleResumedEvent(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.events.BattleResumedEvent.staticClass;
+ }
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.events.BattleResumedEvent.staticClass = @__class;
+ global::robocode.control.events.BattleResumedEvent.j4n__ctorBattleResumedEvent0 = @__env.GetMethodID(global::robocode.control.events.BattleResumedEvent.staticClass, "", "()V");
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.events.BattleResumedEvent(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattleStartedEvent.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattleStartedEvent.generated.cs
new file mode 100644
index 0000000..5efc401
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/BattleStartedEvent.generated.cs
@@ -0,0 +1,94 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control.events {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaClassAttribute()]
+ public partial class BattleStartedEvent : global::robocode.control.events.BattleEvent {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getBattleRules0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_isReplay1;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getRobotsCount2;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorBattleStartedEvent3;
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/BattleRules;IZ)V")]
+ public BattleStartedEvent(global::java.lang.Object par0, int par1, bool par2) :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 16)){
+ @__env.NewObject(global::robocode.control.events.BattleStartedEvent.staticClass, global::robocode.control.events.BattleStartedEvent.j4n__ctorBattleStartedEvent3, this, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par1), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par2));
+ }
+ }
+
+ protected BattleStartedEvent(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.events.BattleStartedEvent.staticClass;
+ }
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.events.BattleStartedEvent.staticClass = @__class;
+ global::robocode.control.events.BattleStartedEvent.j4n_getBattleRules0 = @__env.GetMethodID(global::robocode.control.events.BattleStartedEvent.staticClass, "getBattleRules", "()Lrobocode/BattleRules;");
+ global::robocode.control.events.BattleStartedEvent.j4n_isReplay1 = @__env.GetMethodID(global::robocode.control.events.BattleStartedEvent.staticClass, "isReplay", "()Z");
+ global::robocode.control.events.BattleStartedEvent.j4n_getRobotsCount2 = @__env.GetMethodID(global::robocode.control.events.BattleStartedEvent.staticClass, "getRobotsCount", "()I");
+ global::robocode.control.events.BattleStartedEvent.j4n__ctorBattleStartedEvent3 = @__env.GetMethodID(global::robocode.control.events.BattleStartedEvent.staticClass, "", "(Lrobocode/BattleRules;IZ)V");
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Lrobocode/BattleRules;")]
+ public virtual global::java.lang.Object getBattleRules() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.events.BattleStartedEvent.j4n_getBattleRules0));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Z")]
+ public virtual bool isReplay() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((bool)(@__env.CallBooleanMethod(this, global::robocode.control.events.BattleStartedEvent.j4n_isReplay1)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ public virtual int getRobotsCount() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.events.BattleStartedEvent.j4n_getRobotsCount2)));
+ }
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.events.BattleStartedEvent(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/IBattleListener.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/IBattleListener.generated.cs
new file mode 100644
index 0000000..bc05339
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/IBattleListener.generated.cs
@@ -0,0 +1,331 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control.events {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaInterfaceAttribute()]
+ public partial interface IBattleListener {
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/events/BattleStartedEvent;)V")]
+ void onBattleStarted(global::robocode.control.events.BattleStartedEvent par0);
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/events/BattleFinishedEvent;)V")]
+ void onBattleFinished(global::robocode.control.events.BattleFinishedEvent par0);
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/events/BattleCompletedEvent;)V")]
+ void onBattleCompleted(global::robocode.control.events.BattleCompletedEvent par0);
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/events/BattlePausedEvent;)V")]
+ void onBattlePaused(global::robocode.control.events.BattlePausedEvent par0);
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/events/BattleResumedEvent;)V")]
+ void onBattleResumed(global::robocode.control.events.BattleResumedEvent par0);
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/events/RoundStartedEvent;)V")]
+ void onRoundStarted(global::robocode.control.events.RoundStartedEvent par0);
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/events/RoundEndedEvent;)V")]
+ void onRoundEnded(global::robocode.control.events.RoundEndedEvent par0);
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/events/TurnStartedEvent;)V")]
+ void onTurnStarted(global::robocode.control.events.TurnStartedEvent par0);
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/events/TurnEndedEvent;)V")]
+ void onTurnEnded(global::robocode.control.events.TurnEndedEvent par0);
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/events/BattleMessageEvent;)V")]
+ void onBattleMessage(global::robocode.control.events.BattleMessageEvent par0);
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/events/BattleErrorEvent;)V")]
+ void onBattleError(global::robocode.control.events.BattleErrorEvent par0);
+ }
+ #endregion
+
+ #region Component Designer generated code
+ public partial class IBattleListener_ {
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.events.@__IBattleListener.staticClass;
+ }
+ }
+ }
+ #endregion
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaProxyAttribute(typeof(global::robocode.control.events.IBattleListener), typeof(global::robocode.control.events.IBattleListener_))]
+ [global::net.sf.jni4net.attributes.ClrWrapperAttribute(typeof(global::robocode.control.events.IBattleListener), typeof(global::robocode.control.events.IBattleListener_))]
+ internal sealed partial class @__IBattleListener : global::java.lang.Object, global::robocode.control.events.IBattleListener {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_onBattleStarted0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_onBattleFinished1;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_onBattleCompleted2;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_onBattlePaused3;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_onBattleResumed4;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_onRoundStarted5;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_onRoundEnded6;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_onTurnStarted7;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_onTurnEnded8;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_onBattleMessage9;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_onBattleError10;
+
+ private @__IBattleListener(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.events.@__IBattleListener.staticClass = @__class;
+ global::robocode.control.events.@__IBattleListener.j4n_onBattleStarted0 = @__env.GetMethodID(global::robocode.control.events.@__IBattleListener.staticClass, "onBattleStarted", "(Lrobocode/control/events/BattleStartedEvent;)V");
+ global::robocode.control.events.@__IBattleListener.j4n_onBattleFinished1 = @__env.GetMethodID(global::robocode.control.events.@__IBattleListener.staticClass, "onBattleFinished", "(Lrobocode/control/events/BattleFinishedEvent;)V");
+ global::robocode.control.events.@__IBattleListener.j4n_onBattleCompleted2 = @__env.GetMethodID(global::robocode.control.events.@__IBattleListener.staticClass, "onBattleCompleted", "(Lrobocode/control/events/BattleCompletedEvent;)V");
+ global::robocode.control.events.@__IBattleListener.j4n_onBattlePaused3 = @__env.GetMethodID(global::robocode.control.events.@__IBattleListener.staticClass, "onBattlePaused", "(Lrobocode/control/events/BattlePausedEvent;)V");
+ global::robocode.control.events.@__IBattleListener.j4n_onBattleResumed4 = @__env.GetMethodID(global::robocode.control.events.@__IBattleListener.staticClass, "onBattleResumed", "(Lrobocode/control/events/BattleResumedEvent;)V");
+ global::robocode.control.events.@__IBattleListener.j4n_onRoundStarted5 = @__env.GetMethodID(global::robocode.control.events.@__IBattleListener.staticClass, "onRoundStarted", "(Lrobocode/control/events/RoundStartedEvent;)V");
+ global::robocode.control.events.@__IBattleListener.j4n_onRoundEnded6 = @__env.GetMethodID(global::robocode.control.events.@__IBattleListener.staticClass, "onRoundEnded", "(Lrobocode/control/events/RoundEndedEvent;)V");
+ global::robocode.control.events.@__IBattleListener.j4n_onTurnStarted7 = @__env.GetMethodID(global::robocode.control.events.@__IBattleListener.staticClass, "onTurnStarted", "(Lrobocode/control/events/TurnStartedEvent;)V");
+ global::robocode.control.events.@__IBattleListener.j4n_onTurnEnded8 = @__env.GetMethodID(global::robocode.control.events.@__IBattleListener.staticClass, "onTurnEnded", "(Lrobocode/control/events/TurnEndedEvent;)V");
+ global::robocode.control.events.@__IBattleListener.j4n_onBattleMessage9 = @__env.GetMethodID(global::robocode.control.events.@__IBattleListener.staticClass, "onBattleMessage", "(Lrobocode/control/events/BattleMessageEvent;)V");
+ global::robocode.control.events.@__IBattleListener.j4n_onBattleError10 = @__env.GetMethodID(global::robocode.control.events.@__IBattleListener.staticClass, "onBattleError", "(Lrobocode/control/events/BattleErrorEvent;)V");
+ }
+
+ public void onBattleStarted(global::robocode.control.events.BattleStartedEvent par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.CallVoidMethod(this, global::robocode.control.events.@__IBattleListener.j4n_onBattleStarted0, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0));
+ }
+ }
+
+ public void onBattleFinished(global::robocode.control.events.BattleFinishedEvent par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.CallVoidMethod(this, global::robocode.control.events.@__IBattleListener.j4n_onBattleFinished1, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0));
+ }
+ }
+
+ public void onBattleCompleted(global::robocode.control.events.BattleCompletedEvent par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.CallVoidMethod(this, global::robocode.control.events.@__IBattleListener.j4n_onBattleCompleted2, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0));
+ }
+ }
+
+ public void onBattlePaused(global::robocode.control.events.BattlePausedEvent par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.CallVoidMethod(this, global::robocode.control.events.@__IBattleListener.j4n_onBattlePaused3, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0));
+ }
+ }
+
+ public void onBattleResumed(global::robocode.control.events.BattleResumedEvent par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.CallVoidMethod(this, global::robocode.control.events.@__IBattleListener.j4n_onBattleResumed4, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0));
+ }
+ }
+
+ public void onRoundStarted(global::robocode.control.events.RoundStartedEvent par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.CallVoidMethod(this, global::robocode.control.events.@__IBattleListener.j4n_onRoundStarted5, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0));
+ }
+ }
+
+ public void onRoundEnded(global::robocode.control.events.RoundEndedEvent par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.CallVoidMethod(this, global::robocode.control.events.@__IBattleListener.j4n_onRoundEnded6, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0));
+ }
+ }
+
+ public void onTurnStarted(global::robocode.control.events.TurnStartedEvent par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.CallVoidMethod(this, global::robocode.control.events.@__IBattleListener.j4n_onTurnStarted7, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0));
+ }
+ }
+
+ public void onTurnEnded(global::robocode.control.events.TurnEndedEvent par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.CallVoidMethod(this, global::robocode.control.events.@__IBattleListener.j4n_onTurnEnded8, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0));
+ }
+ }
+
+ public void onBattleMessage(global::robocode.control.events.BattleMessageEvent par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.CallVoidMethod(this, global::robocode.control.events.@__IBattleListener.j4n_onBattleMessage9, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0));
+ }
+ }
+
+ public void onBattleError(global::robocode.control.events.BattleErrorEvent par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.CallVoidMethod(this, global::robocode.control.events.@__IBattleListener.j4n_onBattleError10, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0));
+ }
+ }
+
+ private static global::System.Collections.Generic.List @__Init(global::net.sf.jni4net.jni.JNIEnv @__env, global::java.lang.Class @__class) {
+ global::System.Type @__type = typeof(__IBattleListener);
+ global::System.Collections.Generic.List methods = new global::System.Collections.Generic.List();
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "onBattleStarted", "onBattleStarted0", "(Lrobocode/control/events/BattleStartedEvent;)V"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "onBattleFinished", "onBattleFinished1", "(Lrobocode/control/events/BattleFinishedEvent;)V"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "onBattleCompleted", "onBattleCompleted2", "(Lrobocode/control/events/BattleCompletedEvent;)V"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "onBattlePaused", "onBattlePaused3", "(Lrobocode/control/events/BattlePausedEvent;)V"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "onBattleResumed", "onBattleResumed4", "(Lrobocode/control/events/BattleResumedEvent;)V"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "onRoundStarted", "onRoundStarted5", "(Lrobocode/control/events/RoundStartedEvent;)V"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "onRoundEnded", "onRoundEnded6", "(Lrobocode/control/events/RoundEndedEvent;)V"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "onTurnStarted", "onTurnStarted7", "(Lrobocode/control/events/TurnStartedEvent;)V"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "onTurnEnded", "onTurnEnded8", "(Lrobocode/control/events/TurnEndedEvent;)V"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "onBattleMessage", "onBattleMessage9", "(Lrobocode/control/events/BattleMessageEvent;)V"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "onBattleError", "onBattleError10", "(Lrobocode/control/events/BattleErrorEvent;)V"));
+ return methods;
+ }
+
+ private static void onBattleStarted0(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, global::net.sf.jni4net.utils.JniLocalHandle par0) {
+ // (Lrobocode/control/events/BattleStartedEvent;)V
+ // (Lrobocode/control/events/BattleStartedEvent;)V
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ try {
+ global::robocode.control.events.IBattleListener @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__real.onBattleStarted(global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, par0));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ }
+
+ private static void onBattleFinished1(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, global::net.sf.jni4net.utils.JniLocalHandle par0) {
+ // (Lrobocode/control/events/BattleFinishedEvent;)V
+ // (Lrobocode/control/events/BattleFinishedEvent;)V
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ try {
+ global::robocode.control.events.IBattleListener @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__real.onBattleFinished(global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, par0));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ }
+
+ private static void onBattleCompleted2(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, global::net.sf.jni4net.utils.JniLocalHandle par0) {
+ // (Lrobocode/control/events/BattleCompletedEvent;)V
+ // (Lrobocode/control/events/BattleCompletedEvent;)V
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ try {
+ global::robocode.control.events.IBattleListener @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__real.onBattleCompleted(global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, par0));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ }
+
+ private static void onBattlePaused3(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, global::net.sf.jni4net.utils.JniLocalHandle par0) {
+ // (Lrobocode/control/events/BattlePausedEvent;)V
+ // (Lrobocode/control/events/BattlePausedEvent;)V
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ try {
+ global::robocode.control.events.IBattleListener @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__real.onBattlePaused(global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, par0));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ }
+
+ private static void onBattleResumed4(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, global::net.sf.jni4net.utils.JniLocalHandle par0) {
+ // (Lrobocode/control/events/BattleResumedEvent;)V
+ // (Lrobocode/control/events/BattleResumedEvent;)V
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ try {
+ global::robocode.control.events.IBattleListener @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__real.onBattleResumed(global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, par0));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ }
+
+ private static void onRoundStarted5(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, global::net.sf.jni4net.utils.JniLocalHandle par0) {
+ // (Lrobocode/control/events/RoundStartedEvent;)V
+ // (Lrobocode/control/events/RoundStartedEvent;)V
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ try {
+ global::robocode.control.events.IBattleListener @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__real.onRoundStarted(global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, par0));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ }
+
+ private static void onRoundEnded6(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, global::net.sf.jni4net.utils.JniLocalHandle par0) {
+ // (Lrobocode/control/events/RoundEndedEvent;)V
+ // (Lrobocode/control/events/RoundEndedEvent;)V
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ try {
+ global::robocode.control.events.IBattleListener @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__real.onRoundEnded(global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, par0));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ }
+
+ private static void onTurnStarted7(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, global::net.sf.jni4net.utils.JniLocalHandle par0) {
+ // (Lrobocode/control/events/TurnStartedEvent;)V
+ // (Lrobocode/control/events/TurnStartedEvent;)V
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ try {
+ global::robocode.control.events.IBattleListener @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__real.onTurnStarted(global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, par0));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ }
+
+ private static void onTurnEnded8(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, global::net.sf.jni4net.utils.JniLocalHandle par0) {
+ // (Lrobocode/control/events/TurnEndedEvent;)V
+ // (Lrobocode/control/events/TurnEndedEvent;)V
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ try {
+ global::robocode.control.events.IBattleListener @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__real.onTurnEnded(global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, par0));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ }
+
+ private static void onBattleMessage9(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, global::net.sf.jni4net.utils.JniLocalHandle par0) {
+ // (Lrobocode/control/events/BattleMessageEvent;)V
+ // (Lrobocode/control/events/BattleMessageEvent;)V
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ try {
+ global::robocode.control.events.IBattleListener @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__real.onBattleMessage(global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, par0));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ }
+
+ private static void onBattleError10(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, global::net.sf.jni4net.utils.JniLocalHandle par0) {
+ // (Lrobocode/control/events/BattleErrorEvent;)V
+ // (Lrobocode/control/events/BattleErrorEvent;)V
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ try {
+ global::robocode.control.events.IBattleListener @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__real.onBattleError(global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, par0));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.events.@__IBattleListener(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/RoundEndedEvent.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/RoundEndedEvent.generated.cs
new file mode 100644
index 0000000..570931f
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/RoundEndedEvent.generated.cs
@@ -0,0 +1,94 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control.events {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaClassAttribute()]
+ public partial class RoundEndedEvent : global::robocode.control.events.BattleEvent {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getRound0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getTurns1;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getTotalTurns2;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorRoundEndedEvent3;
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(III)V")]
+ public RoundEndedEvent(int par0, int par1, int par2) :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 16)){
+ @__env.NewObject(global::robocode.control.events.RoundEndedEvent.staticClass, global::robocode.control.events.RoundEndedEvent.j4n__ctorRoundEndedEvent3, this, global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par0), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par1), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par2));
+ }
+ }
+
+ protected RoundEndedEvent(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.events.RoundEndedEvent.staticClass;
+ }
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.events.RoundEndedEvent.staticClass = @__class;
+ global::robocode.control.events.RoundEndedEvent.j4n_getRound0 = @__env.GetMethodID(global::robocode.control.events.RoundEndedEvent.staticClass, "getRound", "()I");
+ global::robocode.control.events.RoundEndedEvent.j4n_getTurns1 = @__env.GetMethodID(global::robocode.control.events.RoundEndedEvent.staticClass, "getTurns", "()I");
+ global::robocode.control.events.RoundEndedEvent.j4n_getTotalTurns2 = @__env.GetMethodID(global::robocode.control.events.RoundEndedEvent.staticClass, "getTotalTurns", "()I");
+ global::robocode.control.events.RoundEndedEvent.j4n__ctorRoundEndedEvent3 = @__env.GetMethodID(global::robocode.control.events.RoundEndedEvent.staticClass, "", "(III)V");
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ public virtual int getRound() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.events.RoundEndedEvent.j4n_getRound0)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ public virtual int getTurns() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.events.RoundEndedEvent.j4n_getTurns1)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ public virtual int getTotalTurns() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.events.RoundEndedEvent.j4n_getTotalTurns2)));
+ }
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.events.RoundEndedEvent(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/RoundStartedEvent.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/RoundStartedEvent.generated.cs
new file mode 100644
index 0000000..0ffd0f6
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/RoundStartedEvent.generated.cs
@@ -0,0 +1,83 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control.events {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaClassAttribute()]
+ public partial class RoundStartedEvent : global::robocode.control.events.BattleEvent {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getRound0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getStartSnapshot1;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorRoundStartedEvent2;
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/snapshot/ITurnSnapshot;I)V")]
+ public RoundStartedEvent(global::robocode.control.snapshot.ITurnSnapshot par0, int par1) :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 14)){
+ @__env.NewObject(global::robocode.control.events.RoundStartedEvent.staticClass, global::robocode.control.events.RoundStartedEvent.j4n__ctorRoundStartedEvent2, this, global::net.sf.jni4net.utils.Convertor.ParFullC2J(@__env, par0), global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par1));
+ }
+ }
+
+ protected RoundStartedEvent(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.events.RoundStartedEvent.staticClass;
+ }
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.events.RoundStartedEvent.staticClass = @__class;
+ global::robocode.control.events.RoundStartedEvent.j4n_getRound0 = @__env.GetMethodID(global::robocode.control.events.RoundStartedEvent.staticClass, "getRound", "()I");
+ global::robocode.control.events.RoundStartedEvent.j4n_getStartSnapshot1 = @__env.GetMethodID(global::robocode.control.events.RoundStartedEvent.staticClass, "getStartSnapshot", "()Lrobocode/control/snapshot/ITurnSnapshot;");
+ global::robocode.control.events.RoundStartedEvent.j4n__ctorRoundStartedEvent2 = @__env.GetMethodID(global::robocode.control.events.RoundStartedEvent.staticClass, "", "(Lrobocode/control/snapshot/ITurnSnapshot;I)V");
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ public virtual int getRound() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.events.RoundStartedEvent.j4n_getRound0)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Lrobocode/control/snapshot/ITurnSnapshot;")]
+ public virtual global::robocode.control.snapshot.ITurnSnapshot getStartSnapshot() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.events.RoundStartedEvent.j4n_getStartSnapshot1));
+ }
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.events.RoundStartedEvent(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/TurnEndedEvent.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/TurnEndedEvent.generated.cs
new file mode 100644
index 0000000..032500a
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/TurnEndedEvent.generated.cs
@@ -0,0 +1,72 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control.events {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaClassAttribute()]
+ public partial class TurnEndedEvent : global::robocode.control.events.BattleEvent {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getTurnSnapshot0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorTurnEndedEvent1;
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Lrobocode/control/snapshot/ITurnSnapshot;)V")]
+ public TurnEndedEvent(global::robocode.control.snapshot.ITurnSnapshot par0) :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ @__env.NewObject(global::robocode.control.events.TurnEndedEvent.staticClass, global::robocode.control.events.TurnEndedEvent.j4n__ctorTurnEndedEvent1, this, global::net.sf.jni4net.utils.Convertor.ParFullC2J(@__env, par0));
+ }
+ }
+
+ protected TurnEndedEvent(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.events.TurnEndedEvent.staticClass;
+ }
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.events.TurnEndedEvent.staticClass = @__class;
+ global::robocode.control.events.TurnEndedEvent.j4n_getTurnSnapshot0 = @__env.GetMethodID(global::robocode.control.events.TurnEndedEvent.staticClass, "getTurnSnapshot", "()Lrobocode/control/snapshot/ITurnSnapshot;");
+ global::robocode.control.events.TurnEndedEvent.j4n__ctorTurnEndedEvent1 = @__env.GetMethodID(global::robocode.control.events.TurnEndedEvent.staticClass, "", "(Lrobocode/control/snapshot/ITurnSnapshot;)V");
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Lrobocode/control/snapshot/ITurnSnapshot;")]
+ public virtual global::robocode.control.snapshot.ITurnSnapshot getTurnSnapshot() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.events.TurnEndedEvent.j4n_getTurnSnapshot0));
+ }
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.events.TurnEndedEvent(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/TurnStartedEvent.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/TurnStartedEvent.generated.cs
new file mode 100644
index 0000000..118276b
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/events/TurnStartedEvent.generated.cs
@@ -0,0 +1,61 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control.events {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaClassAttribute()]
+ public partial class TurnStartedEvent : global::robocode.control.events.BattleEvent {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n__ctorTurnStartedEvent0;
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()V")]
+ public TurnStartedEvent() :
+ base(((global::net.sf.jni4net.jni.JNIEnv)(null))) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ @__env.NewObject(global::robocode.control.events.TurnStartedEvent.staticClass, global::robocode.control.events.TurnStartedEvent.j4n__ctorTurnStartedEvent0, this);
+ }
+ }
+
+ protected TurnStartedEvent(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.events.TurnStartedEvent.staticClass;
+ }
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.events.TurnStartedEvent.staticClass = @__class;
+ global::robocode.control.events.TurnStartedEvent.j4n__ctorTurnStartedEvent0 = @__env.GetMethodID(global::robocode.control.events.TurnStartedEvent.staticClass, "", "()V");
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.events.TurnStartedEvent(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/snapshot/BulletState.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/snapshot/BulletState.generated.cs
new file mode 100644
index 0000000..6b49adf
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/snapshot/BulletState.generated.cs
@@ -0,0 +1,195 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control.snapshot {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaClassAttribute()]
+ public partial class BulletState : global::java.lang.Object {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_values0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_valueOf1;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getValue2;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_toState3;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_isActive4;
+
+ internal static global::net.sf.jni4net.jni.FieldId j4n_FIRED5;
+
+ internal static global::net.sf.jni4net.jni.FieldId j4n_MOVING6;
+
+ internal static global::net.sf.jni4net.jni.FieldId j4n_HIT_VICTIM7;
+
+ internal static global::net.sf.jni4net.jni.FieldId j4n_HIT_BULLET8;
+
+ internal static global::net.sf.jni4net.jni.FieldId j4n_HIT_WALL9;
+
+ internal static global::net.sf.jni4net.jni.FieldId j4n_EXPLODED10;
+
+ internal static global::net.sf.jni4net.jni.FieldId j4n_INACTIVE11;
+
+ protected BulletState(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.snapshot.BulletState.staticClass;
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("Lrobocode/control/snapshot/BulletState;")]
+ public static global::robocode.control.snapshot.BulletState FIRED {
+ get {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.GetStaticObjectFieldPtr(global::robocode.control.snapshot.BulletState.staticClass, global::robocode.control.snapshot.BulletState.j4n_FIRED5));
+ }
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("Lrobocode/control/snapshot/BulletState;")]
+ public static global::robocode.control.snapshot.BulletState MOVING {
+ get {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.GetStaticObjectFieldPtr(global::robocode.control.snapshot.BulletState.staticClass, global::robocode.control.snapshot.BulletState.j4n_MOVING6));
+ }
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("Lrobocode/control/snapshot/BulletState;")]
+ public static global::robocode.control.snapshot.BulletState HIT_VICTIM {
+ get {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.GetStaticObjectFieldPtr(global::robocode.control.snapshot.BulletState.staticClass, global::robocode.control.snapshot.BulletState.j4n_HIT_VICTIM7));
+ }
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("Lrobocode/control/snapshot/BulletState;")]
+ public static global::robocode.control.snapshot.BulletState HIT_BULLET {
+ get {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.GetStaticObjectFieldPtr(global::robocode.control.snapshot.BulletState.staticClass, global::robocode.control.snapshot.BulletState.j4n_HIT_BULLET8));
+ }
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("Lrobocode/control/snapshot/BulletState;")]
+ public static global::robocode.control.snapshot.BulletState HIT_WALL {
+ get {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.GetStaticObjectFieldPtr(global::robocode.control.snapshot.BulletState.staticClass, global::robocode.control.snapshot.BulletState.j4n_HIT_WALL9));
+ }
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("Lrobocode/control/snapshot/BulletState;")]
+ public static global::robocode.control.snapshot.BulletState EXPLODED {
+ get {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.GetStaticObjectFieldPtr(global::robocode.control.snapshot.BulletState.staticClass, global::robocode.control.snapshot.BulletState.j4n_EXPLODED10));
+ }
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("Lrobocode/control/snapshot/BulletState;")]
+ public static global::robocode.control.snapshot.BulletState INACTIVE {
+ get {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.GetStaticObjectFieldPtr(global::robocode.control.snapshot.BulletState.staticClass, global::robocode.control.snapshot.BulletState.j4n_INACTIVE11));
+ }
+ }
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.snapshot.BulletState.staticClass = @__class;
+ global::robocode.control.snapshot.BulletState.j4n_values0 = @__env.GetStaticMethodID(global::robocode.control.snapshot.BulletState.staticClass, "values", "()[Lrobocode/control/snapshot/BulletState;");
+ global::robocode.control.snapshot.BulletState.j4n_valueOf1 = @__env.GetStaticMethodID(global::robocode.control.snapshot.BulletState.staticClass, "valueOf", "(Ljava/lang/String;)Lrobocode/control/snapshot/BulletState;");
+ global::robocode.control.snapshot.BulletState.j4n_getValue2 = @__env.GetMethodID(global::robocode.control.snapshot.BulletState.staticClass, "getValue", "()I");
+ global::robocode.control.snapshot.BulletState.j4n_toState3 = @__env.GetStaticMethodID(global::robocode.control.snapshot.BulletState.staticClass, "toState", "(I)Lrobocode/control/snapshot/BulletState;");
+ global::robocode.control.snapshot.BulletState.j4n_isActive4 = @__env.GetMethodID(global::robocode.control.snapshot.BulletState.staticClass, "isActive", "()Z");
+ global::robocode.control.snapshot.BulletState.j4n_FIRED5 = @__env.GetStaticFieldID(global::robocode.control.snapshot.BulletState.staticClass, "FIRED", "Lrobocode/control/snapshot/BulletState;");
+ global::robocode.control.snapshot.BulletState.j4n_MOVING6 = @__env.GetStaticFieldID(global::robocode.control.snapshot.BulletState.staticClass, "MOVING", "Lrobocode/control/snapshot/BulletState;");
+ global::robocode.control.snapshot.BulletState.j4n_HIT_VICTIM7 = @__env.GetStaticFieldID(global::robocode.control.snapshot.BulletState.staticClass, "HIT_VICTIM", "Lrobocode/control/snapshot/BulletState;");
+ global::robocode.control.snapshot.BulletState.j4n_HIT_BULLET8 = @__env.GetStaticFieldID(global::robocode.control.snapshot.BulletState.staticClass, "HIT_BULLET", "Lrobocode/control/snapshot/BulletState;");
+ global::robocode.control.snapshot.BulletState.j4n_HIT_WALL9 = @__env.GetStaticFieldID(global::robocode.control.snapshot.BulletState.staticClass, "HIT_WALL", "Lrobocode/control/snapshot/BulletState;");
+ global::robocode.control.snapshot.BulletState.j4n_EXPLODED10 = @__env.GetStaticFieldID(global::robocode.control.snapshot.BulletState.staticClass, "EXPLODED", "Lrobocode/control/snapshot/BulletState;");
+ global::robocode.control.snapshot.BulletState.j4n_INACTIVE11 = @__env.GetStaticFieldID(global::robocode.control.snapshot.BulletState.staticClass, "INACTIVE", "Lrobocode/control/snapshot/BulletState;");
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()[Lrobocode/control/snapshot/BulletState;")]
+ public static robocode.control.snapshot.BulletState[] values() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.ArrayStrongJ2Cp(@__env, @__env.CallStaticObjectMethodPtr(global::robocode.control.snapshot.BulletState.staticClass, global::robocode.control.snapshot.BulletState.j4n_values0));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Ljava/lang/String;)Lrobocode/control/snapshot/BulletState;")]
+ public static global::robocode.control.snapshot.BulletState valueOf(global::java.lang.String par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.CallStaticObjectMethodPtr(global::robocode.control.snapshot.BulletState.staticClass, global::robocode.control.snapshot.BulletState.j4n_valueOf1, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ public virtual int getValue() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.snapshot.BulletState.j4n_getValue2)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(I)Lrobocode/control/snapshot/BulletState;")]
+ public static global::robocode.control.snapshot.BulletState toState(int par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.CallStaticObjectMethodPtr(global::robocode.control.snapshot.BulletState.staticClass, global::robocode.control.snapshot.BulletState.j4n_toState3, global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par0)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Z")]
+ public virtual bool isActive() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((bool)(@__env.CallBooleanMethod(this, global::robocode.control.snapshot.BulletState.j4n_isActive4)));
+ }
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.snapshot.BulletState(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/snapshot/IBulletSnapshot.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/snapshot/IBulletSnapshot.generated.cs
new file mode 100644
index 0000000..6c857ec
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/snapshot/IBulletSnapshot.generated.cs
@@ -0,0 +1,431 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control.snapshot {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaInterfaceAttribute()]
+ public partial interface IBulletSnapshot {
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Lrobocode/control/snapshot/BulletState;")]
+ global::robocode.control.snapshot.BulletState getState();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getX();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getY();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getHeading();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getPower();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getPaintX();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getPaintY();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ int getColor();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ int getFrame();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Z")]
+ bool isExplosion();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ int getExplosionImageIndex();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ int getBulletId();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ int getVictimIndex();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ int getOwnerIndex();
+ }
+ #endregion
+
+ #region Component Designer generated code
+ public partial class IBulletSnapshot_ {
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.snapshot.@__IBulletSnapshot.staticClass;
+ }
+ }
+ }
+ #endregion
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaProxyAttribute(typeof(global::robocode.control.snapshot.IBulletSnapshot), typeof(global::robocode.control.snapshot.IBulletSnapshot_))]
+ [global::net.sf.jni4net.attributes.ClrWrapperAttribute(typeof(global::robocode.control.snapshot.IBulletSnapshot), typeof(global::robocode.control.snapshot.IBulletSnapshot_))]
+ internal sealed partial class @__IBulletSnapshot : global::java.lang.Object, global::robocode.control.snapshot.IBulletSnapshot {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getState0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getX1;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getY2;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getHeading3;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getPower4;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getPaintX5;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getPaintY6;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getColor7;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getFrame8;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_isExplosion9;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getExplosionImageIndex10;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getBulletId11;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getVictimIndex12;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getOwnerIndex13;
+
+ private @__IBulletSnapshot(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.snapshot.@__IBulletSnapshot.staticClass = @__class;
+ global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getState0 = @__env.GetMethodID(global::robocode.control.snapshot.@__IBulletSnapshot.staticClass, "getState", "()Lrobocode/control/snapshot/BulletState;");
+ global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getX1 = @__env.GetMethodID(global::robocode.control.snapshot.@__IBulletSnapshot.staticClass, "getX", "()D");
+ global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getY2 = @__env.GetMethodID(global::robocode.control.snapshot.@__IBulletSnapshot.staticClass, "getY", "()D");
+ global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getHeading3 = @__env.GetMethodID(global::robocode.control.snapshot.@__IBulletSnapshot.staticClass, "getHeading", "()D");
+ global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getPower4 = @__env.GetMethodID(global::robocode.control.snapshot.@__IBulletSnapshot.staticClass, "getPower", "()D");
+ global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getPaintX5 = @__env.GetMethodID(global::robocode.control.snapshot.@__IBulletSnapshot.staticClass, "getPaintX", "()D");
+ global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getPaintY6 = @__env.GetMethodID(global::robocode.control.snapshot.@__IBulletSnapshot.staticClass, "getPaintY", "()D");
+ global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getColor7 = @__env.GetMethodID(global::robocode.control.snapshot.@__IBulletSnapshot.staticClass, "getColor", "()I");
+ global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getFrame8 = @__env.GetMethodID(global::robocode.control.snapshot.@__IBulletSnapshot.staticClass, "getFrame", "()I");
+ global::robocode.control.snapshot.@__IBulletSnapshot.j4n_isExplosion9 = @__env.GetMethodID(global::robocode.control.snapshot.@__IBulletSnapshot.staticClass, "isExplosion", "()Z");
+ global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getExplosionImageIndex10 = @__env.GetMethodID(global::robocode.control.snapshot.@__IBulletSnapshot.staticClass, "getExplosionImageIndex", "()I");
+ global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getBulletId11 = @__env.GetMethodID(global::robocode.control.snapshot.@__IBulletSnapshot.staticClass, "getBulletId", "()I");
+ global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getVictimIndex12 = @__env.GetMethodID(global::robocode.control.snapshot.@__IBulletSnapshot.staticClass, "getVictimIndex", "()I");
+ global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getOwnerIndex13 = @__env.GetMethodID(global::robocode.control.snapshot.@__IBulletSnapshot.staticClass, "getOwnerIndex", "()I");
+ }
+
+ public global::robocode.control.snapshot.BulletState getState() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getState0));
+ }
+ }
+
+ public double getX() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getX1)));
+ }
+ }
+
+ public double getY() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getY2)));
+ }
+ }
+
+ public double getHeading() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getHeading3)));
+ }
+ }
+
+ public double getPower() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getPower4)));
+ }
+ }
+
+ public double getPaintX() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getPaintX5)));
+ }
+ }
+
+ public double getPaintY() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getPaintY6)));
+ }
+ }
+
+ public int getColor() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getColor7)));
+ }
+ }
+
+ public int getFrame() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getFrame8)));
+ }
+ }
+
+ public bool isExplosion() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((bool)(@__env.CallBooleanMethod(this, global::robocode.control.snapshot.@__IBulletSnapshot.j4n_isExplosion9)));
+ }
+ }
+
+ public int getExplosionImageIndex() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getExplosionImageIndex10)));
+ }
+ }
+
+ public int getBulletId() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getBulletId11)));
+ }
+ }
+
+ public int getVictimIndex() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getVictimIndex12)));
+ }
+ }
+
+ public int getOwnerIndex() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.snapshot.@__IBulletSnapshot.j4n_getOwnerIndex13)));
+ }
+ }
+
+ private static global::System.Collections.Generic.List @__Init(global::net.sf.jni4net.jni.JNIEnv @__env, global::java.lang.Class @__class) {
+ global::System.Type @__type = typeof(__IBulletSnapshot);
+ global::System.Collections.Generic.List methods = new global::System.Collections.Generic.List();
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getState", "getState0", "()Lrobocode/control/snapshot/BulletState;"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getX", "getX1", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getY", "getY2", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getHeading", "getHeading3", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getPower", "getPower4", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getPaintX", "getPaintX5", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getPaintY", "getPaintY6", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getColor", "getColor7", "()I"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getFrame", "getFrame8", "()I"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "isExplosion", "isExplosion9", "()Z"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getExplosionImageIndex", "getExplosionImageIndex10", "()I"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getBulletId", "getBulletId11", "()I"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getVictimIndex", "getVictimIndex12", "()I"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getOwnerIndex", "getOwnerIndex13", "()I"));
+ return methods;
+ }
+
+ private static global::net.sf.jni4net.utils.JniHandle getState0(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()Lrobocode/control/snapshot/BulletState;
+ // ()Lrobocode/control/snapshot/BulletState;
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle);
+ try {
+ global::robocode.control.snapshot.IBulletSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = global::net.sf.jni4net.utils.Convertor.StrongCp2J(@__real.getState());
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getX1(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IBulletSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getX()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getY2(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IBulletSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getY()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getHeading3(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IBulletSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getHeading()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getPower4(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IBulletSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getPower()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getPaintX5(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IBulletSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getPaintX()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getPaintY6(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IBulletSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getPaintY()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static int getColor7(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()I
+ // ()I
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ int @__return = default(int);
+ try {
+ global::robocode.control.snapshot.IBulletSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((int)(@__real.getColor()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static int getFrame8(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()I
+ // ()I
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ int @__return = default(int);
+ try {
+ global::robocode.control.snapshot.IBulletSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((int)(@__real.getFrame()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static bool isExplosion9(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()Z
+ // ()Z
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ bool @__return = default(bool);
+ try {
+ global::robocode.control.snapshot.IBulletSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((bool)(@__real.isExplosion()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static int getExplosionImageIndex10(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()I
+ // ()I
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ int @__return = default(int);
+ try {
+ global::robocode.control.snapshot.IBulletSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((int)(@__real.getExplosionImageIndex()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static int getBulletId11(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()I
+ // ()I
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ int @__return = default(int);
+ try {
+ global::robocode.control.snapshot.IBulletSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((int)(@__real.getBulletId()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static int getVictimIndex12(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()I
+ // ()I
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ int @__return = default(int);
+ try {
+ global::robocode.control.snapshot.IBulletSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((int)(@__real.getVictimIndex()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static int getOwnerIndex13(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()I
+ // ()I
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ int @__return = default(int);
+ try {
+ global::robocode.control.snapshot.IBulletSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((int)(@__real.getOwnerIndex()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.snapshot.@__IBulletSnapshot(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/snapshot/IDebugProperty.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/snapshot/IDebugProperty.generated.cs
new file mode 100644
index 0000000..9b34022
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/snapshot/IDebugProperty.generated.cs
@@ -0,0 +1,119 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control.snapshot {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaInterfaceAttribute()]
+ public partial interface IDebugProperty {
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/String;")]
+ global::java.lang.String getValue();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/String;")]
+ global::java.lang.String getKey();
+ }
+ #endregion
+
+ #region Component Designer generated code
+ public partial class IDebugProperty_ {
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.snapshot.@__IDebugProperty.staticClass;
+ }
+ }
+ }
+ #endregion
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaProxyAttribute(typeof(global::robocode.control.snapshot.IDebugProperty), typeof(global::robocode.control.snapshot.IDebugProperty_))]
+ [global::net.sf.jni4net.attributes.ClrWrapperAttribute(typeof(global::robocode.control.snapshot.IDebugProperty), typeof(global::robocode.control.snapshot.IDebugProperty_))]
+ internal sealed partial class @__IDebugProperty : global::java.lang.Object, global::robocode.control.snapshot.IDebugProperty {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getValue0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getKey1;
+
+ private @__IDebugProperty(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.snapshot.@__IDebugProperty.staticClass = @__class;
+ global::robocode.control.snapshot.@__IDebugProperty.j4n_getValue0 = @__env.GetMethodID(global::robocode.control.snapshot.@__IDebugProperty.staticClass, "getValue", "()Ljava/lang/String;");
+ global::robocode.control.snapshot.@__IDebugProperty.j4n_getKey1 = @__env.GetMethodID(global::robocode.control.snapshot.@__IDebugProperty.staticClass, "getKey", "()Ljava/lang/String;");
+ }
+
+ public global::java.lang.String getValue() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2CpString(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.snapshot.@__IDebugProperty.j4n_getValue0));
+ }
+ }
+
+ public global::java.lang.String getKey() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2CpString(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.snapshot.@__IDebugProperty.j4n_getKey1));
+ }
+ }
+
+ private static global::System.Collections.Generic.List @__Init(global::net.sf.jni4net.jni.JNIEnv @__env, global::java.lang.Class @__class) {
+ global::System.Type @__type = typeof(__IDebugProperty);
+ global::System.Collections.Generic.List methods = new global::System.Collections.Generic.List();
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getValue", "getValue0", "()Ljava/lang/String;"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getKey", "getKey1", "()Ljava/lang/String;"));
+ return methods;
+ }
+
+ private static global::net.sf.jni4net.utils.JniHandle getValue0(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()Ljava/lang/String;
+ // ()Ljava/lang/String;
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle);
+ try {
+ global::robocode.control.snapshot.IDebugProperty @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = global::net.sf.jni4net.utils.Convertor.StrongCp2J(@__real.getValue());
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static global::net.sf.jni4net.utils.JniHandle getKey1(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()Ljava/lang/String;
+ // ()Ljava/lang/String;
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle);
+ try {
+ global::robocode.control.snapshot.IDebugProperty @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = global::net.sf.jni4net.utils.Convertor.StrongCp2J(@__real.getKey());
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.snapshot.@__IDebugProperty(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/snapshot/IRobotSnapshot.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/snapshot/IRobotSnapshot.generated.cs
new file mode 100644
index 0000000..d73f872
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/snapshot/IRobotSnapshot.generated.cs
@@ -0,0 +1,795 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control.snapshot {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaInterfaceAttribute()]
+ public partial interface IRobotSnapshot {
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/String;")]
+ global::java.lang.String getName();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Lrobocode/control/snapshot/RobotState;")]
+ global::robocode.control.snapshot.RobotState getState();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/String;")]
+ global::java.lang.String getTeamName();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getX();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getY();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/String;")]
+ global::java.lang.String getShortName();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/String;")]
+ global::java.lang.String getVeryShortName();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ int getRobotIndex();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ int getTeamIndex();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ int getContestantIndex();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getEnergy();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getVelocity();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getBodyHeading();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getGunHeading();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getRadarHeading();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getGunHeat();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ int getBodyColor();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ int getGunColor();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ int getRadarColor();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ int getScanColor();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Z")]
+ bool isDroid();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Z")]
+ bool isSentryRobot();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Z")]
+ bool isPaintRobot();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Z")]
+ bool isPaintEnabled();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Z")]
+ bool isSGPaintEnabled();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()[Lrobocode/control/snapshot/IDebugProperty;")]
+ robocode.control.snapshot.IDebugProperty[] getDebugProperties();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/String;")]
+ global::java.lang.String getOutputStreamSnapshot();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Lrobocode/control/snapshot/IScoreSnapshot;")]
+ global::robocode.control.snapshot.IScoreSnapshot getScoreSnapshot();
+ }
+ #endregion
+
+ #region Component Designer generated code
+ public partial class IRobotSnapshot_ {
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.snapshot.@__IRobotSnapshot.staticClass;
+ }
+ }
+ }
+ #endregion
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaProxyAttribute(typeof(global::robocode.control.snapshot.IRobotSnapshot), typeof(global::robocode.control.snapshot.IRobotSnapshot_))]
+ [global::net.sf.jni4net.attributes.ClrWrapperAttribute(typeof(global::robocode.control.snapshot.IRobotSnapshot), typeof(global::robocode.control.snapshot.IRobotSnapshot_))]
+ internal sealed partial class @__IRobotSnapshot : global::java.lang.Object, global::robocode.control.snapshot.IRobotSnapshot {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getName0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getState1;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getTeamName2;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getX3;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getY4;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getShortName5;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getVeryShortName6;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getRobotIndex7;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getTeamIndex8;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getContestantIndex9;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getEnergy10;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getVelocity11;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getBodyHeading12;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getGunHeading13;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getRadarHeading14;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getGunHeat15;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getBodyColor16;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getGunColor17;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getRadarColor18;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getScanColor19;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_isDroid20;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_isSentryRobot21;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_isPaintRobot22;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_isPaintEnabled23;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_isSGPaintEnabled24;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getDebugProperties25;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getOutputStreamSnapshot26;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getScoreSnapshot27;
+
+ private @__IRobotSnapshot(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.snapshot.@__IRobotSnapshot.staticClass = @__class;
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getName0 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getName", "()Ljava/lang/String;");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getState1 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getState", "()Lrobocode/control/snapshot/RobotState;");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getTeamName2 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getTeamName", "()Ljava/lang/String;");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getX3 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getX", "()D");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getY4 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getY", "()D");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getShortName5 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getShortName", "()Ljava/lang/String;");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getVeryShortName6 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getVeryShortName", "()Ljava/lang/String;");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getRobotIndex7 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getRobotIndex", "()I");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getTeamIndex8 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getTeamIndex", "()I");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getContestantIndex9 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getContestantIndex", "()I");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getEnergy10 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getEnergy", "()D");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getVelocity11 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getVelocity", "()D");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getBodyHeading12 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getBodyHeading", "()D");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getGunHeading13 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getGunHeading", "()D");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getRadarHeading14 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getRadarHeading", "()D");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getGunHeat15 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getGunHeat", "()D");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getBodyColor16 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getBodyColor", "()I");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getGunColor17 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getGunColor", "()I");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getRadarColor18 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getRadarColor", "()I");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getScanColor19 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getScanColor", "()I");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_isDroid20 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "isDroid", "()Z");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_isSentryRobot21 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "isSentryRobot", "()Z");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_isPaintRobot22 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "isPaintRobot", "()Z");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_isPaintEnabled23 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "isPaintEnabled", "()Z");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_isSGPaintEnabled24 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "isSGPaintEnabled", "()Z");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getDebugProperties25 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getDebugProperties", "()[Lrobocode/control/snapshot/IDebugProperty;");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getOutputStreamSnapshot26 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getOutputStreamSnapshot", "()Ljava/lang/String;");
+ global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getScoreSnapshot27 = @__env.GetMethodID(global::robocode.control.snapshot.@__IRobotSnapshot.staticClass, "getScoreSnapshot", "()Lrobocode/control/snapshot/IScoreSnapshot;");
+ }
+
+ public global::java.lang.String getName() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2CpString(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getName0));
+ }
+ }
+
+ public global::robocode.control.snapshot.RobotState getState() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getState1));
+ }
+ }
+
+ public global::java.lang.String getTeamName() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2CpString(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getTeamName2));
+ }
+ }
+
+ public double getX() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getX3)));
+ }
+ }
+
+ public double getY() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getY4)));
+ }
+ }
+
+ public global::java.lang.String getShortName() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2CpString(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getShortName5));
+ }
+ }
+
+ public global::java.lang.String getVeryShortName() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2CpString(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getVeryShortName6));
+ }
+ }
+
+ public int getRobotIndex() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getRobotIndex7)));
+ }
+ }
+
+ public int getTeamIndex() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getTeamIndex8)));
+ }
+ }
+
+ public int getContestantIndex() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getContestantIndex9)));
+ }
+ }
+
+ public double getEnergy() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getEnergy10)));
+ }
+ }
+
+ public double getVelocity() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getVelocity11)));
+ }
+ }
+
+ public double getBodyHeading() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getBodyHeading12)));
+ }
+ }
+
+ public double getGunHeading() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getGunHeading13)));
+ }
+ }
+
+ public double getRadarHeading() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getRadarHeading14)));
+ }
+ }
+
+ public double getGunHeat() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getGunHeat15)));
+ }
+ }
+
+ public int getBodyColor() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getBodyColor16)));
+ }
+ }
+
+ public int getGunColor() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getGunColor17)));
+ }
+ }
+
+ public int getRadarColor() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getRadarColor18)));
+ }
+ }
+
+ public int getScanColor() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getScanColor19)));
+ }
+ }
+
+ public bool isDroid() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((bool)(@__env.CallBooleanMethod(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_isDroid20)));
+ }
+ }
+
+ public bool isSentryRobot() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((bool)(@__env.CallBooleanMethod(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_isSentryRobot21)));
+ }
+ }
+
+ public bool isPaintRobot() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((bool)(@__env.CallBooleanMethod(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_isPaintRobot22)));
+ }
+ }
+
+ public bool isPaintEnabled() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((bool)(@__env.CallBooleanMethod(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_isPaintEnabled23)));
+ }
+ }
+
+ public bool isSGPaintEnabled() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((bool)(@__env.CallBooleanMethod(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_isSGPaintEnabled24)));
+ }
+ }
+
+ public robocode.control.snapshot.IDebugProperty[] getDebugProperties() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.ArrayFullJ2C(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getDebugProperties25));
+ }
+ }
+
+ public global::java.lang.String getOutputStreamSnapshot() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2CpString(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getOutputStreamSnapshot26));
+ }
+ }
+
+ public global::robocode.control.snapshot.IScoreSnapshot getScoreSnapshot() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.snapshot.@__IRobotSnapshot.j4n_getScoreSnapshot27));
+ }
+ }
+
+ private static global::System.Collections.Generic.List @__Init(global::net.sf.jni4net.jni.JNIEnv @__env, global::java.lang.Class @__class) {
+ global::System.Type @__type = typeof(__IRobotSnapshot);
+ global::System.Collections.Generic.List methods = new global::System.Collections.Generic.List();
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getName", "getName0", "()Ljava/lang/String;"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getState", "getState1", "()Lrobocode/control/snapshot/RobotState;"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getTeamName", "getTeamName2", "()Ljava/lang/String;"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getX", "getX3", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getY", "getY4", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getShortName", "getShortName5", "()Ljava/lang/String;"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getVeryShortName", "getVeryShortName6", "()Ljava/lang/String;"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getRobotIndex", "getRobotIndex7", "()I"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getTeamIndex", "getTeamIndex8", "()I"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getContestantIndex", "getContestantIndex9", "()I"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getEnergy", "getEnergy10", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getVelocity", "getVelocity11", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getBodyHeading", "getBodyHeading12", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getGunHeading", "getGunHeading13", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getRadarHeading", "getRadarHeading14", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getGunHeat", "getGunHeat15", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getBodyColor", "getBodyColor16", "()I"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getGunColor", "getGunColor17", "()I"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getRadarColor", "getRadarColor18", "()I"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getScanColor", "getScanColor19", "()I"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "isDroid", "isDroid20", "()Z"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "isSentryRobot", "isSentryRobot21", "()Z"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "isPaintRobot", "isPaintRobot22", "()Z"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "isPaintEnabled", "isPaintEnabled23", "()Z"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "isSGPaintEnabled", "isSGPaintEnabled24", "()Z"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getDebugProperties", "getDebugProperties25", "()[Lrobocode/control/snapshot/IDebugProperty;"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getOutputStreamSnapshot", "getOutputStreamSnapshot26", "()Ljava/lang/String;"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getScoreSnapshot", "getScoreSnapshot27", "()Lrobocode/control/snapshot/IScoreSnapshot;"));
+ return methods;
+ }
+
+ private static global::net.sf.jni4net.utils.JniHandle getName0(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()Ljava/lang/String;
+ // ()Ljava/lang/String;
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = global::net.sf.jni4net.utils.Convertor.StrongCp2J(@__real.getName());
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static global::net.sf.jni4net.utils.JniHandle getState1(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()Lrobocode/control/snapshot/RobotState;
+ // ()Lrobocode/control/snapshot/RobotState;
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = global::net.sf.jni4net.utils.Convertor.StrongCp2J(@__real.getState());
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static global::net.sf.jni4net.utils.JniHandle getTeamName2(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()Ljava/lang/String;
+ // ()Ljava/lang/String;
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = global::net.sf.jni4net.utils.Convertor.StrongCp2J(@__real.getTeamName());
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getX3(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getX()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getY4(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getY()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static global::net.sf.jni4net.utils.JniHandle getShortName5(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()Ljava/lang/String;
+ // ()Ljava/lang/String;
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = global::net.sf.jni4net.utils.Convertor.StrongCp2J(@__real.getShortName());
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static global::net.sf.jni4net.utils.JniHandle getVeryShortName6(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()Ljava/lang/String;
+ // ()Ljava/lang/String;
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = global::net.sf.jni4net.utils.Convertor.StrongCp2J(@__real.getVeryShortName());
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static int getRobotIndex7(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()I
+ // ()I
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ int @__return = default(int);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((int)(@__real.getRobotIndex()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static int getTeamIndex8(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()I
+ // ()I
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ int @__return = default(int);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((int)(@__real.getTeamIndex()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static int getContestantIndex9(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()I
+ // ()I
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ int @__return = default(int);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((int)(@__real.getContestantIndex()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getEnergy10(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getEnergy()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getVelocity11(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getVelocity()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getBodyHeading12(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getBodyHeading()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getGunHeading13(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getGunHeading()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getRadarHeading14(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getRadarHeading()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getGunHeat15(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getGunHeat()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static int getBodyColor16(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()I
+ // ()I
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ int @__return = default(int);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((int)(@__real.getBodyColor()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static int getGunColor17(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()I
+ // ()I
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ int @__return = default(int);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((int)(@__real.getGunColor()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static int getRadarColor18(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()I
+ // ()I
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ int @__return = default(int);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((int)(@__real.getRadarColor()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static int getScanColor19(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()I
+ // ()I
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ int @__return = default(int);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((int)(@__real.getScanColor()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static bool isDroid20(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()Z
+ // ()Z
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ bool @__return = default(bool);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((bool)(@__real.isDroid()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static bool isSentryRobot21(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()Z
+ // ()Z
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ bool @__return = default(bool);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((bool)(@__real.isSentryRobot()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static bool isPaintRobot22(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()Z
+ // ()Z
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ bool @__return = default(bool);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((bool)(@__real.isPaintRobot()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static bool isPaintEnabled23(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()Z
+ // ()Z
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ bool @__return = default(bool);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((bool)(@__real.isPaintEnabled()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static bool isSGPaintEnabled24(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()Z
+ // ()Z
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ bool @__return = default(bool);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((bool)(@__real.isSGPaintEnabled()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static global::net.sf.jni4net.utils.JniHandle getDebugProperties25(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()[Lrobocode/control/snapshot/IDebugProperty;
+ // ()[Lrobocode/control/snapshot/IDebugProperty;
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = global::net.sf.jni4net.utils.Convertor.ArrayFullC2J(@__env, @__real.getDebugProperties());
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static global::net.sf.jni4net.utils.JniHandle getOutputStreamSnapshot26(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()Ljava/lang/String;
+ // ()Ljava/lang/String;
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = global::net.sf.jni4net.utils.Convertor.StrongCp2J(@__real.getOutputStreamSnapshot());
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static global::net.sf.jni4net.utils.JniHandle getScoreSnapshot27(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()Lrobocode/control/snapshot/IScoreSnapshot;
+ // ()Lrobocode/control/snapshot/IScoreSnapshot;
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle);
+ try {
+ global::robocode.control.snapshot.IRobotSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = global::net.sf.jni4net.utils.Convertor.FullC2J(@__env, @__real.getScoreSnapshot());
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.snapshot.@__IRobotSnapshot(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/snapshot/IScoreSnapshot.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/snapshot/IScoreSnapshot.generated.cs
new file mode 100644
index 0000000..374c181
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/snapshot/IScoreSnapshot.generated.cs
@@ -0,0 +1,558 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control.snapshot {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaInterfaceAttribute()]
+ public partial interface IScoreSnapshot : global::java.lang.Comparable {
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Ljava/lang/String;")]
+ global::java.lang.String getName();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getTotalScore();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getTotalSurvivalScore();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getTotalLastSurvivorBonus();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getTotalBulletDamageScore();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getTotalBulletKillBonus();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getTotalRammingDamageScore();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getTotalRammingKillBonus();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ int getTotalFirsts();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ int getTotalSeconds();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ int getTotalThirds();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getCurrentScore();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getCurrentSurvivalScore();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getCurrentSurvivalBonus();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getCurrentBulletDamageScore();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getCurrentBulletKillBonus();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getCurrentRammingDamageScore();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()D")]
+ double getCurrentRammingKillBonus();
+ }
+ #endregion
+
+ #region Component Designer generated code
+ public partial class IScoreSnapshot_ {
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.snapshot.@__IScoreSnapshot.staticClass;
+ }
+ }
+ }
+ #endregion
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaProxyAttribute(typeof(global::robocode.control.snapshot.IScoreSnapshot), typeof(global::robocode.control.snapshot.IScoreSnapshot_))]
+ [global::net.sf.jni4net.attributes.ClrWrapperAttribute(typeof(global::robocode.control.snapshot.IScoreSnapshot), typeof(global::robocode.control.snapshot.IScoreSnapshot_))]
+ internal sealed partial class @__IScoreSnapshot : global::java.lang.Object, global::robocode.control.snapshot.IScoreSnapshot {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_compareTo0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getName1;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getTotalScore2;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getTotalSurvivalScore3;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getTotalLastSurvivorBonus4;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getTotalBulletDamageScore5;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getTotalBulletKillBonus6;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getTotalRammingDamageScore7;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getTotalRammingKillBonus8;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getTotalFirsts9;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getTotalSeconds10;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getTotalThirds11;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getCurrentScore12;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getCurrentSurvivalScore13;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getCurrentSurvivalBonus14;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getCurrentBulletDamageScore15;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getCurrentBulletKillBonus16;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getCurrentRammingDamageScore17;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getCurrentRammingKillBonus18;
+
+ private @__IScoreSnapshot(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.snapshot.@__IScoreSnapshot.staticClass = @__class;
+ global::robocode.control.snapshot.@__IScoreSnapshot.j4n_compareTo0 = @__env.GetMethodID(global::robocode.control.snapshot.@__IScoreSnapshot.staticClass, "compareTo", "(Ljava/lang/Object;)I");
+ global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getName1 = @__env.GetMethodID(global::robocode.control.snapshot.@__IScoreSnapshot.staticClass, "getName", "()Ljava/lang/String;");
+ global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getTotalScore2 = @__env.GetMethodID(global::robocode.control.snapshot.@__IScoreSnapshot.staticClass, "getTotalScore", "()D");
+ global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getTotalSurvivalScore3 = @__env.GetMethodID(global::robocode.control.snapshot.@__IScoreSnapshot.staticClass, "getTotalSurvivalScore", "()D");
+ global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getTotalLastSurvivorBonus4 = @__env.GetMethodID(global::robocode.control.snapshot.@__IScoreSnapshot.staticClass, "getTotalLastSurvivorBonus", "()D");
+ global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getTotalBulletDamageScore5 = @__env.GetMethodID(global::robocode.control.snapshot.@__IScoreSnapshot.staticClass, "getTotalBulletDamageScore", "()D");
+ global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getTotalBulletKillBonus6 = @__env.GetMethodID(global::robocode.control.snapshot.@__IScoreSnapshot.staticClass, "getTotalBulletKillBonus", "()D");
+ global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getTotalRammingDamageScore7 = @__env.GetMethodID(global::robocode.control.snapshot.@__IScoreSnapshot.staticClass, "getTotalRammingDamageScore", "()D");
+ global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getTotalRammingKillBonus8 = @__env.GetMethodID(global::robocode.control.snapshot.@__IScoreSnapshot.staticClass, "getTotalRammingKillBonus", "()D");
+ global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getTotalFirsts9 = @__env.GetMethodID(global::robocode.control.snapshot.@__IScoreSnapshot.staticClass, "getTotalFirsts", "()I");
+ global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getTotalSeconds10 = @__env.GetMethodID(global::robocode.control.snapshot.@__IScoreSnapshot.staticClass, "getTotalSeconds", "()I");
+ global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getTotalThirds11 = @__env.GetMethodID(global::robocode.control.snapshot.@__IScoreSnapshot.staticClass, "getTotalThirds", "()I");
+ global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getCurrentScore12 = @__env.GetMethodID(global::robocode.control.snapshot.@__IScoreSnapshot.staticClass, "getCurrentScore", "()D");
+ global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getCurrentSurvivalScore13 = @__env.GetMethodID(global::robocode.control.snapshot.@__IScoreSnapshot.staticClass, "getCurrentSurvivalScore", "()D");
+ global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getCurrentSurvivalBonus14 = @__env.GetMethodID(global::robocode.control.snapshot.@__IScoreSnapshot.staticClass, "getCurrentSurvivalBonus", "()D");
+ global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getCurrentBulletDamageScore15 = @__env.GetMethodID(global::robocode.control.snapshot.@__IScoreSnapshot.staticClass, "getCurrentBulletDamageScore", "()D");
+ global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getCurrentBulletKillBonus16 = @__env.GetMethodID(global::robocode.control.snapshot.@__IScoreSnapshot.staticClass, "getCurrentBulletKillBonus", "()D");
+ global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getCurrentRammingDamageScore17 = @__env.GetMethodID(global::robocode.control.snapshot.@__IScoreSnapshot.staticClass, "getCurrentRammingDamageScore", "()D");
+ global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getCurrentRammingKillBonus18 = @__env.GetMethodID(global::robocode.control.snapshot.@__IScoreSnapshot.staticClass, "getCurrentRammingKillBonus", "()D");
+ }
+
+ public int compareTo(global::java.lang.Object par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.snapshot.@__IScoreSnapshot.j4n_compareTo0, global::net.sf.jni4net.utils.Convertor.ParFullC2J(@__env, par0))));
+ }
+ }
+
+ public global::java.lang.String getName() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2CpString(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getName1));
+ }
+ }
+
+ public double getTotalScore() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getTotalScore2)));
+ }
+ }
+
+ public double getTotalSurvivalScore() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getTotalSurvivalScore3)));
+ }
+ }
+
+ public double getTotalLastSurvivorBonus() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getTotalLastSurvivorBonus4)));
+ }
+ }
+
+ public double getTotalBulletDamageScore() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getTotalBulletDamageScore5)));
+ }
+ }
+
+ public double getTotalBulletKillBonus() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getTotalBulletKillBonus6)));
+ }
+ }
+
+ public double getTotalRammingDamageScore() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getTotalRammingDamageScore7)));
+ }
+ }
+
+ public double getTotalRammingKillBonus() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getTotalRammingKillBonus8)));
+ }
+ }
+
+ public int getTotalFirsts() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getTotalFirsts9)));
+ }
+ }
+
+ public int getTotalSeconds() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getTotalSeconds10)));
+ }
+ }
+
+ public int getTotalThirds() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getTotalThirds11)));
+ }
+ }
+
+ public double getCurrentScore() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getCurrentScore12)));
+ }
+ }
+
+ public double getCurrentSurvivalScore() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getCurrentSurvivalScore13)));
+ }
+ }
+
+ public double getCurrentSurvivalBonus() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getCurrentSurvivalBonus14)));
+ }
+ }
+
+ public double getCurrentBulletDamageScore() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getCurrentBulletDamageScore15)));
+ }
+ }
+
+ public double getCurrentBulletKillBonus() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getCurrentBulletKillBonus16)));
+ }
+ }
+
+ public double getCurrentRammingDamageScore() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getCurrentRammingDamageScore17)));
+ }
+ }
+
+ public double getCurrentRammingKillBonus() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((double)(@__env.CallDoubleMethod(this, global::robocode.control.snapshot.@__IScoreSnapshot.j4n_getCurrentRammingKillBonus18)));
+ }
+ }
+
+ private static global::System.Collections.Generic.List @__Init(global::net.sf.jni4net.jni.JNIEnv @__env, global::java.lang.Class @__class) {
+ global::System.Type @__type = typeof(__IScoreSnapshot);
+ global::System.Collections.Generic.List methods = new global::System.Collections.Generic.List();
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "compareTo", "compareTo0", "(Ljava/lang/Object;)I"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getName", "getName1", "()Ljava/lang/String;"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getTotalScore", "getTotalScore2", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getTotalSurvivalScore", "getTotalSurvivalScore3", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getTotalLastSurvivorBonus", "getTotalLastSurvivorBonus4", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getTotalBulletDamageScore", "getTotalBulletDamageScore5", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getTotalBulletKillBonus", "getTotalBulletKillBonus6", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getTotalRammingDamageScore", "getTotalRammingDamageScore7", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getTotalRammingKillBonus", "getTotalRammingKillBonus8", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getTotalFirsts", "getTotalFirsts9", "()I"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getTotalSeconds", "getTotalSeconds10", "()I"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getTotalThirds", "getTotalThirds11", "()I"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getCurrentScore", "getCurrentScore12", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getCurrentSurvivalScore", "getCurrentSurvivalScore13", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getCurrentSurvivalBonus", "getCurrentSurvivalBonus14", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getCurrentBulletDamageScore", "getCurrentBulletDamageScore15", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getCurrentBulletKillBonus", "getCurrentBulletKillBonus16", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getCurrentRammingDamageScore", "getCurrentRammingDamageScore17", "()D"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getCurrentRammingKillBonus", "getCurrentRammingKillBonus18", "()D"));
+ return methods;
+ }
+
+ private static int compareTo0(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, global::net.sf.jni4net.utils.JniLocalHandle par0) {
+ // (Ljava/lang/Object;)I
+ // (Ljava/lang/Object;)I
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ int @__return = default(int);
+ try {
+ global::robocode.control.snapshot.IScoreSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((int)(((global::java.lang.Comparable)(@__real)).compareTo(global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, par0))));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static global::net.sf.jni4net.utils.JniHandle getName1(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()Ljava/lang/String;
+ // ()Ljava/lang/String;
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle);
+ try {
+ global::robocode.control.snapshot.IScoreSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = global::net.sf.jni4net.utils.Convertor.StrongCp2J(@__real.getName());
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getTotalScore2(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IScoreSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getTotalScore()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getTotalSurvivalScore3(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IScoreSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getTotalSurvivalScore()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getTotalLastSurvivorBonus4(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IScoreSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getTotalLastSurvivorBonus()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getTotalBulletDamageScore5(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IScoreSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getTotalBulletDamageScore()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getTotalBulletKillBonus6(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IScoreSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getTotalBulletKillBonus()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getTotalRammingDamageScore7(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IScoreSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getTotalRammingDamageScore()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getTotalRammingKillBonus8(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IScoreSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getTotalRammingKillBonus()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static int getTotalFirsts9(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()I
+ // ()I
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ int @__return = default(int);
+ try {
+ global::robocode.control.snapshot.IScoreSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((int)(@__real.getTotalFirsts()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static int getTotalSeconds10(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()I
+ // ()I
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ int @__return = default(int);
+ try {
+ global::robocode.control.snapshot.IScoreSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((int)(@__real.getTotalSeconds()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static int getTotalThirds11(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()I
+ // ()I
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ int @__return = default(int);
+ try {
+ global::robocode.control.snapshot.IScoreSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((int)(@__real.getTotalThirds()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getCurrentScore12(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IScoreSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getCurrentScore()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getCurrentSurvivalScore13(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IScoreSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getCurrentSurvivalScore()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getCurrentSurvivalBonus14(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IScoreSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getCurrentSurvivalBonus()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getCurrentBulletDamageScore15(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IScoreSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getCurrentBulletDamageScore()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getCurrentBulletKillBonus16(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IScoreSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getCurrentBulletKillBonus()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getCurrentRammingDamageScore17(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IScoreSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getCurrentRammingDamageScore()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static double getCurrentRammingKillBonus18(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()D
+ // ()D
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ double @__return = default(double);
+ try {
+ global::robocode.control.snapshot.IScoreSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((double)(@__real.getCurrentRammingKillBonus()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.snapshot.@__IScoreSnapshot(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/snapshot/ITurnSnapshot.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/snapshot/ITurnSnapshot.generated.cs
new file mode 100644
index 0000000..417e14f
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/snapshot/ITurnSnapshot.generated.cs
@@ -0,0 +1,249 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control.snapshot {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaInterfaceAttribute()]
+ public partial interface ITurnSnapshot {
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()[Lrobocode/control/snapshot/IRobotSnapshot;")]
+ robocode.control.snapshot.IRobotSnapshot[] getRobots();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()[Lrobocode/control/snapshot/IBulletSnapshot;")]
+ robocode.control.snapshot.IBulletSnapshot[] getBullets();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ int getTPS();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ int getRound();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ int getTurn();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()[Lrobocode/control/snapshot/IScoreSnapshot;")]
+ robocode.control.snapshot.IScoreSnapshot[] getSortedTeamScores();
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()[Lrobocode/control/snapshot/IScoreSnapshot;")]
+ robocode.control.snapshot.IScoreSnapshot[] getIndexedTeamScores();
+ }
+ #endregion
+
+ #region Component Designer generated code
+ public partial class ITurnSnapshot_ {
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.snapshot.@__ITurnSnapshot.staticClass;
+ }
+ }
+ }
+ #endregion
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaProxyAttribute(typeof(global::robocode.control.snapshot.ITurnSnapshot), typeof(global::robocode.control.snapshot.ITurnSnapshot_))]
+ [global::net.sf.jni4net.attributes.ClrWrapperAttribute(typeof(global::robocode.control.snapshot.ITurnSnapshot), typeof(global::robocode.control.snapshot.ITurnSnapshot_))]
+ internal sealed partial class @__ITurnSnapshot : global::java.lang.Object, global::robocode.control.snapshot.ITurnSnapshot {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getRobots0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getBullets1;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getTPS2;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getRound3;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getTurn4;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getSortedTeamScores5;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getIndexedTeamScores6;
+
+ private @__ITurnSnapshot(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.snapshot.@__ITurnSnapshot.staticClass = @__class;
+ global::robocode.control.snapshot.@__ITurnSnapshot.j4n_getRobots0 = @__env.GetMethodID(global::robocode.control.snapshot.@__ITurnSnapshot.staticClass, "getRobots", "()[Lrobocode/control/snapshot/IRobotSnapshot;");
+ global::robocode.control.snapshot.@__ITurnSnapshot.j4n_getBullets1 = @__env.GetMethodID(global::robocode.control.snapshot.@__ITurnSnapshot.staticClass, "getBullets", "()[Lrobocode/control/snapshot/IBulletSnapshot;");
+ global::robocode.control.snapshot.@__ITurnSnapshot.j4n_getTPS2 = @__env.GetMethodID(global::robocode.control.snapshot.@__ITurnSnapshot.staticClass, "getTPS", "()I");
+ global::robocode.control.snapshot.@__ITurnSnapshot.j4n_getRound3 = @__env.GetMethodID(global::robocode.control.snapshot.@__ITurnSnapshot.staticClass, "getRound", "()I");
+ global::robocode.control.snapshot.@__ITurnSnapshot.j4n_getTurn4 = @__env.GetMethodID(global::robocode.control.snapshot.@__ITurnSnapshot.staticClass, "getTurn", "()I");
+ global::robocode.control.snapshot.@__ITurnSnapshot.j4n_getSortedTeamScores5 = @__env.GetMethodID(global::robocode.control.snapshot.@__ITurnSnapshot.staticClass, "getSortedTeamScores", "()[Lrobocode/control/snapshot/IScoreSnapshot;");
+ global::robocode.control.snapshot.@__ITurnSnapshot.j4n_getIndexedTeamScores6 = @__env.GetMethodID(global::robocode.control.snapshot.@__ITurnSnapshot.staticClass, "getIndexedTeamScores", "()[Lrobocode/control/snapshot/IScoreSnapshot;");
+ }
+
+ public robocode.control.snapshot.IRobotSnapshot[] getRobots() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.ArrayFullJ2C(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.snapshot.@__ITurnSnapshot.j4n_getRobots0));
+ }
+ }
+
+ public robocode.control.snapshot.IBulletSnapshot[] getBullets() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.ArrayFullJ2C(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.snapshot.@__ITurnSnapshot.j4n_getBullets1));
+ }
+ }
+
+ public int getTPS() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.snapshot.@__ITurnSnapshot.j4n_getTPS2)));
+ }
+ }
+
+ public int getRound() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.snapshot.@__ITurnSnapshot.j4n_getRound3)));
+ }
+ }
+
+ public int getTurn() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.snapshot.@__ITurnSnapshot.j4n_getTurn4)));
+ }
+ }
+
+ public robocode.control.snapshot.IScoreSnapshot[] getSortedTeamScores() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.ArrayFullJ2C(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.snapshot.@__ITurnSnapshot.j4n_getSortedTeamScores5));
+ }
+ }
+
+ public robocode.control.snapshot.IScoreSnapshot[] getIndexedTeamScores() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.ArrayFullJ2C(@__env, @__env.CallObjectMethodPtr(this, global::robocode.control.snapshot.@__ITurnSnapshot.j4n_getIndexedTeamScores6));
+ }
+ }
+
+ private static global::System.Collections.Generic.List @__Init(global::net.sf.jni4net.jni.JNIEnv @__env, global::java.lang.Class @__class) {
+ global::System.Type @__type = typeof(__ITurnSnapshot);
+ global::System.Collections.Generic.List methods = new global::System.Collections.Generic.List();
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getRobots", "getRobots0", "()[Lrobocode/control/snapshot/IRobotSnapshot;"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getBullets", "getBullets1", "()[Lrobocode/control/snapshot/IBulletSnapshot;"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getTPS", "getTPS2", "()I"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getRound", "getRound3", "()I"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getTurn", "getTurn4", "()I"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getSortedTeamScores", "getSortedTeamScores5", "()[Lrobocode/control/snapshot/IScoreSnapshot;"));
+ methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getIndexedTeamScores", "getIndexedTeamScores6", "()[Lrobocode/control/snapshot/IScoreSnapshot;"));
+ return methods;
+ }
+
+ private static global::net.sf.jni4net.utils.JniHandle getRobots0(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()[Lrobocode/control/snapshot/IRobotSnapshot;
+ // ()[Lrobocode/control/snapshot/IRobotSnapshot;
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle);
+ try {
+ global::robocode.control.snapshot.ITurnSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = global::net.sf.jni4net.utils.Convertor.ArrayFullC2J(@__env, @__real.getRobots());
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static global::net.sf.jni4net.utils.JniHandle getBullets1(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()[Lrobocode/control/snapshot/IBulletSnapshot;
+ // ()[Lrobocode/control/snapshot/IBulletSnapshot;
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle);
+ try {
+ global::robocode.control.snapshot.ITurnSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = global::net.sf.jni4net.utils.Convertor.ArrayFullC2J(@__env, @__real.getBullets());
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static int getTPS2(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()I
+ // ()I
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ int @__return = default(int);
+ try {
+ global::robocode.control.snapshot.ITurnSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((int)(@__real.getTPS()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static int getRound3(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()I
+ // ()I
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ int @__return = default(int);
+ try {
+ global::robocode.control.snapshot.ITurnSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((int)(@__real.getRound()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static int getTurn4(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()I
+ // ()I
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ int @__return = default(int);
+ try {
+ global::robocode.control.snapshot.ITurnSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = ((int)(@__real.getTurn()));
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static global::net.sf.jni4net.utils.JniHandle getSortedTeamScores5(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()[Lrobocode/control/snapshot/IScoreSnapshot;
+ // ()[Lrobocode/control/snapshot/IScoreSnapshot;
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle);
+ try {
+ global::robocode.control.snapshot.ITurnSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = global::net.sf.jni4net.utils.Convertor.ArrayFullC2J(@__env, @__real.getSortedTeamScores());
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ private static global::net.sf.jni4net.utils.JniHandle getIndexedTeamScores6(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) {
+ // ()[Lrobocode/control/snapshot/IScoreSnapshot;
+ // ()[Lrobocode/control/snapshot/IScoreSnapshot;
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp);
+ global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle);
+ try {
+ global::robocode.control.snapshot.ITurnSnapshot @__real = global::net.sf.jni4net.utils.Convertor.FullJ2C(@__env, @__obj);
+ @__return = global::net.sf.jni4net.utils.Convertor.ArrayFullC2J(@__env, @__real.getIndexedTeamScores());
+ }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);}
+ return @__return;
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.snapshot.@__ITurnSnapshot(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/snapshot/RobotState.generated.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/snapshot/RobotState.generated.cs
new file mode 100644
index 0000000..532ad1b
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/generated/robocode/control/snapshot/RobotState.generated.cs
@@ -0,0 +1,189 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+//------------------------------------------------------------------------------
+//
+// This code was generated by jni4net. See http://jni4net.sourceforge.net/
+// Runtime Version:2.0.50727.8669
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace robocode.control.snapshot {
+
+
+ #region Component Designer generated code
+ [global::net.sf.jni4net.attributes.JavaClassAttribute()]
+ public partial class RobotState : global::java.lang.Object {
+
+ internal new static global::java.lang.Class staticClass;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_values0;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_valueOf1;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_getValue2;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_isAlive3;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_toState4;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_isDead5;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_isHitRobot6;
+
+ internal static global::net.sf.jni4net.jni.MethodId j4n_isHitWall7;
+
+ internal static global::net.sf.jni4net.jni.FieldId j4n_ACTIVE8;
+
+ internal static global::net.sf.jni4net.jni.FieldId j4n_HIT_WALL9;
+
+ internal static global::net.sf.jni4net.jni.FieldId j4n_HIT_ROBOT10;
+
+ internal static global::net.sf.jni4net.jni.FieldId j4n_DEAD11;
+
+ protected RobotState(global::net.sf.jni4net.jni.JNIEnv @__env) :
+ base(@__env) {
+ }
+
+ public static global::java.lang.Class _class {
+ get {
+ return global::robocode.control.snapshot.RobotState.staticClass;
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("Lrobocode/control/snapshot/RobotState;")]
+ public static global::robocode.control.snapshot.RobotState ACTIVE {
+ get {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.GetStaticObjectFieldPtr(global::robocode.control.snapshot.RobotState.staticClass, global::robocode.control.snapshot.RobotState.j4n_ACTIVE8));
+ }
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("Lrobocode/control/snapshot/RobotState;")]
+ public static global::robocode.control.snapshot.RobotState HIT_WALL {
+ get {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.GetStaticObjectFieldPtr(global::robocode.control.snapshot.RobotState.staticClass, global::robocode.control.snapshot.RobotState.j4n_HIT_WALL9));
+ }
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("Lrobocode/control/snapshot/RobotState;")]
+ public static global::robocode.control.snapshot.RobotState HIT_ROBOT {
+ get {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.GetStaticObjectFieldPtr(global::robocode.control.snapshot.RobotState.staticClass, global::robocode.control.snapshot.RobotState.j4n_HIT_ROBOT10));
+ }
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("Lrobocode/control/snapshot/RobotState;")]
+ public static global::robocode.control.snapshot.RobotState DEAD {
+ get {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.GetStaticObjectFieldPtr(global::robocode.control.snapshot.RobotState.staticClass, global::robocode.control.snapshot.RobotState.j4n_DEAD11));
+ }
+ }
+ }
+
+ private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) {
+ global::robocode.control.snapshot.RobotState.staticClass = @__class;
+ global::robocode.control.snapshot.RobotState.j4n_values0 = @__env.GetStaticMethodID(global::robocode.control.snapshot.RobotState.staticClass, "values", "()[Lrobocode/control/snapshot/RobotState;");
+ global::robocode.control.snapshot.RobotState.j4n_valueOf1 = @__env.GetStaticMethodID(global::robocode.control.snapshot.RobotState.staticClass, "valueOf", "(Ljava/lang/String;)Lrobocode/control/snapshot/RobotState;");
+ global::robocode.control.snapshot.RobotState.j4n_getValue2 = @__env.GetMethodID(global::robocode.control.snapshot.RobotState.staticClass, "getValue", "()I");
+ global::robocode.control.snapshot.RobotState.j4n_isAlive3 = @__env.GetMethodID(global::robocode.control.snapshot.RobotState.staticClass, "isAlive", "()Z");
+ global::robocode.control.snapshot.RobotState.j4n_toState4 = @__env.GetStaticMethodID(global::robocode.control.snapshot.RobotState.staticClass, "toState", "(I)Lrobocode/control/snapshot/RobotState;");
+ global::robocode.control.snapshot.RobotState.j4n_isDead5 = @__env.GetMethodID(global::robocode.control.snapshot.RobotState.staticClass, "isDead", "()Z");
+ global::robocode.control.snapshot.RobotState.j4n_isHitRobot6 = @__env.GetMethodID(global::robocode.control.snapshot.RobotState.staticClass, "isHitRobot", "()Z");
+ global::robocode.control.snapshot.RobotState.j4n_isHitWall7 = @__env.GetMethodID(global::robocode.control.snapshot.RobotState.staticClass, "isHitWall", "()Z");
+ global::robocode.control.snapshot.RobotState.j4n_ACTIVE8 = @__env.GetStaticFieldID(global::robocode.control.snapshot.RobotState.staticClass, "ACTIVE", "Lrobocode/control/snapshot/RobotState;");
+ global::robocode.control.snapshot.RobotState.j4n_HIT_WALL9 = @__env.GetStaticFieldID(global::robocode.control.snapshot.RobotState.staticClass, "HIT_WALL", "Lrobocode/control/snapshot/RobotState;");
+ global::robocode.control.snapshot.RobotState.j4n_HIT_ROBOT10 = @__env.GetStaticFieldID(global::robocode.control.snapshot.RobotState.staticClass, "HIT_ROBOT", "Lrobocode/control/snapshot/RobotState;");
+ global::robocode.control.snapshot.RobotState.j4n_DEAD11 = @__env.GetStaticFieldID(global::robocode.control.snapshot.RobotState.staticClass, "DEAD", "Lrobocode/control/snapshot/RobotState;");
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()[Lrobocode/control/snapshot/RobotState;")]
+ public static robocode.control.snapshot.RobotState[] values() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return global::net.sf.jni4net.utils.Convertor.ArrayStrongJ2Cp(@__env, @__env.CallStaticObjectMethodPtr(global::robocode.control.snapshot.RobotState.staticClass, global::robocode.control.snapshot.RobotState.j4n_values0));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(Ljava/lang/String;)Lrobocode/control/snapshot/RobotState;")]
+ public static global::robocode.control.snapshot.RobotState valueOf(global::java.lang.String par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.CallStaticObjectMethodPtr(global::robocode.control.snapshot.RobotState.staticClass, global::robocode.control.snapshot.RobotState.j4n_valueOf1, global::net.sf.jni4net.utils.Convertor.ParStrongCp2J(par0)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()I")]
+ public virtual int getValue() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((int)(@__env.CallIntMethod(this, global::robocode.control.snapshot.RobotState.j4n_getValue2)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Z")]
+ public virtual bool isAlive() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((bool)(@__env.CallBooleanMethod(this, global::robocode.control.snapshot.RobotState.j4n_isAlive3)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("(I)Lrobocode/control/snapshot/RobotState;")]
+ public static global::robocode.control.snapshot.RobotState toState(int par0) {
+ global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.ThreadEnv;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 12)){
+ return global::net.sf.jni4net.utils.Convertor.StrongJ2Cp(@__env, @__env.CallStaticObjectMethodPtr(global::robocode.control.snapshot.RobotState.staticClass, global::robocode.control.snapshot.RobotState.j4n_toState4, global::net.sf.jni4net.utils.Convertor.ParPrimC2J(par0)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Z")]
+ public virtual bool isDead() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((bool)(@__env.CallBooleanMethod(this, global::robocode.control.snapshot.RobotState.j4n_isDead5)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Z")]
+ public virtual bool isHitRobot() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((bool)(@__env.CallBooleanMethod(this, global::robocode.control.snapshot.RobotState.j4n_isHitRobot6)));
+ }
+ }
+
+ [global::net.sf.jni4net.attributes.JavaMethodAttribute("()Z")]
+ public virtual bool isHitWall() {
+ global::net.sf.jni4net.jni.JNIEnv @__env = this.Env;
+ using(new global::net.sf.jni4net.jni.LocalFrame(@__env, 10)){
+ return ((bool)(@__env.CallBooleanMethod(this, global::robocode.control.snapshot.RobotState.j4n_isHitWall7)));
+ }
+ }
+
+ new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper {
+
+ public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) {
+ return new global::robocode.control.snapshot.RobotState(@__env);
+ }
+ }
+ }
+ #endregion
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/glue/robocode/control/RandomFactory.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/glue/robocode/control/RandomFactory.cs
new file mode 100644
index 0000000..971149f
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/glue/robocode/control/RandomFactory.cs
@@ -0,0 +1,76 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+
+
+using System;
+using net.sf.robocode.security;
+
+namespace robocode.control
+{
+ partial class RandomFactory : IHiddenRandomHelper
+ {
+ private RandomRedirect rr;
+
+ public RandomFactory(bool fakeInstance)
+ {
+ }
+
+ #region IHiddenRandomHelper Members
+
+ public Random GetRandom()
+ {
+ if (isDeterministic())
+ {
+ if (rr == null)
+ {
+ rr = new RandomRedirect(getRandom());
+ }
+ return rr;
+ }
+ return new Random();
+ }
+
+ #endregion
+ }
+
+ public class RandomRedirect : Random
+ {
+ private java.util.Random r;
+
+ public RandomRedirect(java.util.Random r)
+ {
+ this.r = r;
+ }
+
+ public override int Next()
+ {
+ return r.nextInt();
+ }
+
+ public override int Next(int maxValue)
+ {
+ return r.nextInt(maxValue);
+ }
+
+ public override int Next(int minValue, int maxValue)
+ {
+ return minValue + r.nextInt(maxValue - minValue);
+ }
+
+ public override void NextBytes(byte[] buffer)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override double NextDouble()
+ {
+ return r.nextDouble();
+ }
+ }
+
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/glue/robocode/control/RobocodeEngine.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/glue/robocode/control/RobocodeEngine.cs
new file mode 100644
index 0000000..e6e2ca2
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/glue/robocode/control/RobocodeEngine.cs
@@ -0,0 +1,29 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+using System;
+using System.IO;
+using net.sf.jni4net;
+using File = java.io.File;
+
+namespace robocode.control
+{
+ public partial class RobocodeEngine
+ {
+ public static void Init(string robocodeHome)
+ {
+ BridgeSetup bridgeSetup = new BridgeSetup();
+ bridgeSetup.BindStatic = true;
+ bridgeSetup.BindNative = true;
+ bridgeSetup.AddAllJarsClassPath(Path.Combine(robocodeHome, "libs"));
+ Bridge.CreateJVM(bridgeSetup);
+ Bridge.LoadAndRegisterAssemblyByName(typeof(RobocodeEngine).Assembly.FullName);
+ //Bridge.Setup.BindNative = true;
+ Bridge.Setup.BindStatic = true;
+ }
+ }
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/implementation/robocode/control/BattleSpecification.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/implementation/robocode/control/BattleSpecification.cs
new file mode 100644
index 0000000..0401ff0
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/implementation/robocode/control/BattleSpecification.cs
@@ -0,0 +1,257 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Robocode.Control
+{
+ ///
+ /// A BattleSpecification defines a battle configuration used by the .
+ ///
+ [Serializable]
+ public class BattleSpecification
+ {
+ private readonly int battlefieldWidth;
+ private readonly int battlefieldHeight;
+ private readonly int numRounds;
+ private readonly double gunCoolingRate;
+ private readonly long inactivityTime;
+ private readonly bool hideEnemyNames;
+ private readonly int sentryBorderSize;
+ private readonly RobotSpecification[] robots;
+ private readonly RobotSetup[] initialSetups;
+
+ ///
+ /// Creates a new BattleSpecification with the given number of rounds,
+ /// battlefield size, and robots. Inactivity time for the robots defaults to
+ /// 450, and the gun cooling rate defaults to 0.1.
+ ///
+ /// The number of rounds in this battle.
+ /// The battlefield size.
+ /// The robots participating in this battle.
+ public BattleSpecification(int numRounds, BattlefieldSpecification battlefieldSize, RobotSpecification[] robots) :
+ this(numRounds, 450, .1, battlefieldSize, robots)
+ {
+ }
+
+ ///
+ /// Creates a new BattleSpecification with the given settings.
+ ///
+ /// The number of rounds in this battle.
+ /// The inactivity time allowed for the robots before
+ /// they will loose energy.
+ /// The gun cooling rate for the robots.
+ /// The battlefield size.
+ /// The robots participating in this battle.
+ public BattleSpecification(int numRounds, long inactivityTime, double gunCoolingRate, BattlefieldSpecification battlefieldSize, RobotSpecification[] robots) :
+ this(numRounds, inactivityTime, gunCoolingRate, false, battlefieldSize, robots)
+ {
+ }
+
+ ///
+ /// Creates a new BattleSpecification with the given settings.
+ ///
+ /// The number of rounds in this battle.
+ /// The inactivity time allowed for the robots before
+ /// they will loose energy.
+ /// The gun cooling rate for the robots.
+ /// Flag specifying if enemy names are hidden from robots.
+ /// The battlefield size.
+ /// The robots participating in this battle.
+ public BattleSpecification(int numRounds, long inactivityTime, double gunCoolingRate, bool hideEnemyNames, BattlefieldSpecification battlefieldSize, RobotSpecification[] robots) :
+ this(battlefieldSize, numRounds, inactivityTime, gunCoolingRate, 100, hideEnemyNames, robots)
+ {
+ }
+
+ ///
+ /// Creates a new BattleSpecification with the given settings.
+ ///
+ /// The battlefield size.
+ /// The number of rounds in this battle.
+ /// The inactivity time allowed for the robots before
+ /// they will loose energy.
+ /// The gun cooling rate for the robots.
+ /// The sentry border size for a BorderSentry.
+ /// Flag specifying if enemy names are hidden from robots.
+ /// The robots participating in this battle.
+ public BattleSpecification(BattlefieldSpecification battlefieldSize, int numRounds, long inactivityTime, double gunCoolingRate, int sentryBorderSize, bool hideEnemyNames, RobotSpecification[] robots) :
+ this(battlefieldSize, numRounds, inactivityTime, gunCoolingRate, 100, hideEnemyNames, robots, null)
+ {
+ }
+
+ ///
+ /// Creates a new BattleSpecification with the given settings.
+ ///
+ /// The battlefield size.
+ /// The number of rounds in this battle.
+ /// The inactivity time allowed for the robots before
+ /// they will loose energy.
+ /// The gun cooling rate for the robots.
+ /// The sentry border size for a BorderSentry.
+ /// Flag specifying if enemy names are hidden from robots.
+ /// The robots participating in this battle.
+ /// The initial position and heading of the robots, where the indices matches the indices from the .
+ public BattleSpecification(BattlefieldSpecification battlefieldSize, int numRounds, long inactivityTime, double gunCoolingRate, int sentryBorderSize, bool hideEnemyNames, RobotSpecification[] robots, RobotSetup[] initialSetups)
+ {
+ if (battlefieldSize == null)
+ {
+ throw new ArgumentException("battlefieldSize cannot be null");
+ }
+ if (robots == null)
+ {
+ throw new ArgumentException("robots cannot be null");
+ }
+ if (robots.Length < 1)
+ {
+ throw new ArgumentException("robots.Length must be > 0");
+ }
+ if (initialSetups != null && initialSetups.Length != robots.Length)
+ {
+ throw new ArgumentException("initialSetups.Length must be == robots.Length");
+ }
+ if (numRounds < 1)
+ {
+ throw new ArgumentException("numRounds must be >= 1");
+ }
+ if (inactivityTime < 1)
+ {
+ throw new ArgumentException("inactivityTime must be >= 1");
+ }
+ if (gunCoolingRate < 0.1)
+ {
+ throw new ArgumentException("inactivityTime must be >= 0.1");
+ }
+ if (sentryBorderSize < 50)
+ {
+ throw new ArgumentException("sentryBorderSize must be >= 50");
+ }
+ this.battlefieldWidth = battlefieldSize.Width;
+ this.battlefieldHeight = battlefieldSize.Height;
+ this.numRounds = numRounds;
+ this.inactivityTime = inactivityTime;
+ this.gunCoolingRate = gunCoolingRate;
+ this.sentryBorderSize = sentryBorderSize;
+ this.hideEnemyNames = hideEnemyNames;
+ this.robots = robots;
+ this.initialSetups = initialSetups;
+ }
+
+ ///
+ /// Contains the allowed inactivity time for the robots in this battle.
+ ///
+ ///
+ /// The allowed inactivity time for the robots in this battle.
+ ///
+ public long InactivityTime
+ {
+ get { return inactivityTime; }
+ }
+
+ ///
+ /// Contains the gun cooling rate of the robots in this battle.
+ ///
+ ///
+ /// The gun cooling rate of the robots in this battle.
+ ///
+ public double GunCoolingRate
+ {
+ get { return gunCoolingRate; }
+ }
+
+ ///
+ /// Contains the battlefield size for this battle.
+ ///
+ ///
+ /// The battlefield size for this battle.
+ ///
+ public BattlefieldSpecification Battlefield
+ {
+ get { return new BattlefieldSpecification(battlefieldWidth, battlefieldHeight); }
+ }
+
+ ///
+ /// Contains the number of rounds in this battle.
+ ///
+ ///
+ /// The number of rounds in this battle.
+ ///
+ public int NumRounds
+ {
+ get { return numRounds; }
+ }
+
+ ///
+ /// Flag specifying if the enemy names must be hidden from events sent to robots.
+ ///
+ ///
+ /// true if the enemy names must be hidden; false otherwise.
+ ///
+ public bool HideEnemyNames
+ {
+ get { return hideEnemyNames; }
+ }
+
+ ///
+ /// Returns the sentry border size for a BorderSentry that defines the how
+ /// far a BorderSentry is allowed to move from the border edges measured in units.
+ ///
+ /// Hence, the sentry border size defines the width/range of the border area surrounding the battlefield that
+ /// border sentry robots cannot leave (they must stay in the border area), but it also define the
+ /// distance from the border edges where border sentry robots are allowed/able to make damage to robots entering this
+ /// border area.
+ ///
+ public int SentryBorderSize
+ {
+ get { return sentryBorderSize; }
+ }
+
+ ///
+ /// Contains the specifications of the robots participating in this battle.
+ ///
+ ///
+ /// An array of instances - one entry for each robot.
+ ///
+ ///
+ public RobotSpecification[] Robots
+ {
+ get
+ {
+ if (robots == null)
+ return null;
+
+ RobotSpecification[] copy = new RobotSpecification[robots.Length];
+ robots.CopyTo(copy, 0);
+ return copy;
+ }
+ }
+
+ ///
+ /// Contains the initial position and heading of each robot participating in this battle.
+ ///
+ ///
+ /// An array of instances - one entry for each robot.
+ /// The the indices of this array matches the array indices from the robot specifications (see ).
+ ///
+ ///
+ public RobotSetup[] InitialSetups
+ {
+ get
+ {
+ if (initialSetups == null)
+ return null;
+
+ RobotSetup[] copy = new RobotSetup[initialSetups.Length];
+ initialSetups.CopyTo(copy, 0);
+ return copy;
+ }
+ }
+ }
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/implementation/robocode/control/BattlefieldSpecification.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/implementation/robocode/control/BattlefieldSpecification.cs
new file mode 100644
index 0000000..d59dab6
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/implementation/robocode/control/BattlefieldSpecification.cs
@@ -0,0 +1,77 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Robocode.Control
+{
+ ///
+ /// Defines the size of a battlefield, which is a part of the .
+ ///
+ ///
+ ///
+ ///
+ [Serializable]
+ public class BattlefieldSpecification
+ {
+ private readonly int width;
+ private readonly int height;
+
+ ///
+ /// Creates a standard 800 x 600 battlefield.
+ ///
+ public BattlefieldSpecification()
+ : this(800, 600)
+ {
+ }
+
+ ///
+ /// Creates a battlefield of the specified width and height.
+ ///
+ /// The width of the battlefield, where 400 <= width <= 5000.
+ /// The height of the battlefield, where 400 <= height <= 5000.
+ /// Thrown when the width or height is < 400 or > 5000.
+ ///
+ public BattlefieldSpecification(int width, int height)
+ {
+ if (width < 400 || width > 5000)
+ throw new ArgumentException("width must be: 400 <= width <= 5000");
+
+ if (height < 400 || height > 5000)
+ throw new ArgumentException("height must be: 400 <= height <= 5000");
+
+ this.width = width;
+ this.height = height;
+ }
+
+ ///
+ /// Contains the width of this battlefield.
+ ///
+ ///
+ /// The width of this battlefield.
+ ///
+ public int Width
+ {
+ get { return width; }
+ }
+
+ ///
+ /// Contains the height of this battlefield.
+ ///
+ ///
+ /// The height of this battlefield.
+ ///
+ public int Height
+ {
+ get { return height; }
+ }
+ }
+}
\ No newline at end of file
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/implementation/robocode/control/IRobocodeEngine.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/implementation/robocode/control/IRobocodeEngine.cs
new file mode 100644
index 0000000..b87d8cc
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/implementation/robocode/control/IRobocodeEngine.cs
@@ -0,0 +1,237 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Robocode.Control.Events; // for the XML documentation
+
+namespace Robocode.Control
+{
+ ///
+ /// Event handler for the .
+ ///
+ /// The event.
+ public delegate void BattleStartedEventHandler(Robocode.Control.Events.BattleStartedEvent evnt);
+
+ ///
+ /// Event handler for the .
+ ///
+ /// The event.
+ public delegate void BattleFinishedEventHandler(Robocode.Control.Events.BattleFinishedEvent evnt);
+
+ ///
+ /// Event handler for the .
+ ///
+ /// The event.
+ public delegate void BattleCompletedEventHandler(Robocode.Control.Events.BattleCompletedEvent evnt);
+
+ ///
+ /// Event handler for the .
+ ///
+ /// The event.
+ public delegate void BattlePausedEventHandler(Robocode.Control.Events.BattlePausedEvent evnt);
+
+ ///
+ /// Event handler for the .
+ ///
+ /// The event.
+ public delegate void BattleResumedEventHandler(Robocode.Control.Events.BattleResumedEvent evnt);
+
+ ///
+ /// Event handler for the .
+ ///
+ /// The event.
+ public delegate void RoundStartedEventHandler(Robocode.Control.Events.RoundStartedEvent evnt);
+
+ ///
+ /// Event handler for the .
+ ///
+ /// The event.
+ public delegate void RoundEndedEventHandler(Robocode.Control.Events.RoundEndedEvent evnt);
+
+ ///
+ /// Event handler for the .
+ ///
+ /// The event.
+ public delegate void TurnStartedEventHandler(Robocode.Control.Events.TurnStartedEvent evnt);
+
+ ///
+ /// Event handler for the .
+ ///
+ /// The event.
+ public delegate void TurnEndedEventHandler(Robocode.Control.Events.TurnEndedEvent evnt);
+
+ ///
+ /// Event handler for the .
+ ///
+ /// The event.
+ public delegate void BattleMessageEventHandler(Robocode.Control.Events.BattleMessageEvent evnt);
+
+ ///
+ /// Event handler for the .
+ ///
+ /// The event.
+ public delegate void BattleErrorEventHandler(Robocode.Control.Events.BattleErrorEvent evnt);
+
+ ///
+ /// Interface for a RobocodeEngine.
+ ///
+ public interface IRobocodeEngine
+ {
+ ///
+ /// Occurs when a new battle is started.
+ ///
+ event BattleStartedEventHandler BattleStarted;
+
+ ///
+ /// Occurs when the battle is finished, where the battle can be either completed or aborted.
+ ///
+ event BattleFinishedEventHandler BattleFinished;
+
+ ///
+ /// Occurs when the battle is completed successfully and results are available.
+ ///
+ event BattleCompletedEventHandler BattleCompleted;
+
+ ///
+ /// Occurs when the battle is paused.
+ ///
+ event BattlePausedEventHandler BattlePaused;
+
+ ///
+ /// Occurs when the battle is resumed after having been paused.
+ ///
+ event BattleResumedEventHandler BattleResumed;
+
+ ///
+ /// Occurs when a new round is started.
+ ///
+ event RoundStartedEventHandler RoundStarted;
+
+ ///
+ /// Occurs when a round has ended.
+ ///
+ event RoundEndedEventHandler RoundEnded;
+
+ ///
+ /// Occurs when a new turn is started.
+ ///
+ event TurnStartedEventHandler TurnStarted;
+
+ ///
+ /// Occurs when a new turn is ended.
+ ///
+ event TurnEndedEventHandler TurnEnded;
+
+ ///
+ /// Occurs when a message from the battle is sent from the game.
+ ///
+ event BattleMessageEventHandler BattleMessage;
+
+ ///
+ /// Occurs when an error message from the battle is sent from the game.
+ ///
+ event BattleErrorEventHandler BattleError;
+
+ ///
+ /// Closes the RobocodeEngine and releases any allocated resources it holds.
+ /// You should call this when you have finished using the RobocodeEngine.
+ /// This method automatically disposes the Robocode window if it open.
+ ///
+ void Close();
+
+ ///
+ /// Contains the installed version of Robocode controlled by this RobocodeEngine.
+ ///
+ ///
+ /// The installed version of Robocode controlled by this RobocodeEngine.
+ ///
+ string Version { get; }
+
+ ///
+ /// Contains the visible state of the Robocode window.
+ ///
+ ///
+ /// Sets/gets the visible state of the Robocode window, where
+ /// true means that the window is visible, and
+ /// false means that the window is hidden.
+ ///
+ bool Visible { get; set; }
+
+ ///
+ /// Returns all robots available from the local robot repository of Robocode.
+ /// These robots must exists in the \robocode\robots directory, and must be
+ /// compiled in advance, before these robot are returned with this method.
+ ///
+ ///
+ /// An array of all available robots from the local robot repository.
+ ///
+ RobotSpecification[] GetLocalRepository();
+
+ ///
+ /// Returns a selection of robots available from the local robot repository
+ /// of Robocode. These robots must exists in the \robocode\robots directory,
+ /// and must be compiled in advance, before these robot are returned with this method.
+ ///
+ /// Notice: If a specified robot cannot be found in the repository, it will
+ /// not be returned in the array of robots returned by this method.
+ ///
+ /// A comma or space separated list of robots to return.
+ /// The full class name must be used for specifying the individual robot, e.g.
+ /// "sample.Corners, sample.Crazy".
+ ///
+ /// An array containing the available robots from the local robot repository based on
+ /// the selected robots specified with the selectedRobotList parameter.
+ ///
+ RobotSpecification[] GetLocalRepository(String selectedRobotList);
+
+ ///
+ /// Runs the specified battle.
+ ///
+ /// The specification of the battle to run
+ /// including the participation robots.
+ ///
+ void RunBattle(BattleSpecification battleSpecification);
+
+ ///
+ /// Runs the specified battle.
+ ///
+ /// The specification of the battle to run
+ /// including the participating robots.
+ /// Will block caller till end of battle if set.
+ ///
+ void RunBattle(BattleSpecification battleSpecification, bool waitTillOver);
+
+ ///
+ /// Runs the specified battle.
+ ///
+ /// The specification of the battle to run
+ /// including the participating robots.
+ /// A comma or space separated list like:
+ /// x1,y1,heading1, x2,y2,heading2, which are the coordinates and heading of
+ /// robot #1 and #2. So e.g. 0,0,180, 50,80,270 means that robot #1 has position
+ /// (0,0) and heading 180, and robot #2 has position (50,80) and heading 270.
+ /// Will block caller till end of battle if set.
+ ///
+ void RunBattle(BattleSpecification battleSpecification, string initialPositions, bool waitTillOver);
+
+ ///
+ /// Will block caller until current battle is over.
+ ///
+ ///
+ void WaitTillBattleOver();
+
+ ///
+ /// Aborts the current battle if it is running.
+ ///
+ ///
+ void AbortCurrentBattle();
+ }
+}
diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/implementation/robocode/control/RobocodeEngine.cs b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/implementation/robocode/control/RobocodeEngine.cs
new file mode 100644
index 0000000..956f270
--- /dev/null
+++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.control.api/src/implementation/robocode/control/RobocodeEngine.cs
@@ -0,0 +1,1682 @@
+/**
+ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://robocode.sourceforge.net/license/epl-v10.html
+ */
+
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+using Robocode.Control.Events;
+using Robocode.Control.Snapshot;
+using net.sf.robocode.security;
+
+namespace Robocode.Control
+{
+ ///
+ /// The RobocodeEngine is the interface provided for external applications
+ /// in order to let these applications run battles within the Robocode application,
+ /// and to get the results from these battles.
+ ///
+ /// This class in the main entry class of the namespace.
+ ///
+ /// The RobocodeEngine is used by e.g. RoboRumble@Home client, which is integrated in
+ /// Robocode. In addition, the RobocodeEngine is also used by the test units for
+ /// testing the Robocode application itself.
+ ///
+ public class RobocodeEngine : IRobocodeEngine
+ {
+ ///
+ public event BattleStartedEventHandler BattleStarted;
+ ///
+ public event BattleFinishedEventHandler BattleFinished;
+ ///
+ public event BattleCompletedEventHandler BattleCompleted;
+ ///
+ public event BattlePausedEventHandler BattlePaused;
+ ///
+ public event BattleResumedEventHandler BattleResumed;
+ ///
+ public event RoundStartedEventHandler RoundStarted;
+ ///
+ public event RoundEndedEventHandler RoundEnded;
+ ///
+ public event TurnStartedEventHandler TurnStarted;
+ ///
+ public event TurnEndedEventHandler TurnEnded;
+ ///
+ public event BattleMessageEventHandler BattleMessage;
+ ///
+ public event BattleErrorEventHandler BattleError;
+
+ // The internal hidden engine that has been generated based on the Java version of the engine
+ private robocode.control.RobocodeEngine engine;
+ // The internal robocode.control.events.IBattleListener
+ private BattleObserver battleObserver;
+ // Flag specifying if the Robocode window is currently visible
+ private bool isVisible;
+
+ #region Public API
+
+ ///
+ /// Creates a new RobocodeEngine for controlling Robocode.
+ /// In order for this constructor to work, the current working directory must be the
+ /// home directory directory of Robocode, e.g. C:\Robocode
+ ///
+ ///
+ public RobocodeEngine() :
+ this(AppDomain.CurrentDomain.BaseDirectory)
+ {
+ }
+
+ ///
+ /// Creates a new RobocodeEngine for controlling Robocode, where the home directory
+ /// of Robocode is specified.
+ ///
+ /// The root directory of Robocode, e.g. "C:\Robocode".
+ ///
+ public RobocodeEngine(string robocodeHome)
+ {
+ robocode.control.RobocodeEngine.Init(robocodeHome);
+ engine = new robocode.control.RobocodeEngine(new java.io.File(robocodeHome));
+ battleObserver = new BattleObserver(this);
+ engine.addBattleListener(battleObserver);
+ }
+
+ ~RobocodeEngine()
+ {
+ // Make sure Close() is called to prevent memory leaks
+ Close();
+ }
+
+ ///
+ public void Close()
+ {
+ engine.close();
+ }
+
+ ///
+ public string Version
+ {
+ get { return engine.getVersion(); }
+ }
+
+ ///
+ /// Returns the current working directory for Robocode.
+ ///
+ ///
+ /// The name of the current working directory.
+ ///
+ public static string CurrentWorkingDir
+ {
+ get { return robocode.control.RobocodeEngine.getCurrentWorkingDir().getAbsolutePath(); }
+ }
+
+ ///
+ /// Returns the directory containing the robots.
+ ///
+ ///
+ /// The name of the robot directory containing all robots.
+ ///
+ public static string RobotsDir
+ {
+ get { return robocode.control.RobocodeEngine.getRobotsDir().getAbsolutePath(); }
+ }
+
+ ///
+ public bool Visible
+ {
+ set
+ {
+ isVisible = value;
+ engine.setVisible(value);
+ }
+ get
+ {
+ return isVisible;
+ }
+ }
+
+ ///
+ public RobotSpecification[] GetLocalRepository()
+ {
+ return MapRobotSpecifications(engine.getLocalRepository());
+ }
+
+ ///
+ public RobotSpecification[] GetLocalRepository(string selectedRobots)
+ {
+ return MapRobotSpecifications(engine.getLocalRepository(selectedRobots));
+ }
+
+ ///
+ public void RunBattle(BattleSpecification battleSpecification)
+ {
+ RunBattle(battleSpecification, null, false);
+ }
+
+ ///
+ public void RunBattle(BattleSpecification battleSpecification, bool waitTillOver)
+ {
+ RunBattle(battleSpecification, "", waitTillOver);
+ }
+
+ ///
+ public void RunBattle(BattleSpecification battleSpecification, string initialPositions, bool waitTillOver)
+ {
+ engine.runBattle(MapBattleSpecification(battleSpecification), initialPositions, waitTillOver);
+ }
+
+ ///
+ public void WaitTillBattleOver()
+ {
+ engine.waitTillBattleOver();
+ }
+
+ ///
+ public void AbortCurrentBattle()
+ {
+ engine.abortCurrentBattle();
+ }
+
+ ///
+ /// Prints out all running threads to standard system out.
+ ///
+ public static void PrintRunningThreads()
+ {
+ robocode.control.RobocodeEngine.printRunningThreads();
+ }
+
+ ///
+ /// Enables or disables messages and warnings logged to Console.Out.
+ ///
+ ///
+ /// true means that log messages must be enabled, and
+ /// false means that log messages must be disabled.
+ ///
+ ///
+ public static bool LogMessagesEnabled
+ {
+ set
+ {
+ robocode.control.RobocodeEngine.setLogMessagesEnabled(value);
+ }
+ }
+
+ ///
+ /// Enables or disables errors logged to Console.Error.
+ ///
+ ///
+ /// true means that log errors must be enabled, and
+ /// false means that log errors must be disabled.
+ ///
+ ///
+ public static bool LogErrorsEnabled
+ {
+ set
+ {
+ robocode.control.RobocodeEngine.setLogErrorsEnabled(value);
+ }
+ }
+
+ #endregion
+
+ #region Event dispatchers
+
+ private void OnBattleStarted(BattleStartedEvent e)
+ {
+ if (BattleStarted != null)
+ BattleStarted(e);
+ }
+
+ private void OnBattleFinished(BattleFinishedEvent e)
+ {
+ if (BattleFinished != null)
+ BattleFinished(e);
+ }
+
+ private void OnBattleCompleted(BattleCompletedEvent e)
+ {
+ if (BattleCompleted != null)
+ BattleCompleted(e);
+ }
+
+ private void OnBattlePaused(BattlePausedEvent e)
+ {
+ if (BattlePaused != null)
+ BattlePaused(e);
+ }
+
+ private void OnBattleResumed(BattleResumedEvent e)
+ {
+ if (BattleResumed != null)
+ BattleResumed(e);
+ }
+
+ private void OnRoundStarted(RoundStartedEvent e)
+ {
+ if (RoundStarted != null)
+ RoundStarted(e);
+ }
+
+ private void OnRoundEnded(Robocode.Control.Events.RoundEndedEvent e)
+ {
+ if (RoundEnded != null)
+ RoundEnded(e);
+ }
+
+ private void OnTurnStarted(TurnStartedEvent e)
+ {
+ if (TurnStarted != null)
+ TurnStarted(e);
+ }
+
+ private void OnTurnEnded(TurnEndedEvent e)
+ {
+ if (TurnEnded != null)
+ TurnEnded(e);
+ }
+
+ private void OnBattleMessage(BattleMessageEvent e)
+ {
+ if (BattleMessage != null)
+ BattleMessage(e);
+ }
+
+ private void OnBattleError(BattleErrorEvent e)
+ {
+ if (BattleError != null)
+ BattleError(e);
+ }
+
+ #endregion
+
+ #region Specification mappers
+
+ private RobotSpecification[] MapRobotSpecifications(robocode.control.RobotSpecification[] specifications)
+ {
+ if (specifications == null)
+ {
+ return null;
+ }
+
+ RobotSpecification[] mappedSpecifications = new RobotSpecification[specifications.Length];
+
+ for (int i = 0; i < specifications.Length; i++)
+ {
+ mappedSpecifications[i] = MapRobotSpecification(specifications[i]);
+ }
+ return mappedSpecifications;
+ }
+
+ private RobotSpecification MapRobotSpecification(robocode.control.RobotSpecification spec)
+ {
+ return new RobotSpecification(spec);
+ }
+
+ private robocode.control.RobotSpecification[] MapRobotSpecifications(RobotSpecification[] specifications)
+ {
+ if (specifications == null)
+ {
+ return null;
+ }
+
+ robocode.control.RobotSpecification[] mappedSpecifications = new robocode.control.RobotSpecification[specifications.Length];
+
+ for (int i = 0; i < specifications.Length; i++)
+ {
+ mappedSpecifications[i] = MapRobotSpecification(specifications[i]);
+ }
+ return mappedSpecifications;
+ }
+
+ private robocode.control.RobotSpecification MapRobotSpecification(RobotSpecification spec)
+ {
+ return spec.robotSpecification;
+ }
+
+ private robocode.control.BattleSpecification MapBattleSpecification(BattleSpecification spec)
+ {
+ robocode.control.BattlefieldSpecification battlefieldSpec = new robocode.control.BattlefieldSpecification(spec.Battlefield.Width, spec.Battlefield.Height);
+ robocode.control.RobotSpecification[] robotSpecs = MapRobotSpecifications(spec.Robots);
+ robocode.control.RobotSetup[] initialSetups = MapInitialSetups(spec.InitialSetups);
+
+ return new robocode.control.BattleSpecification(battlefieldSpec, spec.NumRounds, spec.InactivityTime,
+ spec.GunCoolingRate, spec.SentryBorderSize, spec.HideEnemyNames, robotSpecs, initialSetups);
+ }
+
+ private robocode.control.RobotSetup[] MapInitialSetups(RobotSetup[] setups)
+ {
+ if (setups == null)
+ {
+ return null;
+ }
+
+ robocode.control.RobotSetup[] mappedSetups = new robocode.control.RobotSetup[setups.Length];
+
+ for (int i = 0; i < setups.Length; i++)
+ {
+ mappedSetups[i] = MapRobotSetup(setups[i]);
+ }
+ return mappedSetups;
+ }
+
+ private robocode.control.RobotSetup MapRobotSetup(RobotSetup setup)
+ {
+ return new robocode.control.RobotSetup(setup.X, setup.Y, setup.Heading);
+ }
+ #endregion
+
+ #region Battle observer (internal engine events -> Robocode.Control.Events)
+
+ private class BattleObserver : robocode.control.events.IBattleListener
+ {
+ RobocodeEngine engine;
+
+ public BattleObserver(RobocodeEngine engine)
+ {
+ this.engine = engine;
+ }
+
+ public void onBattleStarted(robocode.control.events.BattleStartedEvent evnt)
+ {
+ engine.OnBattleStarted(MapEvent(evnt));
+ }
+
+ public void onBattleFinished(robocode.control.events.BattleFinishedEvent evnt)
+ {
+ engine.OnBattleFinished(MapEvent(evnt));
+ }
+
+ public void onBattleCompleted(robocode.control.events.BattleCompletedEvent evnt)
+ {
+ engine.OnBattleCompleted(MapEvent(evnt));
+ }
+
+ public void onBattlePaused(robocode.control.events.BattlePausedEvent evnt)
+ {
+ engine.OnBattlePaused(new BattlePausedEvent());
+ }
+
+ public void onBattleResumed(robocode.control.events.BattleResumedEvent evnt)
+ {
+ engine.OnBattleResumed(new BattleResumedEvent());
+ }
+
+ public void onRoundStarted(robocode.control.events.RoundStartedEvent evnt)
+ {
+ engine.OnRoundStarted(MapEvent(evnt));
+ }
+
+ public void onRoundEnded(robocode.control.events.RoundEndedEvent evnt)
+ {
+ engine.OnRoundEnded(MapEvent(evnt));
+ }
+
+ public void onTurnStarted(robocode.control.events.TurnStartedEvent evnt)
+ {
+ engine.OnTurnStarted(new TurnStartedEvent());
+ }
+
+ public void onTurnEnded(robocode.control.events.TurnEndedEvent evnt)
+ {
+ engine.OnTurnEnded(MapEvent(evnt));
+ }
+
+ public void onBattleMessage(robocode.control.events.BattleMessageEvent evnt)
+ {
+ engine.OnBattleMessage(MapEvent(evnt));
+ }
+
+ public void onBattleError(robocode.control.events.BattleErrorEvent evnt)
+ {
+ engine.OnBattleError(MapEvent(evnt));
+ }
+ }
+
+ #endregion
+
+ #region Event mappers (generated events -> Robocode.Control.Events)
+
+ private static BattleStartedEvent MapEvent(robocode.control.events.BattleStartedEvent evnt)
+ {
+ return new BattleStartedEvent(MapBattleRules(evnt.getBattleRules()), evnt.getRobotsCount(), evnt.isReplay());
+ }
+
+ private static BattleFinishedEvent MapEvent(robocode.control.events.BattleFinishedEvent evnt)
+ {
+ return new BattleFinishedEvent(evnt.isAborted());
+ }
+
+ private static BattleCompletedEvent MapEvent(robocode.control.events.BattleCompletedEvent evnt)
+ {
+ return new BattleCompletedEvent(MapBattleRules(evnt.getBattleRules()), MapBattleResults(evnt.getIndexedResults()));
+ }
+
+ private static BattleMessageEvent MapEvent(robocode.control.events.BattleMessageEvent evnt)
+ {
+ return new BattleMessageEvent(evnt.getMessage());
+ }
+
+ private static BattleErrorEvent MapEvent(robocode.control.events.BattleErrorEvent evnt)
+ {
+ return new BattleErrorEvent(evnt.getError());
+ }
+
+ private static RoundStartedEvent MapEvent(robocode.control.events.RoundStartedEvent evnt)
+ {
+ return new RoundStartedEvent(MapTurnSnapshot(evnt.getStartSnapshot()), evnt.getRound());
+ }
+
+ private static Robocode.Control.Events.RoundEndedEvent MapEvent(robocode.control.events.RoundEndedEvent evnt)
+ {
+ return new Robocode.Control.Events.RoundEndedEvent(evnt.getRound(), evnt.getTurns(), evnt.getTotalTurns());
+ }
+
+ private static TurnEndedEvent MapEvent(robocode.control.events.TurnEndedEvent evnt)
+ {
+ return new TurnEndedEvent(MapTurnSnapshot(evnt.getTurnSnapshot()));
+ }
+
+ private static BattleCompletedEvent[] MapEvents(robocode.control.events.BattleCompletedEvent[] events)
+ {
+ if (events == null)
+ {
+ return null;
+ }
+
+ BattleCompletedEvent[] mappedEvents = new BattleCompletedEvent[events.Length];
+
+ for (int i = 0; i < events.Length; i++)
+ {
+ mappedEvents[i] = MapEvent(events[i]);
+ }
+ return mappedEvents;
+ }
+
+ private static BattleResults[] MapBattleResults(java.lang.Object[] results)
+ {
+ if (results == null)
+ {
+ return null;
+ }
+
+ BattleResults[] mappedResults = new BattleResults[results.Length];
+
+ for (int i = 0; i < results.Length; i++)
+ {
+ mappedResults[i] = MapBattleResults(results[i]);
+ }
+ return mappedResults;
+ }
+
+ private static BattleRules MapBattleRules(java.lang.Object obj)
+ {
+ int battlefieldWidth = obj.Invoke("getBattlefieldWidth", "()I", new object[] { });
+ int battlefieldHeight = obj.Invoke("getBattlefieldHeight", "()I", new object[] { });
+ int numRounds = obj.Invoke("getNumRounds", "()I", new object[] { });
+ double gunCoolingRate = obj.Invoke("getGunCoolingRate", "()D", new object[] { });
+ long inactivityTime = obj.Invoke("getInactivityTime", "()J", new object[] { });
+ bool hideEnemyNames = obj.Invoke("getHideEnemyNames", "()Z", new object[] { });
+ int sentryBorderSize = obj.Invoke("getSentryBorderSize", "()I", new object[] { });
+
+ MethodInfo method = typeof(BattleRules).GetMethod("createHiddenHelper", BindingFlags.Static | BindingFlags.NonPublic);
+ IHiddenRulesHelper rulesHelper = (IHiddenRulesHelper)method.Invoke(null, null);
+
+ return rulesHelper.createRules(battlefieldWidth, battlefieldHeight, numRounds, gunCoolingRate, inactivityTime, hideEnemyNames, sentryBorderSize);
+ }
+
+ private static BattleResults MapBattleResults(java.lang.Object obj)
+ {
+ string teamLeaderName = obj.Invoke("getTeamLeaderName", "()Ljava/lang/String;", new object[] { });
+ int rank = obj.Invoke("getRank", "()I", new object[] { });
+ int score = obj.Invoke("getScore", "()I", new object[] { });
+ int survival = obj.Invoke("getSurvival", "()I", new object[] { });
+ int lastSurvivorBonus = obj.Invoke