OSDN Git Service

損傷状態の表示を変更
authormasakih <masakih@users.sourceforge.jp>
Thu, 25 Feb 2016 11:47:36 +0000 (20:47 +0900)
committermasakih <masakih@users.sourceforge.jp>
Thu, 25 Feb 2016 11:47:36 +0000 (20:47 +0900)
KCD.xcodeproj/project.pbxproj
KCD/HMDamageValueTransformer.h [new file with mode: 0644]
KCD/HMDamageValueTransformer.m [new file with mode: 0644]
KCD/HMRepairListViewController.xib

index 19db7d8..ca5d35b 100644 (file)
                F4F9F8A31C70AFB600D0EE76 /* HMFleetManager.m in Sources */ = {isa = PBXBuildFile; fileRef = F4F9F8A21C70AFB600D0EE76 /* HMFleetManager.m */; };
                F4F9F8A61C78596900D0EE76 /* HMAnchorageRepairManager.m in Sources */ = {isa = PBXBuildFile; fileRef = F4F9F8A51C78596900D0EE76 /* HMAnchorageRepairManager.m */; };
                F4F9F8A91C796C2E00D0EE76 /* HMChangeHenseiNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = F4F9F8A81C796C2E00D0EE76 /* HMChangeHenseiNotification.m */; };
+               F4F9F8AC1C7C823600D0EE76 /* HMDamageValueTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = F4F9F8AB1C7C823600D0EE76 /* HMDamageValueTransformer.m */; };
                F4FCFD44191F4C1D000640A1 /* HMKenzoMarkCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4FCFD43191F4C1D000640A1 /* HMKenzoMarkCommand.m */; };
                F4FDF2411A3D50420033E0AD /* HMShipMasterDetailWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = F4FDF23F1A3D50420033E0AD /* HMShipMasterDetailWindowController.m */; };
 /* End PBXBuildFile section */
                F4F9F8A51C78596900D0EE76 /* HMAnchorageRepairManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMAnchorageRepairManager.m; sourceTree = "<group>"; };
                F4F9F8A71C796C2E00D0EE76 /* HMChangeHenseiNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMChangeHenseiNotification.h; sourceTree = "<group>"; };
                F4F9F8A81C796C2E00D0EE76 /* HMChangeHenseiNotification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMChangeHenseiNotification.m; sourceTree = "<group>"; };
+               F4F9F8AA1C7C823600D0EE76 /* HMDamageValueTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMDamageValueTransformer.h; sourceTree = "<group>"; };
+               F4F9F8AB1C7C823600D0EE76 /* HMDamageValueTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMDamageValueTransformer.m; sourceTree = "<group>"; };
                F4FCFD42191F4C1D000640A1 /* HMKenzoMarkCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMKenzoMarkCommand.h; sourceTree = "<group>"; };
                F4FCFD43191F4C1D000640A1 /* HMKenzoMarkCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMKenzoMarkCommand.m; sourceTree = "<group>"; };
                F4FDF23E1A3D50420033E0AD /* HMShipMasterDetailWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMShipMasterDetailWindowController.h; sourceTree = "<group>"; };
                                F4C86B911C1C445D00F260FE /* HMUpgradeShipExcludeColorTransformer.m */,
                                F4ECA36D1C6102FC0098AB6A /* HMMillisecondTransformer.h */,
                                F4ECA36E1C6102FC0098AB6A /* HMMillisecondTransformer.m */,
+                               F4F9F8AA1C7C823600D0EE76 /* HMDamageValueTransformer.h */,
+                               F4F9F8AB1C7C823600D0EE76 /* HMDamageValueTransformer.m */,
                        );
                        name = "Transformar&Formatter";
                        sourceTree = "<group>";
                                F448F9981B75A128004901AD /* HMKCBasic.m in Sources */,
                                F43769E11AE7CFF800DE6204 /* HMClearItemGetComand.m in Sources */,
                                F4131ED5190F63D8004F7F9A /* HMUpdateSlotItemCommand.m in Sources */,
+                               F4F9F8AC1C7C823600D0EE76 /* HMDamageValueTransformer.m in Sources */,
                                F4C668781C54592300601AFB /* HMEquipmentWindowController.m in Sources */,
                                F4C1190518A71AEA005D5B25 /* HMJSONReciever.m in Sources */,
                                F4F9F8901C6B6ACA00D0EE76 /* HMKCNyukyoDock.m in Sources */,
diff --git a/KCD/HMDamageValueTransformer.h b/KCD/HMDamageValueTransformer.h
new file mode 100644 (file)
index 0000000..c6ef63f
--- /dev/null
@@ -0,0 +1,13 @@
+//
+//  HMDamageValueTransformer.h
+//  KCD
+//
+//  Created by Hori,Masaki on 2016/02/23.
+//  Copyright © 2016年 Hori,Masaki. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface HMDamageValueTransformer : NSValueTransformer
+
+@end
diff --git a/KCD/HMDamageValueTransformer.m b/KCD/HMDamageValueTransformer.m
new file mode 100644 (file)
index 0000000..a2215c8
--- /dev/null
@@ -0,0 +1,86 @@
+//
+//  HMDamageValueTransformer.m
+//  KCD
+//
+//  Created by Hori,Masaki on 2016/02/23.
+//  Copyright © 2016年 Hori,Masaki. All rights reserved.
+//
+
+#import "HMDamageValueTransformer.h"
+
+@implementation HMDamageValueTransformer
++ (void)load
+{
+       static dispatch_once_t onceToken;
+       dispatch_once(&onceToken, ^{
+               [NSValueTransformer setValueTransformer:[self new] forName:@"HMDamageValueTransformer"];
+       });
+}
++ (Class)transformedValueClass
+{
+       return [NSAttributedString class];
+}
++ (BOOL)allowsReverseTransformation
+{
+       return NO;
+}
+
+- (NSParagraphStyle *)paragraphStyle
+{
+       static NSParagraphStyle *style = nil;
+       if(!style) {
+               NSMutableParagraphStyle *s = [NSMutableParagraphStyle new];
+               s.alignment = NSTextAlignmentCenter;
+               style = s;
+       }
+       return style;
+}
+
+- (id)transformedValue:(id)value
+{
+       NSInteger damage = [value integerValue];
+       
+       NSString *mark = nil;
+       NSDictionary *attr = nil;
+       
+       switch(damage) {
+               case 0:
+                       return nil;
+                       break;
+               case 1:
+//                     mark = @"•";
+                       mark = @"●";
+                       attr = @{
+                                        NSForegroundColorAttributeName:
+                                                [NSColor colorWithCalibratedRed:1.000 green:0.925 blue:0.000 alpha:1.000],
+                                        NSParagraphStyleAttributeName: self.paragraphStyle
+                                        };
+                       break;
+               case 2:
+                       mark = @"●";
+                       attr = @{
+                                        NSForegroundColorAttributeName:
+                                                [NSColor colorWithCalibratedRed:1.000 green:0.392 blue:0.000 alpha:1.000],
+                                        NSParagraphStyleAttributeName: self.paragraphStyle
+                                        };
+                       break;
+               case 3:
+                       mark = @"◼︎";
+                       attr = @{
+                                        NSForegroundColorAttributeName:
+                                                [NSColor colorWithCalibratedRed:0.870 green:0.000 blue:0.036 alpha:1.000],
+                                        NSParagraphStyleAttributeName: self.paragraphStyle
+                                        };
+                       break;
+               default:
+                       NSLog(@"Unknown status");
+                       return nil;
+                       break;
+       }
+       
+       NSMutableAttributedString *result = [[NSMutableAttributedString alloc] initWithString:mark
+                                                                                                                                                          attributes:attr];
+       
+       return result;
+}
+@end
index 070a591..7e6bc11 100644 (file)
@@ -11,7 +11,7 @@
         </customObject>
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <customObject id="-3" userLabel="Application" customClass="NSObject"/>
-        <arrayController mode="entity" entityName="Ship" fetchPredicateFormat="id != -2 &amp;&amp; ndock_time != 0" editable="NO" automaticallyPreparesContent="YES" automaticallyRearrangesObjects="YES" id="d8w-mz-p76" userLabel="Ship">
+        <arrayController mode="entity" entityName="Ship" fetchPredicateFormat="id != -2 &amp;&amp; nowhp &lt;&gt; maxhp" editable="NO" automaticallyPreparesContent="YES" automaticallyRearrangesObjects="YES" id="d8w-mz-p76" userLabel="Ship">
             <connections>
                 <binding destination="-2" name="managedObjectContext" keyPath="managedObjectContext" id="fN9-6X-PZD"/>
                 <binding destination="4yO-Gx-S09" name="sortDescriptors" keyPath="values.repairListViewSortDesc" id="hbY-uH-jhj">
@@ -39,7 +39,7 @@
                                 <color key="backgroundColor" name="_sourceListBackgroundColor" catalog="System" colorSpace="catalog"/>
                                 <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
                                 <tableColumns>
-                                    <tableColumn identifier="name" editable="NO" width="79" minWidth="79" maxWidth="20000" id="TUB-Oz-Ql1">
+                                    <tableColumn identifier="name" editable="NO" width="99" minWidth="79" maxWidth="20000" id="TUB-Oz-Ql1">
                                         <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="名前">
                                             <font key="font" metaFont="smallSystem"/>
                                             <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
@@ -65,8 +65,8 @@
                                             </binding>
                                         </connections>
                                     </tableColumn>
-                                    <tableColumn identifier="lv" width="36" minWidth="10" maxWidth="3.4028234663852886e+38" id="1tc-6T-vOf">
-                                        <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="right" title="Lv.">
+                                    <tableColumn identifier="lv" width="31" minWidth="10" maxWidth="3.4028234663852886e+38" id="1tc-6T-vOf">
+                                        <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="center" title="Lv.">
                                             <font key="font" metaFont="smallSystem"/>
                                             <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                             <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
                                             <binding destination="-3" name="font" keyPath="delegate.monospaceSystemFont13" id="KAE-Qz-e6W"/>
                                         </connections>
                                     </tableColumn>
-                                    <tableColumn identifier="status" width="39" minWidth="10" maxWidth="3.4028234663852886e+38" id="P4y-CL-RvJ">
-                                        <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="損害率">
+                                    <tableColumn identifier="status" width="25" minWidth="10" maxWidth="3.4028234663852886e+38" id="P4y-CL-RvJ">
+                                        <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="center" title="損害率">
                                             <font key="font" metaFont="smallSystem"/>
                                             <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                             <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
                                         </tableHeaderCell>
-                                        <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="right" title="Text Cell" id="A1v-1Z-nce">
-                                            <font key="font" metaFont="system"/>
+                                        <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="center" title="Text Cell" id="A1v-1Z-nce">
+                                            <font key="font" metaFont="systemBold" size="16"/>
                                             <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                             <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
                                         </textFieldCell>
                                         <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
                                         <connections>
-                                            <binding destination="d8w-mz-p76" name="displayPatternValue1" keyPath="arrangedObjects.status" id="IF7-sc-Gpl">
+                                            <binding destination="d8w-mz-p76" name="value" keyPath="arrangedObjects.status" id="V5j-vQ-Jlv">
                                                 <dictionary key="options">
-                                                    <string key="NSDisplayPattern">%{value1}@</string>
+                                                    <string key="NSValueTransformerName">HMDamageValueTransformer</string>
                                                 </dictionary>
                                             </binding>
-                                            <binding destination="d8w-mz-p76" name="textColor" keyPath="arrangedObjects.statusColor" id="om4-lP-AbJ"/>
                                         </connections>
                                     </tableColumn>
                                     <tableColumn identifier="time" editable="NO" width="62" minWidth="10" maxWidth="3.4028234663852886e+38" id="TM5-mx-9OE">
                                             <binding destination="-3" name="font" keyPath="delegate.monospaceSystemFont13" id="lPb-C8-SCt"/>
                                         </connections>
                                     </tableColumn>
-                                    <tableColumn identifier="steel" width="42" minWidth="10" maxWidth="3.4028234663852886e+38" id="AWO-9w-e21">
-                                        <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="right" title="鋼材">
+                                    <tableColumn identifier="steel" width="37" minWidth="10" maxWidth="3.4028234663852886e+38" id="AWO-9w-e21">
+                                        <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="center" title="鋼材">
                                             <font key="font" metaFont="smallSystem"/>
                                             <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                             <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
                                             <binding destination="-3" name="font" keyPath="delegate.monospaceSystemFont13" id="wSZ-2a-dbX"/>
                                         </connections>
                                     </tableColumn>
-                                    <tableColumn identifier="fuel" width="33" minWidth="10" maxWidth="3.4028234663852886e+38" id="inV-zw-QnU">
-                                        <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="right" title="燃焼">
+                                    <tableColumn identifier="fuel" width="37" minWidth="10" maxWidth="3.4028234663852886e+38" id="inV-zw-QnU">
+                                        <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="center" title="燃焼">
                                             <font key="font" metaFont="smallSystem"/>
                                             <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                             <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
                         <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
                     </clipView>
                     <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="Kfg-xX-yu7">
-                        <rect key="frame" x="1" y="341" width="309" height="16"/>
+                        <rect key="frame" x="1" y="342" width="309" height="16"/>
                         <autoresizingMask key="autoresizingMask"/>
                     </scroller>
                     <scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="WN3-XE-yqm">