Hook up the "Play" button to launch the game.
This commit is contained in:
@@ -11,14 +11,16 @@
|
||||
@class Mod;
|
||||
@class SidebarEntry;
|
||||
@class GameInstall;
|
||||
@class JSBridge;
|
||||
@interface Controller : NSObject
|
||||
{
|
||||
SidebarEntry *sidebarItems;
|
||||
GameInstall *game;
|
||||
JSBridge *jsbridge;
|
||||
IBOutlet NSOutlineView *outlineView;
|
||||
IBOutlet WebView *webView;
|
||||
}
|
||||
- (IBAction)launchGame:(id)sender;
|
||||
- (void)launchGame;
|
||||
- (SidebarEntry *)sidebarModsTree;
|
||||
- (SidebarEntry *)sidebarOtherTree;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#import "SidebarEntry.h"
|
||||
#import "GameInstall.h"
|
||||
#import "ImageAndTextCell.h"
|
||||
#import "JSBridge.h"
|
||||
|
||||
@implementation Controller
|
||||
|
||||
@@ -27,6 +28,9 @@
|
||||
[outlineView reloadData];
|
||||
[outlineView expandItem:[outlineView itemAtRow:0] expandChildren:YES];
|
||||
[outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:1] byExtendingSelection:NO];
|
||||
|
||||
jsbridge = [[JSBridge alloc] initWithController:self];
|
||||
[[webView windowScriptObject] setValue:jsbridge forKey:@"Launcher"];
|
||||
}
|
||||
|
||||
- (SidebarEntry *)sidebarModsTree
|
||||
@@ -130,7 +134,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)launchGame:(id)sender
|
||||
- (void)launchGame
|
||||
{
|
||||
[game launchGame];
|
||||
}
|
||||
|
||||
@@ -16,13 +16,14 @@
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
gameURL = url;
|
||||
gameURL = [url retain];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[gameURL release]; gameURL = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
18
OpenRA.Launcher.Mac/JSBridge.h
Normal file
18
OpenRA.Launcher.Mac/JSBridge.h
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see LICENSE.
|
||||
*/
|
||||
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@class Controller;
|
||||
@interface JSBridge : NSObject {
|
||||
Controller *controller;
|
||||
}
|
||||
|
||||
-(id)initWithController:(Controller *)aController;
|
||||
@end
|
||||
36
OpenRA.Launcher.Mac/JSBridge.m
Normal file
36
OpenRA.Launcher.Mac/JSBridge.m
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see LICENSE.
|
||||
*/
|
||||
|
||||
#import "JSBridge.h"
|
||||
#import "Controller.h"
|
||||
|
||||
@implementation JSBridge
|
||||
|
||||
-(id)initWithController:(Controller *)aController
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
controller = [aController retain];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
- (void) dealloc
|
||||
{
|
||||
[controller release]; controller = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
- (void)launchCurrentMod
|
||||
{
|
||||
[controller launchGame];
|
||||
}
|
||||
|
||||
+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector { return NO; }
|
||||
@end
|
||||
@@ -12,6 +12,7 @@
|
||||
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
|
||||
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
|
||||
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
|
||||
DA38212212925344003B0BB5 /* JSBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = DA38212112925344003B0BB5 /* JSBridge.m */; };
|
||||
DA81FA821290F5C800C48F2F /* Controller.m in Sources */ = {isa = PBXBuildFile; fileRef = DA81FA811290F5C800C48F2F /* Controller.m */; };
|
||||
DA81FAAA1290FA0000C48F2F /* Mod.m in Sources */ = {isa = PBXBuildFile; fileRef = DA81FAA91290FA0000C48F2F /* Mod.m */; };
|
||||
DA81FB9312910A8B00C48F2F /* ImageAndTextCell.m in Sources */ = {isa = PBXBuildFile; fileRef = DA81FB9212910A8B00C48F2F /* ImageAndTextCell.m */; };
|
||||
@@ -34,6 +35,8 @@
|
||||
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
|
||||
8D1107310486CEB800E47090 /* OpenRA-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "OpenRA-Info.plist"; sourceTree = "<group>"; };
|
||||
8D1107320486CEB800E47090 /* OpenRA.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OpenRA.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
DA38212012925344003B0BB5 /* JSBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBridge.h; sourceTree = "<group>"; };
|
||||
DA38212112925344003B0BB5 /* JSBridge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSBridge.m; sourceTree = "<group>"; };
|
||||
DA81FA801290F5C800C48F2F /* Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Controller.h; sourceTree = "<group>"; };
|
||||
DA81FA811290F5C800C48F2F /* Controller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Controller.m; sourceTree = "<group>"; };
|
||||
DA81FAA81290FA0000C48F2F /* Mod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Mod.h; sourceTree = "<group>"; };
|
||||
@@ -77,6 +80,8 @@
|
||||
DA81FC3E12911E2B00C48F2F /* GameInstall.m */,
|
||||
DA92968E1292328200EDB02E /* SidebarEntry.h */,
|
||||
DA92968F1292328200EDB02E /* SidebarEntry.m */,
|
||||
DA38212012925344003B0BB5 /* JSBridge.h */,
|
||||
DA38212112925344003B0BB5 /* JSBridge.m */,
|
||||
);
|
||||
name = Classes;
|
||||
sourceTree = "<group>";
|
||||
@@ -220,6 +225,7 @@
|
||||
DA81FB9312910A8B00C48F2F /* ImageAndTextCell.m in Sources */,
|
||||
DA81FC3F12911E2B00C48F2F /* GameInstall.m in Sources */,
|
||||
DA9296901292328200EDB02E /* SidebarEntry.m in Sources */,
|
||||
DA38212212925344003B0BB5 /* JSBridge.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="buttons">
|
||||
<input type="button" class="button" value="Play" />
|
||||
<input type="button" class="button" onclick="Launcher.launchCurrentMod();" value="Play" />
|
||||
<input type="button" class="button" value="Install Music" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user