Added basic settings, and ability to manage game controllers

This commit is contained in:
Riley Testut 2015-09-07 15:05:11 -07:00
parent 2cfb22fd8d
commit cc6a044b29
13 changed files with 767 additions and 6 deletions

@ -1 +1 @@
Subproject commit 026b22be17246068f7e333437545db490882521f Subproject commit bbb35924b544251b20061340fa9aa9e0275caee4

View File

@ -9,8 +9,14 @@
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
BF090CF41B490D8300DCAB45 /* UIDevice+Vibration.m in Sources */ = {isa = PBXBuildFile; fileRef = BF090CF31B490D8300DCAB45 /* UIDevice+Vibration.m */; }; BF090CF41B490D8300DCAB45 /* UIDevice+Vibration.m in Sources */ = {isa = PBXBuildFile; fileRef = BF090CF31B490D8300DCAB45 /* UIDevice+Vibration.m */; };
BF46894F1AAC46EF00A2586D /* DirectoryContentsDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF46894E1AAC46EF00A2586D /* DirectoryContentsDataSource.swift */; }; BF46894F1AAC46EF00A2586D /* DirectoryContentsDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF46894E1AAC46EF00A2586D /* DirectoryContentsDataSource.swift */; };
BF5E7F441B9A650B00AE44F8 /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF5E7F431B9A650B00AE44F8 /* SettingsViewController.swift */; settings = {ASSET_TAGS = (); }; };
BF5E7F461B9A652600AE44F8 /* Settings.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BF5E7F451B9A652600AE44F8 /* Settings.storyboard */; settings = {ASSET_TAGS = (); }; };
BF70798C1B6B464B0019077C /* ZipZap.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF70798B1B6B464B0019077C /* ZipZap.framework */; };
BF70798D1B6B464B0019077C /* ZipZap.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BF70798B1B6B464B0019077C /* ZipZap.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
BF9F4FCF1AAD7B87004C9500 /* DeltaCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF9F4FCE1AAD7B87004C9500 /* DeltaCore.framework */; }; BF9F4FCF1AAD7B87004C9500 /* DeltaCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF9F4FCE1AAD7B87004C9500 /* DeltaCore.framework */; };
BF9F4FD01AAD7B87004C9500 /* DeltaCore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BF9F4FCE1AAD7B87004C9500 /* DeltaCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; BF9F4FD01AAD7B87004C9500 /* DeltaCore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BF9F4FCE1AAD7B87004C9500 /* DeltaCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
BFAA1FED1B8AA4FA00495943 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFAA1FEC1B8AA4FA00495943 /* Settings.swift */; };
BFAA1FF41B8AD7F900495943 /* ControllersSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFAA1FF31B8AD7F900495943 /* ControllersSettingsViewController.swift */; };
BFC134E11AAD82460087AD7B /* SNESDeltaCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BFC134E01AAD82460087AD7B /* SNESDeltaCore.framework */; }; BFC134E11AAD82460087AD7B /* SNESDeltaCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BFC134E01AAD82460087AD7B /* SNESDeltaCore.framework */; };
BFC134E21AAD82470087AD7B /* SNESDeltaCore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BFC134E01AAD82460087AD7B /* SNESDeltaCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; BFC134E21AAD82470087AD7B /* SNESDeltaCore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BFC134E01AAD82460087AD7B /* SNESDeltaCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
BFEC732D1AAECC4A00650035 /* Roxas.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BFEC732C1AAECC4A00650035 /* Roxas.framework */; }; BFEC732D1AAECC4A00650035 /* Roxas.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BFEC732C1AAECC4A00650035 /* Roxas.framework */; };
@ -33,6 +39,7 @@
files = ( files = (
BF9F4FD01AAD7B87004C9500 /* DeltaCore.framework in Embed Frameworks */, BF9F4FD01AAD7B87004C9500 /* DeltaCore.framework in Embed Frameworks */,
BFEC732E1AAECC4A00650035 /* Roxas.framework in Embed Frameworks */, BFEC732E1AAECC4A00650035 /* Roxas.framework in Embed Frameworks */,
BF70798D1B6B464B0019077C /* ZipZap.framework in Embed Frameworks */,
BFC134E21AAD82470087AD7B /* SNESDeltaCore.framework in Embed Frameworks */, BFC134E21AAD82470087AD7B /* SNESDeltaCore.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
@ -45,7 +52,12 @@
BF090CF21B490D8300DCAB45 /* UIDevice+Vibration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIDevice+Vibration.h"; sourceTree = "<group>"; }; BF090CF21B490D8300DCAB45 /* UIDevice+Vibration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIDevice+Vibration.h"; sourceTree = "<group>"; };
BF090CF31B490D8300DCAB45 /* UIDevice+Vibration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIDevice+Vibration.m"; sourceTree = "<group>"; }; BF090CF31B490D8300DCAB45 /* UIDevice+Vibration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIDevice+Vibration.m"; sourceTree = "<group>"; };
BF46894E1AAC46EF00A2586D /* DirectoryContentsDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DirectoryContentsDataSource.swift; sourceTree = "<group>"; }; BF46894E1AAC46EF00A2586D /* DirectoryContentsDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DirectoryContentsDataSource.swift; sourceTree = "<group>"; };
BF5E7F431B9A650B00AE44F8 /* SettingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = "<group>"; };
BF5E7F451B9A652600AE44F8 /* Settings.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Settings.storyboard; sourceTree = "<group>"; };
BF70798B1B6B464B0019077C /* ZipZap.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ZipZap.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BF9F4FCE1AAD7B87004C9500 /* DeltaCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = DeltaCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; BF9F4FCE1AAD7B87004C9500 /* DeltaCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = DeltaCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BFAA1FEC1B8AA4FA00495943 /* Settings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = "<group>"; };
BFAA1FF31B8AD7F900495943 /* ControllersSettingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControllersSettingsViewController.swift; sourceTree = "<group>"; };
BFC134E01AAD82460087AD7B /* SNESDeltaCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SNESDeltaCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; BFC134E01AAD82460087AD7B /* SNESDeltaCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SNESDeltaCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BFEC732C1AAECC4A00650035 /* Roxas.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Roxas.framework; sourceTree = BUILT_PRODUCTS_DIR; }; BFEC732C1AAECC4A00650035 /* Roxas.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Roxas.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BFFA71D71AAC406100EE9DD1 /* Delta.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Delta.app; sourceTree = BUILT_PRODUCTS_DIR; }; BFFA71D71AAC406100EE9DD1 /* Delta.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Delta.app; sourceTree = BUILT_PRODUCTS_DIR; };
@ -66,6 +78,7 @@
files = ( files = (
BF9F4FCF1AAD7B87004C9500 /* DeltaCore.framework in Frameworks */, BF9F4FCF1AAD7B87004C9500 /* DeltaCore.framework in Frameworks */,
BFEC732D1AAECC4A00650035 /* Roxas.framework in Frameworks */, BFEC732D1AAECC4A00650035 /* Roxas.framework in Frameworks */,
BF70798C1B6B464B0019077C /* ZipZap.framework in Frameworks */,
BFC134E11AAD82460087AD7B /* SNESDeltaCore.framework in Frameworks */, BFC134E11AAD82460087AD7B /* SNESDeltaCore.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
@ -94,6 +107,7 @@
BF9F4FCD1AAD7B25004C9500 /* Frameworks */ = { BF9F4FCD1AAD7B25004C9500 /* Frameworks */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
BF70798B1B6B464B0019077C /* ZipZap.framework */,
BFEC732C1AAECC4A00650035 /* Roxas.framework */, BFEC732C1AAECC4A00650035 /* Roxas.framework */,
BF9F4FCE1AAD7B87004C9500 /* DeltaCore.framework */, BF9F4FCE1AAD7B87004C9500 /* DeltaCore.framework */,
BFC134E01AAD82460087AD7B /* SNESDeltaCore.framework */, BFC134E01AAD82460087AD7B /* SNESDeltaCore.framework */,
@ -101,6 +115,17 @@
name = Frameworks; name = Frameworks;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
BFAA1FEB1B8AA4E800495943 /* Settings */ = {
isa = PBXGroup;
children = (
BFAA1FEC1B8AA4FA00495943 /* Settings.swift */,
BF5E7F451B9A652600AE44F8 /* Settings.storyboard */,
BF5E7F431B9A650B00AE44F8 /* SettingsViewController.swift */,
BFAA1FF31B8AD7F900495943 /* ControllersSettingsViewController.swift */,
);
name = Settings;
sourceTree = "<group>";
};
BFEC732F1AAECCBD00650035 /* Resources */ = { BFEC732F1AAECCBD00650035 /* Resources */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -133,6 +158,7 @@
BFFA71E01AAC406100EE9DD1 /* Main.storyboard */, BFFA71E01AAC406100EE9DD1 /* Main.storyboard */,
BF46894D1AAC469800A2586D /* Game Selection */, BF46894D1AAC469800A2586D /* Game Selection */,
BFFB709D1AF99ACA00DE56FE /* Emulation */, BFFB709D1AF99ACA00DE56FE /* Emulation */,
BFAA1FEB1B8AA4E800495943 /* Settings */,
BF090CEE1B490C1A00DCAB45 /* Extensions */, BF090CEE1B490C1A00DCAB45 /* Extensions */,
BFEC732F1AAECCBD00650035 /* Resources */, BFEC732F1AAECCBD00650035 /* Resources */,
BFFA71DA1AAC406100EE9DD1 /* Supporting Files */, BFFA71DA1AAC406100EE9DD1 /* Supporting Files */,
@ -222,6 +248,7 @@
BFFB70A11AF99DFB00DE56FE /* EmulationViewController.xib in Resources */, BFFB70A11AF99DFB00DE56FE /* EmulationViewController.xib in Resources */,
BFFA71E71AAC406100EE9DD1 /* LaunchScreen.xib in Resources */, BFFA71E71AAC406100EE9DD1 /* LaunchScreen.xib in Resources */,
BFFA71E41AAC406100EE9DD1 /* Images.xcassets in Resources */, BFFA71E41AAC406100EE9DD1 /* Images.xcassets in Resources */,
BF5E7F461B9A652600AE44F8 /* Settings.storyboard in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -232,11 +259,14 @@
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
BFAA1FED1B8AA4FA00495943 /* Settings.swift in Sources */,
BFFA71DF1AAC406100EE9DD1 /* GamesViewController.swift in Sources */, BFFA71DF1AAC406100EE9DD1 /* GamesViewController.swift in Sources */,
BFFB709F1AF99B1700DE56FE /* EmulationViewController.swift in Sources */, BFFB709F1AF99B1700DE56FE /* EmulationViewController.swift in Sources */,
BFAA1FF41B8AD7F900495943 /* ControllersSettingsViewController.swift in Sources */,
BFFA71DD1AAC406100EE9DD1 /* AppDelegate.swift in Sources */, BFFA71DD1AAC406100EE9DD1 /* AppDelegate.swift in Sources */,
BF46894F1AAC46EF00A2586D /* DirectoryContentsDataSource.swift in Sources */, BF46894F1AAC46EF00A2586D /* DirectoryContentsDataSource.swift in Sources */,
BF090CF41B490D8300DCAB45 /* UIDevice+Vibration.m in Sources */, BF090CF41B490D8300DCAB45 /* UIDevice+Vibration.m in Sources */,
BF5E7F441B9A650B00AE44F8 /* SettingsViewController.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -0,0 +1,43 @@
{
"DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {
},
"DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
"377491A212AA92C1503AD101C88ADDBD6FD62CF0" : 0,
"C14902E1A817B9BD0549E16C5F6A56E2377FBF42" : 0,
"816D57F18EE93972A535858CB18F29A85BE91A39" : 0,
"82DF43EF5CA016D15C41E0AF1AF686E9973475B7" : 0
},
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "8EE86D07-2AAF-47C3-91DF-0E46DBDAB128",
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
"377491A212AA92C1503AD101C88ADDBD6FD62CF0" : "Delta\/External\/Roxas\/",
"C14902E1A817B9BD0549E16C5F6A56E2377FBF42" : "Delta\/Cores\/SNESDeltaCore\/",
"816D57F18EE93972A535858CB18F29A85BE91A39" : "Delta\/Cores\/DeltaCore\/",
"82DF43EF5CA016D15C41E0AF1AF686E9973475B7" : "Delta\/Cores\/DeltaCore\/External\/ZipZap\/"
},
"DVTSourceControlWorkspaceBlueprintNameKey" : "Delta",
"DVTSourceControlWorkspaceBlueprintVersion" : 204,
"DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "Delta.xcworkspace",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:rileytestut\/Roxas.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "377491A212AA92C1503AD101C88ADDBD6FD62CF0"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:rileytestut\/DeltaCore.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "816D57F18EE93972A535858CB18F29A85BE91A39"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:pixelglow\/ZipZap.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "82DF43EF5CA016D15C41E0AF1AF686E9973475B7"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:rileytestut\/SNESDeltaCore.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "C14902E1A817B9BD0549E16C5F6A56E2377FBF42"
}
]
}

View File

@ -7,16 +7,18 @@
// //
import UIKit import UIKit
import DeltaCore
@UIApplicationMain @UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate class AppDelegate: UIResponder, UIApplicationDelegate
{ {
var window: UIWindow? var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
{ {
// Override point for customization after application launch. // Controllers
ExternalControllerManager.sharedManager.startMonitoringExternalControllers()
return true return true
} }

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7519.1" systemVersion="14C109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="Sqc-e3-Var"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8187.4" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="Sqc-e3-Var">
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7513.1"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8151.3"/>
</dependencies> </dependencies>
<scenes> <scenes>
<!--Navigation Controller--> <!--Navigation Controller-->
@ -32,8 +33,10 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes> <prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" id="c0Y-lU-K8S"> <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" id="c0Y-lU-K8S">
<rect key="frame" x="0.0" y="86" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="c0Y-lU-K8S" id="Mt2-sh-4yq"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="c0Y-lU-K8S" id="Mt2-sh-4yq">
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView> </tableViewCellContentView>
</tableViewCell> </tableViewCell>
@ -43,11 +46,28 @@
<outlet property="delegate" destination="pG3-6q-BDc" id="BR2-bB-ZZq"/> <outlet property="delegate" destination="pG3-6q-BDc" id="BR2-bB-ZZq"/>
</connections> </connections>
</tableView> </tableView>
<navigationItem key="navigationItem" title="Games" id="rvP-Aa-cit"/> <navigationItem key="navigationItem" title="Games" id="rvP-Aa-cit">
<barButtonItem key="leftBarButtonItem" image="Settings_Button" id="2gg-lC-FhX">
<connections>
<segue destination="xMK-Cs-fAS" kind="presentation" id="uN5-PN-7FK"/>
</connections>
</barButtonItem>
</navigationItem>
</tableViewController> </tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="g9b-Lz-1FG" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="g9b-Lz-1FG" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects> </objects>
<point key="canvasLocation" x="1054" y="333"/> <point key="canvasLocation" x="1054" y="333"/>
</scene> </scene>
<!--Settings-->
<scene sceneID="L3X-MM-hJL">
<objects>
<viewControllerPlaceholder storyboardName="Settings" id="xMK-Cs-fAS" sceneMemberID="viewController"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="2N5-3k-beA" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="795.5" y="-88"/>
</scene>
</scenes> </scenes>
<resources>
<image name="Settings_Button" width="22" height="22"/>
</resources>
</document> </document>

View File

@ -0,0 +1,229 @@
//
// ControllersSettingsViewController.swift
// Delta
//
// Created by Riley Testut on 8/23/15.
// Copyright © 2015 Riley Testut. All rights reserved.
//
import UIKit
import DeltaCore
private enum ControllersSettingsSection: Int
{
case None
case LocalDevice
case ExternalControllers
}
private class LocalDeviceController: ExternalController
{
override var name: String {
return UIDevice.currentDevice().name
}
}
class ControllersSettingsViewController: UITableViewController
{
var playerIndex: Int? {
didSet
{
if let playerIndex = self.playerIndex
{
self.title = NSLocalizedString("Player \(playerIndex + 1)", comment: "")
}
else
{
self.title = NSLocalizedString("Controllers", comment: "")
}
}
}
private var connectedControllers = ExternalControllerManager.sharedManager.connectedControllers.sort({ $0.playerIndex ?? NSIntegerMax < $1.playerIndex ?? NSIntegerMax })
private lazy var localDeviceController: LocalDeviceController = {
let device = LocalDeviceController()
device.playerIndex = Settings.localControllerPlayerIndex
return device
}()
required init?(coder aDecoder: NSCoder)
{
super.init(coder: aDecoder)
NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("externalControllerDidConnect:"), name: ExternalControllerDidConnectNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("externalControllerDidDisconnect:"), name: ExternalControllerDidDisconnectNotification, object: nil)
}
override func viewDidLoad()
{
super.viewDidLoad()
}
//MARK: - Storyboards -
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?)
{
guard let indexPath = self.tableView.indexPathForSelectedRow else { return }
var controllers = self.connectedControllers
controllers.append(self.localDeviceController)
// Reset previous controller
if let playerIndex = self.playerIndex, index = controllers.indexOf({ $0.playerIndex == playerIndex })
{
let controller = controllers[index]
controller.playerIndex = nil
}
switch ControllersSettingsSection(rawValue: indexPath.section)!
{
case .None: break
case .LocalDevice: self.localDeviceController.playerIndex = self.playerIndex
case .ExternalControllers:
let controller = self.connectedControllers[indexPath.row]
controller.playerIndex = self.playerIndex
}
// Updates in case we reset it above, as well as if we updated in the switch statement
Settings.localControllerPlayerIndex = self.localDeviceController.playerIndex
}
}
private extension ControllersSettingsViewController
{
dynamic func externalControllerDidConnect(notification: NSNotification)
{
guard let controller = notification.object as? ExternalController else { return }
if let playerIndex = controller.playerIndex
{
self.connectedControllers.insert(controller, atIndex: playerIndex)
}
else
{
self.connectedControllers.append(controller)
}
if let index = self.connectedControllers.indexOf(controller)
{
if self.connectedControllers.count == 1
{
self.tableView.insertSections(NSIndexSet(index: ControllersSettingsSection.ExternalControllers.rawValue), withRowAnimation: .Fade)
}
else
{
self.tableView.insertRowsAtIndexPaths([NSIndexPath(forRow: index, inSection: ControllersSettingsSection.ExternalControllers.rawValue)], withRowAnimation: .Automatic)
}
}
}
dynamic func externalControllerDidDisconnect(notification: NSNotification)
{
guard let controller = notification.object as? ExternalController else { return }
if let index = self.connectedControllers.indexOf(controller)
{
self.connectedControllers.removeAtIndex(index)
if self.connectedControllers.count == 0
{
self.tableView.deleteSections(NSIndexSet(index: ControllersSettingsSection.ExternalControllers.rawValue), withRowAnimation: .Fade)
}
else
{
self.tableView.deleteRowsAtIndexPaths([NSIndexPath(forRow: index, inSection: ControllersSettingsSection.ExternalControllers.rawValue)], withRowAnimation: .Automatic)
}
}
if controller.playerIndex == self.playerIndex
{
self.tableView.reloadSections(NSIndexSet(index: ControllersSettingsSection.None.rawValue), withRowAnimation: .None)
}
}
}
extension ControllersSettingsViewController
{
override func numberOfSectionsInTableView(tableView: UITableView) -> Int
{
if self.connectedControllers.count == 0
{
return 2
}
return 3
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int
{
switch ControllersSettingsSection(rawValue: section)!
{
case .None: return 1
case .LocalDevice: return 1
case .ExternalControllers: return self.connectedControllers.count
}
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
{
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
cell.detailTextLabel?.text = nil
cell.accessoryType = .None
if indexPath.section == ControllersSettingsSection.None.rawValue
{
cell.textLabel?.text = NSLocalizedString("None", comment: "")
if Settings.localControllerPlayerIndex != self.playerIndex && !self.connectedControllers.contains({ $0.playerIndex == self.playerIndex })
{
cell.accessoryType = .Checkmark
}
}
else
{
let controller: ExternalController
if indexPath.section == ControllersSettingsSection.LocalDevice.rawValue
{
controller = self.localDeviceController
}
else if indexPath.section == ControllersSettingsSection.ExternalControllers.rawValue
{
controller = self.connectedControllers[indexPath.row]
}
else
{
fatalError("Section index invalid")
}
cell.textLabel?.text = controller.name
if controller.playerIndex == self.playerIndex
{
cell.accessoryType = .Checkmark
}
else
{
if let playerIndex = controller.playerIndex
{
cell.detailTextLabel?.text = NSLocalizedString("Player \(playerIndex + 1)", comment: "")
}
}
}
return cell
}
override func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String?
{
switch ControllersSettingsSection(rawValue: section)!
{
case .None: return nil
case .LocalDevice: return NSLocalizedString("Local Device", comment: "")
case .ExternalControllers: return self.connectedControllers.count > 0 ? NSLocalizedString("External Controllers", comment: "") : ""
}
}
}

View File

@ -77,6 +77,13 @@ class GamesViewController: UITableViewController
// Dispose of any resources that can be recreated. // Dispose of any resources that can be recreated.
} }
//MARK: - Settings -
@IBAction func dismissSettingsViewController(segue: UIStoryboardSegue)
{
}
//MARK: UITableViewDelegate //MARK: UITableViewDelegate

View File

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "gear_1.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -0,0 +1,68 @@
%PDF-1.5
%µí®û
3 0 obj
<< /Length 4 0 R
/Filter /FlateDecode
>>
stream
<EFBFBD>“ÍJ1 ÇïyŠÿ ¶Ó<C2B6>'«Gñ #(Âă¯oÛ´ÝpYvš&™$¿$ûEõy¼Ãí«Áû7Nø!Á}ù}Òó ¼‘Ç¾ Íù¦ÖbÝ(r.$öÎcC`#$r4 [ë` [Yàx1¾9æ€Â1-<2D>À±ø{v)dáìRõ âÙÄT<Ÿp¢?wûÌ,–½)•d6©®¨a…CÕÉ<C395>V$^â¸eNâ¨~"Áã@r9­Ú{öm Ò㙵cuØ3³ªÕiâAŽ<×òk±ÛÀͼä4°öˆ}<7D>rë‰ÒRí—¤™ïŸÝÖÑl׳ÍnÒêDV§½Ž†è&()•%1Áá@r1±šGÞÎÉYbvEQ(UX;dW+¢åäá€p1ŸšG{°/uãSÅ<1B><>®Ù•­/ô¾ø+çB)\ßæÎ±gªUQç\áÆ&ï‹¿<Ê…Eb ÔæØdWÝ<¦C—ê¿&Ú8®<38>Sr î­·VŠê«ïiTaÅñ£<16>ŽÑ[¤ªÅŸèââ
endstream
endobj
4 0 obj
398
endobj
2 0 obj
<<
/ExtGState <<
/a0 << /CA 1 /ca 1 >>
>>
>>
endobj
5 0 obj
<< /Type /Page
/Parent 1 0 R
/MediaBox [ 0 0 22.000074 22 ]
/Contents 3 0 R
/Group <<
/Type /Group
/S /Transparency
/I true
/CS /DeviceRGB
>>
/Resources 2 0 R
>>
endobj
1 0 obj
<< /Type /Pages
/Kids [ 5 0 R ]
/Count 1
>>
endobj
6 0 obj
<< /Creator (cairo 1.12.16 (http://cairographics.org))
/Producer (cairo 1.12.16 (http://cairographics.org))
>>
endobj
7 0 obj
<< /Type /Catalog
/Pages 1 0 R
>>
endobj
xref
0 8
0000000000 65535 f
0000000803 00000 n
0000000512 00000 n
0000000015 00000 n
0000000490 00000 n
0000000584 00000 n
0000000868 00000 n
0000000997 00000 n
trailer
<< /Size 8
/Root 7 0 R
/Info 6 0 R
>>
startxref
1049
%%EOF

208
Delta/Settings.storyboard Normal file
View File

@ -0,0 +1,208 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8187.4" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="ssH-mM-uG6">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8151.3"/>
</dependencies>
<scenes>
<!--Settings-->
<scene sceneID="N30-Sa-dHo">
<objects>
<tableViewController title="Settings" id="eHi-aO-uGS" customClass="SettingsViewController" customModule="Delta" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="hRw-wV-lch">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
<sections>
<tableViewSection headerTitle="Inputs" id="c6K-sJ-0vW">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="tls-Hv-Rx2" detailTextLabel="vJP-Ie-a9H" style="IBUITableViewCellStyleValue1" id="jvV-ZB-Rq1">
<rect key="frame" x="0.0" y="113.5" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="jvV-ZB-Rq1" id="AVi-6C-eIS">
<rect key="frame" x="0.0" y="0.0" width="567" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Player 1" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="tls-Hv-Rx2">
<rect key="frame" x="15" y="12" width="56" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Riley's iPhone" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="vJP-Ie-a9H">
<rect key="frame" x="464.5" y="12" width="100.5" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.55686274509803924" green="0.55686274509803924" blue="0.57647058823529407" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="e3u-x9-IEC" detailTextLabel="2OP-A1-VYo" style="IBUITableViewCellStyleValue1" id="1Fv-H5-0oH">
<rect key="frame" x="0.0" y="157.5" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="1Fv-H5-0oH" id="kFJ-zK-MLZ">
<rect key="frame" x="0.0" y="0.0" width="567" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Player 2" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="e3u-x9-IEC">
<rect key="frame" x="15" y="12" width="58" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="SteelSeries Stratus" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="2OP-A1-VYo">
<rect key="frame" x="426.5" y="12" width="138.5" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.55686274509803924" green="0.55686274509803924" blue="0.57647058823529407" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="Cdn-11-xZe" detailTextLabel="wWc-NY-Bsd" style="IBUITableViewCellStyleValue1" id="EcC-Be-jV5">
<rect key="frame" x="0.0" y="201.5" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="EcC-Be-jV5" id="9ZS-um-scR">
<rect key="frame" x="0.0" y="0.0" width="567" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Player 3" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Cdn-11-xZe">
<rect key="frame" x="15" y="12" width="58.5" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="MOGA Gamepad" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="wWc-NY-Bsd">
<rect key="frame" x="443" y="12" width="122" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.55686274509803924" green="0.55686274509803924" blue="0.57647058823529407" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="Hls-3b-EaS" detailTextLabel="hNf-uc-PLR" style="IBUITableViewCellStyleValue1" id="hO9-Ov-vsA">
<rect key="frame" x="0.0" y="245.5" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="hO9-Ov-vsA" id="MRi-re-XI7">
<rect key="frame" x="0.0" y="0.0" width="567" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Player 4" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Hls-3b-EaS">
<rect key="frame" x="15" y="12" width="59" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Jayce's iPhone" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="hNf-uc-PLR">
<rect key="frame" x="457" y="12" width="108" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.55686274509803924" green="0.55686274509803924" blue="0.57647058823529407" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
</tableViewCell>
</cells>
</tableViewSection>
</sections>
<connections>
<outlet property="dataSource" destination="eHi-aO-uGS" id="rsh-0y-8Ex"/>
<outlet property="delegate" destination="eHi-aO-uGS" id="7cP-Sn-ONN"/>
</connections>
</tableView>
<navigationItem key="navigationItem" title="Settings" id="DYU-tO-Lmw">
<barButtonItem key="rightBarButtonItem" style="done" systemItem="done" id="UdW-1j-fSz">
<connections>
<segue destination="slQ-xv-zI1" kind="unwind" unwindAction="dismissSettingsViewController:" id="cjt-zt-6SE"/>
</connections>
</barButtonItem>
</navigationItem>
<connections>
<segue destination="uBz-mm-mXr" kind="show" identifier="controllersSegue" id="MLY-hF-UB8"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="19F-9T-esM" userLabel="First Responder" sceneMemberID="firstResponder"/>
<exit id="slQ-xv-zI1" userLabel="Exit" sceneMemberID="exit"/>
</objects>
<point key="canvasLocation" x="1555" y="471"/>
</scene>
<!--Controllers-->
<scene sceneID="swa-DT-VKS">
<objects>
<tableViewController id="uBz-mm-mXr" customClass="ControllersSettingsViewController" customModule="Delta" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="hLd-Z5-I3b">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" textLabel="VBO-V1-Wfu" detailTextLabel="tqn-1q-p53" style="IBUITableViewCellStyleValue1" id="lzU-uS-el2">
<rect key="frame" x="0.0" y="113.5" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="lzU-uS-el2" id="o56-OW-cxE">
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Controller Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="VBO-V1-Wfu">
<rect key="frame" x="15" y="12" width="118.5" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Player 1" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="tqn-1q-p53">
<rect key="frame" x="529" y="12" width="56" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.55686274509803924" green="0.55686274509803924" blue="0.57647058823529407" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<connections>
<segue destination="HzL-SB-qry" kind="unwind" identifier="unwindControllersSegue" unwindAction="unwindControllersSettingsViewController:" id="WJe-ZI-clo"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="uBz-mm-mXr" id="XB4-jw-1fr"/>
<outlet property="delegate" destination="uBz-mm-mXr" id="tJX-mX-6j8"/>
</connections>
</tableView>
<navigationItem key="navigationItem" title="Controllers" id="QK7-oi-2jJ"/>
<simulatedNavigationBarMetrics key="simulatedTopBarMetrics" prompted="NO"/>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="owG-Kh-rfn" userLabel="First Responder" sceneMemberID="firstResponder"/>
<exit id="HzL-SB-qry" userLabel="Exit" sceneMemberID="exit"/>
</objects>
<point key="canvasLocation" x="2221" y="471"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="8qd-VB-Uy5">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="ssH-mM-uG6" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="Ckw-ES-lkE">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="eHi-aO-uGS" kind="relationship" relationship="rootViewController" id="wkb-nX-9mw"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="HMI-Ep-MdI" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="889" y="471"/>
</scene>
</scenes>
</document>

16
Delta/Settings.swift Normal file
View File

@ -0,0 +1,16 @@
//
// Settings.swift
// Delta
//
// Created by Riley Testut on 8/23/15.
// Copyright © 2015 Riley Testut. All rights reserved.
//
import Foundation
struct Settings
{
/// Controllers
static var localControllerPlayerIndex: Int? = 0
}

View File

@ -0,0 +1,120 @@
//
// SettingsViewController.swift
// Delta
//
// Created by Riley Testut on 9/4/15.
// Copyright © 2015 Riley Testut. All rights reserved.
//
import UIKit
import DeltaCore
private enum SettingsSection: Int
{
case Controllers
}
private enum SettingsSegues: String
{
case Controllers = "controllersSegue"
}
class SettingsViewController: UITableViewController
{
required init?(coder aDecoder: NSCoder)
{
super.init(coder: aDecoder)
NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("externalControllerDidConnect:"), name: ExternalControllerDidConnectNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("externalControllerDidDisconnect:"), name: ExternalControllerDidDisconnectNotification, object: nil)
}
override func viewDidLoad()
{
super.viewDidLoad()
}
override func viewWillAppear(animated: Bool)
{
super.viewWillAppear(animated)
if let indexPath = self.tableView.indexPathForSelectedRow
{
self.tableView.deselectRowAtIndexPath(indexPath, animated: true)
}
}
override func didReceiveMemoryWarning()
{
super.didReceiveMemoryWarning()
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?)
{
if segue.identifier == SettingsSegues.Controllers.rawValue
{
let controllersSettingsViewController = segue.destinationViewController as! ControllersSettingsViewController
controllersSettingsViewController.playerIndex = self.tableView.indexPathForSelectedRow?.row
}
}
}
private extension SettingsViewController
{
@IBAction func unwindControllersSettingsViewController(segue: UIStoryboardSegue)
{
let indexPath = self.tableView.indexPathForSelectedRow
self.tableView.reloadSections(NSIndexSet(index: SettingsSection.Controllers.rawValue), withRowAnimation: .None)
self.tableView.selectRowAtIndexPath(indexPath, animated: true, scrollPosition: UITableViewScrollPosition.None)
}
}
private extension SettingsViewController
{
dynamic func externalControllerDidConnect(notification: NSNotification)
{
self.tableView.reloadSections(NSIndexSet(index: SettingsSection.Controllers.rawValue), withRowAnimation: .None)
}
dynamic func externalControllerDidDisconnect(notification: NSNotification)
{
self.tableView.reloadSections(NSIndexSet(index: SettingsSection.Controllers.rawValue), withRowAnimation: .None)
}
}
extension SettingsViewController
{
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
{
let cell = super.tableView(tableView, cellForRowAtIndexPath: indexPath)
if indexPath.section == SettingsSection.Controllers.rawValue
{
if indexPath.row == Settings.localControllerPlayerIndex
{
cell.detailTextLabel?.text = UIDevice.currentDevice().name
}
else if let index = ExternalControllerManager.sharedManager.connectedControllers.indexOf({ $0.playerIndex == indexPath.row })
{
let controller = ExternalControllerManager.sharedManager.connectedControllers[index]
cell.detailTextLabel?.text = controller.name
}
else
{
cell.detailTextLabel?.text = nil
}
}
return cell
}
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath)
{
if indexPath.section == SettingsSection.Controllers.rawValue
{
self.performSegueWithIdentifier(SettingsSegues.Controllers.rawValue, sender: self)
}
}
}