F44AB23E19E824D700F217AF /* HMKCSlotItemObject.m in Sources */ = {isa = PBXBuildFile; fileRef = F44AB23D19E824D700F217AF /* HMKCSlotItemObject.m */; };
F44AB24119E8252600F217AF /* HMKCSlotItemObject+Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = F44AB24019E8252600F217AF /* HMKCSlotItemObject+Extensions.m */; };
F4513EDD18B619B600073552 /* HMCoreDataManager.m in Sources */ = {isa = PBXBuildFile; fileRef = F4513EDC18B619B600073552 /* HMCoreDataManager.m */; };
- F4513EE418B635EA00073552 /* HMDocksViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F4513EE218B635EA00073552 /* HMDocksViewController.m */; };
F4513EE818B77A5300073552 /* HMMemberKDockCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4513EE718B77A5300073552 /* HMMemberKDockCommand.m */; };
F4513EEB18B7900A00073552 /* HMMemberDeckCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4513EEA18B7900A00073552 /* HMMemberDeckCommand.m */; };
F4513EEE18B8E2F600073552 /* HMMemberMaterialCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4513EED18B8E2F600073552 /* HMMemberMaterialCommand.m */; };
F4551BEA1A48FA6000BB0235 /* HMCacheVersionInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4551BE91A48FA6000BB0235 /* HMCacheVersionInfo.swift */; };
F4551BEE1A49186900BB0235 /* HMShipViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4551BED1A49186900BB0235 /* HMShipViewController.swift */; };
F4551BF01A49350B00BB0235 /* HMPowerUpSupportViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4551BEF1A49350B00BB0235 /* HMPowerUpSupportViewController.swift */; };
+ F4551BF21A49490A00BB0235 /* HMDocksViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4551BF11A49490A00BB0235 /* HMDocksViewController.swift */; };
F46F103618A7CE310063E503 /* HMJSONViewCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F46F103518A7CE310063E503 /* HMJSONViewCommand.m */; };
F46F104118A9B85E0063E503 /* HMJSONNode.m in Sources */ = {isa = PBXBuildFile; fileRef = F46F104018A9B85E0063E503 /* HMJSONNode.m */; };
F46F104518AA50730063E503 /* HMBroserWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = F46F104318AA50730063E503 /* HMBroserWindowController.m */; };
F44AB24019E8252600F217AF /* HMKCSlotItemObject+Extensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "HMKCSlotItemObject+Extensions.m"; sourceTree = "<group>"; };
F4513EDB18B619B600073552 /* HMCoreDataManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMCoreDataManager.h; sourceTree = "<group>"; };
F4513EDC18B619B600073552 /* HMCoreDataManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMCoreDataManager.m; sourceTree = "<group>"; };
- F4513EE118B635EA00073552 /* HMDocksViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMDocksViewController.h; sourceTree = "<group>"; };
- F4513EE218B635EA00073552 /* HMDocksViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMDocksViewController.m; sourceTree = "<group>"; };
F4513EE618B77A5300073552 /* HMMemberKDockCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMMemberKDockCommand.h; sourceTree = "<group>"; };
F4513EE718B77A5300073552 /* HMMemberKDockCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMMemberKDockCommand.m; sourceTree = "<group>"; };
F4513EE918B7900A00073552 /* HMMemberDeckCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMMemberDeckCommand.h; sourceTree = "<group>"; };
F4551BE91A48FA6000BB0235 /* HMCacheVersionInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMCacheVersionInfo.swift; sourceTree = "<group>"; };
F4551BED1A49186900BB0235 /* HMShipViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMShipViewController.swift; sourceTree = "<group>"; };
F4551BEF1A49350B00BB0235 /* HMPowerUpSupportViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMPowerUpSupportViewController.swift; sourceTree = "<group>"; };
+ F4551BF11A49490A00BB0235 /* HMDocksViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMDocksViewController.swift; sourceTree = "<group>"; };
F46F103418A7CE310063E503 /* HMJSONViewCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMJSONViewCommand.h; sourceTree = "<group>"; };
F46F103518A7CE310063E503 /* HMJSONViewCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMJSONViewCommand.m; sourceTree = "<group>"; };
F46F103F18A9B85E0063E503 /* HMJSONNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMJSONNode.h; sourceTree = "<group>"; };
F46F104218AA50730063E503 /* HMBroserWindowController.h */,
F46F104318AA50730063E503 /* HMBroserWindowController.m */,
F4B3DC4118E5C8870011B4FC /* HMBroserWindowController.xib */,
- F4513EE118B635EA00073552 /* HMDocksViewController.h */,
- F4513EE218B635EA00073552 /* HMDocksViewController.m */,
+ F4551BF11A49490A00BB0235 /* HMDocksViewController.swift */,
F4B3DC3E18E5C87D0011B4FC /* HMDocksViewController.xib */,
F4551BED1A49186900BB0235 /* HMShipViewController.swift */,
F4B3DC3518E5C8520011B4FC /* HMShipViewController.xib */,
F43F3D4C1A34AC8000D6DAF7 /* HMKCMasterShipObject.m in Sources */,
F4268031194D1B1A00B2C27F /* HMChangeHenseiCommand.m in Sources */,
F4551BE61A48711D00BB0235 /* HMScreenshotInformation.swift in Sources */,
- F4513EE418B635EA00073552 /* HMDocksViewController.m in Sources */,
F494DC6D18CC054800AE97E4 /* HMNyukyoDockStatus.m in Sources */,
F43BA4A1197BE22200CFF788 /* HMDestroyShipCommand.m in Sources */,
F47B78B218A7B42B0011386E /* HMJSONViewWindowController.m in Sources */,
F4D2CBC218AD0E1A000EBC59 /* HMMasterSTypeCommand.m in Sources */,
F4B1E30919C73B6A00805879 /* HMSuppliesView.m in Sources */,
F4551BE41A48379F00BB0235 /* HMDeckViewController.swift in Sources */,
+ F4551BF21A49490A00BB0235 /* HMDocksViewController.swift in Sources */,
F4B30CF31A458AF2008E3D79 /* HMSlotItemWindowController.swift in Sources */,
F43BA4A4197BE6C200CFF788 /* HMRealDestroyShipCommand.m in Sources */,
F46F104518AA50730063E503 /* HMBroserWindowController.m in Sources */,
#import "HMAppDelegate.h"
#import "HMUserDefaults.h"
-#import "HMDocksViewController.h"
#import "HMScreenshotListWindowController.h"
self.flashTopLeft = NSMakePoint(70, 145);
[self adjustFlash];
- self.selectedViewController = [HMDocksViewController new];
+ self.selectedViewController = [HMDocksViewController create];
[self.selectedViewController.view setFrame:[self.docksPlaceholder frame]];
[self.selectedViewController.view setAutoresizingMask:[self.docksPlaceholder autoresizingMask]];
[[self.docksPlaceholder superview] replaceSubview:self.docksPlaceholder with:self.selectedViewController.view];
+++ /dev/null
-//
-// HMDocksViewController.h
-// KCD
-//
-// Created by Hori,Masaki on 2014/02/20.
-// Copyright (c) 2014年 Hori,Masaki. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-
-@interface HMDocksViewController : NSViewController
-
-@property (readonly) NSManagedObjectContext *managedObjectContext;
-
-@property (nonatomic, strong) NSNumber *nDock1Time;
-@property (nonatomic, strong) NSNumber *nDock2Time;
-@property (nonatomic, strong) NSNumber *nDock3Time;
-@property (nonatomic, strong) NSNumber *nDock4Time;
-
-@property (readonly) NSString *nDock1ShipName;
-@property (readonly) NSString *nDock2ShipName;
-@property (readonly) NSString *nDock3ShipName;
-@property (readonly) NSString *nDock4ShipName;
-
-
-@property (nonatomic, strong) NSNumber *kDock1Time;
-@property (nonatomic, strong) NSNumber *kDock2Time;
-@property (nonatomic, strong) NSNumber *kDock3Time;
-@property (nonatomic, strong) NSNumber *kDock4Time;
-
-
-@property (readonly) NSNumber *deck2Time;
-@property (readonly) NSNumber *deck3Time;
-@property (readonly) NSNumber *deck4Time;
-
-@property (readonly) NSString *mission2Name;
-@property (readonly) NSString *mission3Name;
-@property (readonly) NSString *mission4Name;
-
-@end
+++ /dev/null
-//
-// HMDocksViewController.m
-// KCD
-//
-// Created by Hori,Masaki on 2014/02/20.
-// Copyright (c) 2014年 Hori,Masaki. All rights reserved.
-//
-
-#import "HMDocksViewController.h"
-
-#import "HMServerDataStore.h"
-
-#import "HMMissionStatus.h"
-#import "HMNyukyoDockStatus.h"
-#import "HMKenzoDockStatus.h"
-
-
-#import "HMTemporaryDataStore.h"
-
-
-@interface HMDocksViewController ()
-
-@property (strong) HMMissionStatus *mission2Status;
-@property (strong) HMMissionStatus *mission3Status;
-@property (strong) HMMissionStatus *mission4Status;
-
-@property (strong) HMNyukyoDockStatus *ndock1Status;
-@property (strong) HMNyukyoDockStatus *ndock2Status;
-@property (strong) HMNyukyoDockStatus *ndock3Status;
-@property (strong) HMNyukyoDockStatus *ndock4Status;
-
-@property (strong) HMKenzoDockStatus *kdock1Status;
-@property (strong) HMKenzoDockStatus *kdock2Status;
-@property (strong) HMKenzoDockStatus *kdock3Status;
-@property (strong) HMKenzoDockStatus *kdock4Status;
-
-
-@property (readonly) NSManagedObjectContext *battleManagedObjectController;
-@property (nonatomic, weak) IBOutlet NSObjectController *battleContoller;
-@property (readonly) NSManagedObject *battle;
-
-
-@end
-
-@implementation HMDocksViewController
-
-
-- (NSManagedObjectContext *)managedObjectContext
-{
- return [HMServerDataStore defaultManager].managedObjectContext;
-}
-
-- (id)init
-{
- self = [super initWithNibName:NSStringFromClass([self class]) bundle:nil];
- if(self) {
- _mission2Status = [[HMMissionStatus alloc] initWithDeckNumber:2];
- _mission2Status.managedObjectContext = self.managedObjectContext;
- [self bind:@"deck2Time" toObject:self.mission2Status withKeyPath:@"time" options:nil];
- [self bind:@"mission2Name" toObject:self.mission2Status withKeyPath:@"name" options:nil];
-
- _mission3Status = [[HMMissionStatus alloc] initWithDeckNumber:3];
- _mission3Status.managedObjectContext = self.managedObjectContext;
- [self bind:@"deck3Time" toObject:self.mission3Status withKeyPath:@"time" options:nil];
- [self bind:@"mission3Name" toObject:self.mission3Status withKeyPath:@"name" options:nil];
-
- _mission4Status = [[HMMissionStatus alloc] initWithDeckNumber:4];
- _mission4Status.managedObjectContext = self.managedObjectContext;
- [self bind:@"deck4Time" toObject:self.mission4Status withKeyPath:@"time" options:nil];
- [self bind:@"mission4Name" toObject:self.mission4Status withKeyPath:@"name" options:nil];
-
-
- //
- _ndock1Status = [[HMNyukyoDockStatus alloc] initWithDockNumber:1];
- _ndock1Status.managedObjectContext = self.managedObjectContext;
- [self bind:@"nDock1Time" toObject:self.ndock1Status withKeyPath:@"time" options:nil];
- [self bind:@"nDock1ShipName" toObject:self.ndock1Status withKeyPath:@"name" options:nil];
-
- _ndock2Status = [[HMNyukyoDockStatus alloc] initWithDockNumber:2];
- _ndock2Status.managedObjectContext = self.managedObjectContext;
- [self bind:@"nDock2Time" toObject:self.ndock2Status withKeyPath:@"time" options:nil];
- [self bind:@"nDock2ShipName" toObject:self.ndock2Status withKeyPath:@"name" options:nil];
-
- _ndock3Status = [[HMNyukyoDockStatus alloc] initWithDockNumber:3];
- _ndock3Status.managedObjectContext = self.managedObjectContext;
- [self bind:@"nDock3Time" toObject:self.ndock3Status withKeyPath:@"time" options:nil];
- [self bind:@"nDock3ShipName" toObject:self.ndock3Status withKeyPath:@"name" options:nil];
-
- _ndock4Status = [[HMNyukyoDockStatus alloc] initWithDockNumber:4];
- _ndock4Status.managedObjectContext = self.managedObjectContext;
- [self bind:@"nDock4Time" toObject:self.ndock4Status withKeyPath:@"time" options:nil];
- [self bind:@"nDock4ShipName" toObject:self.ndock4Status withKeyPath:@"name" options:nil];
-
-
- //
- _kdock1Status = [[HMKenzoDockStatus alloc] initWithDockNumber:1];
- _kdock1Status.managedObjectContext = self.managedObjectContext;
- [self bind:@"kDock1Time" toObject:self.kdock1Status withKeyPath:@"time" options:nil];
-
- _kdock2Status = [[HMKenzoDockStatus alloc] initWithDockNumber:2];
- _kdock2Status.managedObjectContext = self.managedObjectContext;
- [self bind:@"kDock2Time" toObject:self.kdock2Status withKeyPath:@"time" options:nil];
-
- _kdock3Status = [[HMKenzoDockStatus alloc] initWithDockNumber:3];
- _kdock3Status.managedObjectContext = self.managedObjectContext;
- [self bind:@"kDock3Time" toObject:self.kdock3Status withKeyPath:@"time" options:nil];
-
- _kdock4Status = [[HMKenzoDockStatus alloc] initWithDockNumber:4];
- _kdock4Status.managedObjectContext = self.managedObjectContext;
- [self bind:@"kDock4Time" toObject:self.kdock4Status withKeyPath:@"time" options:nil];
-
- }
- return self;
-}
-
-- (void)awakeFromNib
-{
- [NSTimer scheduledTimerWithTimeInterval:0.33
- target:self
- selector:@selector(fire:)
- userInfo:nil
- repeats:YES];
-
-
- //
- [self.battleContoller addObserver:self
- forKeyPath:@"selection"
- options:0
- context:NULL];
-}
-
-
-- (void)fire:(id)timer
-{
- // 入渠ドック
- [self.ndock1Status update];
- [self.ndock2Status update];
- [self.ndock3Status update];
- [self.ndock4Status update];
-
- // 建造ドック
- [self.kdock1Status update];
- [self.kdock2Status update];
- [self.kdock3Status update];
- [self.kdock4Status update];
-
- // 遠征
- [self.mission2Status update];
- [self.mission3Status update];
- [self.mission4Status update];
-
-}
-
-- (NSManagedObjectContext *)battleManagedObjectController
-{
- return [[HMTemporaryDataStore defaultManager] managedObjectContext];
-}
-- (NSManagedObject *)battle
-{
- HMTemporaryDataStore *store = [HMTemporaryDataStore defaultManager];
- NSError *error = nil;
- NSArray *array = [store objectsWithEntityName:@"Battle" predicate:nil error:&error];
- if(error) {
- NSLog(@"%s error: %@", __PRETTY_FUNCTION__, error);
- }
- return array.count > 0 ? array[0] : nil;
-}
-
-- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
-{
- if([keyPath isEqualToString:@"selection"]) {
- [self willChangeValueForKey:@"sortieString"];
- [self didChangeValueForKey:@"sortieString"];
- return;
- }
-
- return [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
-}
-
-- (NSString *)sortieString
-{
- NSString *result = nil;
- if(self.fleetName && self.areaName && self.areaNumber) {
- NSString *format = NSLocalizedString(@"%@ in sortie into %@ (%@)", @"Sortie");
- result = [NSString stringWithFormat:format, self.fleetName, self.areaName, self.areaNumber];
- }
- return result;
-}
-
-- (NSString *)fleetName
-{
- HMServerDataStore *store = [HMServerDataStore defaultManager];
-
- NSError *error = nil;
- id deckId = [self.battleContoller valueForKeyPath:@"content.deckId"];
- NSArray *array = [store objectsWithEntityName:@"Deck"
- error:&error
- predicateFormat:@"id = %@", deckId];
- if(error) {
- NSLog(@"%s error: %@", __PRETTY_FUNCTION__, error);
- }
- if(array.count == 0) return nil;
-
- return [NSString stringWithFormat:@"%@", [array[0] valueForKey:@"name"]];
-}
-- (NSString *)areaNumber
-{
- return [NSString stringWithFormat:@"%@-%@",
- [self.battleContoller valueForKeyPath:@"content.mapArea"],
- [self.battleContoller valueForKeyPath:@"content.mapInfo"]];
-}
-- (NSString *)areaName
-{
- HMServerDataStore *store = [HMServerDataStore defaultManager];
-
- NSError *error = nil;
- id mapAreaId = [self.battleContoller valueForKeyPath:@"content.mapArea"];
- id mapInfoId = [self.battleContoller valueForKeyPath:@"content.mapInfo"];
- NSArray *array = [store objectsWithEntityName:@"MasterMapInfo"
- error:&error
- predicateFormat:@"maparea_id = %@ AND %K = %@", mapAreaId, @"no", mapInfoId];
- if(error) {
- NSLog(@"%s error: %@", __PRETTY_FUNCTION__, error);
- }
- if(array.count == 0) return nil;
-
- return [NSString stringWithFormat:@"%@", [array[0] valueForKey:@"name"]];
-}
-
-@end
--- /dev/null
+//
+// HMDocksViewController.swift
+// KCD
+//
+// Created by Hori,Masaki on 2014/12/23.
+// Copyright (c) 2014年 Hori,Masaki. All rights reserved.
+//
+
+import Cocoa
+
+class HMDocksViewController: NSViewController
+{
+
+ override init?(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
+ mission2Status = HMMissionStatus(deckNumber: 2)
+ mission3Status = HMMissionStatus(deckNumber: 3)
+ mission4Status = HMMissionStatus(deckNumber: 4)
+
+ ndock1Status = HMNyukyoDockStatus(dockNumber: 1)
+ ndock2Status = HMNyukyoDockStatus(dockNumber: 2)
+ ndock3Status = HMNyukyoDockStatus(dockNumber: 3)
+ ndock4Status = HMNyukyoDockStatus(dockNumber: 4)
+
+ kdock1Status = HMKenzoDockStatus(dockNumber: 1)
+ kdock2Status = HMKenzoDockStatus(dockNumber: 2)
+ kdock3Status = HMKenzoDockStatus(dockNumber: 3)
+ kdock4Status = HMKenzoDockStatus(dockNumber: 4)
+
+ super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
+ }
+
+ required init?(coder: NSCoder) {
+ mission2Status = HMMissionStatus(deckNumber: 2)
+ mission3Status = HMMissionStatus(deckNumber: 3)
+ mission4Status = HMMissionStatus(deckNumber: 4)
+
+ ndock1Status = HMNyukyoDockStatus(dockNumber: 1)
+ ndock2Status = HMNyukyoDockStatus(dockNumber: 2)
+ ndock3Status = HMNyukyoDockStatus(dockNumber: 3)
+ ndock4Status = HMNyukyoDockStatus(dockNumber: 4)
+
+ kdock1Status = HMKenzoDockStatus(dockNumber: 1)
+ kdock2Status = HMKenzoDockStatus(dockNumber: 2)
+ kdock3Status = HMKenzoDockStatus(dockNumber: 3)
+ kdock4Status = HMKenzoDockStatus(dockNumber: 4)
+
+ super.init(coder: coder)
+ }
+
+ class func create() -> HMDocksViewController? {
+ return HMDocksViewController(nibName: "HMDocksViewController", bundle: nil)
+ }
+
+ override func awakeFromNib() {
+ mission2Status.managedObjectContext = managedObjectContext
+ mission3Status.managedObjectContext = managedObjectContext
+ mission4Status.managedObjectContext = managedObjectContext
+
+ self.bind("deck2Time", toObject: mission2Status, withKeyPath: "time", options: nil)
+ self.bind("deck3Time", toObject: mission3Status, withKeyPath: "time", options: nil)
+ self.bind("deck4Time", toObject: mission4Status, withKeyPath: "time", options: nil)
+
+ self.bind("mission2Name", toObject: mission2Status, withKeyPath: "name", options: nil)
+ self.bind("mission3Name", toObject: mission3Status, withKeyPath: "name", options: nil)
+ self.bind("mission4Name", toObject: mission4Status, withKeyPath: "name", options: nil)
+
+ ndock1Status.managedObjectContext = managedObjectContext
+ ndock2Status.managedObjectContext = managedObjectContext
+ ndock3Status.managedObjectContext = managedObjectContext
+ ndock4Status.managedObjectContext = managedObjectContext
+
+ self.bind("nDock1Time", toObject: ndock1Status, withKeyPath: "time", options: nil)
+ self.bind("nDock2Time", toObject: ndock2Status, withKeyPath: "time", options: nil)
+ self.bind("nDock3Time", toObject: ndock3Status, withKeyPath: "time", options: nil)
+ self.bind("nDock4Time", toObject: ndock4Status, withKeyPath: "time", options: nil)
+
+ self.bind("nDock1ShipName", toObject: ndock1Status, withKeyPath: "name", options: nil)
+ self.bind("nDock2ShipName", toObject: ndock2Status, withKeyPath: "name", options: nil)
+ self.bind("nDock3ShipName", toObject: ndock3Status, withKeyPath: "name", options: nil)
+ self.bind("nDock4ShipName", toObject: ndock4Status, withKeyPath: "name", options: nil)
+
+ kdock1Status.managedObjectContext = managedObjectContext
+ kdock2Status.managedObjectContext = managedObjectContext
+ kdock3Status.managedObjectContext = managedObjectContext
+ kdock4Status.managedObjectContext = managedObjectContext
+
+ self.bind("kDock1Time", toObject: kdock1Status, withKeyPath: "time", options: nil)
+ self.bind("kDock2Time", toObject: kdock2Status, withKeyPath: "time", options: nil)
+ self.bind("kDock3Time", toObject: kdock3Status, withKeyPath: "time", options: nil)
+ self.bind("kDock4Time", toObject: kdock4Status, withKeyPath: "time", options: nil)
+
+ NSTimer.scheduledTimerWithTimeInterval(0.33, target: self, selector: "fire:", userInfo: nil, repeats: true)
+
+ battleContoller?.addObserver(self, forKeyPath: "selection", options: .Initial, context: nil)
+ }
+
+ let mission2Status: HMMissionStatus
+ let mission3Status: HMMissionStatus
+ let mission4Status: HMMissionStatus
+
+ let ndock1Status: HMNyukyoDockStatus
+ let ndock2Status: HMNyukyoDockStatus
+ let ndock3Status: HMNyukyoDockStatus
+ let ndock4Status: HMNyukyoDockStatus
+
+ let kdock1Status: HMKenzoDockStatus
+ let kdock2Status: HMKenzoDockStatus
+ let kdock3Status: HMKenzoDockStatus
+ let kdock4Status: HMKenzoDockStatus
+
+ var nDock1Time: NSNumber?
+ var nDock2Time: NSNumber?
+ var nDock3Time: NSNumber?
+ var nDock4Time: NSNumber?
+
+ var nDock1ShipName: String?
+ var nDock2ShipName: String?
+ var nDock3ShipName: String?
+ var nDock4ShipName: String?
+
+ var kDock1Time: NSNumber?
+ var kDock2Time: NSNumber?
+ var kDock3Time: NSNumber?
+ var kDock4Time: NSNumber?
+
+ var deck2Time: NSNumber?
+ var deck3Time: NSNumber?
+ var deck4Time: NSNumber?
+
+ var mission2Name: String?
+ var mission3Name: String?
+ var mission4Name: String?
+
+ var managedObjectContext: NSManagedObjectContext {
+ return HMServerDataStore.defaultManager().managedObjectContext
+ }
+
+ func fire(timer: NSTimer) {
+ ndock1Status.update()
+ ndock2Status.update()
+ ndock3Status.update()
+ ndock4Status.update()
+
+ kdock1Status.update()
+ kdock2Status.update()
+ kdock3Status.update()
+ kdock4Status.update()
+
+ mission2Status.update()
+ mission3Status.update()
+ mission4Status.update()
+ }
+
+ override func observeValueForKeyPath(keyPath: String, ofObject object: AnyObject, change: [NSObject : AnyObject], context: UnsafeMutablePointer<Void>) {
+ switch keyPath {
+ case "selection":
+ self.willChangeValueForKey("sortieString")
+ self.didChangeValueForKey("sortieString")
+ default:
+ super.observeValueForKeyPath(keyPath, ofObject: object, change: change, context: context)
+ }
+ }
+
+ var battleManagedObjectController: NSManagedObjectContext {
+ return HMTemporaryDataStore.defaultManager().managedObjectContext;
+ }
+ var battle: NSManagedObject? {
+ let store = HMTemporaryDataStore.defaultManager()
+ var error: NSError? = nil
+ let array = store.objectsWithEntityName("Battle", predicate: nil, error: &error)
+ if error != nil {
+ println("%s error: \(error)", __FUNCTION__)
+ return nil
+ }
+ if array.count == 0 {
+ return nil
+ }
+ return array[0] as? NSManagedObject
+ }
+ var fleetName: String? {
+ let store = HMServerDataStore.defaultManager()
+ var error: NSError? = nil
+ let deckID = battleContoller?.valueForKeyPath("content.deckId") as? NSNumber
+ if deckID == nil { return nil }
+ let array = store.objectsWithEntityName("Deck", predicate: NSPredicate(format: "id = %@", deckID!), error: &error)
+ if error != nil {
+ println("%s error: \(error)", __FUNCTION__)
+ return nil
+ }
+ if array.count == 0 {
+ return nil
+ }
+ let name: AnyObject? = array[0].valueForKey("name")
+ if name == nil { return nil }
+ return "\(name!)"
+ }
+ var areaNumber: String? {
+ let area = battleContoller?.valueForKeyPath("content.mapArea") as? NSNumber
+ let info = battleContoller?.valueForKeyPath("content.mapInfo") as? NSNumber
+ if area == nil || info == nil { return nil }
+ return "\(area!)-\(info!)"
+ }
+ var areaName: String? {
+ let store = HMServerDataStore.defaultManager()
+ var error: NSError? = nil
+ let area = battleContoller?.valueForKeyPath("content.mapArea") as? NSNumber
+ let info = battleContoller?.valueForKeyPath("content.mapInfo") as? NSNumber
+ if area == nil || info == nil { return nil }
+ let predicate = NSPredicate(format: "maparea_id = %@ AND %K = %@", area!, "no", info!)
+ let array = store.objectsWithEntityName("MasterMapInfo", predicate: predicate, error: &error)
+ if error != nil {
+ println("%s error: \(error)", __FUNCTION__)
+ return nil
+ }
+ if array.count == 0 {
+ return nil
+ }
+ let name: AnyObject? = array[0].valueForKey("name")
+ if name == nil { return nil }
+ return "\(name!)"
+ }
+ var sortieString: String? {
+ let fName = fleetName
+ let aNum = areaNumber
+ let aName = areaName
+ if fName == nil || aNum == nil || aName == nil { return nil }
+ let format = NSLocalizedString("%@ in sortie into %@ (%@)", comment: "Sortie")
+ return NSString(format: format, fName!, aName!, aNum!)
+ }
+
+ @IBOutlet var battleContoller: NSObjectController?
+
+}
#import "HMServerDataStore.h"
#import "HMLocalDataStore.h"
+#import "HMTemporaryDataStore.h"
+#import "HMMissionStatus.h"
+#import "HMNyukyoDockStatus.h"
+#import "HMKenzoDockStatus.h"
#import "HMFleetInformation.h"
+
#import "HMSuppliesView.h"
+
+
+
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6250"/>
</dependencies>
<objects>
- <customObject id="-2" userLabel="File's Owner" customClass="HMDocksViewController">
+ <customObject id="-2" userLabel="File's Owner" customClass="HMDocksViewController" customModule="KCD" customModuleProvider="target">
<connections>
<outlet property="battleContoller" destination="sje-58-fiD" id="4Qx-Ag-AL2"/>
<outlet property="view" destination="vGg-MO-rzn" id="Z4V-4O-pqr"/>