} // được thực hiện khi 1 lệnh được thực thi. public static Command StaticReadAndCreate(ref InputMemoryBitStream input) { Command returnval = new Command(); int type = 0; input.Read(ref type); int networkid = 0; input.Read(ref networkid); int playerid = 0; input.Read(ref playerid); CommandType mtype = (CommandType)type; switch (mtype) { case CommandType.CM_ATTACK: { returnval = new AttackCommand(); returnval.SetNetworkID(networkid); returnval.SetPlayerID(playerid); returnval.Read(ref input); break; } case CommandType.CM_MOVE: { returnval = new MoveCommand(); returnval.SetNetworkID(networkid); returnval.SetPlayerID(playerid); returnval.Read(ref input); break; } case CommandType.CM_SPAWN: { returnval = new SpawnCommand(); returnval.SetNetworkID(networkid); returnval.SetPlayerID(playerid); returnval.Read(ref input); break; } case CommandType.CM_ROTATE: { break; } default: break; } return(returnval); }