// Convenience constructors public ActionMouse( long timeDelayMS, CoordinateMode mode, int moveX, int moveY ) : this(timeDelayMS, ClickType.NONE, mode, MouseButton.LeftButton, -1, moveX, moveY) { }
public ActionMouse( long timeDelayMS, ClickType clickType, CoordinateMode mode, int xButtonId, int xClick, int yClick) : this(timeDelayMS, clickType, mode, MouseButton.LeftButton, xButtonId, xClick, yClick) { }
public ActionMouse( long timeDelayMS, ClickType clickType, CoordinateMode mode, MouseButton mouseButton, int xClick, int yClick) : this(timeDelayMS, clickType, mode, mouseButton, -1, xClick, yClick) { }
public ActionMouse(ActionMouse copyFrom) : base(copyFrom) { this.xMove = copyFrom.xMove; this.yMove = copyFrom.yMove; this.clickType = copyFrom.clickType; this.mode = copyFrom.mode; this.Type = copyFrom.Type; this.button = copyFrom.button; this.xButtonId = copyFrom.xButtonId; }
protected void AddCollision(CoordinateMode mode, CollisionBox box) { if (mode == CoordinateMode.Grid) { box.X *= 16; box.Y *= 16; box.Width *= 16; box.Height *= 16; } collision.Add(box); }
public ActionMouse( long timeDelayMS, ClickType clickType, CoordinateMode mode, MouseButton button, int xButtonId, int moveX, int moveY) : base(timeDelayMS) { this.clickType = clickType; this.mode = mode; this.button = button; this.xMove = moveX; this.yMove = moveY; this.xButtonId = xButtonId; this.Type = ActionType.Mouse; }
protected override Boolean IsValid(CSSValue value) { var calc = value.AsCalc(); if (calc != null) { _mode = new CalcCoordinateMode(calc); } else if (value.Is("auto")) { _mode = _auto; } else if (value != CSSValue.Inherit) { return(false); } return(true); }
protected CSSCoordinateProperty(String name) : base(name) { _inherited = false; _mode = _auto; }
private void HandleDataValueMessage(Stream s) { // construct a binary reader BinaryReader reader = new BinaryReader(s); // get the sequence number int seqNo = reader.ReadInt32(); // calculate how many packet we've missed // we are expecting a difference of 1 in the sequence numbers int missed = seqNo - lastSeqNo - 1; // if the difference is less than zero, something stuff is going on if (missed > 0 && lastSeqNo != -1) { missedCount += missed; } // set the last sequence number lastSeqNo = seqNo; // increment the received count receivedCount++; // get the data item name string diName = reader.ReadString(); // get the time CarTimestamp t = reader.ReadDouble(); // read the data type code DataTypeCode dtc = (DataTypeCode)reader.ReadInt32(); // handle the type appropriately object value = null; switch (dtc) { case DataTypeCode.Double: value = reader.ReadDouble(); break; case DataTypeCode.Single: value = reader.ReadSingle(); break; case DataTypeCode.Int8: value = reader.ReadSByte(); break; case DataTypeCode.Int16: value = reader.ReadInt16(); break; case DataTypeCode.Int32: value = reader.ReadInt32(); break; case DataTypeCode.Int64: value = reader.ReadInt64(); break; case DataTypeCode.UInt8: value = reader.ReadByte(); break; case DataTypeCode.UInt16: value = reader.ReadUInt16(); break; case DataTypeCode.UInt32: value = reader.ReadUInt32(); break; case DataTypeCode.UInt64: value = reader.ReadUInt64(); break; case DataTypeCode.Boolean: value = reader.ReadBoolean(); break; case DataTypeCode.DateTime: value = DateTime.FromBinary(reader.ReadInt64()); break; case DataTypeCode.TimeSpan: value = new TimeSpan(reader.ReadInt64()); break; case DataTypeCode.Coordinates: value = new Coordinates(reader.ReadDouble(), reader.ReadDouble()); break; case DataTypeCode.Circle: value = new Circle(reader.ReadDouble(), new Coordinates(reader.ReadDouble(), reader.ReadDouble())); break; case DataTypeCode.Line: value = new Line(new Coordinates(reader.ReadDouble(), reader.ReadDouble()), new Coordinates(reader.ReadDouble(), reader.ReadDouble())); break; case DataTypeCode.LineSegment: value = new LineSegment(new Coordinates(reader.ReadDouble(), reader.ReadDouble()), new Coordinates(reader.ReadDouble(), reader.ReadDouble())); break; case DataTypeCode.Polygon: { CoordinateMode coordMode = (CoordinateMode)reader.ReadInt32(); int count = reader.ReadInt32(); Polygon pg = new Polygon(coordMode); for (int i = 0; i < count; i++) { pg.Add(new Coordinates(reader.ReadDouble(), reader.ReadDouble())); } value = pg; } break; case DataTypeCode.Bezier: { value = new CubicBezier( new Coordinates(reader.ReadDouble(), reader.ReadDouble()), new Coordinates(reader.ReadDouble(), reader.ReadDouble()), new Coordinates(reader.ReadDouble(), reader.ReadDouble()), new Coordinates(reader.ReadDouble(), reader.ReadDouble())); } break; case DataTypeCode.LineList: { LineList linelist = new LineList(); int ll_count = reader.ReadInt32(); linelist.Capacity = ll_count; for (int i = 0; i < ll_count; i++) { linelist.Add(new Coordinates(reader.ReadDouble(), reader.ReadDouble())); } value = linelist; } break; case DataTypeCode.CoordinatesArray: { int numPts = reader.ReadInt32(); Coordinates[] pts = new Coordinates[numPts]; for (int i = 0; i < numPts; i++) { pts[i] = new Coordinates(reader.ReadDouble(), reader.ReadDouble()); } value = pts; } break; case DataTypeCode.LineListArray: { int numLineList = reader.ReadInt32(); LineList[] lineLists = new LineList[numLineList]; for (int i = 0; i < numLineList; i++) { int numPoints = reader.ReadInt32(); lineLists[i] = new LineList(numPoints); for (int j = 0; j < numPoints; j++) { lineLists[i].Add(new Coordinates(reader.ReadDouble(), reader.ReadDouble())); } } value = lineLists; } break; case DataTypeCode.PolygonArray: { int numPolys = reader.ReadInt32(); Polygon[] polys = new Polygon[numPolys]; for (int i = 0; i < numPolys; i++) { int numPoints = reader.ReadInt32(); polys[i] = new Polygon(numPoints); for (int j = 0; j < numPoints; j++) { polys[i].Add(ReadReducedCoord(reader)); } } value = polys; } break; case DataTypeCode.ObstacleArray: { int numObs = reader.ReadInt32(); OperationalObstacle[] obstacles = new OperationalObstacle[numObs]; for (int i = 0; i < numObs; i++) { OperationalObstacle obs = new OperationalObstacle(); obs.age = reader.ReadInt32(); obs.obstacleClass = (ObstacleClass)reader.ReadInt32(); obs.ignored = reader.ReadBoolean(); obs.headingValid = reader.ReadBoolean(); obs.heading = reader.ReadDouble(); int numPoints = reader.ReadInt32(); obs.poly = new Polygon(numPoints); for (int j = 0; j < numPoints; j++) { obs.poly.Add(ReadReducedCoord(reader)); } obstacles[i] = obs; } value = obstacles; } break; case DataTypeCode.BinarySerialized: if (reader.ReadByte() == 0) { value = formatter.Deserialize(s); } else { DeflateStream ds = new DeflateStream(s, CompressionMode.Decompress, true); value = formatter.Deserialize(ds); } break; default: // unknown type throw new InvalidOperationException(); } // check if there is no value if (value == null) { return; } // check if we have the data item IDataItemClient diObj; if (!items.TryGetValue(diName, out diObj)) { // build the data item Type diGenType = typeof(DataItemClient <>); Type diType = diGenType.MakeGenericType(value.GetType()); diObj = (IDataItemClient)Activator.CreateInstance(diType, diName); Add(diName, diObj); } diObj.AddDataItem(value, t); }
/// <summary> /// Constructs a path initialized with the specified path segments and coordinate mode /// </summary> /// <param name="initial"></param> /// <param name="coordMode"></param> public PointPath(IEnumerable<IPathSegment> initial, CoordinateMode coordMode) : this(initial) { this.coordMode = coordMode; achieved = new List<IPathSegment>(); }
public Polygon(IEnumerable <Coordinates> points) { this.points = new List <Coordinates>(points); coordMode = CoordinateMode.AbsoluteProjected; }
public Polygon(int capacity) { points = new List <Coordinates>(capacity); coordMode = CoordinateMode.AbsoluteProjected; }
/// <summary> /// Constructs a path initialized with the specified path segments and coordinate mode /// </summary> /// <param name="initial"></param> /// <param name="coordMode"></param> public Path(IEnumerable<IPathSegment> initial, CoordinateMode coordMode) : this(initial) { this.coordMode = coordMode; }
public override void Play() { InputBuilder inputBuilder = new InputBuilder(); CoordinateMode modeActual = this.mode; int xActual = this.xMove; int yActual = this.yMove; // Absolute mode in pixels isn't supported by SendInput() API // Glue supports it with this translation if (this.mode == CoordinateMode.PIXEL) { modeActual = CoordinateMode.ABSOLUTE; xActual = NormalizeX(this.xMove); yActual = NormalizeY(this.yMove); } // Add movement if one is specified switch (modeActual) { case CoordinateMode.ABSOLUTE: inputBuilder.AddAbsoluteMouseMovement(xActual, yActual); break; case CoordinateMode.ABSOLUTE_VIRTUAL_DESKTOP: inputBuilder.AddAbsoluteMouseMovementOnVirtualDesktop(xActual, yActual); break; case CoordinateMode.RELATIVE: inputBuilder.AddRelativeMouseMovement(xActual, yActual); break; case CoordinateMode.NONE: default: // If none specified don't do anything break; } switch (this.clickType) { case ClickType.PRESS: if (-1 != this.xButtonId) { inputBuilder.AddMouseXButtonDown(this.xButtonId); } else { inputBuilder.AddMouseButtonDown(this.button); } break; case ClickType.RELEASE: if (-1 != this.xButtonId) { inputBuilder.AddMouseXButtonUp(this.xButtonId); } else { inputBuilder.AddMouseButtonUp(this.button); } break; case ClickType.DOUBLE: if (-1 != this.xButtonId) { inputBuilder.AddMouseXButtonDoubleClick(this.xButtonId); } else { inputBuilder.AddMouseButtonDoubleClick(this.button); } break; case ClickType.CLICK: if (-1 != this.xButtonId) { inputBuilder.AddMouseXButtonClick(this.xButtonId); } else { inputBuilder.AddMouseButtonClick(this.button); } break; case ClickType.NONE: default: // Do nothing break; } if (LOGGER.IsDebugEnabled) { long now = TimeProvider.GetTickCount(); string message = String.Format( " Played at tick {0:n0} dt {1:n0}ms: {2} {3} {4} {5} ({6:n0}, {7:n0})", now, // Time actually played now - this.ScheduledTick, // Time delta (how late were we?) this.clickType, this.button, this.xButtonId, this.mode, this.xMove, this.yMove); LOGGER.Debug(message); } DISPATCHER.DispatchInput(inputBuilder.ToArray()); }
/// <summary> /// Constructs an empty path with the specified coordinate mode /// </summary> /// <param name="coordMode">Reference frame for the path points</param> public PointPath(CoordinateMode coordMode) : this() { this.coordMode = coordMode; }
/// <summary> /// Constructs an empty path with the specified coordinate mode /// </summary> /// <param name="coordMode">Reference frame for the path points</param> public Path(CoordinateMode coordMode) { this.coordMode = coordMode; segments = new List<IPathSegment>(); }
/// <summary> /// Constructs a path initialized with the specified path segments and coordinate mode /// </summary> /// <param name="initial"></param> /// <param name="coordMode"></param> public PointPath(IEnumerable <IPathSegment> initial, CoordinateMode coordMode) : this(initial) { this.coordMode = coordMode; achieved = new List <IPathSegment>(); }
public Polygon() { points = new List <Coordinates>(); coordMode = CoordinateMode.AbsoluteProjected; }
/// <summary> /// Constructs an empty path with the specified coordinate mode /// </summary> /// <param name="coordMode">Reference frame for the path points</param> public Path(CoordinateMode coordMode) { this.coordMode = coordMode; segments = new List <IPathSegment>(); }
public Polygon(CoordinateMode coordMode) { points = new List <Coordinates>(); this.coordMode = coordMode; }
/// <summary> /// Constructs a path initialized with the specified path segments and coordinate mode /// </summary> /// <param name="initial"></param> /// <param name="coordMode"></param> public Path(IEnumerable <IPathSegment> initial, CoordinateMode coordMode) : this(initial) { this.coordMode = coordMode; }
public Polygon(IEnumerable <Coordinates> points, CoordinateMode coordMode) { this.points = new List <Coordinates>(points); this.coordMode = coordMode; }