OSDN Git Service

基地航空隊ウインドウに階級、改修度、疲労度、補充の必要性を表示するようにした
authormasakih <masakih@users.sourceforge.jp>
Sun, 30 Apr 2017 08:14:21 +0000 (17:14 +0900)
committermasakih <masakih@users.sourceforge.jp>
Sun, 30 Apr 2017 08:14:21 +0000 (17:14 +0900)
KCD.xcodeproj/project.pbxproj
KCD/AirPlanInfoView.swift [new file with mode: 0644]
KCD/Base.lproj/AirBaseWindowController.xib

index 69ac34d..df29c53 100644 (file)
@@ -21,6 +21,7 @@
                F421850A1DF44AA900256590 /* AirBaseWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F421850C1DF44AA900256590 /* AirBaseWindowController.xib */; };
                F421850F1DF4518000256590 /* BroswerTouchBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = F421850E1DF4518000256590 /* BroswerTouchBar.xib */; };
                F42185111DF461A600256590 /* ScreenshotTouchBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = F42185101DF461A600256590 /* ScreenshotTouchBar.xib */; };
+               F42539E21EB4A7950083EB9D /* AirPlanInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F42539E11EB4A7950083EB9D /* AirPlanInfoView.swift */; };
                F42A8FCC1E3DA4DF0099DC1D /* MasterMission.swift in Sources */ = {isa = PBXBuildFile; fileRef = F42A8FCB1E3DA4DF0099DC1D /* MasterMission.swift */; };
                F42A8FCE1E3DA7E90099DC1D /* MasterShip.swift in Sources */ = {isa = PBXBuildFile; fileRef = F42A8FCD1E3DA7E90099DC1D /* MasterShip.swift */; };
                F42A8FD01E3DB49A0099DC1D /* MasterSlotItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = F42A8FCF1E3DB49A0099DC1D /* MasterSlotItem.swift */; };
                F421850D1DF44AEA00256590 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/AirBaseWindowController.xib; sourceTree = "<group>"; };
                F421850E1DF4518000256590 /* BroswerTouchBar.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BroswerTouchBar.xib; sourceTree = "<group>"; };
                F42185101DF461A600256590 /* ScreenshotTouchBar.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ScreenshotTouchBar.xib; sourceTree = "<group>"; };
+               F42539E11EB4A7950083EB9D /* AirPlanInfoView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AirPlanInfoView.swift; sourceTree = "<group>"; };
                F42A8FCB1E3DA4DF0099DC1D /* MasterMission.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MasterMission.swift; sourceTree = "<group>"; };
                F42A8FCD1E3DA7E90099DC1D /* MasterShip.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MasterShip.swift; sourceTree = "<group>"; };
                F42A8FCF1E3DB49A0099DC1D /* MasterSlotItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MasterSlotItem.swift; sourceTree = "<group>"; };
                                F4AC136E1E0963DB00851147 /* ProgressPanel.swift */,
                                F4C668651C54518F00601AFB /* ProgressPanel.xib */,
                                F4D05BC71E0C0DA100688D66 /* AirBaseWindowController.swift */,
+                               F42539E11EB4A7950083EB9D /* AirPlanInfoView.swift */,
                                F421850C1DF44AA900256590 /* AirBaseWindowController.xib */,
                        );
                        name = UI;
                                F47C3EA01E5DE08F00D97449 /* MasterMapInfoMapper.swift in Sources */,
                                F4AA59481E1E3CBA001667AF /* AirbasePlaneStateTransformer.swift in Sources */,
                                F4E7802E18DC3AF00011BC4C /* LocalData.xcdatamodeld in Sources */,
+                               F42539E21EB4A7950083EB9D /* AirPlanInfoView.swift in Sources */,
                                F491A4C01E4EACDD00D1E067 /* CacheStoragePolicy.swift in Sources */,
                                F47C3EB41E606C4300D97449 /* ResetSortie.swift in Sources */,
                                F42A8FEE1E435E330099DC1D /* Damage.swift in Sources */,
diff --git a/KCD/AirPlanInfoView.swift b/KCD/AirPlanInfoView.swift
new file mode 100644 (file)
index 0000000..238a046
--- /dev/null
@@ -0,0 +1,82 @@
+//
+//  AirPlanInfoView.swift
+//  KCD
+//
+//  Created by Hori,Masaki on 2017/04/29.
+//  Copyright © 2017年 Hori,Masaki. All rights reserved.
+//
+
+import Cocoa
+
+class AirPlanInfoView: NSTableCellView {
+    
+    enum Condition: Int {
+        case normal = 1
+        case tired = 2
+        case bad = 3
+    }
+    
+    @IBOutlet var planNameVew: SlotItemLevelView!
+    @IBOutlet var conditionBox: NSBox!
+    @IBOutlet var needSupplyField: NSTextField!
+    
+    dynamic var condition: Int = 1 {
+        didSet {
+            guard let cond = Condition(rawValue: condition)
+                else { return }
+            conditionBox.fillColor = conditionColor(cond)
+            conditionBox.borderColor = borderColor(cond)
+        }
+    }
+    dynamic var slotId: NSNumber? {
+        didSet { planNameVew.slotItemID = slotId }
+    }
+    dynamic var maxCount: Int = 0 {
+        didSet { needSupplyField.isHidden = !needSupply() }
+    }
+    dynamic var count: Int = 0 {
+        didSet { needSupplyField.isHidden = !needSupply() }
+    }
+    private func conditionColor(_ cond: Condition) -> NSColor {
+        switch cond {
+        case .normal: return .clear
+        case .tired: return #colorLiteral(red: 1, green: 0.7233425379, blue: 0.1258574128, alpha: 0.8239436619)
+        case .bad: return #colorLiteral(red: 0.7320367694, green: 0.07731548697, blue: 0.06799335033, alpha: 1)
+        }
+    }
+    private func borderColor(_ cond: Condition) -> NSColor {
+        switch cond {
+        case .normal: return .clear
+        case .tired: return #colorLiteral(red: 0.458858192, green: 0.3335277438, blue: 0.07979661971, alpha: 1)
+        case .bad: return #colorLiteral(red: 0.5462518334, green: 0.04599834234, blue: 0.04913448542, alpha: 1)
+        }
+    }
+    private func needSupply() -> Bool {
+        return (maxCount - count != 0)
+    }
+    
+    required init?(coder: NSCoder) {
+        super.init(coder: coder)
+    }
+    deinit {
+        unbind(#keyPath(AirPlanInfoView.condition))
+        unbind(#keyPath(AirPlanInfoView.slotId))
+        unbind(#keyPath(AirPlanInfoView.maxCount))
+        unbind(#keyPath(AirPlanInfoView.count))
+    }
+    
+    override func awakeFromNib() {
+        bind(#keyPath(AirPlanInfoView.condition),
+             to: self,
+             withKeyPath: "objectValue.cond")
+        bind(#keyPath(AirPlanInfoView.slotId),
+             to: self,
+             withKeyPath: "objectValue.slotid")
+        bind(#keyPath(AirPlanInfoView.maxCount),
+             to: self,
+             withKeyPath: "objectValue.max_count")
+        bind(#keyPath(AirPlanInfoView.count),
+             to: self,
+             withKeyPath: "objectValue.count")
+    }
+}
index 8c68002..1be0e04 100644 (file)
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="12120"/>
         <capability name="box content view" minToolsVersion="7.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -34,7 +34,7 @@
                             <rect key="frame" x="1" y="1" width="292" height="291"/>
                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                             <subviews>
-                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="OuP-cj-2FX">
+                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="OuP-cj-2FX">
                                     <rect key="frame" x="18" y="225" width="170" height="17"/>
                                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                     <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Label" id="XhN-9I-IGk">
                                                         </textFieldCell>
                                                         <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
                                                         <prototypeCellViews>
-                                                            <tableCellView identifier="Plane" id="PxU-0P-03e">
+                                                            <tableCellView identifier="Plane" id="PxU-0P-03e" customClass="AirPlanInfoView" customModule="KCD" customModuleProvider="target">
                                                                 <rect key="frame" x="1" y="1" width="247" height="42"/>
                                                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                                 <subviews>
-                                                                    <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="NtS-hS-07y" customClass="SlotItemLevelView" customModule="KCD">
+                                                                    <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="NtS-hS-07y" customClass="SlotItemLevelView" customModule="KCD">
                                                                         <rect key="frame" x="1" y="22" width="245" height="17"/>
                                                                         <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
                                                                         <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="三式戦 飛燕(飛行第244戦隊)" id="DCg-rj-geR">
                                                                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                                                         </textFieldCell>
                                                                         <connections>
-                                                                            <binding destination="PxU-0P-03e" name="value" keyPath="objectValue.slotid" id="3hh-fX-Enx">
+                                                                            <binding destination="PxU-0P-03e" name="value" keyPath="objectValue.slotid" id="Ym3-zw-RqQ">
                                                                                 <dictionary key="options">
                                                                                     <string key="NSValueTransformerName">SlotitemNameTransformer</string>
                                                                                 </dictionary>
                                                                             </binding>
                                                                         </connections>
                                                                     </textField>
-                                                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="wca-Q0-vUn">
+                                                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="wca-Q0-vUn">
                                                                         <rect key="frame" x="13" y="3" width="39" height="17"/>
                                                                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                                                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="18/18" id="WCl-N5-A1D">
                                                                             </binding>
                                                                         </connections>
                                                                     </textField>
-                                                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="NnQ-hl-Xh4">
+                                                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="NnQ-hl-Xh4">
                                                                         <rect key="frame" x="205" y="3" width="41" height="17"/>
                                                                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                                                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="転換中" id="sub-Yc-fzn">
                                                                             </binding>
                                                                         </connections>
                                                                     </textField>
+                                                                    <box fixedFrame="YES" boxType="custom" cornerRadius="2" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="r7U-P0-HX9">
+                                                                        <rect key="frame" x="114" y="4" width="16" height="12"/>
+                                                                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                                                                        <view key="contentView" ambiguous="YES" id="WFI-zX-MPU">
+                                                                            <rect key="frame" x="1" y="1" width="14" height="10"/>
+                                                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                                        </view>
+                                                                    </box>
+                                                                    <textField hidden="YES" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lqb-bX-0Xt">
+                                                                        <rect key="frame" x="60" y="3" width="41" height="17"/>
+                                                                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                                                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="要補充" id="iJP-D6-6mP">
+                                                                            <font key="font" metaFont="systemBold"/>
+                                                                            <color key="textColor" red="0.86994009067357514" green="0.49668352008367767" blue="0.1245250512408806" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
+                                                                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                                                                        </textFieldCell>
+                                                                    </textField>
                                                                 </subviews>
                                                                 <connections>
+                                                                    <outlet property="conditionBox" destination="r7U-P0-HX9" id="EsE-xD-ZMc"/>
+                                                                    <outlet property="needSupplyField" destination="lqb-bX-0Xt" id="CLh-ut-PIq"/>
+                                                                    <outlet property="planNameVew" destination="NtS-hS-07y" id="xn2-sw-nBN"/>
                                                                     <outlet property="textField" destination="NtS-hS-07y" id="GLA-fR-4IQ"/>
                                                                 </connections>
                                                             </tableCellView>
                                         <autoresizingMask key="autoresizingMask"/>
                                     </scroller>
                                 </scrollView>
-                                <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uWu-Vp-PJw">
+                                <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uWu-Vp-PJw">
                                     <rect key="frame" x="18" y="206" width="89" height="17"/>
                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
                                     <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="right" title="戦闘行動半径:" id="aTA-M0-y0b">
                                         <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                     </textFieldCell>
                                 </textField>
-                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="AKN-mz-2Rs">
+                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="AKN-mz-2Rs">
                                     <rect key="frame" x="102" y="206" width="19" height="17"/>
                                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                     <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="10" id="q2l-rA-9P2">
                                         <binding destination="7NM-nX-0DR" name="value" keyPath="selection.distance" id="6Pp-FD-aKZ"/>
                                     </connections>
                                 </textField>
-                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="PsD-sw-esA">
+                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="PsD-sw-esA">
                                     <rect key="frame" x="226" y="206" width="37" height="17"/>
                                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                     <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="出撃" id="dKv-6b-lsr">