OSDN Git Service

変数名を修正
authormasakih <masakih@users.sourceforge.jp>
Tue, 12 Dec 2017 15:47:10 +0000 (00:47 +0900)
committermasakih <masakih@users.sourceforge.jp>
Tue, 12 Dec 2017 15:47:10 +0000 (00:47 +0900)
KCD/ShipDetailViewController.swift
KCD/SuppliesCell.swift
KCD/SuppliesView.swift

index 3d078b0..561ec1f 100644 (file)
@@ -61,7 +61,7 @@ final class ShipDetailViewController: NSViewController {
         
         NotificationCenter.default.removeObserver(self)
         damageView.unbind(NSBindingName(#keyPath(DamageView.damageType)))
-        supply.unbind(NSBindingName(#keyPath(SuppliesView.shipStatus)))
+        supply.unbind(NSBindingName(#keyPath(SuppliesView.ship)))
         [slot00Field, slot01Field, slot02Field, slot03Field]
             .forEach { $0?.unbind(NSBindingName(#keyPath(SlotItemLevelView.slotItemID))) }
         
@@ -124,7 +124,7 @@ final class ShipDetailViewController: NSViewController {
                         to: shipController,
                         withKeyPath: "selection.status", options: nil)
         
-        supply.bind(NSBindingName(#keyPath(SuppliesView.shipStatus)),
+        supply.bind(NSBindingName(#keyPath(SuppliesView.ship)),
                     to: shipController,
                     withKeyPath: "selection.self", options: nil)
         
index b571382..b43eec6 100644 (file)
@@ -24,32 +24,32 @@ final class SuppliesCell: NSCell {
     private let borderColor = NSColor(calibratedWhite: 0.632, alpha: 1.0)
     private let backgroundColor = NSColor(calibratedWhite: 0.948, alpha: 1.0)
     
-    @objc dynamic var shipStatus: Ship?
+    @objc dynamic var ship: Ship?
     
     private var fuelStatusColor: NSColor {
         
-        guard let s = shipStatus else { return redColor }
+        guard let s = ship else { return redColor }
         
         return statusColor(withValue: s.fuel, max: s.maxFuel)
     }
     
     private var bullStatusColor: NSColor {
         
-        guard let s = shipStatus else { return redColor }
+        guard let s = ship else { return redColor }
         
         return statusColor(withValue: s.bull, max: s.maxBull)
     }
     
     private var numberOfFuelColoredCell: Int {
         
-        guard let s = shipStatus else { return 0 }
+        guard let s = ship else { return 0 }
         
         return numberOfColoredCell(withValue: s.fuel, max: s.maxFuel)
     }
     
-    private var numberOgBullColoredCell: Int {
+    private var numberOfBullColoredCell: Int {
         
-        guard let s = shipStatus else { return 0 }
+        guard let s = ship else { return 0 }
         
         return numberOfColoredCell(withValue: s.bull, max: s.maxBull)
     }
@@ -78,7 +78,7 @@ final class SuppliesCell: NSCell {
         
         let height = (cellFrame.height - 3.0) / 2.0
         let width = (cellFrame.width - CGFloat(numberOfCell) - 1.0) / CGFloat(numberOfCell)
-        let y = type == .fuel ? height + 2.0 : 1.0
+        let y = (type == .fuel ? height + 2.0 : 1.0)
         
         (0...numberOfCell).forEach {
             
@@ -96,7 +96,7 @@ final class SuppliesCell: NSCell {
     
     private func drawBullInterior(withFrame cellFrame: NSRect) {
         
-        drawResource(withFrame: cellFrame, border: numberOgBullColoredCell, type: .bull)
+        drawResource(withFrame: cellFrame, border: numberOfBullColoredCell, type: .bull)
     }
     
     private func numberOfColoredCell(withValue value: Int, max: Int) -> Int {
index 86f89a1..853ab03 100644 (file)
@@ -40,22 +40,22 @@ final class SuppliesView: NSControl {
         
         observeKeys.forEach {
             
-            suppliesCell.shipStatus?.removeObserver(self, forKeyPath: $0)
+            suppliesCell.ship?.removeObserver(self, forKeyPath: $0)
         }
     }
     
-    @objc var shipStatus: Ship? {
+    @objc var ship: Ship? {
         
-        get { return suppliesCell.shipStatus }
+        get { return suppliesCell.ship }
         set {
             observeKeys.forEach {
                 
-                suppliesCell.shipStatus?.removeObserver(self, forKeyPath: $0)
+                suppliesCell.ship?.removeObserver(self, forKeyPath: $0)
             }
-            suppliesCell.shipStatus = newValue
+            suppliesCell.ship = newValue
             observeKeys.forEach {
                 
-                suppliesCell.shipStatus?.addObserver(self, forKeyPath: $0, context: &pShipStatusContext)
+                suppliesCell.ship?.addObserver(self, forKeyPath: $0, context: &pShipStatusContext)
             }
             needsDisplay = true
         }