public static CharacterRouteInfo operator *(CharacterRouteInfo a, double b) { if (a.Kind == CharacterKind.General) { var routes = a.Routes.Select((RelativeRoute route) => { var r = new RelativeRoute(route.StartX * b, route.StartY * b, route.EndX * b, route.EndY * b); Console.WriteLine(string.Format("From {0} to {1}", route, r)); return(r); }); var newInfo = new CharacterRouteInfo(optimizationRoute(routes.ToList())); return(newInfo); } return(a); }
public List <RelativeRoute> RequestCharacterWithTcp(char c) { byte[] b = new byte[2]; b[0] = (byte)((c & 0xFF00) >> 8); b[1] = (byte)(c & 0xFF); Socket.Send(b); var list = new List <RelativeRoute>(); b = new byte[4]; var end = false; do { Socket.Receive(b); var sx = BitConverter.ToInt32(b, 0); Socket.Receive(b); var sy = BitConverter.ToInt32(b, 0); Socket.Receive(b); var ex = BitConverter.ToInt32(b, 0); Socket.Receive(b); var ey = BitConverter.ToInt32(b, 0); if (sx != 0 && sy != 0 && ex != 0 && ey != 0) { var route = new RelativeRoute(sx, sy, ex, ey); Console.WriteLine(route); list.Add(route); } else { end = true; } } while (!end); return(list); }