From: masakih Date: Wed, 2 Sep 2015 15:49:47 +0000 (+0900) Subject: ソースコードないのマルチバイト文字をplistに追い出した X-Git-Tag: 1.3b13~7 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=0274d0ac14e42abf4d55c858dc1aa6411706739f;p=kcd%2FKCD.git ソースコードないのマルチバイト文字をplistに追い出した --- diff --git a/KCD.xcodeproj/project.pbxproj b/KCD.xcodeproj/project.pbxproj index 2f8910b9..79594886 100644 --- a/KCD.xcodeproj/project.pbxproj +++ b/KCD.xcodeproj/project.pbxproj @@ -103,6 +103,7 @@ 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 */; }; @@ -396,6 +397,7 @@ F4A3AD8F19BDDD8D00FDBF80 /* HMPreferencePanelController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMPreferencePanelController.h; sourceTree = ""; }; F4A3AD9019BDDD8E00FDBF80 /* HMPreferencePanelController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMPreferencePanelController.m; sourceTree = ""; }; F4A3AD9519BDDE5500FDBF80 /* ja */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ja; path = ja.lproj/HMPreferencePanelController.xib; sourceTree = ""; }; + F4A9B8D31B975029005786C2 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = ja; path = ja.lproj/SlotItemShortName.plist; sourceTree = ""; }; F4AA05FA192B92C800844688 /* Temporary.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Temporary.xcdatamodel; sourceTree = ""; }; F4AA05FC192B932E00844688 /* HMTemporaryDataStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMTemporaryDataStore.h; sourceTree = ""; }; F4AA05FD192B932E00844688 /* HMTemporaryDataStore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMTemporaryDataStore.m; sourceTree = ""; }; @@ -730,6 +732,7 @@ F43E67B618BE02A10087E5B6 /* STypeShortName.plist */, F43E67B818BE060E0087E5B6 /* LevelUpExp.plist */, F4666C6A1B29E974001840DB /* EquipmentStrengthen.plist */, + F4A9B8D21B975029005786C2 /* SlotItemShortName.plist */, ); name = "Supporting Files"; sourceTree = ""; @@ -1189,6 +1192,7 @@ 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 */, @@ -1431,6 +1435,14 @@ name = HMPreferencePanelController.xib; sourceTree = ""; }; + F4A9B8D21B975029005786C2 /* SlotItemShortName.plist */ = { + isa = PBXVariantGroup; + children = ( + F4A9B8D31B975029005786C2 /* ja */, + ); + name = SlotItemShortName.plist; + sourceTree = ""; + }; F4B2D02D18F83A2F00542742 /* HMScreenshotWindowController.xib */ = { isa = PBXVariantGroup; children = ( diff --git a/KCD/HMSlotitemNameTransformer.m b/KCD/HMSlotitemNameTransformer.m index 1b153ef3..c69cd340 100644 --- a/KCD/HMSlotitemNameTransformer.m +++ b/KCD/HMSlotitemNameTransformer.m @@ -13,12 +13,29 @@ #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; }); } @@ -50,12 +67,9 @@ } 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 index 00000000..4de9528e --- /dev/null +++ b/KCD/ja.lproj/SlotItemShortName.plist @@ -0,0 +1,12 @@ + + + + + 42 + 修理 + 43 + 女神 + 145 + 糧食 + +