F4131ED8190FA08D004F7F9A /* HMDestroyItem2Command.m in Sources */ = {isa = PBXBuildFile; fileRef = F4131ED7190FA08D004F7F9A /* HMDestroyItem2Command.m */; };
F4131EDE190FEBDB004F7F9A /* HMSlotItemWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F4131EE0190FEBDB004F7F9A /* HMSlotItemWindowController.xib */; };
F4131EE61910318F004F7F9A /* HMMasterSlotItemEquipTypeCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4131EE51910318F004F7F9A /* HMMasterSlotItemEquipTypeCommand.m */; };
- F4268009193AF4E000B2C27F /* HMUserDefaults.m in Sources */ = {isa = PBXBuildFile; fileRef = F4268008193AF4E000B2C27F /* HMUserDefaults.m */; };
F426802B194D0F4800B2C27F /* HMMemberShip2Command.m in Sources */ = {isa = PBXBuildFile; fileRef = F426802A194D0F4800B2C27F /* HMMemberShip2Command.m */; };
F426802E194D0FFD00B2C27F /* HMMemberShip3Command.m in Sources */ = {isa = PBXBuildFile; fileRef = F426802D194D0FFD00B2C27F /* HMMemberShip3Command.m */; };
F4268031194D1B1A00B2C27F /* HMChangeHenseiCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4268030194D1B1A00B2C27F /* HMChangeHenseiCommand.m */; };
F47B78B218A7B42B0011386E /* HMJSONViewWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = F47B78B018A7B42B0011386E /* HMJSONViewWindowController.m */; };
F47C5BFE1A5A889500C276B5 /* HMKenzoDockStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = F47C5BFD1A5A889500C276B5 /* HMKenzoDockStatus.swift */; };
F47C5C001A5ADF9E00C276B5 /* HMMissionStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = F47C5BFF1A5ADF9E00C276B5 /* HMMissionStatus.swift */; };
+ F47C5C021A5C17C400C276B5 /* HMUserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = F47C5C011A5C17C400C276B5 /* HMUserDefaults.swift */; };
F48F7B021907D7B800E78AE1 /* HMPortCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F48F7B011907D7B800E78AE1 /* HMPortCommand.m */; };
F494DC6A18C8BAB900AE97E4 /* HMPowerUpSupportViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F494DC6818C8BAB900AE97E4 /* HMPowerUpSupportViewController.xib */; };
F4A2AF541A074DE40024BD9E /* HMScreenshotListWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F4A2AF561A074DE40024BD9E /* HMScreenshotListWindowController.xib */; };
F4131EDF190FEBDB004F7F9A /* ja */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ja; path = ja.lproj/HMSlotItemWindowController.xib; sourceTree = "<group>"; };
F4131EE41910318F004F7F9A /* HMMasterSlotItemEquipTypeCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMMasterSlotItemEquipTypeCommand.h; sourceTree = "<group>"; };
F4131EE51910318F004F7F9A /* HMMasterSlotItemEquipTypeCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMMasterSlotItemEquipTypeCommand.m; 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>"; };
F4268029194D0F4800B2C27F /* HMMemberShip2Command.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMMemberShip2Command.h; sourceTree = "<group>"; };
F426802A194D0F4800B2C27F /* HMMemberShip2Command.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMMemberShip2Command.m; sourceTree = "<group>"; };
F426802C194D0FFD00B2C27F /* HMMemberShip3Command.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMMemberShip3Command.h; sourceTree = "<group>"; };
F47B78B018A7B42B0011386E /* HMJSONViewWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMJSONViewWindowController.m; sourceTree = "<group>"; };
F47C5BFD1A5A889500C276B5 /* HMKenzoDockStatus.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMKenzoDockStatus.swift; sourceTree = "<group>"; };
F47C5BFF1A5ADF9E00C276B5 /* HMMissionStatus.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMMissionStatus.swift; sourceTree = "<group>"; };
+ F47C5C011A5C17C400C276B5 /* HMUserDefaults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMUserDefaults.swift; sourceTree = "<group>"; };
F48F7B001907D7B800E78AE1 /* HMPortCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMPortCommand.h; sourceTree = "<group>"; };
F48F7B011907D7B800E78AE1 /* HMPortCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMPortCommand.m; sourceTree = "<group>"; };
F494DC5618C23E4300AE97E4 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/MainMenu.strings; sourceTree = "<group>"; };
children = (
F4BDEB58187252F30069D0CE /* HMAppDelegate.h */,
F4BDEB59187252F30069D0CE /* HMAppDelegate.m */,
- F4268007193AF4E000B2C27F /* HMUserDefaults.h */,
- F4268008193AF4E000B2C27F /* HMUserDefaults.m */,
+ F47C5C011A5C17C400C276B5 /* HMUserDefaults.swift */,
F4551BDD1A46C23100BB0235 /* HMTimerCountFormatter.swift */,
F4B30CF71A45DACB008E3D79 /* HMSlotItemEquipTypeTransformer.swift */,
F4B30CF91A468216008E3D79 /* HMPlanToShowsBoldFontTransformer.swift */,
F4B414F818B1D35800468DAF /* HMMasterMissionCommand.m in Sources */,
F477E24B1A544EA000493198 /* HMKCShipObject.swift in Sources */,
F4E33B5818BF5F67005B8C07 /* HMMemberSlotItemCommand.m in Sources */,
+ F47C5C021A5C17C400C276B5 /* HMUserDefaults.swift in Sources */,
F4E802071A50F8A100016781 /* HMSuppliesView.swift in Sources */,
F4C1190B18A74DF0005D5B25 /* HMJSONCommand.m in Sources */,
F4B30CF81A45DACB008E3D79 /* HMSlotItemEquipTypeTransformer.swift in Sources */,
F4B414EC18B0A7D600468DAF /* HMMasterUseItemCommand.m in Sources */,
F4513EF318B991F800073552 /* HMMemberBasicCommand.m in Sources */,
F47C5BFE1A5A889500C276B5 /* HMKenzoDockStatus.swift in Sources */,
- F4268009193AF4E000B2C27F /* HMUserDefaults.m in Sources */,
F477E2831A57826C00493198 /* HMCoreDataManager.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
#import "HMAppDelegate.h"
-#import "HMUserDefaults.h"
#import "HMShipMasterDetailWindowController.h"
#import "HMFleetInformation.h"
self.shipMDWindowController = [HMShipMasterDetailWindowController new];
[self.shipMDWindowController showWindow:nil];
#endif
- if(!HMStandardDefaults.showsDebugMenu) {
+ if(![HMUserDefaults hmStandardDefauls].showsDebugMenu) {
[self.debugMenuItem setHidden:YES];
}
- if(!HMStandardDefaults.showsBillingWindowMenu) {
+ if(![HMUserDefaults hmStandardDefauls].showsBillingWindowMenu) {
[self.billingWindowMenuItem setHidden:YES];
}
}
- (void)setScreenShotSaveDirectory:(NSString *)screenShotSaveDirectory
{
- HMStandardDefaults.screenShotSaveDirectory = screenShotSaveDirectory;
+ [HMUserDefaults hmStandardDefauls].screenShotSaveDirectory = screenShotSaveDirectory;
}
- (NSString *)screenShotSaveDirectory
{
- NSString *path = HMStandardDefaults.screenShotSaveDirectory;
+ NSString *path = [HMUserDefaults hmStandardDefauls].screenShotSaveDirectory;
if(!path) {
path = [[self picturesDirectory] path];
}
var conditionColor: NSColor {
return NSColor.controlTextColor()
}
- var planColor: NSColor {
+ var planColor: NSColor? {
if !HMUserDefaults.hmStandardDefauls().showsPlanColor {
return NSColor.controlTextColor()
}
return HMUserDefaults.hmStandardDefauls().plan01Color
case 2:
return HMUserDefaults.hmStandardDefauls().plan02Color
- case 2:
+ case 3:
return HMUserDefaults.hmStandardDefauls().plan03Color
default:
return NSColor.controlTextColor()
override func observeValueForKeyPath(keyPath: String, ofObject object: AnyObject, change: [NSObject : AnyObject], context: UnsafeMutablePointer<Void>) {
switch keyPath {
case NSSortDescriptorsBinding:
- HMUserDefaults.hmStandardDefauls().powerupSupportSortDecriptors = shipController!.sortDescriptors
+ if let sortDescriptors = shipController.sortDescriptors as? [NSSortDescriptor] {
+ HMUserDefaults.hmStandardDefauls().powerupSupportSortDecriptors = sortDescriptors
+ }
default:
super.observeValueForKeyPath(keyPath, ofObject: object, change: change, context: context)
}
}
- @IBOutlet var shipController: NSArrayController?
- @IBOutlet var typeSegment: NSSegmentedControl?
+ @IBOutlet var shipController: NSArrayController!
+ @IBOutlet var typeSegment: NSSegmentedControl!
@IBAction func changeCategory(sender: AnyObject?) {
let tag = typeSegment!.selectedSegment
//
#import "HMScreenshotWindowController.h"
-#import "HMUserDefaults.h"
#import "HMAppDelegate.h"
} else {
_tagString = @"";
}
- _appendKanColleTag = HMStandardDefaults.appendKanColleTag;
+ _appendKanColleTag = [HMUserDefaults hmStandardDefauls].appendKanColleTag;
self.tweetString = @"";
- _useMask = HMStandardDefaults.useMask;
+ _useMask = [HMUserDefaults hmStandardDefauls].useMask;
}
return self;
}
}
- (void)setUseMask:(BOOL)useMask
{
- HMStandardDefaults.useMask = useMask;
+ [HMUserDefaults hmStandardDefauls].useMask = useMask;
_useMask = useMask;
}
- (NSInteger)leaveLength
}
- (void)setAppendKanColleTag:(BOOL)appendKanColleTag
{
- HMStandardDefaults.appendKanColleTag = appendKanColleTag;
+ [HMUserDefaults hmStandardDefauls].appendKanColleTag = appendKanColleTag;
_appendKanColleTag = appendKanColleTag;
}
- (BOOL)canTweet
override func observeValueForKeyPath(keyPath: String, ofObject object: AnyObject, change: [NSObject : AnyObject], context: UnsafeMutablePointer<Void>) {
switch keyPath {
case NSSortDescriptorsBinding:
- HMUserDefaults.hmStandardDefauls().shipviewSortDescriptors = shipController!.sortDescriptors
+ if let sortDescriptors = shipController.sortDescriptors as? [NSSortDescriptor] {
+ HMUserDefaults.hmStandardDefauls().shipviewSortDescriptors = sortDescriptors
+ }
default:
super.observeValueForKeyPath(keyPath, ofObject: object, change: change, context: context)
}
weak var currentTableView: NSView?
- @IBOutlet var shipController: NSArrayController?
- @IBOutlet var expTableView: NSScrollView?
- @IBOutlet var powerTableView: NSScrollView?
- @IBOutlet var power2TableView: NSScrollView?
+ @IBOutlet var shipController: NSArrayController!
+ @IBOutlet var expTableView: NSScrollView!
+ @IBOutlet var powerTableView: NSScrollView!
+ @IBOutlet var power2TableView: NSScrollView!
@IBAction func changeCategory(sender: AnyObject?) {
let selectedSegment = sender?.selectedSegment?
let appDelegate = NSApplication.sharedApplication().delegate as HMAppDelegate
let predicate: NSPredicate? = appDelegate.predicateForShipType(type!)
- shipController!.filterPredicate = predicate
+ shipController.filterPredicate = predicate
}
@IBAction func changeView(sender: AnyObject?) {
var tag: Int? = nil
return HMServerDataStore.defaultManager().managedObjectContext
}
- @IBOutlet var slotItemController: NSArrayController?
+ @IBOutlet var slotItemController: NSArrayController!
override func awakeFromNib() {
var error: NSError? = nil
- self.slotItemController!.fetchWithRequest(nil, merge: true, error: &error)
- self.slotItemController!.sortDescriptors = HMUserDefaults.hmStandardDefauls().slotItemSortDescriptors
- self.slotItemController!.addObserver(self, forKeyPath: NSSortDescriptorsBinding, options: .Initial, context: nil)
+ self.slotItemController.fetchWithRequest(nil, merge: true, error: &error)
+ self.slotItemController.sortDescriptors = HMUserDefaults.hmStandardDefauls().slotItemSortDescriptors
+ self.slotItemController.addObserver(self, forKeyPath: NSSortDescriptorsBinding, options: .Initial, context: nil)
}
override func observeValueForKeyPath(keyPath: String, ofObject object: AnyObject, change: [NSObject : AnyObject], context: UnsafeMutablePointer<Void>) {
switch keyPath {
case NSSortDescriptorsBinding:
- HMUserDefaults.hmStandardDefauls().slotItemSortDescriptors = self.slotItemController!.sortDescriptors
+ if let sortDescriptors = slotItemController.sortDescriptors as? [NSSortDescriptor] {
+ HMUserDefaults.hmStandardDefauls().slotItemSortDescriptors = sortDescriptors
+ }
default:
super.observeValueForKeyPath(keyPath, ofObject: object, change: change, context: context)
}
+++ /dev/null
-//
-// HMUserDefaults.h
-// KCD
-//
-// Created by Hori,Masaki on 2014/06/01.
-// Copyright (c) 2014年 Hori,Masaki. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-
-@class HMUserDefaults;
-
-extern HMUserDefaults *HMStandardDefaults;
-
-
-@interface HMUserDefaults : NSObject
-
-+ (instancetype)hmStandardDefauls;
-
-@property (nonatomic, weak) NSArray *slotItemSortDescriptors;
-@property (nonatomic, weak) NSArray *powerupSupportSortDecriptors;
-@property (nonatomic, weak) NSArray *shipviewSortDescriptors;
-
-@property BOOL showsDebugMenu;
-
-@property BOOL hideMaxKaryoku;
-@property BOOL hideMaxRaisou;
-@property BOOL hideMaxTaiku;
-@property BOOL hideMaxSoukou;
-@property BOOL hideMaxLucky;
-
-@property BOOL appendKanColleTag;
-
-@property (nonatomic, weak) NSDate *prevReloadDate;
-
-
-/**
- * 取得可能艦娘数
- */
-@property NSInteger minimumColoredShipCount;
-
-/**
- * 2014年夏イベント時の出撃海域による色分けの有効/無効
- */
-@property BOOL showsPlanColor;
-/**
- * 作戦01の色
- */
-@property (nonatomic, weak) NSColor *plan01Color;
-/**
- * 作戦02の色
- */
-@property (nonatomic, weak) NSColor *plan02Color;
-/**
- * 作戦03の色
- */
-@property (nonatomic, weak) NSColor *plan03Color;
-
-
-/**
- * スクリーンショットの縁取りの幅
- */
-@property CGFloat screenShotBorderWidth;
-
-/**
- * スクリーンショットに提督名マスクを施すか
- */
-@property BOOL useMask;
-
-/**
- * スクリーンショットを保存する場所
- */
-@property (nonatomic, weak) NSString *screenShotSaveDirectory;
-
-/**
- * スクリーンショットを撮ったときリストウインドウを最前面にするか
- */
-@property BOOL showsListWindowAtScreenshot;
-
-/**
- * スクリーンショットのプレビューのズーム値
- */
-@property NSNumber *screenshotPreviewZoomValue;
-
-/**
- * 遠征帰還時の通知音を鳴らす
- */
-@property BOOL playFinishMissionSound;
-
-/**
- * 入渠完了時の通知音を鳴らす
- */
-@property BOOL playFinishNyukyoSound;
-
-/**
- * 建造完了時の通知音を鳴らす
- */
-@property BOOL playFinishKenzoSound;
-
-/**
- * Lv.1の艦娘を改造可能艦リストに表示するか
- */
-@property BOOL showLevelOneShipInUpgradableList;
-
-/**
- * 課金用のウインドウを使用可能にする
- */
-@property BOOL showsBillingWindowMenu;
-
-@end
+++ /dev/null
-//
-// HMUserDefaults.m
-// KCD
-//
-// Created by Hori,Masaki on 2014/06/01.
-// Copyright (c) 2014年 Hori,Masaki. All rights reserved.
-//
-
-#import "HMUserDefaults.h"
-
-HMUserDefaults *HMStandardDefaults = nil;
-
-
-@implementation HMUserDefaults
-
-@dynamic slotItemSortDescriptors, shipviewSortDescriptors, powerupSupportSortDecriptors;
-@dynamic showsDebugMenu;
-@dynamic hideMaxKaryoku, hideMaxRaisou, hideMaxLucky, hideMaxSoukou, hideMaxTaiku;
-@dynamic appendKanColleTag;
-@dynamic prevReloadDate;
-
-+ (void)load
-{
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- HMStandardDefaults = [self new];
- });
-}
-
-+ (instancetype)hmStandardDefauls
-{
- return HMStandardDefaults;
-}
-
-- (void)setObject:(id)value forKey:(NSString *)key
-{
- [[NSUserDefaults standardUserDefaults] setObject:value forKey:key];
-}
-- (id)objectForKey:(NSString *)key
-{
- return [[NSUserDefaults standardUserDefaults] objectForKey:key];
-}
-- (NSString *)stringForKey:(NSString *)key
-{
- return [[NSUserDefaults standardUserDefaults] stringForKey:key];
-}
-- (void)setInteger:(NSInteger)value forKey:(NSString *)key
-{
- [[NSUserDefaults standardUserDefaults] setInteger:value forKey:key];
-}
-- (NSInteger)integerForKey:(NSString *)key
-{
- return [[NSUserDefaults standardUserDefaults] integerForKey:key];
-}
-- (void)setDouble:(double)value forKey:(NSString *)key
-{
- [[NSUserDefaults standardUserDefaults] setDouble:value forKey:key];
-}
-- (double)doubleForKey:(NSString *)key
-{
- return [[NSUserDefaults standardUserDefaults] doubleForKey:key];
-}
-- (void)setBool:(BOOL)value forKey:(NSString *)key
-{
- [[NSUserDefaults standardUserDefaults] setBool:value forKey:key];
-}
-- (BOOL)boolForKey:(NSString *)key
-{
- return [[NSUserDefaults standardUserDefaults] boolForKey:key];
-}
-- (void)setKeyedArchiveObject:(id)value forKey:(NSString *)key
-{
- NSData *data = nil;
- if(value) {
- data = [NSKeyedArchiver archivedDataWithRootObject:value];
- }
- [[NSUserDefaults standardUserDefaults] setObject:data forKey:key];
-}
-- (id)keyedUnarchiveObject:(NSString *)key
-{
- NSData *data = [[NSUserDefaults standardUserDefaults] objectForKey:key];
- return data ? [NSKeyedUnarchiver unarchiveObjectWithData:data] : nil;
-}
-
-#pragma mark-Properties
-- (void)setSlotItemSortDescriptors:(NSArray *)slotItemSortDescriptors
-{
- [self setKeyedArchiveObject:slotItemSortDescriptors forKey:@"slotItemSortKey2"];
-}
-- (NSArray *)slotItemSortDescriptors
-{
- NSArray *array = [self keyedUnarchiveObject:@"slotItemSortKey2"];
- if(array) {
- NSMutableArray *result = [NSMutableArray new];
- for(NSSortDescriptor *item in array) {
- if(![item.key hasPrefix:@"master_ship"] && ![item.key hasPrefix:@"master_slotItem"]) {
- [result addObject:item];
- }
- }
-
- return [NSArray arrayWithArray:result];
- }
- return [NSArray new];
-}
-- (void)setShipviewSortDescriptors:(NSArray *)shipviewSortDescriptors
-{
- [self setKeyedArchiveObject:shipviewSortDescriptors forKey:@"shipviewsortdescriptor"];
-}
-- (NSArray *)shipviewSortDescriptors
-{
- NSArray *array = [self keyedUnarchiveObject:@"shipviewsortdescriptor"];
- if(array) {
- NSMutableArray *result = [NSMutableArray new];
- for(NSSortDescriptor *item in array) {
- if(![item.key hasPrefix:@"master_ship"]) {
- [result addObject:item];
- }
- }
-
- return [NSArray arrayWithArray:result];
- }
- return [NSArray new];
-}
-- (void)setPowerupSupportSortDecriptors:(NSArray *)powerupSupportSortDecriptors
-{
- [self setKeyedArchiveObject:powerupSupportSortDecriptors forKey:@"powerupsupportsortdecriptor"];
-}
-- (NSArray *)powerupSupportSortDecriptors
-{
- NSArray *array = [self keyedUnarchiveObject:@"powerupsupportsortdecriptor"];
- if(array) {
- NSMutableArray *result = [NSMutableArray new];
- for(NSSortDescriptor *item in array) {
- if(![item.key hasPrefix:@"master_ship"]) {
- [result addObject:item];
- }
- }
-
- return [NSArray arrayWithArray:result];
- }
- return [NSArray new];
-}
-
-- (void)setPrevReloadDate:(NSDate *)prevReloadDate
-{
- if(prevReloadDate) {
- [self setObject:[prevReloadDate description] forKey:@"previousReloadDateString"];
- }
-}
-- (NSDate *)prevReloadDate
-{
- NSString *dateString = [self stringForKey:@"previousReloadDateString"];
- if(dateString) {
- return [NSDate dateWithString:dateString];
- }
- return nil;
-}
-
-- (void)setShowsDebugMenu:(BOOL)showsDebugMenu
-{
- [self setBool:showsDebugMenu forKey:@"ShowsDebugMenu"];
-}
-- (BOOL)showsDebugMenu
-{
- return [self boolForKey:@"ShowsDebugMenu"];
-}
-
-- (void)setAppendKanColleTag:(BOOL)appendKanColleTag
-{
- [self setBool:appendKanColleTag forKey:@"appendKanColleTag"];
-}
-- (BOOL)appendKanColleTag
-{
- return [self boolForKey:@"appendKanColleTag"];
-}
-
-- (void)setHideMaxKaryoku:(BOOL)hideMaxKaryoku
-{
- [self setBool:hideMaxKaryoku forKey:@"hideMaxKaryoku"];
-}
-- (BOOL)hideMaxKaryoku
-{
- return [self boolForKey:@"hideMaxKaryoku"];
-}
-- (void)setHideMaxLucky:(BOOL)hideMaxLucky
-{
- [self setBool:hideMaxLucky forKey:@"hideMaxLucky"];
-}
-- (BOOL)hideMaxLucky
-{
- return [self boolForKey:@"hideMaxLucky"];
-}
-- (void)setHideMaxRaisou:(BOOL)hideMaxRaisou
-{
- [self setBool:hideMaxRaisou forKey:@"hideMaxRaisou"];
-}
-- (BOOL)hideMaxRaisou
-{
- return [self boolForKey:@"hideMaxRaisou"];
-}
-- (void)setHideMaxSoukou:(BOOL)hideMaxSoukou
-{
- [self setBool:hideMaxSoukou forKey:@"hideMaxSoukou"];
-}
-- (BOOL)hideMaxSoukou
-{
- return [self boolForKey:@"hideMaxSoukou"];
-}
-- (void)setHideMaxTaiku:(BOOL)hideMaxTaiku
-{
- [self setBool:hideMaxTaiku forKey:@"hideMaxTaiku"];
-}
-- (BOOL)hideMaxTaiku
-{
- return [self boolForKey:@"hideMaxTaiku"];
-}
-
-- (void)setShowsPlanColor:(BOOL)showsPlanColor
-{
- [self setBool:showsPlanColor forKey:@"showsPlanColor"];
-}
-- (BOOL)showsPlanColor
-{
- return [self boolForKey:@"showsPlanColor"];
-}
-- (void)setPlan01Color:(NSColor *)plan01Color
-{
- [self setKeyedArchiveObject:plan01Color forKey:@"plan01Color"];
-}
-- (NSColor *)plan01Color
-{
- return [self keyedUnarchiveObject:@"plan01Color"];
-}
-- (void)setPlan02Color:(NSColor *)plan02Color
-{
- [self setKeyedArchiveObject:plan02Color forKey:@"plan02Color"];
-}
-- (NSColor *)plan02Color
-{
- return [self keyedUnarchiveObject:@"plan02Color"];
-}
-- (void)setPlan03Color:(NSColor *)plan03Color
-{
- [self setKeyedArchiveObject:plan03Color forKey:@"plan03Color"];
-}
-- (NSColor *)plan03Color
-{
- return [self keyedUnarchiveObject:@"plan03Color"];
-}
-
-- (void)setMinimumColoredShipCount:(NSInteger)minimumColoredShipCount
-{
- [self setInteger:minimumColoredShipCount forKey:@"minimumColoredShipCount"];
-}
-- (NSInteger)minimumColoredShipCount
-{
- return [self integerForKey:@"minimumColoredShipCount"];
-}
-
-#pragma mark - Screenshot
-- (void)setUseMask:(BOOL)useMask
-{
- [self setBool:useMask forKey:@"useMask"];
-}
-- (BOOL)useMask
-{
- return [self boolForKey:@"useMask"];
-}
-
-- (void)setScreenShotBorderWidth:(CGFloat)screenShotBorderWidth
-{
- if(screenShotBorderWidth < 0 || screenShotBorderWidth > 20) return;
-
- [self setDouble:screenShotBorderWidth forKey:@"screenShotBorderWidth"];
-}
-- (CGFloat)screenShotBorderWidth
-{
- CGFloat result = [self doubleForKey:@"screenShotBorderWidth"];
-
- if(result < 0) {
- [self setDouble:0 forKey:@"screenShotBorderWidth"];
- return 0;
- }
- if(result > 20) {
- [self setDouble:20 forKey:@"screenShotBorderWidth"];
- return 20;
- }
-
- return result;
-}
-
-- (void)setScreenShotSaveDirectory:(NSURL *)screenShotSaveDirectory
-{
- [self setObject:screenShotSaveDirectory forKey:@"screenShotSaveDirectory"];
-}
-- (NSString *)screenShotSaveDirectory
-{
- return [self objectForKey:@"screenShotSaveDirectory"];
-}
-
-- (void)setShowsListWindowAtScreenshot:(BOOL)showsListWindowAtScreenshot
-{
- [self setBool:showsListWindowAtScreenshot forKey:@"showsListWindowAtScreenshot"];
-}
-- (BOOL)showsListWindowAtScreenshot
-{
- return [self boolForKey:@"showsListWindowAtScreenshot"];
-}
-
-- (void)setScreenshotPreviewZoomValue:(NSNumber *)screenshotPreviewZoomValue
-{
- [self setObject:screenshotPreviewZoomValue forKey:@"screenshotPreviewZoomValue"];
-}
-- (NSNumber *)screenshotPreviewZoomValue
-{
- return [self objectForKey:@"screenshotPreviewZoomValue"];
-}
-
-#pragma mark - Notify Sound
-- (void)setPlayFinishMissionSound:(BOOL)playFinishMissionSound
-{
- [self setBool:playFinishMissionSound forKey:@"playFinishMissionSound"];
-}
-- (BOOL)playFinishMissionSound
-{
- return [self boolForKey:@"playFinishMissionSound"];
-}
-- (void)setPlayFinishNyukyoSound:(BOOL)playFinishNyukyoSound
-{
- [self setBool:playFinishNyukyoSound forKey:@"playFinishNyukyoSound"];
-}
-- (BOOL)playFinishNyukyoSound
-{
- return [self boolForKey:@"playFinishNyukyoSound"];
-}
-- (void)setPlayFinishKenzoSound:(BOOL)playFinishKenzoSound
-{
- [self setBool:playFinishKenzoSound forKey:@"playFinishKenzoSound"];
-}
-- (BOOL)playFinishKenzoSound
-{
- return [self boolForKey:@"playFinishKenzoSound"];
-}
-
-
-#pragma mark -
-- (void)setShowLevelOneShipInUpgradableList:(BOOL)showLevelOneShipInUpgradableList
-{
- [self setBool:showLevelOneShipInUpgradableList forKey:@"showLevelOneShipInUpgradableList"];
-}
-- (BOOL)showLevelOneShipInUpgradableList
-{
- return [self boolForKey:@"showLevelOneShipInUpgradableList"];
-}
-
-#pragma mark- Billing Window
-- (void)setShowsBillingWindowMenu:(BOOL)showsBillingWindowMenu
-{
- [self setBool:showsBillingWindowMenu forKey:@"showsBillingWindowMenu"];
-}
-- (BOOL)showsBillingWindowMenu
-{
- return [self boolForKey:@"showsBillingWindowMenu"];
-}
-
-@end
--- /dev/null
+//
+// HMUserDefaults.swift
+// KCD
+//
+// Created by Hori,Masaki on 2015/01/06.
+// Copyright (c) 2015年 Hori,Masaki. All rights reserved.
+//
+
+import Cocoa
+
+private var _standardDefaults: HMUserDefaults!
+
+class HMUserDefaults: NSObject {
+ private override init() {
+ super.init()
+ }
+
+ class func hmStandardDefauls() -> HMUserDefaults {
+ if _standardDefaults == nil {
+ _standardDefaults = HMUserDefaults()
+ }
+ return _standardDefaults
+ }
+
+ private func setObject(value: AnyObject?, forKey key: String) {
+ NSUserDefaults.standardUserDefaults().setObject(value, forKey: key)
+ }
+ private func objectForKey(key: String) -> AnyObject? {
+ return NSUserDefaults.standardUserDefaults().objectForKey(key)
+ }
+ private func stringForKey(key: String) -> String? {
+ return NSUserDefaults.standardUserDefaults().stringForKey(key)
+ }
+ private func setInteger(value: Int, forKey key: String) {
+ NSUserDefaults.standardUserDefaults().setInteger(value, forKey: key)
+ }
+ private func integerForKey(key: String) -> Int {
+ return NSUserDefaults.standardUserDefaults().integerForKey(key)
+ }
+ private func setDouble(value: Double, forKey key: String) {
+ NSUserDefaults.standardUserDefaults().setDouble(value, forKey: key)
+ }
+ private func doubleForKey(key: String) -> Double {
+ return NSUserDefaults.standardUserDefaults().doubleForKey(key)
+ }
+ private func setBool(value: Bool, forKey key: String) {
+ NSUserDefaults.standardUserDefaults().setBool(value, forKey: key)
+ }
+ private func boolForKey(key: String) -> Bool {
+ return NSUserDefaults.standardUserDefaults().boolForKey(key)
+ }
+ private func setKeyedArchiveObject(value: AnyObject?, forKey key: String) {
+ if value != nil {
+ let data = NSKeyedArchiver.archivedDataWithRootObject(value!)
+ setObject(data, forKey: key)
+ }
+ }
+ private func keyedUnarchiveObject(key: String) -> AnyObject? {
+ if let data = objectForKey(key) as? NSData {
+ return NSKeyedUnarchiver.unarchiveObjectWithData(data)
+ }
+ return nil
+ }
+}
+
+/// For Debug
+extension HMUserDefaults {
+ var showsDebugMenu: Bool {
+ return boolForKey("showsDebugMenu")
+ }
+
+ /// 課金用のウインドウを使用可能にする
+ var showsBillingWindowMenu: Bool {
+ return boolForKey("showsBillingWindowMenu")
+ }
+}
+
+/// SortDescriptors
+extension HMUserDefaults {
+ var slotItemSortDescriptors: [NSSortDescriptor] {
+ get {
+ if let array = keyedUnarchiveObject("slotItemSortKey2") as? [NSSortDescriptor] {
+ return array.filter() {
+ if let key = $0.key() {
+ if key.hasPrefix("master_ship") || key.hasPrefix("master_slotItem"){
+ return false
+ }
+ }
+ return true
+ }
+ }
+ return []
+ }
+ set {
+ setKeyedArchiveObject(newValue, forKey: "slotItemSortKey2")
+ }
+ }
+ var shipviewSortDescriptors: [NSSortDescriptor] {
+ get {
+ if let array = keyedUnarchiveObject("shipviewsortdescriptor") as? [NSSortDescriptor] {
+ return array.filter() {
+ if let key = $0.key() {
+ if key.hasPrefix("master_ship") {
+ return false
+ }
+ }
+ return true
+ }
+ }
+ return []
+ }
+ set {
+ setKeyedArchiveObject(newValue, forKey: "shipviewsortdescriptor")
+ }
+ }
+ var powerupSupportSortDecriptors: [NSSortDescriptor] {
+ get {
+ if let array = keyedUnarchiveObject("powerupsupportsortdecriptor") as? [NSSortDescriptor] {
+ return array.filter() {
+ if let key = $0.key() {
+ if key.hasPrefix("master_ship") {
+ return false
+ }
+ }
+ return true
+ }
+ }
+ return []
+ }
+ set {
+ setKeyedArchiveObject(newValue, forKey: "powerupsupportsortdecriptor")
+ }
+ }
+}
+
+/// limit reload
+extension HMUserDefaults {
+ var prevReloadDate: NSDate? {
+ get {
+ if let dateString = stringForKey("previousReloadDateString") {
+ return NSDate(string: dateString)
+ }
+ return nil
+ }
+ set {
+ if newValue != nil {
+ setObject(newValue!.description, forKey: "previousReloadDateString")
+ } else {
+ setObject(nil, forKey: "previousReloadDateString")
+ }
+ }
+ }
+}
+
+/// main window
+extension HMUserDefaults {
+ /// 取得可能艦娘数
+ var minimumColoredShipCount: Int {
+ get {
+ return integerForKey("minimumColoredShipCount")
+ }
+ set {
+ setInteger(newValue, forKey: "minimumColoredShipCount")
+ }
+ }
+}
+
+/// Organize view
+extension HMUserDefaults {
+
+ /// 2014年夏イベント時の出撃海域による色分けの有効/無効
+ var showsPlanColor: Bool {
+ get {
+ return boolForKey("showsPlanColor")
+ }
+ set {
+ setBool(newValue, forKey: "showsPlanColor")
+ }
+ }
+ /// 作戦01の色
+ var plan01Color: NSColor? {
+ get {
+ return keyedUnarchiveObject("plan01Color") as NSColor?
+ }
+ set {
+ setKeyedArchiveObject(newValue, forKey: "plan01Color")
+ }
+ }
+ /// 作戦02の色
+ var plan02Color: NSColor? {
+ get {
+ return keyedUnarchiveObject("plan02Color") as NSColor?
+ }
+ set {
+ setKeyedArchiveObject(newValue, forKey: "plan02Color")
+ }
+ }
+ /// 作戦03の色
+ var plan03Color: NSColor? {
+ get {
+ return keyedUnarchiveObject("plan03Color") as NSColor?
+ }
+ set {
+ setKeyedArchiveObject(newValue, forKey: "plan03Color")
+ }
+ }
+}
+
+/// PowerUp view
+extension HMUserDefaults {
+ var hideMaxKaryoku: Bool {
+ get {
+ return boolForKey("hideMaxKaryoku")
+ }
+ set {
+ setBool(newValue, forKey: "hideMaxKaryoku")
+ }
+ }
+ var hideMaxRaisou: Bool {
+ get {
+ return boolForKey("hideMaxRaisou")
+ }
+ set {
+ setBool(newValue, forKey: "hideMaxRaisou")
+ }
+ }
+ var hideMaxTaiku: Bool {
+ get {
+ return boolForKey("hideMaxTaiku")
+ }
+ set {
+ setBool(newValue, forKey: "hideMaxTaiku")
+ }
+ }
+ var hideMaxSoukou: Bool {
+ get {
+ return boolForKey("hideMaxSoukou")
+ }
+ set {
+ setBool(newValue, forKey: "hideMaxSoukou")
+ }
+ }
+ var hideMaxLucky: Bool {
+ get {
+ return boolForKey("hideMaxLucky")
+ }
+ set {
+ setBool(newValue, forKey: "hideMaxLucky")
+ }
+ }
+}
+
+/// Screenshot window
+extension HMUserDefaults {
+ /// スクリーンショットの縁取りの幅
+ var screenShotBorderWidth: CGFloat {
+ get {
+ let result = doubleForKey("screenShotBorderWidth")
+ if result < 0 { return 0 }
+ if result > 20 { return 20 }
+ return CGFloat(result)
+ }
+ set {
+ if newValue < 0 || newValue > 20 { return }
+ setDouble(Double(newValue), forKey: "screenShotBorderWidth")
+ }
+ }
+ /// スクリーンショットに提督名マスクを施すか
+ var useMask: Bool {
+ get {
+ return boolForKey("useMask")
+ }
+ set {
+ setBool(newValue, forKey: "useMask")
+ }
+ }
+ /// スクリーンショットを保存する場所
+ var screenShotSaveDirectory: String? {
+ get {
+ return stringForKey("screenShotSaveDirectory")
+ }
+ set {
+ setObject(newValue, forKey: "screenShotSaveDirectory")
+ }
+ }
+ /// スクリーンショットを撮ったときリストウインドウを最前面にするか
+ var showsListWindowAtScreenshot: Bool {
+ get {
+ return boolForKey("showsListWindowAtScreenshot")
+ }
+ set {
+ setBool(newValue, forKey: "showsListWindowAtScreenshot")
+ }
+ }
+ /// スクリーンショットのプレビューのズーム値
+ var screenshotPreviewZoomValue: NSNumber? {
+ get {
+ return objectForKey("screenshotPreviewZoomValue") as NSNumber?
+ }
+ set {
+ setObject(newValue, forKey: "screenshotPreviewZoomValue")
+ }
+ }
+
+ /// ツイートに艦これタグを付けるか
+ var appendKanColleTag: Bool {
+ get {
+ return boolForKey("appendKanColleTag")
+ }
+ set {
+ setBool(newValue, forKey: "appendKanColleTag")
+ }
+ }
+}
+
+/// Preferences
+extension HMUserDefaults {
+ /// 遠征帰還時の通知音を鳴らす
+ var playFinishMissionSound: Bool {
+ get {
+ return boolForKey("playFinishMissionSound")
+ }
+ set {
+ setBool(newValue, forKey: "playFinishMissionSound")
+ }
+ }
+ /// 入渠完了時の通知音を鳴らす
+ var playFinishNyukyoSound: Bool {
+ get {
+ return boolForKey("playFinishNyukyoSound")
+ }
+ set {
+ setBool(newValue, forKey: "playFinishNyukyoSound")
+ }
+ }
+ /// 建造完了時の通知音を鳴らす
+ var playFinishKenzoSound: Bool {
+ get {
+ return boolForKey("playFinishKenzoSound")
+ }
+ set {
+ setBool(newValue, forKey: "playFinishKenzoSound")
+ }
+ }
+}
+
+/// Upgradable window
+extension HMUserDefaults {
+ /// Lv.1の艦娘を改造可能艦リストに表示するか
+ var showLevelOneShipInUpgradableList: Bool {
+ get {
+ return boolForKey("showLevelOneShipInUpgradableList")
+ }
+ set {
+ setBool(newValue, forKey: "showLevelOneShipInUpgradableList")
+ }
+ }
+}
+
//
#import "HMAppDelegate.h"
-#import "HMUserDefaults.h"
#import "HMKCManagedObject.h"