JubeatPlus 3.9.11
Loading...
Searching...
No Matches
ChallengeStatus.h
Go to the documentation of this file.
1
14
15#import <Foundation/Foundation.h>
16#import <UIKit/UIKit.h>
17
20@class ScratchInfo;
21
22NS_ASSUME_NONNULL_BEGIN
23
27@interface ChallengeStatus : NSObject
28
29#pragma mark - Singleton
30
38@property(class, nonatomic, readonly) ChallengeStatus *sharedStatus;
39
40#pragma mark - Lifecycle
41
47- (instancetype)init;
48
54- (void)resetStatus;
55
61- (void)initWithDictionary:(nullable NSDictionary *)dictionary;
62
63#pragma mark - State updates
64
72- (void)updateState:(nullable NSDictionary *)dictionary;
73
80- (void)updateConsume:(nullable NSDictionary *)dictionary;
81
87- (void)updateName:(nullable NSString *)name;
88
96- (void)setScratchItem:(int)index dict:(nullable NSDictionary *)dict;
97
103- (void)updatePresentNum:(nullable NSDictionary *)dictionary;
104
110- (void)setPresentNum:(int)num;
111
118- (void)updateScratchID:(nullable NSDictionary *)dictionary;
119
125- (void)updateHowtoURL:(nullable NSDictionary *)dictionary;
126
132- (void)updateInformationURL:(nullable NSDictionary *)dictionary;
133
138- (void)saveInformationURL;
139
146- (void)updatePersonalInformationURL:(nullable NSDictionary *)dictionary;
147
156
162
169- (void)updateScratchTable:(nullable NSDictionary *)dictionary;
170
176- (void)updateScratchLineup:(nullable NSDictionary *)dictionary;
177
184- (void)updateUserInfo:(nullable NSDictionary *)dictionary;
185
191- (void)updateScratchTimeState:(nullable NSDictionary *)dictionary;
192
199- (void)updateServerTime:(nullable NSDictionary *)dictionary;
200
206- (void)updateCubeState:(nullable NSDictionary *)dictionary;
207
214- (void)updateCoinState:(nullable NSDictionary *)dictionary;
215
221- (void)updateNailState:(nullable NSDictionary *)dictionary;
222
227- (void)restCoinNum;
228
235- (void)updateChallengeMission:(nullable NSDictionary *)dictionary;
236
242- (void)exchangeNail:(nullable NSDictionary *)dictionary;
243
251- (void)openScratch:(nullable NSDictionary *)dictionary index:(int)index;
252
258- (void)restPlayCoin:(nullable NSDictionary *)dictionary;
259
265- (void)changeScratchNail:(nullable NSDictionary *)dictionary;
266
272- (void)cubePurchaseSuccess:(nullable NSDictionary *)dictionary;
273
281- (void)openMusicDetail:(nullable NSDictionary *)dictionary index:(int)index;
282
288- (void)playMusic:(nullable NSDictionary *)dictionary;
289
295- (void)receivePresent:(nullable NSDictionary *)dictionary;
296
305- (void)updateMusicRanking:(int)musicID diff:(int)diff rank:(int)rank index:(int)index;
306
307#pragma mark - Derived time values
308
315- (nullable NSString *)timeStringFromInterval_Minute:(double)interval;
316
323- (nullable NSString *)timeStringFromInterval:(double)interval;
324
331- (double)getTimeLeft:(nullable NSDate *)date;
332
339- (double)getMusicEnableTime:(int)index;
340
347- (nullable NSString *)getMusicEnableTimeString:(int)index;
348
349#pragma mark - Line-up image cache
350
357- (void)setLineupImage:(nullable UIImage *)image musicID:(nullable id)musicID;
358
365- (nullable UIImage *)getLineupImage:(nullable id)musicID;
366
371- (void)clearLineupImage;
372
373#pragma mark - Scratch panel counts
374
382
390
391#pragma mark - Notifications
392
402
403#pragma mark - Mission sheets
404
410- (void)updateMissionSheet:(nullable NSDictionary *)dictionary;
411
418
425- (void)setSelectedMissionSheet:(nullable ChallengeMissionSheet *)sheet;
426
433
439
445- (void)setChallengeRootView:(nullable ChallengeModeRootView *)rootView;
446
447#pragma mark - Properties
448
454@property(nonatomic, weak, readonly, nullable) ChallengeModeRootView *rootView;
455
460@property(nonatomic, strong, nullable) NSString *myName;
465@property(nonatomic, strong, nullable) NSString *mySearchID;
470@property(nonatomic, strong, readonly, nullable) NSNumber *scratchID;
475@property(nonatomic, strong, nullable) NSDate *serverDate;
480@property(nonatomic, strong, nullable) NSDate *clientDate;
485@property(nonatomic, strong, nullable) NSDate *coinRestDate;
490@property(nonatomic, strong, nullable) NSDate *scratchResetDate;
495@property(nonatomic, strong, nullable) NSArray *scratchLineUp;
500@property(nonatomic, strong, nullable) NSArray<ScratchInfo *> *scratchInfoTable;
505@property(nonatomic, strong, readonly, nullable) NSArray *stampTable;
510@property(nonatomic, strong, nullable) NSString *sessionSeed;
511
516@property(nonatomic, assign) int coinLim;
521@property(nonatomic, assign) int coinNum;
526@property(nonatomic, assign) int nailNum;
531@property(nonatomic, assign) int jCubeNum;
536@property(nonatomic, assign, readonly) BOOL bInitialized;
541@property(nonatomic, assign, readonly) int presentNum;
546@property(nonatomic, assign, readonly) BOOL bItemDownload;
551@property(nonatomic, assign) int consumePlayCoin;
556@property(nonatomic, assign) int consumeScratchCube;
561@property(nonatomic, assign) int consumeRestCube;
568@property(nonatomic, assign, readonly) float phoneScreenRate;
573@property(nonatomic, strong, nullable) NSString *howtoURL;
578@property(nonatomic, strong, nullable) NSString *informationURL;
583@property(nonatomic, strong, readonly, nullable) NSString *personalInfoURL;
588@property(nonatomic, strong, readonly, nullable) NSArray *enableMissionSheets;
593@property(nonatomic, assign) double serverTimeDelay;
594
595@end
596
597NS_ASSUME_NONNULL_END
598
599// code: language=Objective-C
600// kate: hl Objective-C;
601// vim: set ft=objc :
A challenge mission sheet's identity, dates, reward, and mission tables.
Definition ChallengeMissionSheet.h:24
The scratch challenge-mode root container.
Definition ChallengeModeRootView.h:55
Shared state for the challenge mode, including the play-coin economy.
Definition ChallengeStatus.h:28
nullable ChallengeMissionSheet * getSelectedMissionSheet()
The currently selected mission sheet, looked up in the mission-file manager.
Definition ChallengeStatus.m:704
NSString * myName
The player's display name.
Definition ChallengeStatus.h:460
int coinLim
The maximum number of play coins.
Definition ChallengeStatus.h:516
NSString * mySearchID
The player's search identifier.
Definition ChallengeStatus.h:465
ChallengeModeRootView * rootView
The challenge-mode root view.
Definition ChallengeStatus.h:454
NSString * sessionSeed
The current play-session seed.
Definition ChallengeStatus.h:510
double serverTimeDelay
The measured client-to-server clock delay, in seconds.
Definition ChallengeStatus.h:593
BOOL bItemDownload
Whether the mission-reward items have been downloaded.
Definition ChallengeStatus.h:546
NSNumber * scratchID
The current scratch identifier.
Definition ChallengeStatus.h:470
NSString * personalInfoURL
The personal-information URL.
Definition ChallengeStatus.h:583
void missionRewardDownload()
Marks the mission-reward items as downloaded.
Definition ChallengeStatus.m:737
void resetStatus()
Clears the URLs, the initialisation flags, and the line-up image cache, and restores the economy defa...
Definition ChallengeStatus.m:151
NSArray * scratchLineUp
The current scratch line-up: an array of per-tune dictionaries.
Definition ChallengeStatus.h:495
NSArray * stampTable
The stamp table.
Definition ChallengeStatus.h:505
int consumePlayCoin
The play-coin consume cost.
Definition ChallengeStatus.h:551
void saveInformationURL()
Persists the current information URL to NSUserDefaults and clears the in-memory copy.
Definition ChallengeStatus.m:292
void updateScratchItemDir()
Clears the on-disk scratch data when the refresh flag is set, then clears the flag.
Definition ChallengeStatus.m:322
int presentNum
The number of unread presents shown on the menu's badge.
Definition ChallengeStatus.h:541
int coinNum
The number of play coins the player currently holds.
Definition ChallengeStatus.h:521
instancetype init()
Sets the initial economy defaults and computes the phone layout scale.
Definition ChallengeStatus.m:129
int nailNum
The scratch nail count.
Definition ChallengeStatus.h:526
int jCubeNum
The cube count.
Definition ChallengeStatus.h:531
int getSelectedMissionSheetID()
The currently selected mission sheet identifier.
Definition ChallengeStatus.m:732
NSDate * serverDate
The parsed server time.
Definition ChallengeStatus.h:475
NSDate * clientDate
The client time captured alongside the server time.
Definition ChallengeStatus.h:480
NSDate * scratchResetDate
The date the free-scratch allowance next resets.
Definition ChallengeStatus.h:490
int scratchablePanelNum()
The number of scratch panels not yet opened (those whose info entry has no music identifier).
Definition ChallengeStatus.m:625
int consumeScratchCube
The scratch-cube consume cost.
Definition ChallengeStatus.h:556
NSArray * enableMissionSheets
The enabled mission sheets, ordered by identifier.
Definition ChallengeStatus.h:588
void restCoinNum()
Advances the coin count and regeneration date for every fully regenerated coin.
Definition ChallengeStatus.m:452
BOOL bInitialized
Whether the challenge state has been loaded.
Definition ChallengeStatus.h:536
NSArray< ScratchInfo * > * scratchInfoTable
The scratch info table: one ScratchInfo per panel.
Definition ChallengeStatus.h:500
NSString * informationURL
The information URL.
Definition ChallengeStatus.h:578
void createCoinNotification()
Schedules the local notification announcing that play coins have refilled.
Definition ChallengeStatus.m:649
NSDate * coinRestDate
The moment the current coin's regeneration started.
Definition ChallengeStatus.h:485
ChallengeStatus * sharedStatus
The shared instance.
Definition ChallengeStatus.m:116
float phoneScreenRate
The phone's layout scale relative to the pad's.
Definition ChallengeStatus.h:568
int scratchOpenedPanelNum()
The number of scratch panels already opened (those whose info entry has a music identifier).
Definition ChallengeStatus.m:636
int consumeRestCube
The rest-cube consume cost.
Definition ChallengeStatus.h:561
void savePersionalInformationURL()
Persists the current personal-information URL to NSUserDefaults and clears the in-memory copy.
Definition ChallengeStatus.m:313
void clearLineupImage()
Empties the line-up image cache.
Definition ChallengeStatus.m:618
NSString * howtoURL
The how-to URL.
Definition ChallengeStatus.h:573
A scratch track resolved from the challenge line-up, with the player's score, rank,...
Definition ScratchInfo.h:18