OSDN Git Service

ソースコードないのマルチバイト文字をplistに追い出した
authormasakih <masakih@users.sourceforge.jp>
Wed, 2 Sep 2015 15:49:47 +0000 (00:49 +0900)
committermasakih <masakih@users.sourceforge.jp>
Wed, 2 Sep 2015 15:49:47 +0000 (00:49 +0900)
KCD.xcodeproj/project.pbxproj
KCD/HMSlotitemNameTransformer.m
KCD/ja.lproj/SlotItemShortName.plist [new file with mode: 0644]

index 2f8910b..7959488 100644 (file)
                F4A3AD8E19BB220000FDBF80 /* HMMaskInfomation.m in Sources */ = {isa = PBXBuildFile; fileRef = F4A3AD8D19BB220000FDBF80 /* HMMaskInfomation.m */; };
                F4A3AD9219BDDD8E00FDBF80 /* HMPreferencePanelController.m in Sources */ = {isa = PBXBuildFile; fileRef = F4A3AD9019BDDD8E00FDBF80 /* HMPreferencePanelController.m */; };
                F4A3AD9419BDDE5500FDBF80 /* HMPreferencePanelController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F4A3AD9619BDDE5500FDBF80 /* HMPreferencePanelController.xib */; };
+               F4A9B8D41B975029005786C2 /* SlotItemShortName.plist in Resources */ = {isa = PBXBuildFile; fileRef = F4A9B8D21B975029005786C2 /* SlotItemShortName.plist */; };
                F4AA05FB192B92C800844688 /* Temporary.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = F4AA05F9192B92C700844688 /* Temporary.xcdatamodeld */; };
                F4AA05FE192B932E00844688 /* HMTemporaryDataStore.m in Sources */ = {isa = PBXBuildFile; fileRef = F4AA05FD192B932E00844688 /* HMTemporaryDataStore.m */; };
                F4AA0601192E1FE900844688 /* HMBattleCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4AA0600192E1FE900844688 /* HMBattleCommand.m */; };
                F4A3AD8F19BDDD8D00FDBF80 /* HMPreferencePanelController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMPreferencePanelController.h; sourceTree = "<group>"; };
                F4A3AD9019BDDD8E00FDBF80 /* HMPreferencePanelController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMPreferencePanelController.m; sourceTree = "<group>"; };
                F4A3AD9519BDDE5500FDBF80 /* ja */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ja; path = ja.lproj/HMPreferencePanelController.xib; sourceTree = "<group>"; };
+               F4A9B8D31B975029005786C2 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = ja; path = ja.lproj/SlotItemShortName.plist; sourceTree = "<group>"; };
                F4AA05FA192B92C800844688 /* Temporary.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Temporary.xcdatamodel; sourceTree = "<group>"; };
                F4AA05FC192B932E00844688 /* HMTemporaryDataStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMTemporaryDataStore.h; sourceTree = "<group>"; };
                F4AA05FD192B932E00844688 /* HMTemporaryDataStore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMTemporaryDataStore.m; sourceTree = "<group>"; };
                                F43E67B618BE02A10087E5B6 /* STypeShortName.plist */,
                                F43E67B818BE060E0087E5B6 /* LevelUpExp.plist */,
                                F4666C6A1B29E974001840DB /* EquipmentStrengthen.plist */,
+                               F4A9B8D21B975029005786C2 /* SlotItemShortName.plist */,
                        );
                        name = "Supporting Files";
                        sourceTree = "<group>";
                                F4BEF00E1B11A645004702B8 /* HMUITestWindowController.xib in Resources */,
                                F4BEF0021B11A5CC004702B8 /* HMFleetMinimumViewController.xib in Resources */,
                                F43E67B718BE02A10087E5B6 /* STypeShortName.plist in Resources */,
+                               F4A9B8D41B975029005786C2 /* SlotItemShortName.plist in Resources */,
                                F4BEF0051B11A5D3004702B8 /* HMFleetViewController.xib in Resources */,
                                F4A2AF541A074DE40024BD9E /* HMScreenshotListWindowController.xib in Resources */,
                                F4BEEFFC1B11A5A7004702B8 /* HMExternalBrowserWindowController.xib in Resources */,
                        name = HMPreferencePanelController.xib;
                        sourceTree = "<group>";
                };
+               F4A9B8D21B975029005786C2 /* SlotItemShortName.plist */ = {
+                       isa = PBXVariantGroup;
+                       children = (
+                               F4A9B8D31B975029005786C2 /* ja */,
+                       );
+                       name = SlotItemShortName.plist;
+                       sourceTree = "<group>";
+               };
                F4B2D02D18F83A2F00542742 /* HMScreenshotWindowController.xib */ = {
                        isa = PBXVariantGroup;
                        children = (
index 1b153ef..c69cd34 100644 (file)
 #import "HMKCSlotItemObject+Extensions.h"
 #import "HMKCMasterSlotItemObject.h"
 
+static NSDictionary *slotItemShortName = nil;
+
 @implementation HMSlotitemNameTransformer
 + (void)load
 {
        static dispatch_once_t onceToken;
        dispatch_once(&onceToken, ^{
                [NSValueTransformer setValueTransformer:[self new] forName:@"HMSlotitemNameTransformer"];
+               
+               NSBundle *mainBundle = [NSBundle mainBundle];
+               NSString *path = [mainBundle pathForResource:@"SlotItemShortName" ofType:@"plist"];
+               if(!path) {
+                       NSLog(@"Could not find SlotItemShortName.plist");
+                       NSBeep();
+                       return;
+               }
+               id dict = [NSDictionary dictionaryWithContentsOfFile:path];
+               if(!dict) {
+                       NSLog(@"SlotItemShortName.plist is not dictionay.");
+                       NSBeep();
+                       return;
+               }
+               slotItemShortName = dict;
        });
 }
 
        }
        
        HMKCSlotItemObject *slotItem = array[0];
-       
-       NSInteger mstID = [slotItem.master_slotItem.id integerValue];
-       
-       if(mstID == 42) return @"修理";
-       if(mstID == 43) return @"女神";
-       if(mstID == 145) return @"糧食";
+       NSString *mstIDString = [slotItem.master_slotItem.id stringValue];
+       NSString *shortName = slotItemShortName[mstIDString];
+       if(shortName) return shortName;
        
        return [slotItem.name copy];
 }
diff --git a/KCD/ja.lproj/SlotItemShortName.plist b/KCD/ja.lproj/SlotItemShortName.plist
new file mode 100644 (file)
index 0000000..4de9528
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>42</key>
+       <string>修理</string>
+       <key>43</key>
+       <string>女神</string>
+       <key>145</key>
+       <string>糧食</string>
+</dict>
+</plist>