搜索结果
返回
最后更新时间: 2021-02-04 03:12:47 PM
Before integration, please make sure you have downloaded the latest version of SuperSDK4.0+Demo (Object-c version).。
Copy all the static libraries and SuperSDK.bundle in the download SDK to the project development directory, then drag and drop them to the project directory, as shown in the following dialog box (note the check), and click Finish.
BaseCore.a base library with statistics and configuration module code, must be imported, the following libraries are dependent on this library
SuperSDK.framework SuperSDK external library, including platform module (platform), and external interface
SuperSdkImp.a SuperSDK orginal package, simulation channel running environment for testing, can be deleted when packaging channel package
SuperSDK.bundle SuperSDK resource configuration file
In the info.plist file of the project, add a value to identify the SuperSDK version code. The key is sp_version, and the corresponding value is the version of currently connected SuperSDK.framework.
For the version code of SuperSDK.framework, please see the README.txt in the downloaded resource bundle.
Add the following dependency libraries in Xcode -> Target -> Build Phrases -> Link Binary WithLibraries:
Foundation.framework
UIKit.framework
AdSupport.framework
SystemConfiguration.framework
CoreTelephony.framework
libstdc++.6.tbd
libsqlite3.tbd
(Note: Change the status of AdSupport.framework to optional)
In the project configuration, find the Linking section, modify the Other Linker Flags, and add -ObjC.
##Add an orginal package configuration
Download the orginal package configuration from the packaging tool and add (replace) it to SuperSDK.bundle as shown below.
#import <SuperSDK/SuperSDK.h>
Interface Description: Invoking this interface will initialize each SuperSDK modules.
Interface definition: The game must be invoked synchronously in the AppDelegate lifecycle method - application: didFinishLaunchingWithOptions:. The game must be paused when invoking. Receiving successful callback of the platform module can be considered as successful and the game can resume running.
+ (void)init:(SuperSDKCallback)callbackBlock;
Interface invoke:
[SuperSDK init:^(NSString *moduleName, NSString *funcName, NSString *result) {
// 设置回调block,将回调交给中间类处理,这里是让viewController对象直接处理
[viewController handlerCallback:moduleName funcName:funcName result:result];
}];
Interface callback:
- (void)handlerCallback:(NSString *)moduleName funcName:(NSString *)funcName result:(NSString *)result {
// 处理SuperSDK回调逻辑,注意,所有模块回调都在这里。
NSLog(@"****** 收到回调\n moduleName : %@,\n funcName : %@,\n result : %@", moduleName, funcName, result);
// 1.回调参数解析
NSDictionary *retParam = nil;
if (result) {
NSData *jsonData = [result dataUsingEncoding:NSUTF8StringEncoding];
if (jsonData) {
retParam = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableLeaves error:nil];
}
}
int code = [[retParam objectForKey:@"code"] intValue]; // 状态码
NSString *msg = [retParam objectForKey:@"msg"]; // 说明
// 2.回调参数判断
if ([moduleName isEqualToString:BCORE_MODULE_PLATFORM]) {// 平台模块回调
if ([funcName isEqualToString:BCORE_FUNC_INIT]) {// 初始化回调
NSLog(@"********初始化结束回调********");
if (code == BCORE_SUCCESS) {
NSLog(@"********初始化成功********");
}
else {
NSLog(@"********初始化失败,游戏无法在进行下去********");
}
}
}
}
Callback log printing:
2017-06-27 17:42:02.115 Demo_Mubao[6255:992012] ****** 收到回调
moduleName : platform,
funcName : init,
result : {
"msg" : "初始化成功",
"code" : 1
}
As shown in the following table:
String constant | Actual string | Description |
---|---|---|
平台模块常量 | ||
BCORE_MODULE_PLATFORM | platform | Module name, fixed per module constant name |
BCORE_FUNC_INIT | init | initialization |
BCORE_FUNC_LOGIN | login | login |
BCORE_FUNC_HAS_LOGOUT | hasLogout | Whether the channel has a logout interface |
BCORE_FUNC_LOGOUT | logout | Logout |
BCORE_FUNC_PAY | pay | Pay |
BCORE_FUNC_PAY_ORDER_ID | payOrderId | Pay to get the successful order |
BCORE_FUNC_ENTER_GAME | enterGame | enter the game |
BCORE_FUNC_CREATE_ROLE | createRole | Creating a Role |
BCORE_FUNC_LEVEL_UP | levelUp | Role upgrade |
BCORE_FUNC_HAS_FORUM | hasForum | Determine if there is a forum |
BCORE_FUNC_OPEN_FORUM | openForum | Open forum |
BCORE_FUNC_HAS_USER_CENTER | hasUserCenter | Determine if there is a user center |
BCORE_FUNC_OPEN_USER_CENTER | openUserCenter | Open the user center |
BCORE_FUNC_HAS_CUSOMER_SERVICE | hasCustomerService | Determine if there is customer service |
BCORE_FUNC_OPEN_CUSOMER_SERVICE | openCustomerService | Open customer service |
BCORE_FUNC_OPEN_LOGIN_PAGE | openLoginPage | Go to the login page |
BCORE_FUNC_OPEN_HOME_PAGE | openHomePage | Enter the game homepage |
BCORE_FUNC_HAS_GUEST | hasGuest | Whether the user is a guest |
BCORE_FUNC_GUEST_UPGRADE | guestUpgrade | guest upgrade |
BCORE_FUNC_OTHER_FUNCTION | otherFunction | Extension interface other |
统计模块常量 | ||
BCORE_MODULE_STATS | stats | Module name |
BCORE_FUNC_REPORT | report | Statistical report |
工具模块常量 | ||
BCORE_MODULE_TOOLS | tools | Module name |
BCORE_FUNC_GET_CLIENT_IP_INFO | getClientIPInfo | Obtain client IP information, such as ip area |
BCORE_FUNC_GET_LANGUAGE | getLanguage | Get the language of the current device |
BCORE_FUNC_GET_COUNTRY | getCountry | Get the country of the current device settings |
BCORE_FUNC_CopyToClipboard | copyToClipboard | Copy text to clipboard |
BCORE_FUNC_ALERT | alert | Pop-ups |
BCORE_FUNC_GET_PACKAGE_NAME | getPackageName | Get the application package name |
BCORE_FUNC_GET_APP_NAME | getAppName | Get app name |
BCORE_FUNC_GET_SHORT_VERSION | getShortVersion | Get short version |
BCORE_FUNC_GET_BUILD_VERSION | getBuildVersion | Get build version |
BCORE_FUNC_GET_INFO_PLIST_VALUE | getInfoPlistValue | Get the string data corresponding to the info.plist key |
BCORE_FUNC_SetScreenLight | setScreenLight | Adjust screen brightness |
BCORE_FUNC_SAVE_DATA | saveData | save data |
BCORE_FUNC_GET_DATA | getData | Get saved data |
BCORE_FUNC_GET_DEVICEID | getDeviceId | Get device ID |
BCORE_FUNC_GET_COLLECTIONDATA | getCollectionData | Get data collected by device |
BCORE_FUNC_JailBreak | isJailBreak | Whether the device is jailbroken |
Configuration module constant | ||
BCORE_MODULE_CONFIG | config | Module name |
BCORE_FUNC_GET_VALUE | getValue | Get configuration information, including gameId |
Advertising module constant | ||
BCORE_MODULE_ADVERT | advert | Module name |
BCORE_FUNC_TRACK | track | Trigger an ad event |
Youzu module constant | ||
BCORE_MODULE_YOUZU | youzu | Module name |
BCORE_FUNC_GET_VALUE | getValue | Get configuration, including opId, opGameId |