From cf06a65572107ab37323bed9e9150277e27adbca Mon Sep 17 00:00:00 2001 From: masakih Date: Sun, 6 Mar 2016 00:41:31 +0900 Subject: [PATCH] =?utf8?q?=E6=B3=8A=E5=9C=B0=E4=BF=AE=E7=90=86=E3=82=BF?= =?utf8?q?=E3=82=A4=E3=83=9E=E3=83=BC=E7=94=A8=E3=81=AE=E3=83=92=E3=82=99?= =?utf8?q?=E3=83=A5=E3=83=BC=E3=82=92=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- KCD.xcodeproj/project.pbxproj | 10 ++++++ KCD/HMAncherageRepairTimerViewController.h | 13 +++++++ KCD/HMAncherageRepairTimerViewController.m | 47 +++++++++++++++++++++++++ KCD/HMAncherageRepairTimerViewController.xib | 52 ++++++++++++++++++++++++++++ 4 files changed, 122 insertions(+) create mode 100644 KCD/HMAncherageRepairTimerViewController.h create mode 100644 KCD/HMAncherageRepairTimerViewController.m create mode 100644 KCD/HMAncherageRepairTimerViewController.xib diff --git a/KCD.xcodeproj/project.pbxproj b/KCD.xcodeproj/project.pbxproj index ca5d35b2..0416853e 100644 --- a/KCD.xcodeproj/project.pbxproj +++ b/KCD.xcodeproj/project.pbxproj @@ -18,6 +18,8 @@ F424A6FA1BC801DE0096C431 /* HMUnknownComand.m in Sources */ = {isa = PBXBuildFile; fileRef = F424A6F91BC801DE0096C431 /* HMUnknownComand.m */; }; F424A6FD1BC809490096C431 /* HMIgnoreCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F424A6FC1BC809490096C431 /* HMIgnoreCommand.m */; }; F424A7001BC8C10C0096C431 /* HMFailedCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F424A6FF1BC8C10C0096C431 /* HMFailedCommand.m */; }; + F4253D831C8B307800CDA2A6 /* HMAncherageRepairTimerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F4253D811C8B307800CDA2A6 /* HMAncherageRepairTimerViewController.m */; }; + F4253D841C8B307800CDA2A6 /* HMAncherageRepairTimerViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F4253D821C8B307800CDA2A6 /* HMAncherageRepairTimerViewController.xib */; }; F4268009193AF4E000B2C27F /* HMUserDefaults.m in Sources */ = {isa = PBXBuildFile; fileRef = F4268008193AF4E000B2C27F /* HMUserDefaults.m */; }; F42680121943E92D00B2C27F /* HMKCShipObject+Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = F42680111943E92D00B2C27F /* HMKCShipObject+Extensions.m */; }; F426802B194D0F4800B2C27F /* HMMemberShip2Command.m in Sources */ = {isa = PBXBuildFile; fileRef = F426802A194D0F4800B2C27F /* HMMemberShip2Command.m */; }; @@ -304,6 +306,9 @@ F424A6FC1BC809490096C431 /* HMIgnoreCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMIgnoreCommand.m; sourceTree = ""; }; F424A6FE1BC8C10C0096C431 /* HMFailedCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMFailedCommand.h; sourceTree = ""; }; F424A6FF1BC8C10C0096C431 /* HMFailedCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMFailedCommand.m; sourceTree = ""; }; + F4253D801C8B307800CDA2A6 /* HMAncherageRepairTimerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMAncherageRepairTimerViewController.h; sourceTree = ""; }; + F4253D811C8B307800CDA2A6 /* HMAncherageRepairTimerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMAncherageRepairTimerViewController.m; sourceTree = ""; }; + F4253D821C8B307800CDA2A6 /* HMAncherageRepairTimerViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HMAncherageRepairTimerViewController.xib; sourceTree = ""; }; F4268007193AF4E000B2C27F /* HMUserDefaults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMUserDefaults.h; sourceTree = ""; }; F4268008193AF4E000B2C27F /* HMUserDefaults.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMUserDefaults.m; sourceTree = ""; }; F42680101943E92D00B2C27F /* HMKCShipObject+Extensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "HMKCShipObject+Extensions.h"; sourceTree = ""; }; @@ -1019,6 +1024,9 @@ F4F388BF1C140AFB00508549 /* HMResourceViewController.h */, F4F388C01C140AFB00508549 /* HMResourceViewController.m */, F4C6686B1C5451C800601AFB /* HMResourceViewController.xib */, + F4253D801C8B307800CDA2A6 /* HMAncherageRepairTimerViewController.h */, + F4253D811C8B307800CDA2A6 /* HMAncherageRepairTimerViewController.m */, + F4253D821C8B307800CDA2A6 /* HMAncherageRepairTimerViewController.xib */, F4F388BA1C13D63B00508549 /* HMGameViewController.h */, F4F388BB1C13D63B00508549 /* HMGameViewController.m */, F4C668621C54517500601AFB /* HMGameViewController.xib */, @@ -1515,6 +1523,7 @@ F43E67B718BE02A10087E5B6 /* STypeShortName.plist in Resources */, F4A9B8D41B975029005786C2 /* SlotItemShortName.plist in Resources */, F4BEF0051B11A5D3004702B8 /* HMFleetViewController.xib in Resources */, + F4253D841C8B307800CDA2A6 /* HMAncherageRepairTimerViewController.xib in Resources */, F4A2AF541A074DE40024BD9E /* HMScreenshotListWindowController.xib in Resources */, F4BEEFFC1B11A5A7004702B8 /* HMExternalBrowserWindowController.xib in Resources */, F4BDEB5F187252F30069D0CE /* Images.xcassets in Resources */, @@ -1732,6 +1741,7 @@ F4B37EF619FBE801002F371A /* HMRemodelSlotItemCommand.m in Sources */, F4F6E80C1B2BC81C0008B66E /* HMPeriodicNotifier.m in Sources */, F4B414EC18B0A7D600468DAF /* HMMasterUseItemCommand.m in Sources */, + F4253D831C8B307800CDA2A6 /* HMAncherageRepairTimerViewController.m in Sources */, F4F9F8A61C78596900D0EE76 /* HMAnchorageRepairManager.m in Sources */, F4513EF318B991F800073552 /* HMMemberBasicCommand.m in Sources */, F4268009193AF4E000B2C27F /* HMUserDefaults.m in Sources */, diff --git a/KCD/HMAncherageRepairTimerViewController.h b/KCD/HMAncherageRepairTimerViewController.h new file mode 100644 index 00000000..093487f6 --- /dev/null +++ b/KCD/HMAncherageRepairTimerViewController.h @@ -0,0 +1,13 @@ +// +// HMAncherageRepairTimerViewController.h +// KCD +// +// Created by Hori,Masaki on 2016/03/06. +// Copyright © 2016年 Hori,Masaki. All rights reserved. +// + +#import + +@interface HMAncherageRepairTimerViewController : NSViewController + +@end diff --git a/KCD/HMAncherageRepairTimerViewController.m b/KCD/HMAncherageRepairTimerViewController.m new file mode 100644 index 00000000..379bba0a --- /dev/null +++ b/KCD/HMAncherageRepairTimerViewController.m @@ -0,0 +1,47 @@ +// +// HMAncherageRepairTimerViewController.m +// KCD +// +// Created by Hori,Masaki on 2016/03/06. +// Copyright © 2016年 Hori,Masaki. All rights reserved. +// + +#import "HMAncherageRepairTimerViewController.h" + +#import "HMAppDelegate.h" + +#import "HMAnchorageRepairManager.h" + +@interface HMAncherageRepairTimerViewController () +@property (strong) HMAnchorageRepairManager *anchorageRepairManager; +@property (strong) NSNumber *repairTime; +@end + +@implementation HMAncherageRepairTimerViewController + +- (id)init +{ + self = [super initWithNibName:NSStringFromClass([self class]) bundle:nil]; + if(self) { + _anchorageRepairManager = [HMAnchorageRepairManager defaultManager]; + + HMAppDelegate *appDelegate = [[NSApplication sharedApplication] delegate]; + [appDelegate addCounterUpdateBlock:^{ + self.repairTime = [self calcRepairTime]; + }]; + } + + return self; +} + +- (NSNumber *)calcRepairTime +{ + NSDate *compTimeValue = self.anchorageRepairManager.repairTime; + if(!compTimeValue) return nil; + + NSTimeInterval compTime = [compTimeValue timeIntervalSince1970]; + NSDate *now = [NSDate dateWithTimeIntervalSinceNow:0]; + NSTimeInterval diff = compTime - [now timeIntervalSince1970]; + return @(diff + 20 * 60); +} +@end diff --git a/KCD/HMAncherageRepairTimerViewController.xib b/KCD/HMAncherageRepairTimerViewController.xib new file mode 100644 index 00000000..7f17ac6c --- /dev/null +++ b/KCD/HMAncherageRepairTimerViewController.xib @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.11.0