Skip to content

Commit

Permalink
Adjust screen timeout and add colorless mana
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Slaght committed Aug 22, 2018
1 parent 5b29cef commit f0176df
Show file tree
Hide file tree
Showing 12 changed files with 215 additions and 81 deletions.
Binary file modified .DS_Store
Binary file not shown.
8 changes: 4 additions & 4 deletions Mana Count.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -270,7 +270,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand All @@ -285,7 +285,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 98PHYR992B;
INFOPLIST_FILE = "Mana Count/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = manaCount;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -301,7 +301,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 98PHYR992B;
INFOPLIST_FILE = "Mana Count/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = manaCount;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Binary file not shown.
Binary file added Mana Count/.DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions Mana Count/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
UIApplication.shared.statusBarStyle = .lightContent
application.statusBarStyle = .lightContent
application.isIdleTimerDisabled = true
return true
}

Expand Down
21 changes: 21 additions & 0 deletions Mana Count/Assets.xcassets/waste.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "Wastes-MtG-Art-Oath-of-the-Gatewatch-.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
212 changes: 148 additions & 64 deletions Mana Count/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Mana Count/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.2</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
Expand Down
10 changes: 10 additions & 0 deletions Mana Count/Settings.bundle/Root.plist
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@
<key>DefaultValue</key>
<false/>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>Title</key>
<string>Colorless Mana</string>
<key>Key</key>
<string>colorless</string>
<key>DefaultValue</key>
<false/>
</dict>
</array>
</dict>
</plist>
31 changes: 21 additions & 10 deletions Mana Count/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,23 @@ class ViewController: UIViewController {
final let BLUE = "blue"
final let GREEN = "green"
final let BLACK = "black"
final let COLORLESS = "colorless"

@IBOutlet weak var stormView: UIView!
@IBOutlet weak var whiteView: UIView!
@IBOutlet weak var redView: UIView!
@IBOutlet weak var blueView: UIView!
@IBOutlet weak var greenView: UIView!
@IBOutlet weak var blackView: UIView!
@IBOutlet weak var colorlessView: UIView!

@IBOutlet weak var stormImage: UIImageView!
@IBOutlet weak var plainsImage: UIImageView!
@IBOutlet weak var mountainImage: UIImageView!
@IBOutlet weak var islandImage: UIImageView!
@IBOutlet weak var forestImage: UIImageView!
@IBOutlet weak var swampImage: UIImageView!
@IBOutlet weak var wasteImage: UIImageView!

@IBOutlet weak var stormPlus: UIView!
@IBOutlet weak var stormMinus: UIView!
Expand All @@ -37,13 +40,16 @@ class ViewController: UIViewController {
@IBOutlet weak var forestMinus: UIView!
@IBOutlet weak var swampPlus: UIView!
@IBOutlet weak var swampMinus: UIView!
@IBOutlet weak var wastePlus: UIView!
@IBOutlet weak var wasteMinus: UIView!

@IBOutlet weak var stormCount: UILabel!
@IBOutlet weak var plainsCount: UILabel!
@IBOutlet weak var mountainCount: UILabel!
@IBOutlet weak var islandCount: UILabel!
@IBOutlet weak var forestCount: UILabel!
@IBOutlet weak var swampCount: UILabel!
@IBOutlet weak var wasteCount: UILabel!

@IBAction func stormPlusGesture(_ sender: UILongPressGestureRecognizer) {
handleCounterTouch(target: stormPlus, count: stormCount, up: true, gesture: sender)
Expand Down Expand Up @@ -81,6 +87,12 @@ class ViewController: UIViewController {
@IBAction func swampMinusGesture(_ sender: UILongPressGestureRecognizer) {
handleCounterTouch(target: swampMinus, count: swampCount, up: false, gesture: sender)
}
@IBAction func wastePlusGesture(_ sender: UILongPressGestureRecognizer) {
handleCounterTouch(target: wastePlus, count: wasteCount, up: true, gesture: sender)
}
@IBAction func wasteMinusGesture(_ sender: UILongPressGestureRecognizer) {
handleCounterTouch(target: wasteMinus, count: wasteCount, up: false, gesture: sender)
}

override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
Expand Down Expand Up @@ -173,7 +185,8 @@ class ViewController: UIViewController {
self.mountainCount.text != "0" ||
self.islandCount.text != "0" ||
self.forestCount.text != "0" ||
self.swampCount.text != "0")
self.swampCount.text != "0" ||
self.wasteCount.text != "0")
}

func setCountersToZero() {
Expand All @@ -183,20 +196,12 @@ class ViewController: UIViewController {
self.islandCount.text = "0"
self.forestCount.text = "0"
self.swampCount.text = "0"
self.wasteCount.text = "0"
}

@objc func setupSelectedCounters() {
unhideAllCounterViews()
showSelectedCounterViews()

//print(UserDefaults.standard.bool(forKey: STORM))
//print(UserDefaults.standard.bool(forKey: WHITE))
//print(UserDefaults.standard.bool(forKey: RED))
//print(UserDefaults.standard.bool(forKey: BLUE))
//print(UserDefaults.standard.bool(forKey: GREEN))
//print(UserDefaults.standard.bool(forKey: BLACK))


}

func unhideAllCounterViews() {
Expand All @@ -206,6 +211,7 @@ class ViewController: UIViewController {
blueView.isHidden = false
greenView.isHidden = false
blackView.isHidden = false
colorlessView.isHidden = false
}

func showSelectedCounterViews() {
Expand Down Expand Up @@ -233,6 +239,10 @@ class ViewController: UIViewController {
blackView.isHidden = true
swampCount.text = "0"
}
if !UserDefaults.standard.bool(forKey: COLORLESS) {
colorlessView.isHidden = true
wasteCount.text = "0"
}
}

func setupImageBorderRadii() {
Expand All @@ -242,6 +252,7 @@ class ViewController: UIViewController {
islandImage.layer.cornerRadius = 10
forestImage.layer.cornerRadius = 10
swampImage.layer.cornerRadius = 10
wasteImage.layer.cornerRadius = 10
}

func handleCounterTouch(target: UIView, count: UILabel, up: Bool, gesture: UILongPressGestureRecognizer) {
Expand Down

0 comments on commit f0176df

Please sign in to comment.