OSDN Git Service

泊地修理タイマー用のビューを作成
authormasakih <masakih@users.sourceforge.jp>
Sat, 5 Mar 2016 15:41:31 +0000 (00:41 +0900)
committermasakih <masakih@users.sourceforge.jp>
Sat, 5 Mar 2016 15:42:40 +0000 (00:42 +0900)
KCD.xcodeproj/project.pbxproj
KCD/HMAncherageRepairTimerViewController.h [new file with mode: 0644]
KCD/HMAncherageRepairTimerViewController.m [new file with mode: 0644]
KCD/HMAncherageRepairTimerViewController.xib [new file with mode: 0644]

index ca5d35b..0416853 100644 (file)
@@ -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 */; };
                F424A6FC1BC809490096C431 /* HMIgnoreCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMIgnoreCommand.m; sourceTree = "<group>"; };
                F424A6FE1BC8C10C0096C431 /* HMFailedCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMFailedCommand.h; sourceTree = "<group>"; };
                F424A6FF1BC8C10C0096C431 /* HMFailedCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMFailedCommand.m; sourceTree = "<group>"; };
+               F4253D801C8B307800CDA2A6 /* HMAncherageRepairTimerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMAncherageRepairTimerViewController.h; sourceTree = "<group>"; };
+               F4253D811C8B307800CDA2A6 /* HMAncherageRepairTimerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMAncherageRepairTimerViewController.m; sourceTree = "<group>"; };
+               F4253D821C8B307800CDA2A6 /* HMAncherageRepairTimerViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HMAncherageRepairTimerViewController.xib; sourceTree = "<group>"; };
                F4268007193AF4E000B2C27F /* HMUserDefaults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMUserDefaults.h; sourceTree = "<group>"; };
                F4268008193AF4E000B2C27F /* HMUserDefaults.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMUserDefaults.m; sourceTree = "<group>"; };
                F42680101943E92D00B2C27F /* HMKCShipObject+Extensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "HMKCShipObject+Extensions.h"; sourceTree = "<group>"; };
                                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 */,
                                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 */,
                                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 (file)
index 0000000..093487f
--- /dev/null
@@ -0,0 +1,13 @@
+//
+//  HMAncherageRepairTimerViewController.h
+//  KCD
+//
+//  Created by Hori,Masaki on 2016/03/06.
+//  Copyright © 2016年 Hori,Masaki. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+@interface HMAncherageRepairTimerViewController : NSViewController
+
+@end
diff --git a/KCD/HMAncherageRepairTimerViewController.m b/KCD/HMAncherageRepairTimerViewController.m
new file mode 100644 (file)
index 0000000..379bba0
--- /dev/null
@@ -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 (file)
index 0000000..7f17ac6
--- /dev/null
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+    <dependencies>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9532"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="HMAncherageRepairTimerViewController">
+            <connections>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="352" height="30"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="Len-bF-3P9">
+                    <rect key="frame" x="157" y="7" width="101" height="17"/>
+                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="泊地修理タイマー" id="9rH-KA-HLC">
+                        <font key="font" metaFont="system"/>
+                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                        <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                    </textFieldCell>
+                </textField>
+                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="lPa-da-VKP">
+                    <rect key="frame" x="260" y="7" width="73" height="17"/>
+                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" id="ORE-wG-yKF">
+                        <customFormatter key="formatter" id="LHP-bc-xIy" customClass="HMTimerCountFormatter"/>
+                        <font key="font" metaFont="system"/>
+                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                        <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                    </textFieldCell>
+                    <connections>
+                        <binding destination="-3" name="font" keyPath="delegate.monospaceSystemFont13" id="sDL-hK-XrQ"/>
+                        <binding destination="-2" name="value" keyPath="repairTime" id="sMc-R4-LMf"/>
+                    </connections>
+                </textField>
+                <box verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="18H-dF-jqB">
+                    <rect key="frame" x="11" y="-2" width="329" height="5"/>
+                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                    <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
+                    <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+                    <font key="titleFont" metaFont="system"/>
+                </box>
+            </subviews>
+            <point key="canvasLocation" x="402" y="271"/>
+        </customView>
+    </objects>
+</document>