OSDN Git Service

開発履歴を残すようにした
authormasakih <masakih@users.sourceforge.jp>
Sat, 22 Mar 2014 14:37:42 +0000 (23:37 +0900)
committermasakih <masakih@users.sourceforge.jp>
Sat, 22 Mar 2014 14:37:42 +0000 (23:37 +0900)
KCD.xcodeproj/project.pbxproj
KCD/HMCreateSlotItemCommand.h [new file with mode: 0644]
KCD/HMCreateSlotItemCommand.m [new file with mode: 0644]
KCD/HMKaihatuHistory.h [new file with mode: 0644]
KCD/HMKaihatuHistory.m [new file with mode: 0644]
KCD/LocalData.xcdatamodeld/LocalData.xcdatamodel/contents

index 9c96f3a..95d8c3e 100644 (file)
@@ -34,6 +34,8 @@
                F494DC6718C8BA6400AE97E4 /* HMPowerUpSupportViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F494DC6618C8BA6400AE97E4 /* HMPowerUpSupportViewController.m */; };
                F494DC6A18C8BAB900AE97E4 /* HMPowerUpSupportViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F494DC6818C8BAB900AE97E4 /* HMPowerUpSupportViewController.xib */; };
                F494DC6D18CC054800AE97E4 /* HMNyukyoDockStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = F494DC6C18CC054800AE97E4 /* HMNyukyoDockStatus.m */; };
+               F4B3DBCA18DDB9170011B4FC /* HMCreateSlotItemCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4B3DBC918DDB9170011B4FC /* HMCreateSlotItemCommand.m */; };
+               F4B3DBCD18DDBA200011B4FC /* HMKaihatuHistory.m in Sources */ = {isa = PBXBuildFile; fileRef = F4B3DBCC18DDBA200011B4FC /* HMKaihatuHistory.m */; };
                F4B414E918B09A4B00468DAF /* HMMasterMapAreaCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4B414E818B09A4B00468DAF /* HMMasterMapAreaCommand.m */; };
                F4B414EC18B0A7D600468DAF /* HMMasterUseItemCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4B414EB18B0A7D600468DAF /* HMMasterUseItemCommand.m */; };
                F4B414EF18B0BF1A00468DAF /* HMMasterMapInfoCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4B414EE18B0BF1A00468DAF /* HMMasterMapInfoCommand.m */; };
                F494DC6918C8BAB900AE97E4 /* ja */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ja; path = ja.lproj/HMPowerUpSupportViewController.xib; sourceTree = "<group>"; };
                F494DC6B18CC054800AE97E4 /* HMNyukyoDockStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMNyukyoDockStatus.h; sourceTree = "<group>"; };
                F494DC6C18CC054800AE97E4 /* HMNyukyoDockStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMNyukyoDockStatus.m; sourceTree = "<group>"; };
+               F4B3DBC818DDB9170011B4FC /* HMCreateSlotItemCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMCreateSlotItemCommand.h; sourceTree = "<group>"; };
+               F4B3DBC918DDB9170011B4FC /* HMCreateSlotItemCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMCreateSlotItemCommand.m; sourceTree = "<group>"; };
+               F4B3DBCB18DDBA200011B4FC /* HMKaihatuHistory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMKaihatuHistory.h; sourceTree = "<group>"; };
+               F4B3DBCC18DDBA200011B4FC /* HMKaihatuHistory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMKaihatuHistory.m; sourceTree = "<group>"; };
                F4B414E718B09A4B00468DAF /* HMMasterMapAreaCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMMasterMapAreaCommand.h; sourceTree = "<group>"; };
                F4B414E818B09A4B00468DAF /* HMMasterMapAreaCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMMasterMapAreaCommand.m; sourceTree = "<group>"; };
                F4B414EA18B0A7D600468DAF /* HMMasterUseItemCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMMasterUseItemCommand.h; sourceTree = "<group>"; };
                                F46F104718ABAC910063E503 /* KCD.xcdatamodeld */,
                                F4E7802F18DC42680011BC4C /* HMKenzoHistory.h */,
                                F4E7803018DC42680011BC4C /* HMKenzoHistory.m */,
+                               F4B3DBCB18DDBA200011B4FC /* HMKaihatuHistory.h */,
+                               F4B3DBCC18DDBA200011B4FC /* HMKaihatuHistory.m */,
                                F4E7802C18DC3AF00011BC4C /* LocalData.xcdatamodeld */,
                        );
                        name = CoreData;
                                F4E33B5718BF5F67005B8C07 /* HMMemberSlotItemCommand.m */,
                                F4E7802618DBD2A00011BC4C /* HMGetShipCommand.h */,
                                F4E7802718DBD2A00011BC4C /* HMGetShipCommand.m */,
+                               F4B3DBC818DDB9170011B4FC /* HMCreateSlotItemCommand.h */,
+                               F4B3DBC918DDB9170011B4FC /* HMCreateSlotItemCommand.m */,
                        );
                        name = Command;
                        sourceTree = "<group>";
                                F47B78B218A7B42B0011386E /* HMJSONViewWindowController.m in Sources */,
                                F4B414EF18B0BF1A00468DAF /* HMMasterMapInfoCommand.m in Sources */,
                                F4C118FC18A67B1C005D5B25 /* CustomHTTPProtocol.m in Sources */,
+                               F4B3DBCD18DDBA200011B4FC /* HMKaihatuHistory.m in Sources */,
                                F4D2CBCB18B05E58000EBC59 /* HMMaserShipCommand.m in Sources */,
                                F4513EFA18BB699700073552 /* HMShipWindowController.m in Sources */,
                                F46F104118A9B85E0063E503 /* HMJSONNode.m in Sources */,
                                F4513EF618B9F29800073552 /* HMMemberShipCommand.m in Sources */,
                                F4C1190818A746EB005D5B25 /* HMJSONTracker.m in Sources */,
                                F4513EDD18B619B600073552 /* HMCoreDataManager.m in Sources */,
+                               F4B3DBCA18DDB9170011B4FC /* HMCreateSlotItemCommand.m in Sources */,
                                F4B414E918B09A4B00468DAF /* HMMasterMapAreaCommand.m in Sources */,
                                F4C3957418CDDFE500A1E918 /* HMKenzoDockStatus.m in Sources */,
                                F4C118FB18A67B1C005D5B25 /* CanonicalRequest.m in Sources */,
diff --git a/KCD/HMCreateSlotItemCommand.h b/KCD/HMCreateSlotItemCommand.h
new file mode 100644 (file)
index 0000000..6c0ff29
--- /dev/null
@@ -0,0 +1,13 @@
+//
+//  HMCreateSlotItemCommand.h
+//  KCD
+//
+//  Created by Hori,Masaki on 2014/03/22.
+//  Copyright (c) 2014年 Hori,Masaki. All rights reserved.
+//
+
+#import "HMJSONCommand.h"
+
+@interface HMCreateSlotItemCommand : HMJSONCommand
+
+@end
diff --git a/KCD/HMCreateSlotItemCommand.m b/KCD/HMCreateSlotItemCommand.m
new file mode 100644 (file)
index 0000000..eb538fc
--- /dev/null
@@ -0,0 +1,71 @@
+//
+//  HMCreateSlotItemCommand.m
+//  KCD
+//
+//  Created by Hori,Masaki on 2014/03/22.
+//  Copyright (c) 2014年 Hori,Masaki. All rights reserved.
+//
+
+#import "HMCreateSlotItemCommand.h"
+
+#import "HMCoreDataManager.h"
+#import "HMLocalDataStore.h"
+#import "HMKaihatuHistory.h"
+
+
+@implementation HMCreateSlotItemCommand
++ (void)load
+{
+       static dispatch_once_t onceToken;
+       dispatch_once(&onceToken, ^{
+               [HMJSONCommand registerClass:self];
+       });
+}
+
++ (BOOL)canExcuteAPI:(NSString *)api
+{
+       if([api isEqualToString:@"/kcsapi/api_req_kousyou/createitem"]) return YES;
+       
+       return NO;
+}
+- (void)execute
+{
+       id data = [self.json valueForKey:@"api_data"];
+       BOOL created = [[data valueForKey:@"api_create_flag"] boolValue];
+       NSString *name = nil;
+       NSNumber *numberOfUsedKaihatuSizai = nil;
+       
+       if(created) {
+               NSManagedObjectContext *context = [[HMCoreDataManager defaultManager] managedObjectContext];
+               
+               NSNumber *slotItemID = [data valueForKey:@"api_slotitem_id"];
+               NSFetchRequest *req = [NSFetchRequest fetchRequestWithEntityName:@"MasterSlotItem"];
+               NSPredicate *predicate = [NSPredicate predicateWithFormat:@"id = %@", slotItemID];
+               [req setPredicate:predicate];
+               
+               NSArray *array = [context executeFetchRequest:req error:NULL];
+               if([array count] == 0) {
+                       NSLog(@"MasterSlotItem data is invalid or ship_id is invalid.");
+                       return;
+               }
+               name = [array[0] valueForKey:@"name"];
+               numberOfUsedKaihatuSizai = @1;
+       } else {
+               name = NSLocalizedString(@"fail to develop", @"");
+               numberOfUsedKaihatuSizai = @0;
+       }
+       
+       HMLocalDataStore *lds = [HMLocalDataStore oneTimeEditor];
+       NSManagedObjectContext *localStoreContext = [lds managedObjectContext];
+       HMKaihatuHistory *newObejct = [NSEntityDescription insertNewObjectForEntityForName:@"KaihatuHistory"
+                                                                                                                         inManagedObjectContext:localStoreContext];
+       newObejct.name = name;
+       newObejct.fuel = @([[self.arguments valueForKey:@"api_item1"] integerValue]);
+       newObejct.bull = @([[self.arguments valueForKey:@"api_item2"] integerValue]);
+       newObejct.steel = @([[self.arguments valueForKey:@"api_item3"] integerValue]);
+       newObejct.bauxite = @([[self.arguments valueForKey:@"api_item4"] integerValue]);
+       newObejct.kaihatusizai = numberOfUsedKaihatuSizai;
+       newObejct.date = [NSDate date];
+}
+
+@end
diff --git a/KCD/HMKaihatuHistory.h b/KCD/HMKaihatuHistory.h
new file mode 100644 (file)
index 0000000..708ade5
--- /dev/null
@@ -0,0 +1,23 @@
+//
+//  HMKaihatuHistory.h
+//  KCD
+//
+//  Created by Hori,Masaki on 2014/03/22.
+//  Copyright (c) 2014年 Hori,Masaki. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <CoreData/CoreData.h>
+
+
+@interface HMKaihatuHistory : NSManagedObject
+
+@property (nonatomic, retain) NSNumber *bull;
+@property (nonatomic, retain) NSNumber *bauxite;
+@property (nonatomic, retain) NSDate *date;
+@property (nonatomic, retain) NSNumber *fuel;
+@property (nonatomic, retain) NSString *name;
+@property (nonatomic, retain) NSNumber *steel;
+@property (nonatomic, retain) NSNumber *kaihatusizai;
+
+@end
diff --git a/KCD/HMKaihatuHistory.m b/KCD/HMKaihatuHistory.m
new file mode 100644 (file)
index 0000000..a54e7aa
--- /dev/null
@@ -0,0 +1,22 @@
+//
+//  HMKaihatuHistory.m
+//  KCD
+//
+//  Created by Hori,Masaki on 2014/03/22.
+//  Copyright (c) 2014年 Hori,Masaki. All rights reserved.
+//
+
+#import "HMKaihatuHistory.h"
+
+
+@implementation HMKaihatuHistory
+
+@dynamic bull;
+@dynamic bauxite;
+@dynamic date;
+@dynamic fuel;
+@dynamic name;
+@dynamic steel;
+@dynamic kaihatusizai;
+
+@end
index af2542f..3ece231 100644 (file)
@@ -1,16 +1,26 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <model userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="5063" systemVersion="13C64" minimumToolsVersion="Xcode 4.3" macOSVersion="Automatic" iOSVersion="Automatic">
+    <entity name="KaihatuHistory" representedClassName="HMKaihatuHistory" syncable="YES">
+        <attribute name="bauxite" attributeType="Integer 32" minValueString="10" syncable="YES"/>
+        <attribute name="bull" attributeType="Integer 32" minValueString="10" syncable="YES"/>
+        <attribute name="date" attributeType="Date" indexed="YES" syncable="YES"/>
+        <attribute name="fuel" attributeType="Integer 32" minValueString="10" syncable="YES"/>
+        <attribute name="kaihatusizai" attributeType="Integer 32" minValueString="0" syncable="YES"/>
+        <attribute name="name" attributeType="String" minValueString="1" indexed="YES" syncable="YES"/>
+        <attribute name="steel" attributeType="Integer 32" minValueString="10" syncable="YES"/>
+    </entity>
     <entity name="KenzoHistory" representedClassName="HMKenzoHistory" syncable="YES">
         <attribute name="bauxite" attributeType="Integer 32" minValueString="30" syncable="YES"/>
         <attribute name="bull" attributeType="Integer 32" minValueString="30" syncable="YES"/>
         <attribute name="date" attributeType="Date" indexed="YES" syncable="YES"/>
         <attribute name="fuel" attributeType="Integer 32" minValueString="30" syncable="YES"/>
         <attribute name="isLarge" attributeType="Boolean" syncable="YES"/>
-        <attribute name="kaihatusizai" attributeType="Integer 32" minValueString="1" syncable="YES"/>
+        <attribute name="kaihatusizai" attributeType="Integer 32" syncable="YES"/>
         <attribute name="name" attributeType="String" minValueString="1" indexed="YES" syncable="YES"/>
         <attribute name="steel" attributeType="Integer 32" minValueString="30" syncable="YES"/>
     </entity>
     <elements>
-        <element name="KenzoHistory" positionX="0" positionY="0" width="128" height="165"/>
+        <element name="KenzoHistory" positionX="0" positionY="0" width="128" height="163"/>
+        <element name="KaihatuHistory" positionX="0" positionY="63" width="128" height="148"/>
     </elements>
 </model>
\ No newline at end of file