-
Notifications
You must be signed in to change notification settings - Fork 3
/
BookShelfManager.h
108 lines (69 loc) · 3.14 KB
/
BookShelfManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//
// BookShelfManager.h
// Milestones
//
// Created by anonymous on 6/23/11.
// Copyright 2011 companyName Studio. All rights reserved.
//
// Manage the books in the bookshelf
//#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "Constants.h"
#import "Material.h"
//#import "SBJson.h"
//#import "ASIHTTPRequest.h"
//#import "DownloadManager.h"
typedef UIImage CCSprite;
@interface CCSprite (AliasMethodsFromCocos2d)
+(CCSprite*) spriteWithFile:(NSString*)filename;
@end
@interface BookShelfManager : NSObject {
int bookNumberOnEachColumn;
int currentViewingColumn ; // if bookshelf has multiple columns, decide which one to be shown, also with target books cover on that
int targetImageID; // the image ID to be shown in the containing scrollview
// NOTE: because in our scrollview, we will prepare 3 consecutive subviews (instances of MyViewController with ImageDetailView insided),
// so the currentProcessingImageID will be used in the subview to have a knowledge about which art work to load from BookShelfManager.
int currentProcessingImageID; // to facilitate the loading of images just at the left and right side of the targetImage
NSMutableArray *covers ;
//NSMutableDictionary *idToFilePath ;
NSString *bookCoversDir ;
NSString *contentRootDir ;
NSMutableArray *allMaterials ; // the books/video plain objects, for easier access of local resource files.
NSMutableArray *sortedMaterials ; // the seq in bookshelf, default seq. is the published seq (ordered by id from server).
// Experimenet, keeps of loaded books instances?
}
@property int currentViewingColumn ;
//@property (retain) NSMutableDictionary *idToFilePath ;
@property (retain) NSMutableArray *covers ;
@property int bookNumberOnEachColumn;
@property (retain) NSMutableArray *allMaterials ;
@property (retain) NSMutableArray *sortedMaterials ;
@property(retain) NSString *bookCoversDir ;
@property(retain) NSString *contentRootDir ;
@property int currentProcessingImageID;
@property int targetImageID;
+(BookShelfManager*) sharedInstance ;
-(NSArray *) getBookCoversForShelfColumn:(int)number ;
//-(CCScene *)getNthColumn:(int)columnNumber ; // NOTE: start from zero!
//-(void) updateShelfFromJSONString:(NSString *)jsonString ;
-(void) loadExistingMaterials ;
-(void) prepareMaterialCoverFolder ;
//-(NSString *) getCoverDownloadDestinationFromMaterialInfo:(NSDictionary *)jsonInfo ;
//-(NSString *) getCoverDownloadURLFromMaterialInfo:(NSDictionary *)jsonInfo ;
//
//-(NSString *) getContentDownloadDestinationFromMaterialInfo:(NSDictionary *)jsonInfo ;
//-(NSString *) getContentDownloadURLFromMaterialInfo:(NSDictionary *)jsonInfo ;
//-(void) updateMaterialFromJSONString:(NSString *)jsonString ;
-(void) persistAllMaterialsToPlist ;
-(void) loadMaterialCoversForBookShelf ;
//-(void)downloadBookCoverFor:(NSMutableDictionary *)oneMaterial;
//-(void)downloadBookCoverForMaterial:(Material *)mat ;
-(NSArray *)allValuesFromArrayOfDictionary:(NSArray*)arrayOfDictionary forKey:(NSString*)key ;
-(void) reloadAllMaterials ;
/**
*
*/
-(void) loadInventory;
-(void)saveAllMaterialsToConfig:(NSArray *) materialObjects ;
@end