Channel/Android/qkbt3game/AndroidManifest.xml
New file @@ -0,0 +1,21 @@ <?xml version="1.0" encoding="utf-8"?> <!-- GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN--> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" xmlns:tools="http://schemas.android.com/tools"> <application android:allowNativeHeapPointerTagging="false"> <activity android:name="com.secondworld.sdk.SplashActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="com.secondworld.sdk.GameActivity" android:theme="@style/UnityThemeSelector"> <meta-data android:name="unityplayer.UnityActivity" android:value="true" /> </activity> </application> </manifest> Channel/Android/qkbt3game/debug/libs/library-debug-qkbt3game.aarBinary files differ
Channel/Android/qkbt3game/deps.gradle
New file @@ -0,0 +1,4 @@ //此脚本为渠道的第三方远程依赖库配置,会复制到unity中用于构建 dependencies { } Channel/Android/qkbt3game/release/libs/library-release-qkbt3game.aarBinary files differ
Channel/IOS/qkbt3game/Plugins/QuickSDK/SMPCQuickSDK.framework/Headers/SMPCQuickSDK.h
New file @@ -0,0 +1,196 @@ // // SMPCQuickSDK.h // // // // #define SMPC_QUICK_SDK_VERSION @"2.4.6" //QuickSDK基础库版本 #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #import "SMPCQuickSDKDefines.h" #import "SMPCQuickSDKInitConfigure.h" #import "SMPCQuickSDKPayOrderInfo.h" #import "SMPCQuickSDKGameRoleInfo.h" #import "SMPCQuickSDKShareInfo.h" #pragma mark 基本信息 @interface SMPCQuickSDK : NSObject #pragma mark 单例对象 + (SMPCQuickSDK *)defaultInstance; #pragma mark 获取渠道基本信息 //获取渠道唯一标识,与服务器端channelID一致,任何时刻都可调用 - (int)channelType; @end #pragma mark - 初始化 接入产品信息 @interface SMPCQuickSDK(Base) #pragma mark 初始化 /** @brief 应用初始化 完成后会发送通知kSmpcQuickSDKNotiInitDidFinished @param configure 初始化配置类,SDK会优先使用打包工具上在线配置的productCode @result 错误码 @note 必接 */ - (int)initWithConfig:(SMPCQuickSDKInitConfigure *)configure application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; /** @brief 调用组件功能,参数请看对应组件接入文档 */ - (int)callPlug:(NSString *)name params:(NSArray *)args; @end #pragma mark - 用户部分 登录 注册 登出 @interface SMPCQuickSDK(Account) /** @brief 登录接口 ,登录后会发送kSmpcQuickSDKNotiLogin通知 @result 错误码 @note 必接 */ - (int)login; /** @brief 登出接口 代码调用注销 @result 错误码 @note 成功调用该接口后,SDK会发出kSmpcQuickSDKNotiLogout通知 */ - (int)logout; // 登录后获取用户uid,这个uid在渠道上唯一,多个渠道的用户uid可能重复 - (NSString *)userId; // 登录后获取userToken可用于验证用户信息 - (NSString *)userToken; // 登录后获取用户昵称 - (NSString *)userNick; /** 查询渠道实名认证信息 */ - (NSDictionary *)realNameInfo; /** @brief 调用渠道实名认证 @result 错误码若渠道没有提供此方法会返回非0 @note 结果会发送kSmpcQuickSDKNotiRealAuth通知 */ - (int)realAuth; #pragma mark - 更新角色信息 // 进入游戏角色,角色信息变更时调用(比如升级),请使用updateRoleInfoWith:isCreate: - (void)updateRoleInfoWith:(SMPCQuickSDKGameRoleInfo *)info; //// 创建角色、进入游戏角色、角色信息变更时调用(比如升级,isCreate表示是否为创建角色 - (void)updateRoleInfoWith:(SMPCQuickSDKGameRoleInfo *)info isCreate:(BOOL)isCreate; @end //MARK:- 充值 @interface SMPCQuickSDK(Pay) /** @brief 商品购买 * @param orderInfo * @param roleInfo @result 错误码 */ - (int)payOrderInfo:(SMPCQuickSDKPayOrderInfo *)orderInfo roleInfo:(SMPCQuickSDKGameRoleInfo *)roleInfo; /** @brief 商品信息 * @param productId 商品id */ -(void)Getlocalized:(NSString *)productIds; @end #pragma mark - 界面控制 @interface SMPCQuickSDK(UISetting) #pragma mark 浮动条 /** @brief showToolBar: @brief 浮动工具栏,建议显示在左上角 @result 错误码 @note */ - (int)showToolBar:(SMPC_QUICK_SDK_TOOLBAR_PLACE)place; //隐藏浮动工具栏 - (int)hideToolBar; @end @interface SMPCQuickSDK(Extend) // 获取QuicSDK后台为渠道添加的自定义键值,任何时刻都可调用 // 如果没有将返回nil - (NSString *)getConfigValue:(NSString *)key; /** @brief isFunctionSupported: @brief 判断当前渠道是否实现了QuickSDK提供的某个接口 @brief 如果当前渠道没有实现相应接口,就没有相应接口的回调 @brief 例如渠道SDK没有实现pausedGame这个接口,即使调用了pausedGame,没有暂停恢复通知,因为pausedGame调用无效 @result 是否 @note */ - (BOOL)isFunctionTypeSupported:(SMPC_QUICK_SDK_FUNC_TYPE)type; /** @brief 进入用户中心 如用户注销登录会发送kSmpcQPLogoutNotification(可多次触发) @result 错误码 */ - (int)enterUserCenter; /** 进入YunKefu @param gameRoleInfo @result 错误码 */ - (int)enterYunKeFuCenter:(SMPCQuickSDKGameRoleInfo *)gameRoleInfo; #pragma mark 分享 /** 分享 @param shareInfo shareInfo description @result 错误码 */ - (int)callSDKShare:(SMPCQuickSDKShareInfo *)shareInfo; //***********************应用生命周期的回调*******************// //在应用对应的生命周期回调中调用 /** @brief - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url; @brief - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(nullable NSString *)sourceApplication annotation:(id)annotation @brief - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options @brief 渠道处理应用跳转 @result 错误码 @note 必接 */ - (int)openURL:(NSURL *)url application:(UIApplication *)application; - (int)openURL:(NSURL *)url sourceApplication:(NSString *)sourceApp application:(UIApplication *)application annotation:(id)annotation; - (int)openURL:(NSURL *)url application:(UIApplication *)app options:(NSDictionary <NSString *, id>*)options; /** @brief application:didRegisterForRemoteNotificationsWithDeviceToken: @brief 推送消息 @result 错误码 @note 必接 */ - (int)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken; /** @brief application:didFailToRegisterForRemoteNotificationsWithError: @brief 推送消息 @result 错误码 @note 必接 */ - (int)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error; - (int)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo; - (int)applicationWillResignActive:(UIApplication *)application; - (int)applicationDidEnterBackground:(UIApplication *)application; - (int)applicationWillEnterForeground:(UIApplication *)application; - (int)applicationDidBecomeActive:(UIApplication *)application; - (int)applicationWillTerminate:(UIApplication *)application; - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window; - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray * restorableObjects))restorationHandler; @end Channel/IOS/qkbt3game/Plugins/QuickSDK/SMPCQuickSDK.framework/Headers/SMPCQuickSDKDefines.h
New file @@ -0,0 +1,90 @@ // // SMPCQuickSDKDefines.h // QuickSDKs // // // #ifndef SMPCQuickSDKDefines_h #define SMPCQuickSDKDefines_h #pragma mark - Notification Name extern NSString* const kSmpcQuickSDKNotiInitDidFinished; //初始化成功 extern NSString* const kSmpcQuickSDKNotiLogin; //登录成功 切换账号成功也会回调这个 extern NSString* const kSmpcQCGetLocalizedNotification; //查询接商品信息的通知 extern NSString* const kSmpcQuickSDKNotiLogout; //用户注销 extern NSString* const kSmpcQuickSDKNotiRecharge; //充值结果 extern NSString* const kSmpcQuickSDKNotiPauseOver; //暂停结束 这个回调可以不用监听 extern NSString * const kSmpcQuickSDKNotiPlugin; /*组件通知 见该插件接入文档,默认可以不用监听*/ extern NSString* const kSmpcQuickSDKNotiRealAuth; //实名认证结果通知 #define QUICK_CHANNEL_TO_CP_NOTIFICATON_KEY @"quick_channel_to_cp_notification_key" //QUICK_CHANNEL_TO_CP_NOTIFICATON_KEY这个键定义了QuickSDK标准接口不能提供更多的信息给cp那边时的传输方案,这个通知带上渠道SDK需要传递到cp的信息.通常不需要,遇到了再讨论 #pragma mark - 通知userInfo中的重要key 错误和信息 extern NSString* const kSmpcQuickSDKKeyError; /*Notification userinfo error Key */ extern NSString* const kSmpcQuickSDKKeyMsg; /*Notification userinfo msg Key */ // 订单号 #define kSmpcQuickSDKKeyOrderId @"orderId" // 游戏开发商给的订单号 #define kSmpcQuickSDKKeyCpOrderId @"cpOrderId" // 第3方渠道sdk给的订单号 #define kSmpcQuickSDKKeySdkOrderId @"sdkOrderId" // 透传参数 #define kSmpcQuickSDKKeyExtraParams @"extraParams" // user_token #define kSmpcQuickSDKKeyUserToken @"user_token" /** 实名认证回调是否已实名 YES:已认证NO:未认证*/ #define kSmpcQuickSDKKeyRealName @"realName" /** 实名认证后年龄 */ #define kSmpcQuickSDKKeyRealAge @"age" /** 渠道实名认证失败是否可以继续游戏 YES:可以 NO:不可以 */ #define kSmpcQuickSDKKeyRealResumeGame @"resumeGame" /** 实名认证预留字段 */ #define kSmpcQuickSDKKeyRealOther @"other" #pragma mark - 浮动条位置 Enum typedef enum { SMPC_QUICK_SDK_TOOLBAR_TOP_LEFT = 1, /* 左上 */ SMPC_QUICK_SDK_TOOLBAR_TOP_RIGHT = 2, /* 右上 */ SMPC_QUICK_SDK_TOOLBAR_MID_LEFT = 3, /* 左中 */ SMPC_QUICK_SDK_TOOLBAR_MID_RIGHT = 4, /* 右中 */ SMPC_QUICK_SDK_TOOLBAR_BOT_LEFT = 5, /* 左下 */ SMPC_QUICK_SDK_TOOLBAR_BOT_RIGHT = 6, /* 右下 */ }SMPC_QUICK_SDK_TOOLBAR_PLACE; #pragma mark - 错误码 typedef enum { SMPC_QUICK_SDK_ERROR_NONE = 0, /* 没有错误 */ SMPC_QUICK_SDK_ERROR_UNKNOWN = -1, /* 未知错误 */ SMPC_QUICK_SDK_ERROR_NETWORK = -2, /* 网络连接错误 */ SMPC_QUICK_SDK_ERROR_CHECKFAILED = -3, /* 登录校验失败 */ SMPC_QUICK_SDK_ERROR_CHECKLOGINING = -4, /* 正在校验登录 */ SMPC_QUICK_SDK_ERROR_PARAM = -10, /* 参数错误 */ SMPC_QUICK_SDK_ERROR_NOT_INIT = -20, /* 还没有初始化 */ SMPC_QUICK_SDK_ERROR_INIT_FAILED = -21, /* 初始化失败*/ SMPC_QUICK_SDK_ERROR_UNSUPPORTED = -100, /* 功能不被支持 */ SMPC_QUICK_SDK_ERROR_NOT_LOGIN = -301, /* 没有登录用户 */ SMPC_QUICK_SDK_ERROR_HAD_LOGIN = -302, /* 已有登录用户 */ SMPC_QUICK_SDK_ERROR_LOGOUT_FAIL = -303, /* 用户登出失败 */ SMPC_QUICK_SDK_ERROR_RECHARGE_FAILED = -400, /* 充值失败 */ SMPC_QUICK_SDK_ERROR_RECHARGE_CANCELLED = -401, /* 用户充值取消 */ }SMPC_QUICK_SDK_ERROR_CODE; typedef enum { SMPC_QUICK_SDK_FUNC_TYPE_PAUSED_GAME = 1, /*暂停游戏*/ SMPC_QUICK_SDK_FUNC_TYPE_ENTER_USER_CENTER = 2, /*进入用户中心*/ SMPC_QUICK_SDK_FUNC_TYPE_ENTER_BBS = 3, /*进入论坛*/ // SMPC_QUICK_SDK_FUNC_TYPE_OPEN_URL = 4, SMPC_QUICK_SDK_FUNC_TYPE_SHOW_TOOLBAR = 5, /*显示浮动工具栏*/ SMPC_QUICK_SDK_FUNC_TYPE_HIDE_TOOLBAR = 6, /*隐藏浮动工具栏*/ SMPC_QUICK_SDK_FUNC_TYPE_ENTER_CUSTOMER_CENTER = 7, /*进入客服中心*/ }SMPC_QUICK_SDK_FUNC_TYPE; #endif Channel/IOS/qkbt3game/Plugins/QuickSDK/SMPCQuickSDK.framework/Headers/SMPCQuickSDKGameRoleInfo.h
New file @@ -0,0 +1,23 @@ // // SMPCQuickSDKGameRoleInfo.h // SMPCQuickSDK // // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> @interface SMPCQuickSDKGameRoleInfo : NSObject @property (nonatomic,copy) NSString *serverId; //服务器Id,必填 @property (nonatomic,copy) NSString *serverName; //服务器名称,必填 @property (nonatomic,copy) NSString *gameRoleName; //角色名,必填 @property (nonatomic,copy) NSString *gameRoleID; //角色ID,必填 @property (nonatomic,copy) NSString *gameUserBalance; //玩家虚拟货币余额,必填,可随意 @property (nonatomic,copy) NSString *vipLevel; //玩家vip等级,必填,可随意 @property (nonatomic,copy) NSString *gameUserLevel; //玩家等级,必填,可随意 @property (nonatomic,copy) NSString *partyName; //公会名称,必填,可随意 @property (nonatomic, copy) NSString * creatTime; //角色创建时间(10位时间戳),必填,没有传0 @property (nonatomic, copy) NSString * fightPower; //战力,可不传 @property (nonatomic, copy) NSString * profession; //角色职业, 可不传 @end Channel/IOS/qkbt3game/Plugins/QuickSDK/SMPCQuickSDK.framework/Headers/SMPCQuickSDKInitConfigure.h
New file @@ -0,0 +1,17 @@ // // SMPCQuickSDKInitConfigure.h // SMPCQuickSDK // // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> @interface SMPCQuickSDKInitConfigure : NSObject @property (nonatomic, copy) NSString *productCode; //QuickSDK提供的 product_code @property (nonatomic, copy) NSString *productKey; //QuickSDK提供的 product_token @end Channel/IOS/qkbt3game/Plugins/QuickSDK/SMPCQuickSDK.framework/Headers/SMPCQuickSDKPayOrderInfo.h
New file @@ -0,0 +1,27 @@ // // SMPCQuickSDKPayOrderInfo.h // SMPCQuickSDK // // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> @interface SMPCQuickSDKPayOrderInfo : NSObject @property(nonatomic,copy) NSString *goodsID; //商品ID IAP时为苹果开发者后台配置的商品id,必填 @property(nonatomic,copy) NSString *productName; //商品名称,必填 @property(nonatomic,copy) NSString *cpOrderID; //游戏订单ID,必填 @property(nonatomic,assign) NSUInteger count; //商品数量,必填 @property(nonatomic,assign) float amount; //商品总价,必填,这个很重要 @property(nonatomic,copy) NSString *callbackUrl; //购买回调地址,选填,优先使用服务器端配置的 @property(nonatomic,copy) NSString *extrasParams; //透传字段,选填,服务器回调原样传递 //deprecated 废弃的,可以不传值 @property(nonatomic,assign) float price; //商品单价,选填,如果渠道需要,Quick将通过总价和数量来计算 @property(nonatomic,copy) NSString *productDesc; //商品描述,选填,默认QuickSDK使用“数量+商品名称“拼接,如果数量为1,使用商品名称 @property(nonatomic,copy) NSString *quantifier; //商品量词,选填,可以为@""空串 + (instancetype)info;//获取一个对象属性值为nil,数值属性为0的实例 @end Channel/IOS/qkbt3game/Plugins/QuickSDK/SMPCQuickSDK.framework/Headers/SMPCQuickSDKShareInfo.h
New file @@ -0,0 +1,28 @@ // // SMPCQuickSDKShareInfo.h // SMPCQuickSDK // // Created by xiaoxiao on 2019/2/19. // #import <Foundation/Foundation.h> @interface SMPCQuickSDKShareInfo : NSObject @property (nonatomic, strong) NSString *type; //分享类型 1.facebook分享连接 2.facebook分享图片 3.微信分享文本 4.微信分享图片 @property (nonatomic, strong) NSString *title; //分享标题 @property (nonatomic, strong) NSString *content; //分享内容 @property (nonatomic, strong) NSString *imgPath; //分享图片本地地址 @property (nonatomic, strong) NSString *filePath; //分享文件路径 @property (nonatomic, strong) NSString *imgUrl; //分享图片网络地址 @property (nonatomic, strong) NSString *sencetype; //发送场景 0 聊天界面,1 朋友圈,2 收藏 @property (nonatomic, strong) NSString *url; //分享链接 @property (nonatomic, strong) NSString *shareTo; //分享到哪里 @property (nonatomic, strong) NSString *extenal; //额外备注 @property (nonatomic, assign) float width; //缩略图宽 @property (nonatomic, assign) float height; //缩略图高 @end Channel/IOS/qkbt3game/Plugins/QuickSDK/SMPCQuickSDK.framework/SMPCQuickSDKBinary files differ
Channel/IOS/qkbt3game/Plugins/QuickSDK/libSMPCQuickChannel.aBinary files differ
Channel/IOS/qkbt3game/Plugins/The2thWorldSDK/The2thWorldRES.bundle/TY_AN_34.png
Channel/IOS/qkbt3game/Plugins/The2thWorldSDK/The2thWorldRES.bundle/The2thWorldSDKConfig.plist
New file @@ -0,0 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>JPush_AppKey</key> <string>111a5f817592ddc68edc802c</string> <key>TTTrack_AppID</key> <string>155761</string> <key>TrackingIO_AppKey</key> <string>12aef4c284c6996703765fe9f7422428</string> </dict> </plist> Channel/IOS/qkbt3game/Plugins/The2thWorldSDK/UniversalSDK.h
New file @@ -0,0 +1,78 @@ // // UniversalSDK.h // Unity-iPhone // // Created by 蔡瀚 on 2018/4/24. // #ifndef __UNIVERSALSDK_H_ #define __UNIVERSALSDK_H_ #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #define UNITY_OBJ_NAME "SDKUtility" #define UNITY_FUNC_NAME "HandleSdkMessage" #define PRODUCT_CODE @"40450025922275820036898902533267" #define PRODUCT_KEY @"31232581" #define S2U_BatteryLevel 1 #define S2U_BatteryCharging 2 #define S2U_SdkInitComplete 3 #define S2U_DeviceInfo 4 #define S2U_PushClientID 5 #define S2U_FreePlatformInitOk 100 #define S2U_FreePlatformInitFail 101 #define S2U_FreePlatformLoginOk 102 #define S2U_FreePlatformLoginFail 103 #define S2U_FreePlatformLoginCancel 104 #define S2U_FreePlatformLogoutOk 105 #define S2U_FreePlatformLogoutFail 106 #define S2U_FreePlatformSwitchAccountOk 107 #define S2U_FreePlatformPayOk 108 #define S2U_FreePlatformPayFail 109 #define S2U_FreePlatformPayCancel 110 #define S2U_FreePlatformRegisterOk 111 #define U2S_BatteryListenStart 1 #define U2S_BatteryListenStop 2 #define U2S_CopyContent 7 #define U2S_OpenWebView 8 #define U2S_Init 9 #define U2S_FreePlatformInit 100 #define U2S_FreePlatformLogin 101 #define U2S_FreePlatformLogout 102 #define U2S_FreePlatformSwitchAccount 103 #define U2S_FreePlatformPay 104 #define U2S_PayFinished 105 #define U2S_CreateRole 106 #define U2S_RoleLogin 107 #define U2S_RoleLevelUp 108 #define U2S_JPushAddLocalMessage 200 #define U2S_JPushRemoveLocalMessage 201 #define U2S_MakeKeyAndVisible 300 #define U2S_SendRegistEvent 500 #define U2S_SendLoginEvent 600 #define KIsiPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO) static BOOL JPush_IsProduction = FALSE; @interface UniversalSDK : NSObject { UIWebView* m_UIWebView; UIButton* m_CloseBtn; } -(void) HandleUnityMessage:(NSString*) json; -(void) Init; -(id) APNativeJSONObject:(NSData*) data; -(NSData*) APNativeJSONData:(id) obj; -(void) RemoveLocalNotificationWithIdentifierKey:(NSString*) idKey; -(void) QuickSDKInit:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; @end #endif Channel/IOS/qkbt3game/Plugins/The2thWorldSDK/UniversalSDK.mm
New file @@ -0,0 +1,561 @@ // // UniversalSDK.m // Unity-iPhone // // Created by 蔡瀚 on 2018/4/24. // #import "UniversalSDK.h" #import "AdSupport/AdSupport.h" #import "opus.h" #ifdef NSFoundationVersionNumber_iOS_9_x_Max #import <UserNotifications/UserNotifications.h> #endif #import "SystemConfiguration/CaptiveNetwork.h" #import <SMPCQuickSDK/SMPCQuickSDK.h> @interface UniversalSDK()<UIWebViewDelegate> @end @implementation UniversalSDK #define CHANNEL_NUM 1 static int s_frequency = 16000; static int s_bitRate = 20000; static int s_bandMode = OPUS_BANDWIDTH_WIDEBAND; static int s_frameSize = 160; static int sBatteryLevel = -1; static int sBatteryState = -1; static NSString* sAppID; static NSString* sGameID; static NSString* sUserName; static NSThread* _thread; -(void) Init { UIDevice *_device = [UIDevice currentDevice]; _device.batteryMonitoringEnabled = true; NSString* _uniqueID = [[NSUserDefaults standardUserDefaults] objectForKey:@"tsw_unique_id"]; //获取IDFA NSString* _idfa = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]; if(_uniqueID == NULL || [_uniqueID length] <= 0) { //判断IDFA是否为空 BOOL isEmpty = [[_idfa stringByReplacingOccurrencesOfString:@"-" withString:@""] stringByReplacingOccurrencesOfString:@"0" withString:@""].length; if (isEmpty) { //不为空,将IDFA作为唯一标识 _uniqueID = _idfa; } else { //为空,获取UUID作为唯一标识 _uniqueID = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; } //保存唯一设备标识,如已存在则不进行任何处理 [[NSUserDefaults standardUserDefaults] setObject:_uniqueID forKey:@"tsw_unique_id"]; [[NSUserDefaults standardUserDefaults] synchronize]; } // 取得UserAgent UIWebView* _webView = [[UIWebView alloc] initWithFrame:CGRectZero]; NSString* _userAgent = [_webView stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"]; // 发送设备信息 NSMutableDictionary *_dict = [NSMutableDictionary dictionaryWithObjectsAndKeys: _uniqueID,@"unique_id", _idfa,@"android_id", [NSNumber numberWithInt:S2U_DeviceInfo],@"code", _userAgent,@"userAgent",nil]; [self SendMessageToUnity:_dict]; } -(void)SendMessageToUnity:(NSDictionary*)dict { BOOL _result = [NSJSONSerialization isValidJSONObject:dict]; if(_result) { NSData* _jsonData = [NSJSONSerialization dataWithJSONObject:dict options:0 error:NULL]; UnitySendMessage(UNITY_OBJ_NAME, UNITY_FUNC_NAME, [[[NSString alloc] initWithData:_jsonData encoding:NSUTF8StringEncoding] UTF8String]); } } -(void) BatteryThread { while (TRUE) { [NSThread sleepForTimeInterval:1]; UIDevice *_device = [UIDevice currentDevice]; int _state = [_device batteryState]; if(_state != sBatteryState){ sBatteryState = _state; NSDictionary *_dict = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:sBatteryState], @"status", [NSNumber numberWithInt:S2U_BatteryCharging], @"code", nil]; [self SendMessageToUnity:_dict]; } int _level = (int)([_device batteryLevel] * 100); if(_level != sBatteryLevel){ sBatteryLevel = _level; NSDictionary *_dict = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:sBatteryLevel], @"level", [NSNumber numberWithInt:S2U_BatteryLevel], @"code", nil]; [self SendMessageToUnity:_dict]; } } } -(void) OpenURL:(NSString*) url { if(m_UIWebView != NULL) { [self btnClick:NULL]; return; } CGRect _bounds = UnityGetMainWindow().bounds; float _scale = _bounds.size.width / 1334; float _width = 982 * _scale; float _height = 560 * _scale; float _offsetX = (_bounds.size.width - _width) * .5f; float _offsetY = (_bounds.size.height - _height) * .5f; m_UIWebView = [[UIWebView alloc] initWithFrame:CGRectMake(_offsetX, _offsetY, _width, _height)]; m_UIWebView.delegate = self; m_UIWebView.scalesPageToFit = YES ; m_UIWebView.scrollView.scrollEnabled = YES; m_UIWebView.scrollView.bounces = NO; NSURLRequest *request =[NSURLRequest requestWithURL:[NSURL URLWithString:url]]; [m_UIWebView loadRequest:request]; } -(void) btnClick:(UIButton*)sender { [m_CloseBtn removeFromSuperview]; [m_CloseBtn removeTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside]; m_CloseBtn = NULL; NSURLCache *_cache = [NSURLCache sharedURLCache]; [_cache removeAllCachedResponses]; [_cache setDiskCapacity:0]; [_cache setMemoryCapacity:0]; [m_UIWebView removeFromSuperview]; m_UIWebView = NULL; } -(void)webViewDidStartLoad:(UIWebView *)webView{ } -(void)webViewDidFinishLoad:(UIWebView *)webView{ [UnityGetMainWindow().rootViewController.view addSubview:m_UIWebView]; CGRect _bounds = UnityGetMainWindow().bounds; float _scale = _bounds.size.width / 1334; float _width = 982 * _scale; float _height = 560 * _scale; m_CloseBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [m_CloseBtn setFrame:CGRectMake(_width - 455 * _scale, _height - 86 * _scale, 180 * _scale, 72 * _scale)]; [m_CloseBtn setTitle:@"我知道了" forState:UIControlStateNormal]; NSString *_bundlePath = [[NSBundle mainBundle] pathForResource:@"The2thWorldRES.bundle" ofType:nil]; NSBundle *_bundle = [NSBundle bundleWithPath:_bundlePath]; NSString *pic1Path = [_bundle pathForResource:@"TY_AN_34.png" ofType:nil]; [m_CloseBtn setBackgroundImage:[UIImage imageWithContentsOfFile:pic1Path] forState:UIControlStateNormal]; [m_CloseBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; [m_CloseBtn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside]; [m_UIWebView addSubview:m_CloseBtn]; } -(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{ } -(void)QuickSDKInit:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // 监听初始化 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(smpcQpInitResult:) name:kSmpcQuickSDKNotiInitDidFinished object:nil]; // 监听登录 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(smpcQpLoginResult:) name:kSmpcQuickSDKNotiLogin object:nil]; // 监听注销 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(smpcQpLogoutResult:) name:kSmpcQuickSDKNotiLogout object:nil]; // 监听充值结果 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(smpcQpRechargeResult:) name:kSmpcQuickSDKNotiRecharge object:nil]; // --------------------- 初始化 -------------------------- SMPCQuickSDKInitConfigure *cfg = [[SMPCQuickSDKInitConfigure alloc] init]; cfg.productKey = PRODUCT_KEY; cfg.productCode = PRODUCT_CODE; [[SMPCQuickSDK defaultInstance] initWithConfig:cfg application:application didFinishLaunchingWithOptions:launchOptions]; // ------------------------------------------------------ } - (void)smpcQpInitResult:(NSNotification *)notify { NSLog(@"init result:%@",notify); NSDictionary *userInfo = notify.userInfo; int errorCode = [userInfo[kSmpcQuickSDKKeyError] intValue]; switch (errorCode) { case SMPC_QUICK_SDK_ERROR_NONE: { NSLog(@"初始化成功"); // NSString *_appid = [[SMPCQuickSDK defaultInstance] getConfigValue:@"zfappid"]; // if (_appid == nil || [_appid isEqualToString:@""]) // { // _appid = sAppID; // } NSString *_appid = sAppID; NSLog(@"init _appid:%@",_appid); NSMutableDictionary *_dict = [NSMutableDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:S2U_SdkInitComplete], @"code", @"quick", @"channelPlatform", _appid, @"yj_appid", _appid, @"yj_spid", nil]; [self SendMessageToUnity:_dict]; } break; case SMPC_QUICK_SDK_ERROR_INIT_FAILED: default: { //初始化失败 NSLog(@"渠道初始化失败"); } break; } } - (void)smpcQpLoginResult:(NSNotification *)notify { NSLog(@"登录成功通知%@",notify); int error = [[[notify userInfo] objectForKey:kSmpcQuickSDKKeyError] intValue]; NSDictionary *userInfo = [notify userInfo]; if (error == 0) { NSString *uid = [[SMPCQuickSDK defaultInstance] userId]; NSString *cid =[[SMPCQuickSDK defaultInstance] getConfigValue:@"cid"]; NSString *gameUID = [NSString stringWithFormat:@"%@%@%@", uid,@"@",cid]; NSString *UserName = [[SMPCQuickSDK defaultInstance] userId]; //获取user_token,用于从服务器去验证用户信息 NSString *user_token = userInfo[kSmpcQuickSDKKeyUserToken]; NSDictionary *_dict = [NSDictionary dictionaryWithObjectsAndKeys: [NSDictionary dictionaryWithObjectsAndKeys:user_token, @"token", UserName, @"userName", gameUID, @"account", nil],@"info", [NSNumber numberWithInt:S2U_FreePlatformLoginOk], @"code", nil]; [self SendMessageToUnity:_dict]; } } - (void)smpcQpLogoutResult:(NSNotification *)notify { NSLog(@"%s",__func__); NSDictionary *userInfo = notify.userInfo; int errorCode = [userInfo[kSmpcQuickSDKKeyError] intValue]; switch (errorCode) { case SMPC_QUICK_SDK_ERROR_NONE: { NSLog(@"注销成功"); //注销成功 NSDictionary *_dict = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:S2U_FreePlatformLogoutOk], @"code", nil]; [self SendMessageToUnity:_dict]; } break; case SMPC_QUICK_SDK_ERROR_LOGOUT_FAIL: default: { //注销失败 NSLog(@"注销失败"); } break; } if (errorCode == SMPC_QUICK_SDK_ERROR_NONE) { } } - (void)smpcQpRechargeResult:(NSNotification *)notify{ NSLog(@"充值结果%@",notify); NSDictionary *userInfo = notify.userInfo; int error = [[userInfo objectForKey:kSmpcQuickSDKKeyError] intValue]; switch (error) { case SMPC_QUICK_SDK_ERROR_NONE: { //充值成功 //QuickSDK订单号,cp下单时传入的订单号,渠道sdk的订单号,cp下单时传入的扩展参数 NSString *orderID = userInfo[kSmpcQuickSDKKeyOrderId]; NSString *cpOrderID = userInfo[kSmpcQuickSDKKeyCpOrderId]; NSLog(@"充值成功数据:%@,%@",orderID,cpOrderID); NSDictionary *_dict = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:S2U_FreePlatformPayOk], @"code", nil]; [self SendMessageToUnity:_dict]; } break; case SMPC_QUICK_SDK_ERROR_RECHARGE_CANCELLED: case SMPC_QUICK_SDK_ERROR_RECHARGE_FAILED: { //充值失败 NSString *orderID = userInfo[kSmpcQuickSDKKeyOrderId]; NSString *cpOrderID = userInfo[kSmpcQuickSDKKeyCpOrderId]; NSLog(@"充值失败数据%@,%@",orderID,cpOrderID); NSDictionary *_dict = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:S2U_FreePlatformPayFail], @"code", nil]; [self SendMessageToUnity:_dict]; } break; default: break; } } -(id) APNativeJSONObject:(NSData *)data{ if (!data) { return nil; } NSError *error = nil; id retId = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error]; if (error) { NSLog(@"%s trans data to obj with error: %@", __func__, error); return nil; } return retId; } -(void)HandleUnityMessage:(NSString *)json { NSLog(@"收到Unity发来的消息 => %@", json); NSData *_jsonData = [json dataUsingEncoding:NSUTF8StringEncoding]; NSDictionary *_dict = [self APNativeJSONObject:_jsonData]; switch([[_dict objectForKey:@"code"] intValue]){ case U2S_Init: sAppID = _dict[@"appID"]; sGameID = _dict[@"gameID"]; [self Init]; break; case U2S_CopyContent: [UIPasteboard generalPasteboard].string = _dict[@"content"]; break; case U2S_FreePlatformInit: break; case U2S_MakeKeyAndVisible: { UIWindow * _window = [[UIApplication sharedApplication].delegate window]; if (_window != nil && _window.rootViewController != nil) { [_window makeKeyAndVisible]; } } break; case U2S_OpenWebView: [self OpenURL:_dict[@"url"]]; break; case U2S_FreePlatformLogin: { int error = [[SMPCQuickSDK defaultInstance] login]; if (error != 0) { NSLog(@"U2S_FreePlatformLogin => %d",error); } } break; case U2S_FreePlatformLogout: { [[SMPCQuickSDK defaultInstance] logout]; } break; case U2S_CreateRole: { // 更新角色信息 SMPCQuickSDKGameRoleInfo *gameRoleInfo = [SMPCQuickSDKGameRoleInfo new]; gameRoleInfo.serverName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"serverName"]]; gameRoleInfo.gameRoleName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"roleName"]]; gameRoleInfo.serverId = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"sid"]]; //需要是数字字符串 gameRoleInfo.gameRoleID = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"roleID"]]; gameRoleInfo.gameUserBalance = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"money"]]; gameRoleInfo.vipLevel = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"vipLevel"]]; gameRoleInfo.gameUserLevel = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"level"]]; gameRoleInfo.partyName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"familyName"]]; gameRoleInfo.creatTime = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"createTime"]]; [[SMPCQuickSDK defaultInstance] updateRoleInfoWith:gameRoleInfo isCreate:YES];//如果这个角色是刚刚创建的,这里isCreate可以传YES break; } case U2S_RoleLogin: { // 更新角色信息 SMPCQuickSDKGameRoleInfo *gameRoleInfo = [SMPCQuickSDKGameRoleInfo new]; gameRoleInfo.serverName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"serverName"]]; gameRoleInfo.gameRoleName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"roleName"]]; gameRoleInfo.serverId = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"sid"]]; //需要是数字字符串 gameRoleInfo.gameRoleID = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"roleID"]]; gameRoleInfo.gameUserBalance = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"money"]]; gameRoleInfo.vipLevel = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"vipLevel"]]; gameRoleInfo.gameUserLevel = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"level"]]; gameRoleInfo.partyName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"familyName"]]; gameRoleInfo.creatTime = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"createTime"]]; [[SMPCQuickSDK defaultInstance] updateRoleInfoWith:gameRoleInfo isCreate:NO];//如果这个角色是刚刚创建的,这里isCreate可以传YES break; } case U2S_RoleLevelUp: { // 更新角色信息 SMPCQuickSDKGameRoleInfo *gameRoleInfo = [SMPCQuickSDKGameRoleInfo new]; gameRoleInfo.serverName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"serverName"]]; gameRoleInfo.gameRoleName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"roleName"]]; gameRoleInfo.serverId = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"sid"]]; //需要是数字字符串 gameRoleInfo.gameRoleID = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"roleID"]]; gameRoleInfo.gameUserBalance = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"money"]]; gameRoleInfo.vipLevel = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"vipLevel"]]; gameRoleInfo.gameUserLevel = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"level"]]; gameRoleInfo.partyName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"familyName"]]; gameRoleInfo.creatTime = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"createTime"]]; [[SMPCQuickSDK defaultInstance] updateRoleInfoWith:gameRoleInfo isCreate:NO];//如果这个角色是刚刚创建的,这里isCreate可以传YES break; } case U2S_FreePlatformPay: { SMPCQuickSDKGameRoleInfo *role = [[SMPCQuickSDKGameRoleInfo alloc] init]; SMPCQuickSDKPayOrderInfo *order = [[SMPCQuickSDKPayOrderInfo alloc] init]; role.serverName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"serverName"]]; role.gameRoleName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"roleName"]]; role.serverId = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"sid"]]; //需要是数字字符串 role.gameRoleID = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"roleID"]]; role.gameUserBalance = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"money"]]; role.vipLevel = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"vipLevel"]]; role.gameUserLevel = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"level"]]; role.partyName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"familyName"]]; role.creatTime = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"createTime"]]; order.goodsID = [NSString stringWithFormat:@"%@", [_dict objectForKey:@"cpInfo"]]; //必填 iap时注意和苹果开发者后台一致,或者渠道映射的 order.productName = [NSString stringWithFormat:@"%@", [_dict objectForKey:@"title"]];//必填 order.cpOrderID = [NSString stringWithFormat:@"%@", [_dict objectForKey:@"orderId"]]; //必填 游戏订单号 order.count = 1; //必填 数量 order.amount = [[_dict objectForKey:@"mount"] floatValue]; //必填 总价 // NSString *_appid = [[SMPCQuickSDK defaultInstance] getConfigValue:@"zfappid"]; // if (_appid == nil || [_appid isEqualToString:@""]) // { // _appid = sAppID; // } NSString *_appid = sAppID; order.extrasParams = [NSString stringWithFormat:@"{\"appid\":\"%@\",\"cpinfo\":\"%@\",\"cporderid\":\"%@\"}", _appid, [_dict objectForKey:@"cpInfo"], [_dict objectForKey:@"orderId"] ]; // //个别渠道要求单价*数量==总价 // if([SMPCQuickSDK defaultInstance].channelType == 9999){ // //通过判断渠道号处理特定渠道的参数 // order.goodsID = @"productlist.name"; // } int error = [[SMPCQuickSDK defaultInstance] payOrderInfo:order roleInfo:role]; if (error!=0) NSLog(@"%d", error); } break; case U2S_BatteryListenStart: if(_thread == NULL) { _thread = [[NSThread alloc] initWithTarget:self selector:@selector(BatteryThread) object:nil]; [_thread setName:@"BatteryCheck"]; } if(![_thread isExecuting]) { [_thread start]; } break; case U2S_BatteryListenStop: break; } } @end extern "C" void native_opus_init(int frequency, int bitRate, int bandMode) { s_frequency = frequency; s_bandMode = bandMode; s_bitRate = bitRate; s_frameSize = frequency / 100; } extern "C" int native_opus_encode(opus_int16 *pcm, int len, unsigned char *opus) { int errorCode = 0; opus_int32 skip = 0; OpusEncoder *enc = opus_encoder_create(s_frequency, CHANNEL_NUM, OPUS_APPLICATION_VOIP, &errorCode); if (OPUS_OK != errorCode) { enc = NULL; return -1; } opus_encoder_ctl(enc, OPUS_SET_BANDWIDTH(s_bandMode)); opus_encoder_ctl(enc, OPUS_SET_BITRATE(s_bitRate)); opus_encoder_ctl(enc, OPUS_SET_VBR(1)); opus_encoder_ctl(enc, OPUS_SET_COMPLEXITY(10)); opus_encoder_ctl(enc, OPUS_SET_INBAND_FEC(0)); opus_encoder_ctl(enc, OPUS_SET_FORCE_CHANNELS(OPUS_SIGNAL_VOICE)); opus_encoder_ctl(enc, OPUS_SET_DTX(0)); opus_encoder_ctl(enc, OPUS_SET_PACKET_LOSS_PERC(0)); opus_encoder_ctl(enc, OPUS_GET_LOOKAHEAD(&skip)); opus_encoder_ctl(enc, OPUS_SET_LSB_DEPTH(16)); unsigned char *rbytes = opus; opus_int16 *frame = pcm; int totalSize = 0; while (len >= s_frameSize) { opus_int32 length = opus_encode(enc, frame, s_frameSize, rbytes + sizeof(char), s_bitRate); rbytes[0] = length; frame += s_frameSize; rbytes += length + sizeof(char); len -= s_frameSize; totalSize += length; } opus_encoder_destroy(enc); return totalSize; } extern "C" int native_opus_decode(unsigned char *opus, int len, short *pcm) { int err = 0; //opus_int32 skip = 0; OpusDecoder *dec = opus_decoder_create(s_frequency, CHANNEL_NUM, &err); if (err != OPUS_OK) { dec = NULL; return -1; } while (len > 0) { int frame_opus_length = opus[0]; int length = opus_decode(dec, opus + sizeof(char), frame_opus_length, pcm, s_frameSize, 0); opus += sizeof(char) + frame_opus_length; pcm += s_frameSize; len = len - frame_opus_length - sizeof(char); } opus_decoder_destroy(dec); return 0; } SdkProject/channel/qkbt3game/AndroidManifest.xml
New file @@ -0,0 +1,43 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.secondworld.sdk"> <uses-permission android:name="android.permission.GET_TASKS" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> <application android:name=".BtGameApp" android:allowBackup="true" android:usesCleartextTraffic="true" tools:replace="android:name"> <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" /> <activity android:name="com.secondworld.sdk.SplashActivity" android:screenOrientation="sensorLandscape"> </activity> <provider android:name="androidx.core.content.FileProvider" android:authorities="quicksdk_packName.Provider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/filepaths" /> </provider> </application> </manifest> SdkProject/channel/qkbt3game/build.gradle
New file @@ -0,0 +1,4 @@ //当前脚本为渠道的差异化配置 dependencies { // implementation project(path: ':quick') } SdkProject/channel/qkbt3game/config.properties
New file @@ -0,0 +1 @@ PLUGINS=quick SdkProject/channel/qkbt3game/deps.gradle
New file @@ -0,0 +1 @@ //此脚本为渠道的第三方远程依赖库配置,会复制到unity中用于构建 SdkProject/channel/qkbt3game/java/com/secondworld/sdk/BtGameApp.java
New file @@ -0,0 +1,21 @@ package com.secondworld.sdk; public class BtGameApp extends QuickApp { @Override public void onCreate() { super.onCreate(); QuickSdkMgr.I.register("40450025922275820036898902533267","31232581"); } @Override protected PlatformDiff getPlatform() { return new BtGamePlatform(); } @Override protected Class<? extends GameActivityProxy> getMainProxy() { return BtGameMain.class; } } SdkProject/channel/qkbt3game/java/com/secondworld/sdk/BtGameMain.java
New file @@ -0,0 +1,89 @@ package com.secondworld.sdk; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import androidx.annotation.NonNull; import android.view.KeyEvent; import com.quicksdk.QuickSDK; import com.quicksdk.Sdk; public class BtGameMain extends GameActivityProxy { @Override public void onCreate(Activity activity) { super.onCreate(activity); QuickSdkMgr.I.requestPermissions(activity); com.quicksdk.Sdk.getInstance().onCreate(activity); } @Override public void onStart() { super.onStart(); com.quicksdk.Sdk.getInstance().onStart(activity); } @Override public void onRestart() { super.onRestart(); com.quicksdk.Sdk.getInstance().onRestart(activity); } @Override public void onResume() { super.onResume(); com.quicksdk.Sdk.getInstance().onResume(activity); } @Override public void onStop() { super.onStop(); com.quicksdk.Sdk.getInstance().onStop(activity); } @Override public void onDestroy() { super.onDestroy(); com.quicksdk.Sdk.getInstance().onDestroy(activity); } @Override public void onNewIntent(Intent intent) { super.onNewIntent(intent); com.quicksdk.Sdk.getInstance().onNewIntent(intent); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); QuickSdkMgr.I.onActivityResult(activity, requestCode); com.quicksdk.Sdk.getInstance().onActivityResult(activity, requestCode, resultCode, data); } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); QuickSdkMgr.I.onRequestPermissionsResult(activity, requestCode, grantResults); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (QuickSDK.getInstance().isShowExitDialog()) { Sdk.getInstance().exit(activity); } else { // 游戏调用自身的退出对话框,点击确定后,调用quick的exit接口 new AlertDialog.Builder(activity).setTitle("退出").setMessage("是否退出游戏?").setPositiveButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { Sdk.getInstance().exit(activity); } }).setNegativeButton("取消", null).show(); } return true; } return super.onKeyDown(keyCode, event); } } SdkProject/channel/qkbt3game/java/com/secondworld/sdk/BtGamePlatform.java
New file @@ -0,0 +1,9 @@ package com.secondworld.sdk; public class BtGamePlatform extends PlatformDiff { @Override public String platformName() { return "quick"; } } SdkProject/gradle.properties
@@ -18,4 +18,4 @@ ## Automatically convert third-party libraries to use AndroidX android.enableJetifier=true #当前构建的渠道名称 CHANNEL_NAME=gtgame CHANNEL_NAME=qkbt3game