艦これの経験値を管理するツール
Revision | a362cf184b42fff1067eb212a5902b0ddff099c9 (tree) |
---|---|
Zeit | 2014-02-03 00:11:14 |
Autor | masakih <masakih@user...> |
Commiter | masakih |
ステータスが最大値の艦娘を隠せるようにした
@@ -12,6 +12,7 @@ | ||
12 | 12 | |
13 | 13 | @property (nonatomic, readonly) NSManagedObjectContext *managedObjectContext; |
14 | 14 | @property (nonatomic, retain) IBOutlet NSArrayController *collectionShip; |
15 | +@property (nonatomic, retain) IBOutlet NSSegmentedControl *typeSegment; | |
15 | 16 | |
16 | 17 | |
17 | 18 | - (IBAction)selectCategory:(id)sender; |
@@ -16,10 +16,18 @@ | ||
16 | 16 | |
17 | 17 | @property (retain) NSDictionary *categoryList; |
18 | 18 | |
19 | +@property (readonly) BOOL hideMaxFire; | |
20 | +@property (readonly) BOOL hideMaxTorpedo; | |
21 | +@property (readonly) BOOL hideMaxAA; | |
22 | +@property (readonly) BOOL hideMaxArmor; | |
23 | +@property (readonly) BOOL hideMaxLuck; | |
24 | + | |
19 | 25 | @end |
20 | 26 | |
21 | 27 | @implementation KCStatusCheckWindowController |
22 | 28 | |
29 | +@dynamic hideMaxFire, hideMaxTorpedo, hideMaxAA, hideMaxArmor, hideMaxLuck; | |
30 | + | |
23 | 31 | - (id)init |
24 | 32 | { |
25 | 33 | self = [super initWithWindowNibName:NSStringFromClass([self class])]; |
@@ -43,16 +51,79 @@ | ||
43 | 51 | return ((HMAppDelegate *)[NSApp delegate]).managedObjectContext; |
44 | 52 | } |
45 | 53 | |
54 | +- (id)valueForUndefinedKey:(NSString *)key | |
55 | +{ | |
56 | + NSArray *defindeKyes = @[@"hideMaxFire", @"hideMaxTorpedo", @"hideMaxAA", @"hideMaxArmor", @"hideMaxLuck"]; | |
57 | + if([defindeKyes containsObject:key]) { | |
58 | + return [[NSUserDefaults standardUserDefaults] objectForKey:key]; | |
59 | + } | |
60 | + | |
61 | + return [super valueForUndefinedKey:key]; | |
62 | +} | |
63 | +- (BOOL)hideMaxFire | |
64 | +{ | |
65 | + return [[NSUserDefaults standardUserDefaults] boolForKey:@"hideMaxFire"]; | |
66 | +} | |
67 | +- (BOOL)hideMaxTorpedo | |
68 | +{ | |
69 | + return [[NSUserDefaults standardUserDefaults] boolForKey:@"hideMaxTorpedo"]; | |
70 | +} | |
71 | +- (BOOL)hideMaxAA | |
72 | +{ | |
73 | + return [[NSUserDefaults standardUserDefaults] boolForKey:@"hideMaxAA"]; | |
74 | +} | |
75 | +- (BOOL)hideMaxArmor | |
76 | +{ | |
77 | + return [[NSUserDefaults standardUserDefaults] boolForKey:@"hideMaxArmor"]; | |
78 | +} | |
79 | +- (BOOL)hideMaxLuck | |
80 | +{ | |
81 | + return [[NSUserDefaults standardUserDefaults] boolForKey:@"hideMaxLuck"]; | |
82 | +} | |
83 | + | |
84 | +- (NSPredicate *)omitPredicate | |
85 | +{ | |
86 | + NSMutableArray *hideKeys = [NSMutableArray array]; | |
87 | + if(self.hideMaxFire) { | |
88 | + [hideKeys addObject:@"isMaxFire != TRUE"]; | |
89 | + } | |
90 | + if(self.hideMaxTorpedo) { | |
91 | + [hideKeys addObject:@"isMaxTorpedo != TRUE"]; | |
92 | + } | |
93 | + if(self.hideMaxAA) { | |
94 | + [hideKeys addObject:@"isMaxAA != TRUE"]; | |
95 | + } | |
96 | + if(self.hideMaxArmor) { | |
97 | + [hideKeys addObject:@"isMaxArmor != TRUE"]; | |
98 | + } | |
99 | + if(self.hideMaxLuck) { | |
100 | + [hideKeys addObject:@"isMaxLuck != TRUE"]; | |
101 | + } | |
102 | + | |
103 | + if([hideKeys count] == 0) return nil; | |
104 | + | |
105 | + NSString *predicateString = [hideKeys componentsJoinedByString:@" AND "]; | |
106 | + | |
107 | + return [NSPredicate predicateWithFormat:predicateString]; | |
108 | +} | |
109 | + | |
46 | 110 | - (IBAction)selectCategory:(id)sender |
47 | 111 | { |
48 | - NSPredicate *predicate = nil; | |
49 | - NSInteger segment = [sender selectedSegment]; | |
50 | - NSString *label = [sender labelForSegment:segment]; | |
112 | + NSPredicate *predicate = [self omitPredicate]; | |
113 | + NSInteger segment = [self.typeSegment selectedSegment]; | |
114 | + NSString *label = [self.typeSegment labelForSegment:segment]; | |
51 | 115 | |
52 | 116 | NSDictionary *types = [self.categoryList objectForKey:label]; |
53 | 117 | if(types) { |
54 | - predicate = [NSPredicate predicateWithFormat:@"ship.type.name IN %@", types]; | |
118 | + NSPredicate *catPredicate = [NSPredicate predicateWithFormat:@"ship.type.name IN %@", types]; | |
119 | + if(predicate) { | |
120 | + NSArray *sub = @[predicate, catPredicate]; | |
121 | + predicate = [NSCompoundPredicate andPredicateWithSubpredicates:sub]; | |
122 | + } else { | |
123 | + predicate = catPredicate; | |
124 | + } | |
55 | 125 | } |
126 | + | |
56 | 127 | |
57 | 128 | [self.collectionShip setFetchPredicate:predicate]; |
58 | 129 | } |
@@ -8,6 +8,7 @@ | ||
8 | 8 | <customObject id="-2" userLabel="File's Owner" customClass="KCStatusCheckWindowController"> |
9 | 9 | <connections> |
10 | 10 | <outlet property="collectionShip" destination="b5h-Jc-6Om" id="sS5-7K-uIT"/> |
11 | + <outlet property="typeSegment" destination="YYD-QZ-qFG" id="OSS-Rc-COE"/> | |
11 | 12 | <outlet property="window" destination="1" id="3"/> |
12 | 13 | </connections> |
13 | 14 | </customObject> |
@@ -214,13 +215,74 @@ | ||
214 | 215 | </tableHeaderView> |
215 | 216 | </scrollView> |
216 | 217 | <button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="175-sD-FkB"> |
217 | - <rect key="frame" x="18" y="360" width="126" height="18"/> | |
218 | + <rect key="frame" x="143" y="361" width="48" height="18"/> | |
218 | 219 | <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> |
219 | - <buttonCell key="cell" type="check" title="最大の艦娘は隠す" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="NRl-Ed-dfv"> | |
220 | + <buttonCell key="cell" type="check" title="火力" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="NRl-Ed-dfv"> | |
220 | 221 | <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> |
221 | 222 | <font key="font" size="13" name="AquaKana"/> |
222 | 223 | </buttonCell> |
224 | + <connections> | |
225 | + <action selector="selectCategory:" target="-2" id="H5w-Tb-SwM"/> | |
226 | + <binding destination="bQa-hr-EKb" name="value" keyPath="values.hideMaxFire" id="0CD-Is-HCc"/> | |
227 | + </connections> | |
228 | + </button> | |
229 | + <button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="mHC-Ii-S5A"> | |
230 | + <rect key="frame" x="195" y="361" width="48" height="18"/> | |
231 | + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> | |
232 | + <buttonCell key="cell" type="check" title="雷装" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="h0E-Xu-bHD"> | |
233 | + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> | |
234 | + <font key="font" size="13" name="AquaKana"/> | |
235 | + </buttonCell> | |
236 | + <connections> | |
237 | + <action selector="selectCategory:" target="-2" id="MIt-Mj-8Uy"/> | |
238 | + <binding destination="bQa-hr-EKb" name="value" keyPath="values.hideMaxTorpedo" id="bHU-PK-w4F"/> | |
239 | + </connections> | |
240 | + </button> | |
241 | + <button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="GiW-Zb-LZA"> | |
242 | + <rect key="frame" x="247" y="361" width="48" height="18"/> | |
243 | + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> | |
244 | + <buttonCell key="cell" type="check" title="対空" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="zXJ-A2-60m"> | |
245 | + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> | |
246 | + <font key="font" size="13" name="AquaKana"/> | |
247 | + </buttonCell> | |
248 | + <connections> | |
249 | + <action selector="selectCategory:" target="-2" id="oP1-JV-WCL"/> | |
250 | + <binding destination="bQa-hr-EKb" name="value" keyPath="values.hideMaxAA" id="QeJ-Ny-XAU"/> | |
251 | + </connections> | |
223 | 252 | </button> |
253 | + <button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="O9T-wc-PgY"> | |
254 | + <rect key="frame" x="299" y="361" width="48" height="18"/> | |
255 | + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> | |
256 | + <buttonCell key="cell" type="check" title="装甲" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="0M2-OV-IHQ"> | |
257 | + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> | |
258 | + <font key="font" size="13" name="AquaKana"/> | |
259 | + </buttonCell> | |
260 | + <connections> | |
261 | + <action selector="selectCategory:" target="-2" id="Ocn-2S-6T8"/> | |
262 | + <binding destination="bQa-hr-EKb" name="value" keyPath="values.hideMaxArmor" id="ipI-3n-Xe2"/> | |
263 | + </connections> | |
264 | + </button> | |
265 | + <button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Zwc-46-uuS"> | |
266 | + <rect key="frame" x="351" y="361" width="35" height="18"/> | |
267 | + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> | |
268 | + <buttonCell key="cell" type="check" title="運" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="8oz-Ok-3e5"> | |
269 | + <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> | |
270 | + <font key="font" size="13" name="AquaKana"/> | |
271 | + </buttonCell> | |
272 | + <connections> | |
273 | + <action selector="selectCategory:" target="-2" id="ibY-LD-g2j"/> | |
274 | + <binding destination="bQa-hr-EKb" name="value" keyPath="values.hideMaxLuck" id="wLb-Sg-rcK"/> | |
275 | + </connections> | |
276 | + </button> | |
277 | + <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="FIC-ZJ-kr2"> | |
278 | + <rect key="frame" x="18" y="362" width="121" height="17"/> | |
279 | + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> | |
280 | + <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="最大の艦娘は隠す:" id="G9m-XF-G6U"> | |
281 | + <font key="font" size="13" name="AquaKana"/> | |
282 | + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> | |
283 | + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> | |
284 | + </textFieldCell> | |
285 | + </textField> | |
224 | 286 | </subviews> |
225 | 287 | </view> |
226 | 288 | <connections> |
@@ -232,5 +294,6 @@ | ||
232 | 294 | <binding destination="-2" name="managedObjectContext" keyPath="managedObjectContext" id="2A8-bK-70W"/> |
233 | 295 | </connections> |
234 | 296 | </arrayController> |
297 | + <userDefaultsController id="bQa-hr-EKb"/> | |
235 | 298 | </objects> |
236 | 299 | </document> |
\ No newline at end of file |