OSDN Git Service

泊地修理開始後20分以上たったあと母港に戻るとタイマーをリセットするようにした
authormasakih <masakih@users.sourceforge.jp>
Tue, 21 Jul 2015 14:08:08 +0000 (23:08 +0900)
committermasakih <masakih@users.sourceforge.jp>
Tue, 21 Jul 2015 14:08:08 +0000 (23:08 +0900)
KCD/HMAnchorageRepairManager.m

index cb0cb4c..477d852 100644 (file)
@@ -8,6 +8,8 @@
 
 #import "HMAnchorageRepairManager.h"
 
+#import "HMAppDelegate.h"
+
 #import "HMServerDataStore.h"
 #import "HMKCDeck+Extension.h"
 #import "HMKCShipObject+Extensions.h"
                [self buildMembers];
                
                [self resetRepairTime];
+               
+               NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
+               [nc addObserver:self
+                          selector:@selector(didRecivePortAPINotification:)
+                                  name:HMPortAPIRecieveNotification
+                                object:nil];
        }
        return self;
 }
 //                                                        context:@"members"];
 }
 
+- (void)didRecivePortAPINotification:(NSNotification *)notification
+{
+       NSDate *finishDate = [self.repairTime dateByAddingTimeInterval:20 * 60];
+       if([finishDate compare:[NSDate dateWithTimeIntervalSinceNow:0.0]] == NSOrderedAscending) {
+               [self resetRepairTime];
+       }
+}
+
 - (NSArray *)repairShipIds
 {
        return @[@(19)];