fixed pong with new protocol

This commit is contained in:
Jeena Paradies 2011-04-12 00:58:29 +02:00
commit 865c963ad6
19 changed files with 3974 additions and 110 deletions

View file

@ -140,7 +140,7 @@ class GGSChat:
"Content-Type: text\n" +
"Content-Length: 0\n"+
"\n")
time.sleep(2)
#time.sleep(2)
def updateUsers(self, text):
evalNicks = eval(text)

View file

@ -11,7 +11,7 @@
@implementation GGSNetwork
#define GGS_HOST @"jeena.net"
#define GGS_HOST @"home.jeena.net"
#define GGS_PORT 9000
#define NO_TIMEOUT -1
@ -32,13 +32,14 @@
@synthesize asyncSocket, delegate, gameToken, currentHeaders;
- (id)initWithDelegate:(id<GGSDelegate>)_delegate {
if (self = [super init]) {
if ((self = [super init])) {
delegate = _delegate;
asyncSocket = [[AsyncSocket alloc] initWithDelegate:self];
[asyncSocket connectToHost:GGS_HOST onPort:GGS_PORT error:nil];
[asyncSocket readDataToData:HEADER_DELIMITER withTimeout:NO_TIMEOUT tag:HEAD];
}
return self;
@ -62,11 +63,11 @@
}
- (void)onSocket:(AsyncSocket *)sock didConnectToHost:(NSString *)host port:(UInt16)port {
//[asyncSocket writeData:[self makeMessageFor:@"Server" withCommand:@"hello" andArgs:@""] withTimeout:NO_TIMEOUT tag:NO_TAG];
}
- (void)onSocket:(AsyncSocket *)sender didReadData:(NSData *)data withTag:(long)tag {
if (tag == HEAD) {
[self parseAndSetHeader:data];
@ -96,6 +97,7 @@
self.gameToken = response;
[delegate GGSNetwork:self ready:YES];
NSLog(@"%@", self.gameToken);
} else {
[delegate GGSNetwork:self receivedCommand:command withArgs:response];

View file

@ -48,6 +48,7 @@
#pragma mark GGSNetwork Delegate
- (void)GGSNetwork:(GGSNetwork *)_ggsNetwork ready:(BOOL)ready {
NSLog(@"ready");
[ggsNetwork sendCommand:@"ready" withArgs:@""];
}

View file

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
BuildableName = "Pong.app"
BlueprintName = "Pong"
ReferencedContainer = "container:Pong.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
displayScaleIsEnabled = "NO"
displayScale = "1.00"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
BuildableName = "Pong.app"
BlueprintName = "Pong"
ReferencedContainer = "container:Pong.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
displayScaleIsEnabled = "NO"
displayScale = "1.00"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
BuildableName = "Pong.app"
BlueprintName = "Pong"
ReferencedContainer = "container:Pong.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>Pong.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>1D6058900D05DD3D006BFB54</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>