LiSession Reference
Inherits From: NSObject
Declared In: LiSession.h
Overview
Class for managing user sessions and gameplay.
Tasks
Handling Sessions
+
sessionStart
+
sessionPause
+
sessionResume
+
sessionEnd
Handling Gameplay
+
gameStart:
+
gamePause
+
gameResume
+
gameFinishedWithResult:mainCurrencyBalance:secondaryCurrencyBalance:finalScore:andBonus:
Class Methods
sessionStart
A method to start a session.
+
(void) sessionStart;
Discussion:
Calling this method twice will override an existing session. It is recommended to call sessionStart in your application's application:didFinishLaunchingWithOptions: method.
sessionPause
A method to pause a session.
+
(void) sessionPause;
Discussion:
It is recommended to call sessionPause in your application's applicationDidEnterBackground: method, or whenever you know your application is losing focus.
sessionResume
A method to resume a previously paused session.
+
(void) sessionResume;
Discussion:
Resumes the last active session. If the break is longer than 15 seconds, Applicasa will execute sessionEnd. It is recommended to call sessionResume whenever you know your application has regained focus/foreground state—such as in applicationWillEnterForeground: or applicationDidBecomeActive:.
sessionEnd
A method to finish a session.
+
(void) sessionEnd;
Discussion:
Under normal circumstances, this function will only be called when explicitly asked for. However, there are conditions where the OS may terminate the app, triggering sessionEnd to execute if it has been included in such methods as applicationWillTerminate: or applicationWillResignActive:.
gameStart:
A method to start a new game.
+
(void) gameStart:(NSString *)gameName;
Discussion:
Only one game may be managed at any given time. If gameStart: is called more than once, the currently active game will be finished without parameters provided indicating a user's progress.
gamePause
A method to pause a currently active game.
+
(void) gamePause;
gameResume
A method to resume a paused game.
+
(void) gameResume;
gameFinishedWithResult:mainCurrencyBalance:secondaryCurrencyBalance:finalScore:andBonus:
A method to finish a game, providing additional data to inidicate a user's progress.
+
(void) gameFinishedWithResult:(LiGameResult)gameResult mainCurrencyBalance:(NSInteger)mainBalance secondaryCurrencyBalance:(NSInteger)secondaryBalance finalScore:(NSInteger)score andBonus:(NSInteger)bonus;
Parameters:
gameResult
An LiGameResult enum value indicating the result of the user's playthrough. Available values are LiGameResultLose and LiGameResultWin.
mainBalance
An NSInteger value indicating the user's ending main currency balance.
secondaryBalance
An NSInteger value indicating the user's ending secondary currency balance.
score
An NSInteger value indicating the user's final score at game's end.
bonus
An NSInteger value indicating any potential bonus score granted to the user at game's end.