From 5b77b52c49d5463dd5bd01629a1347db08cd56ce Mon Sep 17 00:00:00 2001 From: masakih Date: Fri, 16 Jan 2015 00:01:09 +0900 Subject: [PATCH] =?utf8?q?HMResetSortieCommand=E3=82=AF=E3=83=A9=E3=82=B9?= =?utf8?q?=E3=82=92Swift=E3=81=A6=E3=82=99=E6=9B=B8=E3=81=8D=E6=8F=9B?= =?utf8?q?=E3=81=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- KCD.xcodeproj/project.pbxproj | 10 ++++------ KCD/HMResetSortieCommand.h | 13 ------------- KCD/HMResetSortieCommand.m | 34 ---------------------------------- KCD/HMResetSortieCommand.swift | 26 ++++++++++++++++++++++++++ KCD/KCD-Bridging-Header.h | 1 - 5 files changed, 30 insertions(+), 54 deletions(-) delete mode 100644 KCD/HMResetSortieCommand.h delete mode 100644 KCD/HMResetSortieCommand.m create mode 100644 KCD/HMResetSortieCommand.swift diff --git a/KCD.xcodeproj/project.pbxproj b/KCD.xcodeproj/project.pbxproj index 0c780f9d..5406547f 100644 --- a/KCD.xcodeproj/project.pbxproj +++ b/KCD.xcodeproj/project.pbxproj @@ -18,7 +18,6 @@ F43BA4A7197CD59400CFF788 /* HMNyukyoSpeedChangeCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F43BA4A6197CD59400CFF788 /* HMNyukyoSpeedChangeCommand.m */; }; F43E67B718BE02A10087E5B6 /* STypeShortName.plist in Resources */ = {isa = PBXBuildFile; fileRef = F43E67B618BE02A10087E5B6 /* STypeShortName.plist */; }; F43E67B918BE060E0087E5B6 /* LevelUpExp.plist in Resources */ = {isa = PBXBuildFile; fileRef = F43E67B818BE060E0087E5B6 /* LevelUpExp.plist */; }; - F43F3D461A33F7D400D6DAF7 /* HMResetSortieCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F43F3D451A33F7D400D6DAF7 /* HMResetSortieCommand.m */; }; F44AB23519E805D100F217AF /* HMKaisouLockCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F44AB23419E805D100F217AF /* HMKaisouLockCommand.m */; }; F4513EEE18B8E2F600073552 /* HMMemberMaterialCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4513EED18B8E2F600073552 /* HMMemberMaterialCommand.m */; }; F4513EF018B96C6C00073552 /* Links.rtf in Resources */ = {isa = PBXBuildFile; fileRef = F4513EEF18B96C6C00073552 /* Links.rtf */; }; @@ -83,6 +82,7 @@ F4896DE71A6567AA00B09967 /* HMHokyuChargeCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4896DE61A6567AA00B09967 /* HMHokyuChargeCommand.swift */; }; F4896DE91A6681DF00B09967 /* HMRemodelSlotCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4896DE81A6681DF00B09967 /* HMRemodelSlotCommand.swift */; }; F4896DEB1A67D11000B09967 /* HMCreateSlotItemCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4896DEA1A67D11000B09967 /* HMCreateSlotItemCommand.swift */; }; + F4896DED1A67E8E500B09967 /* HMResetSortieCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4896DEC1A67E8E500B09967 /* HMResetSortieCommand.swift */; }; F494DC6A18C8BAB900AE97E4 /* HMPowerUpSupportViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F494DC6818C8BAB900AE97E4 /* HMPowerUpSupportViewController.xib */; }; F4A2AF541A074DE40024BD9E /* HMScreenshotListWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F4A2AF561A074DE40024BD9E /* HMScreenshotListWindowController.xib */; }; F4A2AF581A0930160024BD9E /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F4A2AF571A0930160024BD9E /* Quartz.framework */; }; @@ -179,8 +179,6 @@ F43BA4A6197CD59400CFF788 /* HMNyukyoSpeedChangeCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMNyukyoSpeedChangeCommand.m; sourceTree = ""; }; F43E67B618BE02A10087E5B6 /* STypeShortName.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = STypeShortName.plist; sourceTree = ""; }; F43E67B818BE060E0087E5B6 /* LevelUpExp.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = LevelUpExp.plist; sourceTree = ""; }; - F43F3D441A33F7D400D6DAF7 /* HMResetSortieCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMResetSortieCommand.h; sourceTree = ""; }; - F43F3D451A33F7D400D6DAF7 /* HMResetSortieCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMResetSortieCommand.m; sourceTree = ""; }; F44AB23319E805D100F217AF /* HMKaisouLockCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMKaisouLockCommand.h; sourceTree = ""; }; F44AB23419E805D100F217AF /* HMKaisouLockCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMKaisouLockCommand.m; sourceTree = ""; }; F4513EEC18B8E2F600073552 /* HMMemberMaterialCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMMemberMaterialCommand.h; sourceTree = ""; }; @@ -254,6 +252,7 @@ F4896DE61A6567AA00B09967 /* HMHokyuChargeCommand.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMHokyuChargeCommand.swift; sourceTree = ""; }; F4896DE81A6681DF00B09967 /* HMRemodelSlotCommand.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMRemodelSlotCommand.swift; sourceTree = ""; }; F4896DEA1A67D11000B09967 /* HMCreateSlotItemCommand.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMCreateSlotItemCommand.swift; sourceTree = ""; }; + F4896DEC1A67E8E500B09967 /* HMResetSortieCommand.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMResetSortieCommand.swift; sourceTree = ""; }; F494DC5618C23E4300AE97E4 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/MainMenu.strings; sourceTree = ""; }; F494DC5718C23E4300AE97E4 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/InfoPlist.strings; sourceTree = ""; }; F494DC5918C23E4400AE97E4 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/InfoPlist.strings; sourceTree = ""; }; @@ -646,8 +645,7 @@ F4896DE81A6681DF00B09967 /* HMRemodelSlotCommand.swift */, F4B37EF419FBE801002F371A /* HMRemodelSlotItemCommand.h */, F4B37EF519FBE801002F371A /* HMRemodelSlotItemCommand.m */, - F43F3D441A33F7D400D6DAF7 /* HMResetSortieCommand.h */, - F43F3D451A33F7D400D6DAF7 /* HMResetSortieCommand.m */, + F4896DEC1A67E8E500B09967 /* HMResetSortieCommand.swift */, ); name = Command; sourceTree = ""; @@ -857,13 +855,13 @@ F4D2CBCB18B05E58000EBC59 /* HMMaserShipCommand.m in Sources */, F47C5C221A63F2A800C276B5 /* HMDestroyShipCommand.swift in Sources */, F477E2371A52D70F00493198 /* HMKenzoHistory.swift in Sources */, + F4896DED1A67E8E500B09967 /* HMResetSortieCommand.swift in Sources */, F47150331A65342900B714F2 /* HMMidnightBattleCommand.swift in Sources */, F4513EFA18BB699700073552 /* HMShipWindowController.m in Sources */, F477E2431A53836200493198 /* HMKCSlotItemObject.swift in Sources */, F46F104118A9B85E0063E503 /* HMJSONNode.m in Sources */, F47C5C281A640C6700C276B5 /* HMBattleCommand.swift in Sources */, F454F7831A261844003042DD /* HMFleetInformation.m in Sources */, - F43F3D461A33F7D400D6DAF7 /* HMResetSortieCommand.m in Sources */, F4131ECF190F5C08004F7F9A /* HMStoreCreateSlotItemHistoryCommand.m in Sources */, F4AA05FB192B92C800844688 /* Temporary.xcdatamodeld in Sources */, F477E2511A55A10800493198 /* HMTemporaryDataStore.swift in Sources */, diff --git a/KCD/HMResetSortieCommand.h b/KCD/HMResetSortieCommand.h deleted file mode 100644 index 521a5990..00000000 --- a/KCD/HMResetSortieCommand.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// HMResetSortieCommand.h -// KCD -// -// Created by Hori,Masaki on 2014/12/07. -// Copyright (c) 2014年 Hori,Masaki. All rights reserved. -// - -#import "HMJSONCommand.h" - -@interface HMResetSortieCommand : HMJSONCommand - -@end diff --git a/KCD/HMResetSortieCommand.m b/KCD/HMResetSortieCommand.m deleted file mode 100644 index 3c1d17b6..00000000 --- a/KCD/HMResetSortieCommand.m +++ /dev/null @@ -1,34 +0,0 @@ -// -// HMResetSortieCommand.m -// KCD -// -// Created by Hori,Masaki on 2014/12/07. -// Copyright (c) 2014年 Hori,Masaki. All rights reserved. -// - -#import "HMResetSortieCommand.h" - -#import "KCD-Swift.h" - -@implementation HMResetSortieCommand - -- (void)execute -{ - HMTemporaryDataStore *store = [HMTemporaryDataStore oneTimeEditor]; - NSManagedObjectContext *moc = store.managedObjectContext; - - NSError *error = nil; - NSArray *array = [store objectsWithEntityName:@"Battle" - sortDescriptors:nil - predicate:nil - error:NULL]; - if(error) { - [self log:@"%s error: %@", __PRETTY_FUNCTION__, error]; - return; - } - for(id object in array) { - [moc deleteObject:object]; - } -} - -@end diff --git a/KCD/HMResetSortieCommand.swift b/KCD/HMResetSortieCommand.swift new file mode 100644 index 00000000..a112e6fd --- /dev/null +++ b/KCD/HMResetSortieCommand.swift @@ -0,0 +1,26 @@ +// +// HMResetSortieCommand.swift +// KCD +// +// Created by Hori,Masaki on 2015/01/15. +// Copyright (c) 2015年 Hori,Masaki. All rights reserved. +// + +import Cocoa + +/// 出撃よりの帰還時に出撃内容を消す +class HMResetSortieCommand: HMJSONCommand { + override func execute() { + let store = HMTemporaryDataStore.oneTimeEditor() + var error: NSError? = nil + let array = store.objectsWithEntityName("Battle", sortDescriptors: nil, predicate: nil, error: &error) + if error != nil { + NSLog("\(__FUNCTION__) error: \(error!)") + return + } + let moc = store.managedObjectContext! + for object in array { + moc.deleteObject(object as NSManagedObject) + } + } +} diff --git a/KCD/KCD-Bridging-Header.h b/KCD/KCD-Bridging-Header.h index 0bce0ab5..0dcd7d7e 100644 --- a/KCD/KCD-Bridging-Header.h +++ b/KCD/KCD-Bridging-Header.h @@ -18,7 +18,6 @@ #import "HMRealDestroyShipCommand.h" #import "HMMemberMaterialCommand.h" #import "HMMemberBasicCommand.h" -#import "HMResetSortieCommand.h" #import "HMCalculateDamageCommand.h" #import "HMApplySuppliesCommand.h" #import "HMRemodelSlotItemCommand.h" -- 2.11.0