private void RouteGameObjectCommand(NetworkCommandObject command) { GameObjectCommand objCommand = (GameObjectCommand)command.Command; switch (objCommand.CommandType) { case GameObjectCommandType.Create: { NetworkFactory.BuildFromNetwork(objCommand); } break; case GameObjectCommandType.Delete: { throw new NotImplementedException("placeholder, probably won't need"); } break; case GameObjectCommandType.Update: { container.GetObjectById(objCommand.ID).UpdateFromNetworkParams(objCommand); } break; default: { throw new NotImplementedException("gameobject command type not implemented"); } } }
private void RouteNetCommand(NetworkCommandObject command) { //parse command type switch (command.CommandType) { case NetworkCommandType.GameObjectCommand: { RouteGameObjectCommand(command); //NetworkFactory.BuildFromNetwork((CreateParameters)objectCommand.Parameters); } break; /*case GameObjectCommandType.Update: { //findby id and run update from network var parameters = (UpdateParameters)objectCommand.Parameters; var updatee = container.GetObjectById(parameters.ID); updatee.UpdateFromNetworkParams(parameters); } break;*/ default: { throw new NotImplementedException("this command type has not been implemented yet"); } } }
private void EchoAllOthers(NetworkCommandObject command, BinaryFormatter formatter = null) { if (formatter == null) formatter = new BinaryFormatter(); for (int i = 0; i < clients.Count(); ++i) { if (command.ClientId != clients[i].ClientId) { formatter.Serialize(clients[i].Client.GetStream(), command); } } }