// // On attends que le client nous dise s'il veut faire un donjon, auquel cas on le redirige vers un service approprié // public override void ProcessClient(Client c) { ByteMessage byteMessage = c.GetByteMessage(); switch (byteMessage.ReadTag()) { case "OMV": // Movement intent { int id = byteMessage.ReadInt(); int segments = byteMessage.ReadInt(); List <float> dx = new List <float>(); List <float> dy = new List <float>(); List <float> rx = new List <float>(); List <float> ry = new List <float>(); List <float> time = new List <float>(); for (int i = 0; i < segments; i++) { dx.Add(byteMessage.ReadFloat()); dy.Add(byteMessage.ReadFloat()); rx.Add(byteMessage.ReadFloat()); ry.Add(byteMessage.ReadFloat()); time.Add(byteMessage.ReadFloat()); } c.actions[0] = new Actions.MoveAction(dx, dy, rx, ry, time); } break; case "PNG": { c.HeartBeat(); } break; } }
public static void Populate(List <Tuple <string, ByteMessage, ByteMessage> > mapsToBake) { NavigationBuilder.Initialize(); foreach (var mapdata in mapsToBake) { ByteMessage map = mapdata.Item2; //map.Load("D:/Database/Maps/default"); string name = mapdata.Item1; int nbVert = map.ReadInt(); Vector3[] verts = new Vector3[nbVert]; for (int i = 0; i < nbVert; i++) { verts[i] = new Vector3(map.ReadFloat(), map.ReadFloat(), map.ReadFloat()); } int nbInd = map.ReadInt(); int[] inds = new int[nbInd]; for (int i = 0; i < nbInd; i++) { inds[i] = map.ReadInt(); } int nbPg = map.ReadInt(); List <NavigationBuilder.PointGraph> pts = new List <NavigationBuilder.PointGraph>(); for (int i = 0; i < nbPg; i++) { NavigationBuilder.PointGraph p = new NavigationBuilder.PointGraph(); p.index = map.ReadInt(); p.neighbours = new List <int>(); int nbNei = map.ReadInt(); for (int j = 0; j < nbNei; j++) { p.neighbours.Add(map.ReadInt()); } pts.Add(p); } NavigationBuilder.AddMap(name, verts, inds, pts); } }