예제 #1
0
 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");
             }
     }
 }
예제 #2
0
 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");
             }
     }
 }
예제 #3
0
 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);
         }
     }
 }