File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 114
114
*/
115
115
-(void ) loadSpriteFrameLookupDictionaryFromFile : (NSString *)filename ;
116
116
117
+ /* *
118
+ * Loads all sprite sheet lookup files in all search paths and registers all the referenced sprite sheets with the sprite frame cache.
119
+ *
120
+ * @param filename Sprite sheet lookup file.
121
+ */
122
+ - (void )loadSpriteFrameLookupsInAllSearchPathsWithName : (NSString *)filename ;
123
+
117
124
// / -----------------------------------------------------------------------
118
125
// / @name Sprite Frame Cache Removal
119
126
// / -----------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -129,6 +129,30 @@ -(void) loadSpriteFrameLookupDictionaryFromFile:(NSString*)filename
129
129
}
130
130
}
131
131
132
+ - (void )loadSpriteFrameLookupsInAllSearchPathsWithName : (NSString *)filename
133
+ {
134
+ NSArray *paths = [[CCFileUtils sharedFileUtils ] fullPathsOfFileNameInAllSearchPaths: filename];
135
+
136
+ for (NSString *spriteFrameLookupFullPath in paths)
137
+ {
138
+ NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile: spriteFrameLookupFullPath];
139
+
140
+ NSDictionary *metadata = dict[@" metadata" ];
141
+ NSInteger version = [metadata[@" version" ] integerValue ];
142
+ if (version != 1 )
143
+ {
144
+ CCLOG (@" cocos2d: ERROR: Invalid filenameLookup dictionary version: %ld . Filename: %@ " , (long ) version, filename);
145
+ return ;
146
+ }
147
+
148
+ NSArray *spriteFrameFiles = dict[@" spriteFrameFiles" ];
149
+ for (NSString *spriteFrameFile in spriteFrameFiles)
150
+ {
151
+ [self registerSpriteFramesFile: spriteFrameFile];
152
+ }
153
+ }
154
+ }
155
+
132
156
- (void ) registerSpriteFramesFile : (NSString *)plist
133
157
{
134
158
NSAssert (plist, @" plist filename should not be nil" );
You can’t perform that action at this time.
0 commit comments