New file |
| | |
| | | // |
| | | // SMPCQuickPlatform.h |
| | | // QuickPlatforms |
| | | // |
| | | // Created by C.Maverick on 14/11/26. |
| | | // |
| | | // |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | #import <UIKit/UIKit.h> |
| | | //#import <QuickChannel/SMPCQuickChannelDefines.h> |
| | | //#import <QuickChannel/SMPCQuickChannelShareInfo.h> |
| | | //#import <QuickChannel/SMPCQuickRoleInfo.h> |
| | | #import "SMPCQuickChannelDefines.h" |
| | | #import "SMPCQuickRoleInfo.h" |
| | | #import "SMPCQuickChannelShareInfo.h" |
| | | |
| | | #pragma mark 基本信息 |
| | | |
| | | |
| | | @interface SMPCQuickChannel : NSObject { |
| | | NSArray *unsupportedFunctionList; |
| | | } |
| | | |
| | | + (SMPCQuickChannel *)defaultChannel; |
| | | |
| | | - (NSString *)channelName; |
| | | - (NSString *)channelVersion; |
| | | - (NSString *)channelCode; |
| | | - (NSString *)cpsChannelId; |
| | | - (NSString *)frameworkVersion; |
| | | |
| | | - (int)callFunction:(int)type args:(va_list)list; |
| | | -(NSString *)getPaayParams;//QuickSDK的充值额外参数获取发给QuickSDK服务器端 |
| | | @end |
| | | |
| | | #pragma mark 初始化 接入产品信息 |
| | | |
| | | @interface SMPCQuickChannel(Base) |
| | | |
| | | #pragma mark 初始化 |
| | | |
| | | /** |
| | | @brief 应用初始化 完成后会发送kSmpcQPInitDidFinishedNotification |
| | | @param dictionary 读取的配置文件值Channel.plist |
| | | @result 错误码 |
| | | */ |
| | | - (SMPC_CHANNEL_RESULT_CODE)initWithDictionary:(NSDictionary *)dictionary; |
| | | |
| | | - (SMPC_CHANNEL_RESULT_CODE)initWithDictionary:(NSDictionary *)dictionary application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; |
| | | |
| | | //调用插件功能 |
| | | - (int)callPlug:(NSString *)name params:(NSArray *)args; |
| | | // 进入暂停页 |
| | | - (SMPC_CHANNEL_RESULT_CODE)pause; |
| | | |
| | | #pragma mark 是否打开调试模式 |
| | | - (SMPC_CHANNEL_RESULT_CODE)setDebugMode; |
| | | |
| | | @end |
| | | |
| | | |
| | | |
| | | #pragma mark 用户部分 登录 注册 登出 |
| | | |
| | | @interface SMPCQuickChannel(Account) |
| | | |
| | | #pragma mark 登陆 |
| | | |
| | | /** |
| | | @brief 登录平台,默认自动登陆,支持游客账号登陆 登陆后会发送kSmpcQPLoginNotification |
| | | @result 错误码 |
| | | */ |
| | | - (SMPC_CHANNEL_RESULT_CODE)login; |
| | | |
| | | #pragma mark 注销 |
| | | |
| | | /** |
| | | @brief 注销 |
| | | @result 错误码 |
| | | */ |
| | | - (SMPC_CHANNEL_RESULT_CODE)logout; |
| | | |
| | | #pragma mark 登陆用户信息 |
| | | - (NSString *)userId; |
| | | - (NSString *)userNick; |
| | | - (NSString *)sessionId; |
| | | - (NSDictionary *)realNameInfo; |
| | | - (int)realAuth; |
| | | - (int)userType; |
| | | - (NSDictionary *)userExtInfo; |
| | | - (void)updateUserId:(NSString *)userId; //如果渠道本地有uid就不用使用服务器端的更新 |
| | | - (void)updateUserNick:(NSString *)userNick; //如果渠道本地有用户名就不用使用服务器端的更新 |
| | | - (void)updateUserDict:(NSDictionary *)dict; |
| | | |
| | | #pragma mark 更新角色信息 |
| | | - (void)updateRoleInfoWith:(SMPCQuickRoleInfo *)info; |
| | | - (void)updateRoleInfoWith:(SMPCQuickRoleInfo *)info isCreate:(BOOL)isCreate; |
| | | |
| | | // 登录校验等级 |
| | | - (SMPC_CHANNEL_LOGINCHECK_LEVEL)loginCheckLevel; |
| | | |
| | | /** |
| | | * 是否开启第三方登录 |
| | | */ |
| | | -(void)openThirdLogin:(BOOL)thirdLogin; |
| | | /** |
| | | * 获取当前用户的ID |
| | | * |
| | | * @return 获取当前用户的ID,如未登录则返回空 |
| | | */ |
| | | - (NSString *)getIdCode; |
| | | /** |
| | | * 是否游客账号 |
| | | * |
| | | * @return 获取当前用户的ID,如未登录则返回空 |
| | | */ |
| | | -(BOOL)isGuester; |
| | | /** |
| | | * 绑定身份证 |
| | | */ |
| | | -(void)ShowCertification; |
| | | /** |
| | | * 游客绑定并绑定身份证 |
| | | */ |
| | | -(void) BindCertification; |
| | | |
| | | @end |
| | | |
| | | |
| | | |
| | | |
| | | #pragma mark - |
| | | #pragma mark 各种中心 |
| | | |
| | | @interface SMPCQuickChannel(Centers) |
| | | |
| | | /** |
| | | @brief 进入用户中心 如用户注销登录会发送kSmpcQPLogoutNotification(可多次触发) |
| | | @result 错误码 |
| | | //渠道支持才去实现这个接口 |
| | | */ |
| | | - (SMPC_CHANNEL_RESULT_CODE)enterUserCenter; |
| | | - (SMPC_CHANNEL_RESULT_CODE)callSpecifyFunction:(NSInteger)functionName parameters:(NSDictionary *)parameterDict; |
| | | //打开渠道SDK的BBS,渠道支持才去实现这个接口 |
| | | - (SMPC_CHANNEL_RESULT_CODE)enterBBS; |
| | | |
| | | //打开渠道SDK的客服界面,渠道支持才去实现这个接口 |
| | | - (SMPC_CHANNEL_RESULT_CODE)enterCustomerServiceCenter; |
| | | |
| | | //分享 |
| | | - (SMPC_CHANNEL_RESULT_CODE)callSDKShare:(SMPCQuickChannelShareInfo *)shareInfo; |
| | | //隐私弹窗 |
| | | - (void)showPrivacyView:(void (^)(BOOL isAgreed))isAgreed; |
| | | |
| | | /* facebook分享连接 |
| | | * @param url 分享网址 |
| | | * @param quote 网页说明 |
| | | */ |
| | | -(void)FBShareLink:(NSString*)url quote:(NSString*)quote; |
| | | |
| | | /* facebook分享图片 |
| | | * @param filePath 图片路径 |
| | | */ |
| | | -(void)FBShareImage:(NSString*)filePath; |
| | | |
| | | /* 微信分享文本 |
| | | * @param test 分享文本 |
| | | * @param scene 发送场景:0 聊天界面,1 朋友圈,2 收藏 |
| | | */ |
| | | -(void)WXShareText:(NSString*)test sencetype:(int) scene; |
| | | |
| | | /* 微信分享图片 |
| | | * @param filePath 图片路径 |
| | | * @param width 缩略图宽 |
| | | * @param height 缩略图高 |
| | | * @param scene 发送场景:0 聊天界面,1 朋友圈,2 收藏 |
| | | */ |
| | | -(void)WXShareImage:(NSString*)filePath thumbWidth:(float) width thumbHeight:(float) height sencetype:(int) scene; |
| | | |
| | | @end |
| | | |
| | | |
| | | #pragma mark 充值、 支付 |
| | | |
| | | @class SMPCQuickProductInfo; |
| | | @class SMPCQuickRoleInfo; |
| | | |
| | | @interface SMPCQuickChannel(Pay) |
| | | |
| | | #pragma mark 代币充值 |
| | | //基础库向QuickChannel传递从服务器下单回来的数据。 |
| | | - (void)updatePayDict:(NSDictionary *)dict; |
| | | /** |
| | | @brief 进入虚拟币充值界面 如果渠道没有充值回调,就模拟一个QuickChannel充值回调,实际充值结果以服务器同步为准 |
| | | @result 错误码 通常为0,也不必关心 |
| | | */ |
| | | - (SMPC_CHANNEL_RESULT_CODE)buyOrderId:(NSString *)orderId |
| | | productInfo:(SMPCQuickProductInfo *)product |
| | | roleInfo:(SMPCQuickRoleInfo *)role; |
| | | |
| | | //2017.7.25 add begin |
| | | - (NSString *)getProductDescFromProduct:(SMPCQuickProductInfo *)product; |
| | | // |
| | | //探娱海外获取商品信息APi:传入的时候是productId如果多个用,分割,如:vol01,chips01,chips02,返回值监听kSmpcQCGetLocalizedNotification |
| | | |
| | | // |
| | | -(void)Getlocalized:(NSString *)productIds; |
| | | @end |
| | | |
| | | |
| | | #pragma mark 界面控制 |
| | | @interface SMPCQuickChannel(UISetting) |
| | | |
| | | #pragma mark 方向控制 |
| | | /** |
| | | //deprecated |
| | | @brief 设定平台为横屏或者竖屏 |
| | | @note 1、其中设置的方向需要在 app plist文件Supported interface orientations 中支持 |
| | | */ |
| | | - (SMPC_CHANNEL_RESULT_CODE)setChannelOrientation:(UIInterfaceOrientationMask)orientation; |
| | | |
| | | /** |
| | | //deprecated |
| | | @brief 设置是否自动旋转。 |
| | | @note 1、设置NO后,平台页面使用setPlatformOrientation设置的方向 |
| | | 2、设置Yes后,平台页面自适应旋转。 |
| | | */ |
| | | - (SMPC_CHANNEL_RESULT_CODE)setAutoRotation:(BOOL)isAutoRotate; |
| | | |
| | | #pragma mark 浮动条 |
| | | //显示浮动菜单 |
| | | - (SMPC_CHANNEL_RESULT_CODE)showToolBar:(SMPC_CHANNEL_TOOLBAR_PLACE)place; |
| | | //隐藏浮动菜单 |
| | | - (SMPC_CHANNEL_RESULT_CODE)hideToolBar; |
| | | |
| | | @end |
| | | |
| | | |
| | | #pragma mark 回调处理 |
| | | |
| | | @interface SMPCQuickChannel (URL) |
| | | |
| | | |
| | | - (SMPC_CHANNEL_RESULT_CODE)openURL:(NSURL *)url sourceApplication:(NSString *)sourceApp application:(UIApplication *)application annotation:(id)annotation; |
| | | // add |
| | | - (SMPC_CHANNEL_RESULT_CODE)openURL:(NSURL *)url application:(UIApplication *)application; |
| | | - (SMPC_CHANNEL_RESULT_CODE)openURL:(NSURL *)url application:(UIApplication *)app options:(NSDictionary <NSString *, id> *)options; |
| | | //推送 |
| | | - (SMPC_CHANNEL_RESULT_CODE)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken; |
| | | - (SMPC_CHANNEL_RESULT_CODE)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error; |
| | | - (SMPC_CHANNEL_RESULT_CODE)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo; |
| | | //AppDelegate事件 |
| | | - (SMPC_CHANNEL_RESULT_CODE)applicationWillResignActive:(UIApplication *)application; |
| | | |
| | | - (SMPC_CHANNEL_RESULT_CODE)applicationDidEnterBackground:(UIApplication *)application; |
| | | |
| | | - (SMPC_CHANNEL_RESULT_CODE)applicationWillEnterForeground:(UIApplication *)application; |
| | | - (SMPC_CHANNEL_RESULT_CODE)applicationDidBecomeActive:(UIApplication *)application; |
| | | - (SMPC_CHANNEL_RESULT_CODE)applicationWillTerminate:(UIApplication *)application; |
| | | - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window; |
| | | - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray * restorableObjects))restorationHandler; |
| | | |
| | | @end |
| | | |
| | | |
| | | |
| | | |
New file |
| | |
| | | // |
| | | // SMPCQuickPlatformDefines.h |
| | | // QuickPlatforms |
| | | // |
| | | // Created by C.Maverick on 14/11/26. |
| | | // |
| | | // |
| | | |
| | | #ifndef QuickChannel_SMPCQuickChannelDefines_h |
| | | #define QuickChannel_SMPCQuickChannelDefines_h |
| | | |
| | | #pragma mark - Notification Name |
| | | // 初始化通知 |
| | | #define kSmpcQCInitDidFinishedNotification @"kSmpcQCInitDidFinishedNotification" |
| | | //取消登陆 |
| | | #define kSmpcQCLogCancelNotification @"kSmpcQCLogCancelNotification" |
| | | // 登录通知 |
| | | #define kSmpcQCLoginNotification @"kSmpcQCLoginNotification" |
| | | // 登出通知 |
| | | #define kSmpcQCLogoutNotification @"kSmpcQCLogoutNotification" |
| | | /** 实名认证结果通知 */ |
| | | #define kSmpcQCRealAuthNotification @"kSmpcQCRealAuthNotification" |
| | | // 退出暂停页 |
| | | #define kSmpcQCPauseDidExitNotification @"kSmpcQCPauseDidExitNotification" |
| | | // 充值结果通知 |
| | | #define kSmpcQCRechargeResultNotification @"kSmpcQCRechargeResultNotification" |
| | | // 查询接商品信息的通知 |
| | | //#define kSmpcQCGetLocalizedNotification @"kSmpcQCGetLocalizedNotification" |
| | | // 离开平台页面通知 |
| | | #define kSmpcQCLeavedNotification @"kSmpcQCLeavedNotification" |
| | | /** 特殊方法结果回调通知 */ |
| | | #define kSmpcQCExtrNotification @"kSmpcQCExtraNotification" |
| | | #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 - Notification UserInfo Key |
| | | // 错误编码 |
| | | #define kSmpcQCNotificationErrorKey @"error" |
| | | // 错误描述 |
| | | #define kSmpcQCNotificationErrorMsg @"msg" |
| | | // QuickSDK 的订单号 |
| | | #define kSmpcQCNotificationOrderId @"orderId" |
| | | // 游戏开发商给的订单号 |
| | | #define kSmpcQCNotificationCpOrderId @"cpOrderId" |
| | | // 第3方渠道sdk给的订单号 |
| | | #define kSmpcQCNotificationSdkOrderId @"sdkOrderId" |
| | | // 透传参数 |
| | | #define kSmpcQCNotificationExtraParams @"extraParams" |
| | | // 用户id |
| | | #define kSmpcQCNotificationUserId @"userId" |
| | | // sessionID |
| | | #define kSmpcQCNotificationSessionId @"sessionId" |
| | | // token |
| | | #define kSmpcQCNotificationToken @"token" |
| | | // 二次验证时sdk方提供的数据 |
| | | #define kSmpcQCNotificationSdkData @"sdkData" |
| | | /** 实名认证回调是否已实名 */ |
| | | #define kSmpcQCNotificationSdkRealName @"realName" |
| | | /** 实名认证后年龄 */ |
| | | #define kSmpcQCNotificationSdkRealAge @"age" |
| | | /** 实名认证失败是否可以继续游戏 */ |
| | | #define kSmpcQCNotificationSdkRealResumeGame @"realResumeGame" |
| | | /** 预留字段 */ |
| | | #define kSmpcQCNotificationSdkRealOther @"other" |
| | | |
| | | #pragma mark - Enum |
| | | |
| | | // 版本检测类型 |
| | | typedef NS_ENUM(NSInteger, SMPC_CHANNEL_VERSION_CHECK_LEVEL) { |
| | | SMPC_CHANNEL_VERSION_CHECK_LEVEL_NORMAL = 0, // 正常等级 |
| | | SMPC_CHANNEL_VERSION_CHECK_LEVEL_STRICT, // 严格等级 |
| | | }; |
| | | |
| | | // 浮动条位置 |
| | | typedef NS_ENUM(NSInteger, SMPC_CHANNEL_TOOLBAR_PLACE) { |
| | | SMPC_CHANNEL_TOOLBAR_PLACE_TOP_LEFT = 1, // 左上 |
| | | SMPC_CHANNEL_TOOLBAR_PLACE_TOP_RIGHT, // 右上 |
| | | SMPC_CHANNEL_TOOLBAR_PLACE_MID_LEFT, // 左中 |
| | | SMPC_CHANNEL_TOOLBAR_PLACE_MID_RIGHT, // 右中 |
| | | SMPC_CHANNEL_TOOLBAR_PLACE_BOT_LEFT, // 左下 |
| | | SMPC_CHANNEL_TOOLBAR_PLACE_BOT_RIGHT, // 右下 |
| | | }; |
| | | |
| | | // 错误编码 |
| | | typedef NS_ENUM(NSInteger, SMPC_CHANNEL_RESULT_CODE) { |
| | | SMPC_CHANNEL_RESULT_ERROR_NONE = 0, /**< 没有错误 */ |
| | | SMPC_CHANNEL_RESULT_ERROR_INIT_FAILED = -1, /**< 初始化失败 */ |
| | | SMPC_CHANNEL_RESULT_ERROR_CONFIG = -2, /**< 配置文件错误 */ |
| | | SMPC_CHANNEL_RESULT_ERROR_NETWORK = -3, /**< 网络连接错误 */ |
| | | SMPC_CHANNEL_RESULT_ERROR_PARAM = -4, /**< 参数错误 */ |
| | | SMPC_CHANNEL_RESULT_ERROR_UNSUPPORTED = -10, /**< 功能不被支持 */ |
| | | |
| | | SMPC_CHANNEL_RESULT_ERROR_NOT_INIT = -20, /**< 没有初始化 */ |
| | | SMPC_CHANNEL_RESULT_ERROR_NOT_LOGIN = -21, /**< 没有登录用户 */ |
| | | SMPC_CHANNEL_RESULT_ERROR_HAD_LOGIN = -22, /**< 已有登录用户 */ |
| | | |
| | | SMPC_CHANNEL_RESULT_ERROR_RECHARGE_INVALID = -30, /**< 支付信息无效 */ |
| | | SMPC_CHANNEL_RESULT_ERROR_RECHARGE_FAILED = -31, /**< 充值失败 */ |
| | | SMPC_CHANNEL_RESULT_ERROR_RECHARGE_CANCELLED = -32, /**< 充值取消 */ |
| | | |
| | | SMPC_CHANNEL_RESULT_ERROR_UNKNOWN = -200, /**< 未知错误 */ |
| | | }; |
| | | |
| | | // 登录校验类型 |
| | | typedef NS_ENUM(NSInteger, SMPC_CHANNEL_LOGINCHECK_LEVEL) { |
| | | SMPC_CHANNEL_LOGINCHECK_LEVEL_NONE = 0, // 没有登录校验 |
| | | SMPC_CHANNEL_LOGINCHECK_LEVEL_OPTIONAL, // 登录校验可选 |
| | | SMPC_CHANNEL_LOGINCHECK_LEVEL_REQUEST, // 登录校验必选 |
| | | }; |
| | | |
| | | #endif |
New file |
| | |
| | | // |
| | | // SMPCQuickChannelShareInfo.h |
| | | // SMPCQuickChannel |
| | | // |
| | | // Created by xiaoxiao on 2019/2/19. |
| | | // Copyright © 2019年 HanDong. All rights reserved. |
| | | // |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | |
| | | |
| | | |
| | | @interface SMPCQuickChannelShareInfo : 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 |
| | | |
New file |
| | |
| | | // |
| | | // SMPCQuickProductInfo.h |
| | | // QuickChannel |
| | | // |
| | | // Created by IOS-Developer on 14/12/24. |
| | | // |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | |
| | | @interface SMPCQuickProductInfo : NSObject |
| | | @property(copy, nonatomic) NSString *goodsID; //商品ID |
| | | @property(copy, nonatomic) NSString *productName; //商品名称 |
| | | @property(copy, nonatomic) NSString *productOrderID; //商品订单ID |
| | | @property(assign, nonatomic) NSUInteger count; //商品数量 |
| | | @property(assign, nonatomic) float amount; //商品总价 |
| | | @property(copy, nonatomic) NSString *callbackUrl; //购买回调地址 |
| | | @property(copy, nonatomic) NSString *extrasParams; //扩展参数,一般是服务器回调原样回传 |
| | | |
| | | //在QuickSDK中对应的属性已经暂停使用,但是QuickChannel使用不变。 |
| | | //QuickSDK在转换参数时,仍然会使用到这些属性,QuickChannel中使用到这些属性 |
| | | //在客户使用的旧版QuickSDK中仍然用到了这些属性,所以暂时不能删掉 |
| | | @property(assign, nonatomic) float price; //商品单价 |
| | | @property(nonatomic,copy) NSString *quantifier; //商品量词 停用的 |
| | | @property(copy, nonatomic) NSString *productDesc; //商品描述 |
| | | |
| | | @end |
New file |
| | |
| | | // |
| | | // SMPCQuickRoleInfo.h |
| | | // QuickChannel |
| | | // |
| | | // Created by IOS-Developer on 14/12/24. |
| | | // Copyright (c) 2014年 HanDong. All rights reserved. |
| | | // |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | |
| | | @interface SMPCQuickRoleInfo : NSObject |
| | | @property (copy, nonatomic) NSString *serverId; //服务器Id |
| | | @property (copy, nonatomic) NSString *serverName; //服务器名称 |
| | | @property (copy, nonatomic) NSString *gameRoleName; //角色名 |
| | | @property (copy, nonatomic) NSString *gameRoleID; //角色ID |
| | | @property (copy, nonatomic) NSString *gameUserBalance; //玩家虚拟货币余额 |
| | | @property (copy, nonatomic) NSString *roleCreatTime; //角色创建时间 |
| | | @property (nonatomic,copy) NSString * _Nullable vipLevel; //玩家vip等级,选填,默认值0 |
| | | @property (nonatomic,copy) NSString * _Nullable gameUserLevel; //玩家等级,选填,默认值0 |
| | | @property (nonatomic,copy) NSString * _Nullable partyName; //公会名称,选填,默认空字符串 |
| | | @property (nonatomic,copy) NSString * _Nullable partyId; //公会id,选填,默认空字符串 |
| | | @property (nonatomic, copy) NSString * _Nullable fightPower; //战力,选填,默认值0 |
| | | @property (nonatomic, copy) NSString * _Nullable professionId; //角色职业id, 选填,默认值,空字符串 |
| | | @property (nonatomic, copy) NSString * _Nullable profession; //角色职业, 选填,默认值,空字符串 |
| | | @property (nonatomic,copy) NSString * _Nullable roleGender; //角色性别,选填,默认值男 |
| | | @property (nonatomic,copy) NSString * _Nullable partyRoleId; //公会角色id,选填,默认空字符串 |
| | | @property (nonatomic,copy) NSString * _Nullable partyRoleName; //公会角色名,选填,默认空字符串 |
| | | @end |
New file |
| | |
| | | <?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>files</key> |
| | | <dict> |
| | | <key>Headers/SMPCQuickChannel.h</key> |
| | | <data> |
| | | GPDKBzkIuCwRBHvCHwAwrDJea0Y= |
| | | </data> |
| | | <key>Headers/SMPCQuickChannelDefines.h</key> |
| | | <data> |
| | | PNRrALd3V4NpQq8bqfEJuCNbKBY= |
| | | </data> |
| | | <key>Headers/SMPCQuickChannelShareInfo.h</key> |
| | | <data> |
| | | w33Pnwshbnfpn4iQn6JKmNZ99BQ= |
| | | </data> |
| | | <key>Headers/SMPCQuickProductInfo.h</key> |
| | | <data> |
| | | q0cs1VoZ9V0t60Na19KY2X/9n5E= |
| | | </data> |
| | | <key>Headers/SMPCQuickRoleInfo.h</key> |
| | | <data> |
| | | 7r/VBL6Y5ifjt6LJlAEQ5uMVGg8= |
| | | </data> |
| | | <key>Info.plist</key> |
| | | <data> |
| | | +M/hee+GQuccZnLqLk12dh1MD2k= |
| | | </data> |
| | | </dict> |
| | | <key>files2</key> |
| | | <dict> |
| | | <key>Headers/SMPCQuickChannel.h</key> |
| | | <dict> |
| | | <key>hash</key> |
| | | <data> |
| | | GPDKBzkIuCwRBHvCHwAwrDJea0Y= |
| | | </data> |
| | | <key>hash2</key> |
| | | <data> |
| | | RP9PwedwhyvZ1ukdP285jJUKEf7yk5sKYWAlt/VvbdI= |
| | | </data> |
| | | </dict> |
| | | <key>Headers/SMPCQuickChannelDefines.h</key> |
| | | <dict> |
| | | <key>hash</key> |
| | | <data> |
| | | PNRrALd3V4NpQq8bqfEJuCNbKBY= |
| | | </data> |
| | | <key>hash2</key> |
| | | <data> |
| | | Kose592SBCTagKpc5TcZ7ZWChD/Ha2xeKdN7PwQIDPc= |
| | | </data> |
| | | </dict> |
| | | <key>Headers/SMPCQuickChannelShareInfo.h</key> |
| | | <dict> |
| | | <key>hash</key> |
| | | <data> |
| | | w33Pnwshbnfpn4iQn6JKmNZ99BQ= |
| | | </data> |
| | | <key>hash2</key> |
| | | <data> |
| | | jqAupycvDTECKiaY5b4YHdh4cZmq+ApdvcniA1nFp30= |
| | | </data> |
| | | </dict> |
| | | <key>Headers/SMPCQuickProductInfo.h</key> |
| | | <dict> |
| | | <key>hash</key> |
| | | <data> |
| | | q0cs1VoZ9V0t60Na19KY2X/9n5E= |
| | | </data> |
| | | <key>hash2</key> |
| | | <data> |
| | | jqcgeJRfwex25YXHKTi8rwOa8WkisxdltiTKNZfLNM8= |
| | | </data> |
| | | </dict> |
| | | <key>Headers/SMPCQuickRoleInfo.h</key> |
| | | <dict> |
| | | <key>hash</key> |
| | | <data> |
| | | 7r/VBL6Y5ifjt6LJlAEQ5uMVGg8= |
| | | </data> |
| | | <key>hash2</key> |
| | | <data> |
| | | seO35ZxgN7ISscH9J/19AVJvdSvMI2ZbGmTwj0C8/HE= |
| | | </data> |
| | | </dict> |
| | | </dict> |
| | | <key>rules</key> |
| | | <dict> |
| | | <key>^.*</key> |
| | | <true/> |
| | | <key>^.*\.lproj/</key> |
| | | <dict> |
| | | <key>optional</key> |
| | | <true/> |
| | | <key>weight</key> |
| | | <real>1000</real> |
| | | </dict> |
| | | <key>^.*\.lproj/locversion.plist$</key> |
| | | <dict> |
| | | <key>omit</key> |
| | | <true/> |
| | | <key>weight</key> |
| | | <real>1100</real> |
| | | </dict> |
| | | <key>^Base\.lproj/</key> |
| | | <dict> |
| | | <key>weight</key> |
| | | <real>1010</real> |
| | | </dict> |
| | | <key>^version.plist$</key> |
| | | <true/> |
| | | </dict> |
| | | <key>rules2</key> |
| | | <dict> |
| | | <key>.*\.dSYM($|/)</key> |
| | | <dict> |
| | | <key>weight</key> |
| | | <real>11</real> |
| | | </dict> |
| | | <key>^(.*/)?\.DS_Store$</key> |
| | | <dict> |
| | | <key>omit</key> |
| | | <true/> |
| | | <key>weight</key> |
| | | <real>2000</real> |
| | | </dict> |
| | | <key>^.*</key> |
| | | <true/> |
| | | <key>^.*\.lproj/</key> |
| | | <dict> |
| | | <key>optional</key> |
| | | <true/> |
| | | <key>weight</key> |
| | | <real>1000</real> |
| | | </dict> |
| | | <key>^.*\.lproj/locversion.plist$</key> |
| | | <dict> |
| | | <key>omit</key> |
| | | <true/> |
| | | <key>weight</key> |
| | | <real>1100</real> |
| | | </dict> |
| | | <key>^Base\.lproj/</key> |
| | | <dict> |
| | | <key>weight</key> |
| | | <real>1010</real> |
| | | </dict> |
| | | <key>^Info\.plist$</key> |
| | | <dict> |
| | | <key>omit</key> |
| | | <true/> |
| | | <key>weight</key> |
| | | <real>20</real> |
| | | </dict> |
| | | <key>^PkgInfo$</key> |
| | | <dict> |
| | | <key>omit</key> |
| | | <true/> |
| | | <key>weight</key> |
| | | <real>20</real> |
| | | </dict> |
| | | <key>^embedded\.provisionprofile$</key> |
| | | <dict> |
| | | <key>weight</key> |
| | | <real>20</real> |
| | | </dict> |
| | | <key>^version\.plist$</key> |
| | | <dict> |
| | | <key>weight</key> |
| | | <real>20</real> |
| | | </dict> |
| | | </dict> |
| | | </dict> |
| | | </plist> |
New file |
| | |
| | | // |
| | | // SMPCQuickSDK.h |
| | | // |
| | | // |
| | | // |
| | | // |
| | | #define SMPC_QUICK_SDK_VERSION @"2.6.3" //QuickSDK基础库版本 |
| | | |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | #import <UIKit/UIKit.h> |
| | | #import "SMPCQuickSDKDefines.h" |
| | | #import "SMPCQuickSDKInitConfigure.h" |
| | | #import "SMPCQuickSDKPayOrderInfo.h" |
| | | #import "SMPCQuickSDKGameRoleInfo.h" |
| | | #import "SMPCQuickSDKShareInfo.h" |
| | | |
| | | typedef enum { |
| | | QuickSDKUserTYPE_UNKnow = 0,//未知的未定义的 |
| | | QuickSDKUserTYPE_Account = 1,//账号 |
| | | QuickSDKUserTYPE_Phone = 2,//手机号 |
| | | QuickSDKUserTYPE_Guest = 3,//游客登录 |
| | | QuickSDKUserTYPE_WX = 4,//微信 |
| | | QuickSDKUserTYPE_QQ = 5,//手Q |
| | | QuickSDKUserTYPE_WeiBo = 6,//微博 |
| | | QuickSDKUserTYPE_GameCenter = 7,//GameCenter |
| | | QuickSDKUserTYPE_Apple = 16,//苹果 |
| | | QuickSDKUserTYPE_OneKey = 18,//阿里云一键登录 |
| | | } QuickSDKUserTYPE; |
| | | #pragma mark 基本信息 |
| | | |
| | | @interface SMPCQuickSDK : NSObject |
| | | |
| | | #pragma mark 单例对象 |
| | | + (SMPCQuickSDK *)defaultInstance; |
| | | - (instancetype)init NS_UNAVAILABLE; |
| | | + (instancetype)new NS_UNAVAILABLE; |
| | | |
| | | #pragma mark 获取渠道基本信息 |
| | | //获取渠道唯一标识,与服务器端channelID一致,任何时刻都可调用 |
| | | - (int)channelType; |
| | | |
| | | /** |
| | | * 获取QuickGame渠道cps包的渠道号 |
| | | */ |
| | | - (NSString *)cpsChannelId; |
| | | @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; |
| | | /** 设置切换账号回调 */ |
| | | - (void)configSwitchAccount:(void(^)(NSDictionary * resultDict))resultBlock; |
| | | // 登录后获取用户uid,这个uid在渠道上唯一,多个渠道的用户uid可能重复 |
| | | - (NSString *)userId; |
| | | // 登录后获取userToken可用于验证用户信息 |
| | | - (NSString *)userToken; |
| | | // 登录后获取用户昵称 |
| | | - (NSString *)userNick; |
| | | /** 查询渠道实名认证信息 */ |
| | | - (NSDictionary *)realNameInfo; |
| | | /** 获取设备id */ |
| | | - (NSString *)getDeviceID; |
| | | /** 清除设备id缓存数据 */ |
| | | - (void)resetDeviceID; |
| | | /** |
| | | @brief 调用渠道实名认证 |
| | | @result 错误码若渠道没有提供此方法会返回非0 |
| | | @note 结果会发送kSmpcQuickSDKNotiRealAuth通知 |
| | | */ |
| | | - (int)realAuth; |
| | | /** 获取渠道用户登录方式目前仅QuickGame越狱渠道有用 */ |
| | | - (QuickSDKUserTYPE)getChannelUserLoginType; |
| | | /** 获取用户额外信息,若没有额外信息则返回空字典 */ |
| | | - (NSDictionary *)getChannelUserExtInfo; |
| | | #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; |
| | | /** |
| | | @brief 调用渠道特定方法 |
| | | parameterDict: 调用方法需要传入的参数,如果没有则传入@{} |
| | | @result 错误码 |
| | | */ |
| | | - (int)callChannelSpecifyFunction:(NSInteger)functionName parameters:(NSDictionary *)parameterDict; |
| | | |
| | | /** |
| | | 进入YunKefu |
| | | |
| | | @param gameRoleInfo |
| | | @result 错误码 |
| | | */ |
| | | - (int)enterYunKeFuCenter:(SMPCQuickSDKGameRoleInfo *)gameRoleInfo; |
| | | /** 显示是否同意游戏用户协议和隐私政策弹窗-可点击查看在QK后台自定义的用户协议和隐私政策详情 |
| | | * @param must 是否必须同意 YES:弹窗仅有同意按钮 NO同时显示不同意和同意按钮 |
| | | * @param resultBlock 结果回调 YES玩家已经同意 NO玩家没有同意 |
| | | */ |
| | | - (void)showGameCustomPrivacyViewMustAgree:(BOOL)must result:(void(^)(BOOL hasAgreed))resultBlock; |
| | | /** 用手机浏览器打开指定url |
| | | * @param url url地址 |
| | | */ |
| | | - (void)openUrlOutAppWithBrowser:(NSString *)url; |
| | | /** 在app内用WKWebView打开指定url |
| | | * @param url url地址 |
| | | */ |
| | | - (void)openUrlInAppFullScreen:(NSString *)url; |
| | | /** 在APP内用SFSafariViewController打开指定url |
| | | * @param url url地址 |
| | | * @param isCanClose 是否可以关闭浏览器 ,YES 可关闭 |
| | | */ |
| | | - (void)openBrowserPageWithUrlString:(NSString *)url isCanClose:(BOOL)isCanClose; |
| | | |
| | | /** 调用显示渠道用户隐私弹窗, 用户同意返回YES,不同意返回NO*/ |
| | | - (void)showPrivacyView:(void (^)(BOOL isAgreed))isAgreed; |
| | | |
| | | #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 |
New file |
| | |
| | | // |
| | | // SMPCQuickSDKDefines.h |
| | | // QuickSDKs |
| | | // |
| | | // |
| | | // |
| | | |
| | | #ifndef SMPCQuickSDKDefines_h |
| | | #define SMPCQuickSDKDefines_h |
| | | |
| | | #pragma mark - Notification Name |
| | | |
| | | extern NSString* const kSmpcQuickSDKNotiInitDidFinished; //初始化成功 |
| | | extern NSString* const kSmpcQuickSDKNotiLogin; //登录成功 如果没有设置切换账号block切换账号成功也会回调这个 |
| | | extern NSString* const kSmpcQCGetLocalizedNotification; //查询接商品信息的通知 |
| | | extern NSString* const kSmpcQuickSDKNotiLogout; //用户注销 |
| | | extern NSString* const kSmpcQuickSDKNotiRecharge; //充值结果 |
| | | extern NSString* const kSmpcQuickSDKNotiPauseOver; //暂停结束 这个回调可以不用监听 |
| | | extern NSString * const kSmpcQuickSDKNotiPlugin; /*组件通知 见该插件接入文档,默认可以不用监听*/ |
| | | extern NSString* const kSmpcQuickSDKNotiRealAuth; //实名认证结果通知 |
| | | extern NSString* const kSmpcQuickSDKNotiExtra; //特殊方法结果通知 |
| | | |
| | | #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_LOGINDISABLED = -5, /* 渠道禁止登录 */ |
| | | 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_CPSCHANNELID = 0, /*官方渠道cps渠道id*/ |
| | | 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 |
New file |
| | |
| | | // |
| | | // SMPCQuickSDKGameRoleInfo.h |
| | | // SMPCQuickSDK |
| | | // |
| | | // |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | #import <UIKit/UIKit.h> |
| | | |
| | | @interface SMPCQuickSDKGameRoleInfo : NSObject |
| | | |
| | | NS_ASSUME_NONNULL_BEGIN |
| | | @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 * creatTime; //角色创建时间(10位时间戳),必填,没有传0 |
| | | NS_ASSUME_NONNULL_END |
| | | @property (nonatomic,copy) NSString * _Nullable gameUserBalance; //玩家虚拟货币余额,选填,默认值0 |
| | | @property (nonatomic,copy) NSString * _Nullable vipLevel; //玩家vip等级,选填,默认值0 |
| | | @property (nonatomic,copy) NSString * _Nullable gameUserLevel; //玩家等级,选填,默认值0 |
| | | @property (nonatomic,copy) NSString * _Nullable partyName; //公会名称,选填,默认空字符串 |
| | | @property (nonatomic,copy) NSString * _Nullable partyId; //公会id,选填,默认空字符串 |
| | | @property (nonatomic, copy) NSString * _Nullable fightPower; //战力,选填,默认值0 |
| | | @property (nonatomic, copy) NSString * _Nullable professionId; //角色职业id, 选填,默认值,空字符串 |
| | | @property (nonatomic, copy) NSString * _Nullable profession; //角色职业, 选填,默认值,空字符串 |
| | | @property (nonatomic,copy) NSString * _Nullable roleGender; //角色性别,选填,默认值男 |
| | | @property (nonatomic,copy) NSString * _Nullable partyRoleId; //公会角色id,选填,默认空字符串 |
| | | @property (nonatomic,copy) NSString * _Nullable partyRoleName; //公会角色名,选填,默认空字符串 |
| | | @property(nonatomic,copy) NSString * _Nullable extrasParams; //预留参数,选填,默认空字符串 |
| | | @end |
New file |
| | |
| | | // |
| | | // 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 |
New file |
| | |
| | | // |
| | | // 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 |
New file |
| | |
| | | // |
| | | // 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 |
| | | |
| | | |
New file |
| | |
| | | <?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>
|
New file |
| | |
| | | //
|
| | | // UniversalSDK.h
|
| | | // Unity-iPhone
|
| | | //
|
| | | //
|
| | |
|
| | | #ifndef __UNIVERSALSDK_H_
|
| | | #define __UNIVERSALSDK_H_
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | | #import <UIKit/UIKit.h>
|
| | | #import <WebKit/WebKit.h>
|
| | |
|
| | | #define UNITY_OBJ_NAME "ynmbxxjUtil"
|
| | | #define UNITY_FUNC_NAME "HandleMsgWithSDK"
|
| | |
|
| | | #define PRODUCT_CODE @"77059910968783818403901306027155"
|
| | | #define PRODUCT_KEY @"96186295"
|
| | |
|
| | | #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<WKUIDelegate, WKNavigationDelegate> {
|
| | | WKWebView* m_UIWebView;
|
| | | WKWebView* m_fakeUIWebView;
|
| | | 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
|
New file |
| | |
| | | //
|
| | | // 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>
|
| | |
|
| | | @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;
|
| | | static NSString* channel;
|
| | |
|
| | | -(id)init
|
| | | {
|
| | | self = [super init];
|
| | | |
| | | m_fakeUIWebView = [[WKWebView alloc] initWithFrame:CGRectZero];
|
| | | NSURL *url = [NSURL URLWithString:@"www.baidu.com"];
|
| | | NSURLRequest *request = [NSURLRequest requestWithURL:url
|
| | | cachePolicy:NSURLRequestUseProtocolCachePolicy
|
| | | timeoutInterval:10.f];
|
| | | [m_fakeUIWebView loadRequest:request];
|
| | |
|
| | | return self;
|
| | | }
|
| | |
|
| | | -(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
|
| | | [m_fakeUIWebView evaluateJavaScript:@"navigator.userAgent" completionHandler:^(id _Nullable userAgent, NSError * _Nullable error) {
|
| | |
|
| | | NSLog(@"%@", userAgent);
|
| | | NSString* _userAgent = [NSString stringWithFormat:@"%@", userAgent];
|
| | | // 发送设备信息
|
| | | NSMutableDictionary *_dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
| | | _uniqueID,@"unique_id",
|
| | | _idfa,@"android_id",
|
| | | [NSNumber numberWithInt:S2U_DeviceInfo],@"code",
|
| | | _userAgent,@"userAgent",nil];
|
| | | [self SendMessageToUnity:_dict];
|
| | | }];
|
| | | |
| | | NSString *_appid = sAppID;
|
| | | NSLog(@"init _appid:%@",_appid);
|
| | | |
| | | NSMutableDictionary *_dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
| | | [NSNumber numberWithInt:S2U_SdkInitComplete], @"code",
|
| | | @"hygame", @"channelPlatform",
|
| | | _appid, @"yj_appid", _appid, @"yj_spid", 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 = [[WKWebView alloc] initWithFrame:CGRectMake(_offsetX, _offsetY, _width, _height)];
|
| | | m_UIWebView.UIDelegate = self;
|
| | | m_UIWebView.navigationDelegate = self ;
|
| | | 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)webViewDidFinishLoad:(WKWebView *)webView{
|
| | | - (void)webView:(WKWebView *)webView didFinishNavigation:(null_unspecified WKNavigation *)navigation{
|
| | | |
| | | 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 - 600 * _scale, _height - 86 * _scale, 360 * _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];
|
| | | |
| | | UIView *view = UnityGetGLViewController().view;
|
| | | [view addSubview:m_UIWebView];
|
| | | }
|
| | |
|
| | | -(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;
|
| | | // }
|
| | |
|
| | | }
|
| | | 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];
|
| | | channel = [[SMPCQuickSDK defaultInstance] getConfigValue:@"channel"];
|
| | | if(channel&&[channel length]!=0)
|
| | | {
|
| | | |
| | | }
|
| | | else
|
| | | {
|
| | | channel = [NSString stringWithFormat:@"%d", [SMPCQuickSDK defaultInstance].channelType];
|
| | | }
|
| | | NSString *gameUID = [NSString stringWithFormat:@"%@@%@", uid, channel];
|
| | | 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\":\"%@\",\"serverid\":\"%@\",\"channelID\":\"%@\"}",
|
| | | _appid,
|
| | | [_dict objectForKey:@"cpInfo"],
|
| | | [_dict objectForKey:@"orderId"],
|
| | | [_dict objectForKey:@"sid"],
|
| | | channel
|
| | | ];
|
| | | // //个别渠道要求单价*数量==总价
|
| | | // 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+1);
|
| | | }
|
| | | 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;
|
| | | }
|
New file |
| | |
| | | // |
| | | // SMPCQuickPlatform.h |
| | | // QuickPlatforms |
| | | // |
| | | // Created by C.Maverick on 14/11/26. |
| | | // |
| | | // |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | #import <UIKit/UIKit.h> |
| | | //#import <QuickChannel/SMPCQuickChannelDefines.h> |
| | | //#import <QuickChannel/SMPCQuickChannelShareInfo.h> |
| | | //#import <QuickChannel/SMPCQuickRoleInfo.h> |
| | | #import "SMPCQuickChannelDefines.h" |
| | | #import "SMPCQuickRoleInfo.h" |
| | | #import "SMPCQuickChannelShareInfo.h" |
| | | |
| | | #pragma mark 基本信息 |
| | | |
| | | |
| | | @interface SMPCQuickChannel : NSObject { |
| | | NSArray *unsupportedFunctionList; |
| | | } |
| | | |
| | | + (SMPCQuickChannel *)defaultChannel; |
| | | |
| | | - (NSString *)channelName; |
| | | - (NSString *)channelVersion; |
| | | - (NSString *)channelCode; |
| | | - (NSString *)cpsChannelId; |
| | | - (NSString *)frameworkVersion; |
| | | |
| | | - (int)callFunction:(int)type args:(va_list)list; |
| | | -(NSString *)getPaayParams;//QuickSDK的充值额外参数获取发给QuickSDK服务器端 |
| | | @end |
| | | |
| | | #pragma mark 初始化 接入产品信息 |
| | | |
| | | @interface SMPCQuickChannel(Base) |
| | | |
| | | #pragma mark 初始化 |
| | | |
| | | /** |
| | | @brief 应用初始化 完成后会发送kSmpcQPInitDidFinishedNotification |
| | | @param dictionary 读取的配置文件值Channel.plist |
| | | @result 错误码 |
| | | */ |
| | | - (SMPC_CHANNEL_RESULT_CODE)initWithDictionary:(NSDictionary *)dictionary; |
| | | |
| | | - (SMPC_CHANNEL_RESULT_CODE)initWithDictionary:(NSDictionary *)dictionary application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; |
| | | |
| | | //调用插件功能 |
| | | - (int)callPlug:(NSString *)name params:(NSArray *)args; |
| | | // 进入暂停页 |
| | | - (SMPC_CHANNEL_RESULT_CODE)pause; |
| | | |
| | | #pragma mark 是否打开调试模式 |
| | | - (SMPC_CHANNEL_RESULT_CODE)setDebugMode; |
| | | |
| | | @end |
| | | |
| | | |
| | | |
| | | #pragma mark 用户部分 登录 注册 登出 |
| | | |
| | | @interface SMPCQuickChannel(Account) |
| | | |
| | | #pragma mark 登陆 |
| | | |
| | | /** |
| | | @brief 登录平台,默认自动登陆,支持游客账号登陆 登陆后会发送kSmpcQPLoginNotification |
| | | @result 错误码 |
| | | */ |
| | | - (SMPC_CHANNEL_RESULT_CODE)login; |
| | | |
| | | #pragma mark 注销 |
| | | |
| | | /** |
| | | @brief 注销 |
| | | @result 错误码 |
| | | */ |
| | | - (SMPC_CHANNEL_RESULT_CODE)logout; |
| | | |
| | | #pragma mark 登陆用户信息 |
| | | - (NSString *)userId; |
| | | - (NSString *)userNick; |
| | | - (NSString *)sessionId; |
| | | - (NSDictionary *)realNameInfo; |
| | | - (int)realAuth; |
| | | - (int)userType; |
| | | - (NSDictionary *)userExtInfo; |
| | | - (void)updateUserId:(NSString *)userId; //如果渠道本地有uid就不用使用服务器端的更新 |
| | | - (void)updateUserNick:(NSString *)userNick; //如果渠道本地有用户名就不用使用服务器端的更新 |
| | | - (void)updateUserDict:(NSDictionary *)dict; |
| | | |
| | | #pragma mark 更新角色信息 |
| | | - (void)updateRoleInfoWith:(SMPCQuickRoleInfo *)info; |
| | | - (void)updateRoleInfoWith:(SMPCQuickRoleInfo *)info isCreate:(BOOL)isCreate; |
| | | |
| | | // 登录校验等级 |
| | | - (SMPC_CHANNEL_LOGINCHECK_LEVEL)loginCheckLevel; |
| | | |
| | | /** |
| | | * 是否开启第三方登录 |
| | | */ |
| | | -(void)openThirdLogin:(BOOL)thirdLogin; |
| | | /** |
| | | * 获取当前用户的ID |
| | | * |
| | | * @return 获取当前用户的ID,如未登录则返回空 |
| | | */ |
| | | - (NSString *)getIdCode; |
| | | /** |
| | | * 是否游客账号 |
| | | * |
| | | * @return 获取当前用户的ID,如未登录则返回空 |
| | | */ |
| | | -(BOOL)isGuester; |
| | | /** |
| | | * 绑定身份证 |
| | | */ |
| | | -(void)ShowCertification; |
| | | /** |
| | | * 游客绑定并绑定身份证 |
| | | */ |
| | | -(void) BindCertification; |
| | | |
| | | @end |
| | | |
| | | |
| | | |
| | | |
| | | #pragma mark - |
| | | #pragma mark 各种中心 |
| | | |
| | | @interface SMPCQuickChannel(Centers) |
| | | |
| | | /** |
| | | @brief 进入用户中心 如用户注销登录会发送kSmpcQPLogoutNotification(可多次触发) |
| | | @result 错误码 |
| | | //渠道支持才去实现这个接口 |
| | | */ |
| | | - (SMPC_CHANNEL_RESULT_CODE)enterUserCenter; |
| | | - (SMPC_CHANNEL_RESULT_CODE)callSpecifyFunction:(NSInteger)functionName parameters:(NSDictionary *)parameterDict; |
| | | //打开渠道SDK的BBS,渠道支持才去实现这个接口 |
| | | - (SMPC_CHANNEL_RESULT_CODE)enterBBS; |
| | | |
| | | //打开渠道SDK的客服界面,渠道支持才去实现这个接口 |
| | | - (SMPC_CHANNEL_RESULT_CODE)enterCustomerServiceCenter; |
| | | |
| | | //分享 |
| | | - (SMPC_CHANNEL_RESULT_CODE)callSDKShare:(SMPCQuickChannelShareInfo *)shareInfo; |
| | | //隐私弹窗 |
| | | - (void)showPrivacyView:(void (^)(BOOL isAgreed))isAgreed; |
| | | |
| | | /* facebook分享连接 |
| | | * @param url 分享网址 |
| | | * @param quote 网页说明 |
| | | */ |
| | | -(void)FBShareLink:(NSString*)url quote:(NSString*)quote; |
| | | |
| | | /* facebook分享图片 |
| | | * @param filePath 图片路径 |
| | | */ |
| | | -(void)FBShareImage:(NSString*)filePath; |
| | | |
| | | /* 微信分享文本 |
| | | * @param test 分享文本 |
| | | * @param scene 发送场景:0 聊天界面,1 朋友圈,2 收藏 |
| | | */ |
| | | -(void)WXShareText:(NSString*)test sencetype:(int) scene; |
| | | |
| | | /* 微信分享图片 |
| | | * @param filePath 图片路径 |
| | | * @param width 缩略图宽 |
| | | * @param height 缩略图高 |
| | | * @param scene 发送场景:0 聊天界面,1 朋友圈,2 收藏 |
| | | */ |
| | | -(void)WXShareImage:(NSString*)filePath thumbWidth:(float) width thumbHeight:(float) height sencetype:(int) scene; |
| | | |
| | | @end |
| | | |
| | | |
| | | #pragma mark 充值、 支付 |
| | | |
| | | @class SMPCQuickProductInfo; |
| | | @class SMPCQuickRoleInfo; |
| | | |
| | | @interface SMPCQuickChannel(Pay) |
| | | |
| | | #pragma mark 代币充值 |
| | | //基础库向QuickChannel传递从服务器下单回来的数据。 |
| | | - (void)updatePayDict:(NSDictionary *)dict; |
| | | /** |
| | | @brief 进入虚拟币充值界面 如果渠道没有充值回调,就模拟一个QuickChannel充值回调,实际充值结果以服务器同步为准 |
| | | @result 错误码 通常为0,也不必关心 |
| | | */ |
| | | - (SMPC_CHANNEL_RESULT_CODE)buyOrderId:(NSString *)orderId |
| | | productInfo:(SMPCQuickProductInfo *)product |
| | | roleInfo:(SMPCQuickRoleInfo *)role; |
| | | |
| | | //2017.7.25 add begin |
| | | - (NSString *)getProductDescFromProduct:(SMPCQuickProductInfo *)product; |
| | | // |
| | | //探娱海外获取商品信息APi:传入的时候是productId如果多个用,分割,如:vol01,chips01,chips02,返回值监听kSmpcQCGetLocalizedNotification |
| | | |
| | | // |
| | | -(void)Getlocalized:(NSString *)productIds; |
| | | @end |
| | | |
| | | |
| | | #pragma mark 界面控制 |
| | | @interface SMPCQuickChannel(UISetting) |
| | | |
| | | #pragma mark 方向控制 |
| | | /** |
| | | //deprecated |
| | | @brief 设定平台为横屏或者竖屏 |
| | | @note 1、其中设置的方向需要在 app plist文件Supported interface orientations 中支持 |
| | | */ |
| | | - (SMPC_CHANNEL_RESULT_CODE)setChannelOrientation:(UIInterfaceOrientationMask)orientation; |
| | | |
| | | /** |
| | | //deprecated |
| | | @brief 设置是否自动旋转。 |
| | | @note 1、设置NO后,平台页面使用setPlatformOrientation设置的方向 |
| | | 2、设置Yes后,平台页面自适应旋转。 |
| | | */ |
| | | - (SMPC_CHANNEL_RESULT_CODE)setAutoRotation:(BOOL)isAutoRotate; |
| | | |
| | | #pragma mark 浮动条 |
| | | //显示浮动菜单 |
| | | - (SMPC_CHANNEL_RESULT_CODE)showToolBar:(SMPC_CHANNEL_TOOLBAR_PLACE)place; |
| | | //隐藏浮动菜单 |
| | | - (SMPC_CHANNEL_RESULT_CODE)hideToolBar; |
| | | |
| | | @end |
| | | |
| | | |
| | | #pragma mark 回调处理 |
| | | |
| | | @interface SMPCQuickChannel (URL) |
| | | |
| | | |
| | | - (SMPC_CHANNEL_RESULT_CODE)openURL:(NSURL *)url sourceApplication:(NSString *)sourceApp application:(UIApplication *)application annotation:(id)annotation; |
| | | // add |
| | | - (SMPC_CHANNEL_RESULT_CODE)openURL:(NSURL *)url application:(UIApplication *)application; |
| | | - (SMPC_CHANNEL_RESULT_CODE)openURL:(NSURL *)url application:(UIApplication *)app options:(NSDictionary <NSString *, id> *)options; |
| | | //推送 |
| | | - (SMPC_CHANNEL_RESULT_CODE)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken; |
| | | - (SMPC_CHANNEL_RESULT_CODE)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error; |
| | | - (SMPC_CHANNEL_RESULT_CODE)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo; |
| | | //AppDelegate事件 |
| | | - (SMPC_CHANNEL_RESULT_CODE)applicationWillResignActive:(UIApplication *)application; |
| | | |
| | | - (SMPC_CHANNEL_RESULT_CODE)applicationDidEnterBackground:(UIApplication *)application; |
| | | |
| | | - (SMPC_CHANNEL_RESULT_CODE)applicationWillEnterForeground:(UIApplication *)application; |
| | | - (SMPC_CHANNEL_RESULT_CODE)applicationDidBecomeActive:(UIApplication *)application; |
| | | - (SMPC_CHANNEL_RESULT_CODE)applicationWillTerminate:(UIApplication *)application; |
| | | - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window; |
| | | - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray * restorableObjects))restorationHandler; |
| | | |
| | | @end |
| | | |
| | | |
| | | |
| | | |
New file |
| | |
| | | // |
| | | // SMPCQuickPlatformDefines.h |
| | | // QuickPlatforms |
| | | // |
| | | // Created by C.Maverick on 14/11/26. |
| | | // |
| | | // |
| | | |
| | | #ifndef QuickChannel_SMPCQuickChannelDefines_h |
| | | #define QuickChannel_SMPCQuickChannelDefines_h |
| | | |
| | | #pragma mark - Notification Name |
| | | // 初始化通知 |
| | | #define kSmpcQCInitDidFinishedNotification @"kSmpcQCInitDidFinishedNotification" |
| | | //取消登陆 |
| | | #define kSmpcQCLogCancelNotification @"kSmpcQCLogCancelNotification" |
| | | // 登录通知 |
| | | #define kSmpcQCLoginNotification @"kSmpcQCLoginNotification" |
| | | // 登出通知 |
| | | #define kSmpcQCLogoutNotification @"kSmpcQCLogoutNotification" |
| | | /** 实名认证结果通知 */ |
| | | #define kSmpcQCRealAuthNotification @"kSmpcQCRealAuthNotification" |
| | | // 退出暂停页 |
| | | #define kSmpcQCPauseDidExitNotification @"kSmpcQCPauseDidExitNotification" |
| | | // 充值结果通知 |
| | | #define kSmpcQCRechargeResultNotification @"kSmpcQCRechargeResultNotification" |
| | | // 查询接商品信息的通知 |
| | | //#define kSmpcQCGetLocalizedNotification @"kSmpcQCGetLocalizedNotification" |
| | | // 离开平台页面通知 |
| | | #define kSmpcQCLeavedNotification @"kSmpcQCLeavedNotification" |
| | | /** 特殊方法结果回调通知 */ |
| | | #define kSmpcQCExtrNotification @"kSmpcQCExtraNotification" |
| | | #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 - Notification UserInfo Key |
| | | // 错误编码 |
| | | #define kSmpcQCNotificationErrorKey @"error" |
| | | // 错误描述 |
| | | #define kSmpcQCNotificationErrorMsg @"msg" |
| | | // QuickSDK 的订单号 |
| | | #define kSmpcQCNotificationOrderId @"orderId" |
| | | // 游戏开发商给的订单号 |
| | | #define kSmpcQCNotificationCpOrderId @"cpOrderId" |
| | | // 第3方渠道sdk给的订单号 |
| | | #define kSmpcQCNotificationSdkOrderId @"sdkOrderId" |
| | | // 透传参数 |
| | | #define kSmpcQCNotificationExtraParams @"extraParams" |
| | | // 用户id |
| | | #define kSmpcQCNotificationUserId @"userId" |
| | | // sessionID |
| | | #define kSmpcQCNotificationSessionId @"sessionId" |
| | | // token |
| | | #define kSmpcQCNotificationToken @"token" |
| | | // 二次验证时sdk方提供的数据 |
| | | #define kSmpcQCNotificationSdkData @"sdkData" |
| | | /** 实名认证回调是否已实名 */ |
| | | #define kSmpcQCNotificationSdkRealName @"realName" |
| | | /** 实名认证后年龄 */ |
| | | #define kSmpcQCNotificationSdkRealAge @"age" |
| | | /** 实名认证失败是否可以继续游戏 */ |
| | | #define kSmpcQCNotificationSdkRealResumeGame @"realResumeGame" |
| | | /** 预留字段 */ |
| | | #define kSmpcQCNotificationSdkRealOther @"other" |
| | | |
| | | #pragma mark - Enum |
| | | |
| | | // 版本检测类型 |
| | | typedef NS_ENUM(NSInteger, SMPC_CHANNEL_VERSION_CHECK_LEVEL) { |
| | | SMPC_CHANNEL_VERSION_CHECK_LEVEL_NORMAL = 0, // 正常等级 |
| | | SMPC_CHANNEL_VERSION_CHECK_LEVEL_STRICT, // 严格等级 |
| | | }; |
| | | |
| | | // 浮动条位置 |
| | | typedef NS_ENUM(NSInteger, SMPC_CHANNEL_TOOLBAR_PLACE) { |
| | | SMPC_CHANNEL_TOOLBAR_PLACE_TOP_LEFT = 1, // 左上 |
| | | SMPC_CHANNEL_TOOLBAR_PLACE_TOP_RIGHT, // 右上 |
| | | SMPC_CHANNEL_TOOLBAR_PLACE_MID_LEFT, // 左中 |
| | | SMPC_CHANNEL_TOOLBAR_PLACE_MID_RIGHT, // 右中 |
| | | SMPC_CHANNEL_TOOLBAR_PLACE_BOT_LEFT, // 左下 |
| | | SMPC_CHANNEL_TOOLBAR_PLACE_BOT_RIGHT, // 右下 |
| | | }; |
| | | |
| | | // 错误编码 |
| | | typedef NS_ENUM(NSInteger, SMPC_CHANNEL_RESULT_CODE) { |
| | | SMPC_CHANNEL_RESULT_ERROR_NONE = 0, /**< 没有错误 */ |
| | | SMPC_CHANNEL_RESULT_ERROR_INIT_FAILED = -1, /**< 初始化失败 */ |
| | | SMPC_CHANNEL_RESULT_ERROR_CONFIG = -2, /**< 配置文件错误 */ |
| | | SMPC_CHANNEL_RESULT_ERROR_NETWORK = -3, /**< 网络连接错误 */ |
| | | SMPC_CHANNEL_RESULT_ERROR_PARAM = -4, /**< 参数错误 */ |
| | | SMPC_CHANNEL_RESULT_ERROR_UNSUPPORTED = -10, /**< 功能不被支持 */ |
| | | |
| | | SMPC_CHANNEL_RESULT_ERROR_NOT_INIT = -20, /**< 没有初始化 */ |
| | | SMPC_CHANNEL_RESULT_ERROR_NOT_LOGIN = -21, /**< 没有登录用户 */ |
| | | SMPC_CHANNEL_RESULT_ERROR_HAD_LOGIN = -22, /**< 已有登录用户 */ |
| | | |
| | | SMPC_CHANNEL_RESULT_ERROR_RECHARGE_INVALID = -30, /**< 支付信息无效 */ |
| | | SMPC_CHANNEL_RESULT_ERROR_RECHARGE_FAILED = -31, /**< 充值失败 */ |
| | | SMPC_CHANNEL_RESULT_ERROR_RECHARGE_CANCELLED = -32, /**< 充值取消 */ |
| | | |
| | | SMPC_CHANNEL_RESULT_ERROR_UNKNOWN = -200, /**< 未知错误 */ |
| | | }; |
| | | |
| | | // 登录校验类型 |
| | | typedef NS_ENUM(NSInteger, SMPC_CHANNEL_LOGINCHECK_LEVEL) { |
| | | SMPC_CHANNEL_LOGINCHECK_LEVEL_NONE = 0, // 没有登录校验 |
| | | SMPC_CHANNEL_LOGINCHECK_LEVEL_OPTIONAL, // 登录校验可选 |
| | | SMPC_CHANNEL_LOGINCHECK_LEVEL_REQUEST, // 登录校验必选 |
| | | }; |
| | | |
| | | #endif |
New file |
| | |
| | | // |
| | | // SMPCQuickChannelShareInfo.h |
| | | // SMPCQuickChannel |
| | | // |
| | | // Created by xiaoxiao on 2019/2/19. |
| | | // Copyright © 2019年 HanDong. All rights reserved. |
| | | // |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | |
| | | |
| | | |
| | | @interface SMPCQuickChannelShareInfo : 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 |
| | | |
New file |
| | |
| | | // |
| | | // SMPCQuickProductInfo.h |
| | | // QuickChannel |
| | | // |
| | | // Created by IOS-Developer on 14/12/24. |
| | | // |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | |
| | | @interface SMPCQuickProductInfo : NSObject |
| | | @property(copy, nonatomic) NSString *goodsID; //商品ID |
| | | @property(copy, nonatomic) NSString *productName; //商品名称 |
| | | @property(copy, nonatomic) NSString *productOrderID; //商品订单ID |
| | | @property(assign, nonatomic) NSUInteger count; //商品数量 |
| | | @property(assign, nonatomic) float amount; //商品总价 |
| | | @property(copy, nonatomic) NSString *callbackUrl; //购买回调地址 |
| | | @property(copy, nonatomic) NSString *extrasParams; //扩展参数,一般是服务器回调原样回传 |
| | | |
| | | //在QuickSDK中对应的属性已经暂停使用,但是QuickChannel使用不变。 |
| | | //QuickSDK在转换参数时,仍然会使用到这些属性,QuickChannel中使用到这些属性 |
| | | //在客户使用的旧版QuickSDK中仍然用到了这些属性,所以暂时不能删掉 |
| | | @property(assign, nonatomic) float price; //商品单价 |
| | | @property(nonatomic,copy) NSString *quantifier; //商品量词 停用的 |
| | | @property(copy, nonatomic) NSString *productDesc; //商品描述 |
| | | |
| | | @end |
New file |
| | |
| | | // |
| | | // SMPCQuickRoleInfo.h |
| | | // QuickChannel |
| | | // |
| | | // Created by IOS-Developer on 14/12/24. |
| | | // Copyright (c) 2014年 HanDong. All rights reserved. |
| | | // |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | |
| | | @interface SMPCQuickRoleInfo : NSObject |
| | | @property (copy, nonatomic) NSString *serverId; //服务器Id |
| | | @property (copy, nonatomic) NSString *serverName; //服务器名称 |
| | | @property (copy, nonatomic) NSString *gameRoleName; //角色名 |
| | | @property (copy, nonatomic) NSString *gameRoleID; //角色ID |
| | | @property (copy, nonatomic) NSString *gameUserBalance; //玩家虚拟货币余额 |
| | | @property (copy, nonatomic) NSString *roleCreatTime; //角色创建时间 |
| | | @property (nonatomic,copy) NSString * _Nullable vipLevel; //玩家vip等级,选填,默认值0 |
| | | @property (nonatomic,copy) NSString * _Nullable gameUserLevel; //玩家等级,选填,默认值0 |
| | | @property (nonatomic,copy) NSString * _Nullable partyName; //公会名称,选填,默认空字符串 |
| | | @property (nonatomic,copy) NSString * _Nullable partyId; //公会id,选填,默认空字符串 |
| | | @property (nonatomic, copy) NSString * _Nullable fightPower; //战力,选填,默认值0 |
| | | @property (nonatomic, copy) NSString * _Nullable professionId; //角色职业id, 选填,默认值,空字符串 |
| | | @property (nonatomic, copy) NSString * _Nullable profession; //角色职业, 选填,默认值,空字符串 |
| | | @property (nonatomic,copy) NSString * _Nullable roleGender; //角色性别,选填,默认值男 |
| | | @property (nonatomic,copy) NSString * _Nullable partyRoleId; //公会角色id,选填,默认空字符串 |
| | | @property (nonatomic,copy) NSString * _Nullable partyRoleName; //公会角色名,选填,默认空字符串 |
| | | @end |
New file |
| | |
| | | <?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>files</key> |
| | | <dict> |
| | | <key>Headers/SMPCQuickChannel.h</key> |
| | | <data> |
| | | GPDKBzkIuCwRBHvCHwAwrDJea0Y= |
| | | </data> |
| | | <key>Headers/SMPCQuickChannelDefines.h</key> |
| | | <data> |
| | | PNRrALd3V4NpQq8bqfEJuCNbKBY= |
| | | </data> |
| | | <key>Headers/SMPCQuickChannelShareInfo.h</key> |
| | | <data> |
| | | w33Pnwshbnfpn4iQn6JKmNZ99BQ= |
| | | </data> |
| | | <key>Headers/SMPCQuickProductInfo.h</key> |
| | | <data> |
| | | q0cs1VoZ9V0t60Na19KY2X/9n5E= |
| | | </data> |
| | | <key>Headers/SMPCQuickRoleInfo.h</key> |
| | | <data> |
| | | 7r/VBL6Y5ifjt6LJlAEQ5uMVGg8= |
| | | </data> |
| | | <key>Info.plist</key> |
| | | <data> |
| | | +M/hee+GQuccZnLqLk12dh1MD2k= |
| | | </data> |
| | | </dict> |
| | | <key>files2</key> |
| | | <dict> |
| | | <key>Headers/SMPCQuickChannel.h</key> |
| | | <dict> |
| | | <key>hash</key> |
| | | <data> |
| | | GPDKBzkIuCwRBHvCHwAwrDJea0Y= |
| | | </data> |
| | | <key>hash2</key> |
| | | <data> |
| | | RP9PwedwhyvZ1ukdP285jJUKEf7yk5sKYWAlt/VvbdI= |
| | | </data> |
| | | </dict> |
| | | <key>Headers/SMPCQuickChannelDefines.h</key> |
| | | <dict> |
| | | <key>hash</key> |
| | | <data> |
| | | PNRrALd3V4NpQq8bqfEJuCNbKBY= |
| | | </data> |
| | | <key>hash2</key> |
| | | <data> |
| | | Kose592SBCTagKpc5TcZ7ZWChD/Ha2xeKdN7PwQIDPc= |
| | | </data> |
| | | </dict> |
| | | <key>Headers/SMPCQuickChannelShareInfo.h</key> |
| | | <dict> |
| | | <key>hash</key> |
| | | <data> |
| | | w33Pnwshbnfpn4iQn6JKmNZ99BQ= |
| | | </data> |
| | | <key>hash2</key> |
| | | <data> |
| | | jqAupycvDTECKiaY5b4YHdh4cZmq+ApdvcniA1nFp30= |
| | | </data> |
| | | </dict> |
| | | <key>Headers/SMPCQuickProductInfo.h</key> |
| | | <dict> |
| | | <key>hash</key> |
| | | <data> |
| | | q0cs1VoZ9V0t60Na19KY2X/9n5E= |
| | | </data> |
| | | <key>hash2</key> |
| | | <data> |
| | | jqcgeJRfwex25YXHKTi8rwOa8WkisxdltiTKNZfLNM8= |
| | | </data> |
| | | </dict> |
| | | <key>Headers/SMPCQuickRoleInfo.h</key> |
| | | <dict> |
| | | <key>hash</key> |
| | | <data> |
| | | 7r/VBL6Y5ifjt6LJlAEQ5uMVGg8= |
| | | </data> |
| | | <key>hash2</key> |
| | | <data> |
| | | seO35ZxgN7ISscH9J/19AVJvdSvMI2ZbGmTwj0C8/HE= |
| | | </data> |
| | | </dict> |
| | | </dict> |
| | | <key>rules</key> |
| | | <dict> |
| | | <key>^.*</key> |
| | | <true/> |
| | | <key>^.*\.lproj/</key> |
| | | <dict> |
| | | <key>optional</key> |
| | | <true/> |
| | | <key>weight</key> |
| | | <real>1000</real> |
| | | </dict> |
| | | <key>^.*\.lproj/locversion.plist$</key> |
| | | <dict> |
| | | <key>omit</key> |
| | | <true/> |
| | | <key>weight</key> |
| | | <real>1100</real> |
| | | </dict> |
| | | <key>^Base\.lproj/</key> |
| | | <dict> |
| | | <key>weight</key> |
| | | <real>1010</real> |
| | | </dict> |
| | | <key>^version.plist$</key> |
| | | <true/> |
| | | </dict> |
| | | <key>rules2</key> |
| | | <dict> |
| | | <key>.*\.dSYM($|/)</key> |
| | | <dict> |
| | | <key>weight</key> |
| | | <real>11</real> |
| | | </dict> |
| | | <key>^(.*/)?\.DS_Store$</key> |
| | | <dict> |
| | | <key>omit</key> |
| | | <true/> |
| | | <key>weight</key> |
| | | <real>2000</real> |
| | | </dict> |
| | | <key>^.*</key> |
| | | <true/> |
| | | <key>^.*\.lproj/</key> |
| | | <dict> |
| | | <key>optional</key> |
| | | <true/> |
| | | <key>weight</key> |
| | | <real>1000</real> |
| | | </dict> |
| | | <key>^.*\.lproj/locversion.plist$</key> |
| | | <dict> |
| | | <key>omit</key> |
| | | <true/> |
| | | <key>weight</key> |
| | | <real>1100</real> |
| | | </dict> |
| | | <key>^Base\.lproj/</key> |
| | | <dict> |
| | | <key>weight</key> |
| | | <real>1010</real> |
| | | </dict> |
| | | <key>^Info\.plist$</key> |
| | | <dict> |
| | | <key>omit</key> |
| | | <true/> |
| | | <key>weight</key> |
| | | <real>20</real> |
| | | </dict> |
| | | <key>^PkgInfo$</key> |
| | | <dict> |
| | | <key>omit</key> |
| | | <true/> |
| | | <key>weight</key> |
| | | <real>20</real> |
| | | </dict> |
| | | <key>^embedded\.provisionprofile$</key> |
| | | <dict> |
| | | <key>weight</key> |
| | | <real>20</real> |
| | | </dict> |
| | | <key>^version\.plist$</key> |
| | | <dict> |
| | | <key>weight</key> |
| | | <real>20</real> |
| | | </dict> |
| | | </dict> |
| | | </dict> |
| | | </plist> |
New file |
| | |
| | | // |
| | | // SMPCQuickSDK.h |
| | | // |
| | | // |
| | | // |
| | | // |
| | | #define SMPC_QUICK_SDK_VERSION @"2.6.3" //QuickSDK基础库版本 |
| | | |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | #import <UIKit/UIKit.h> |
| | | #import "SMPCQuickSDKDefines.h" |
| | | #import "SMPCQuickSDKInitConfigure.h" |
| | | #import "SMPCQuickSDKPayOrderInfo.h" |
| | | #import "SMPCQuickSDKGameRoleInfo.h" |
| | | #import "SMPCQuickSDKShareInfo.h" |
| | | |
| | | typedef enum { |
| | | QuickSDKUserTYPE_UNKnow = 0,//未知的未定义的 |
| | | QuickSDKUserTYPE_Account = 1,//账号 |
| | | QuickSDKUserTYPE_Phone = 2,//手机号 |
| | | QuickSDKUserTYPE_Guest = 3,//游客登录 |
| | | QuickSDKUserTYPE_WX = 4,//微信 |
| | | QuickSDKUserTYPE_QQ = 5,//手Q |
| | | QuickSDKUserTYPE_WeiBo = 6,//微博 |
| | | QuickSDKUserTYPE_GameCenter = 7,//GameCenter |
| | | QuickSDKUserTYPE_Apple = 16,//苹果 |
| | | QuickSDKUserTYPE_OneKey = 18,//阿里云一键登录 |
| | | } QuickSDKUserTYPE; |
| | | #pragma mark 基本信息 |
| | | |
| | | @interface SMPCQuickSDK : NSObject |
| | | |
| | | #pragma mark 单例对象 |
| | | + (SMPCQuickSDK *)defaultInstance; |
| | | - (instancetype)init NS_UNAVAILABLE; |
| | | + (instancetype)new NS_UNAVAILABLE; |
| | | |
| | | #pragma mark 获取渠道基本信息 |
| | | //获取渠道唯一标识,与服务器端channelID一致,任何时刻都可调用 |
| | | - (int)channelType; |
| | | |
| | | /** |
| | | * 获取QuickGame渠道cps包的渠道号 |
| | | */ |
| | | - (NSString *)cpsChannelId; |
| | | @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; |
| | | /** 设置切换账号回调 */ |
| | | - (void)configSwitchAccount:(void(^)(NSDictionary * resultDict))resultBlock; |
| | | // 登录后获取用户uid,这个uid在渠道上唯一,多个渠道的用户uid可能重复 |
| | | - (NSString *)userId; |
| | | // 登录后获取userToken可用于验证用户信息 |
| | | - (NSString *)userToken; |
| | | // 登录后获取用户昵称 |
| | | - (NSString *)userNick; |
| | | /** 查询渠道实名认证信息 */ |
| | | - (NSDictionary *)realNameInfo; |
| | | /** 获取设备id */ |
| | | - (NSString *)getDeviceID; |
| | | /** 清除设备id缓存数据 */ |
| | | - (void)resetDeviceID; |
| | | /** |
| | | @brief 调用渠道实名认证 |
| | | @result 错误码若渠道没有提供此方法会返回非0 |
| | | @note 结果会发送kSmpcQuickSDKNotiRealAuth通知 |
| | | */ |
| | | - (int)realAuth; |
| | | /** 获取渠道用户登录方式目前仅QuickGame越狱渠道有用 */ |
| | | - (QuickSDKUserTYPE)getChannelUserLoginType; |
| | | /** 获取用户额外信息,若没有额外信息则返回空字典 */ |
| | | - (NSDictionary *)getChannelUserExtInfo; |
| | | #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; |
| | | /** |
| | | @brief 调用渠道特定方法 |
| | | parameterDict: 调用方法需要传入的参数,如果没有则传入@{} |
| | | @result 错误码 |
| | | */ |
| | | - (int)callChannelSpecifyFunction:(NSInteger)functionName parameters:(NSDictionary *)parameterDict; |
| | | |
| | | /** |
| | | 进入YunKefu |
| | | |
| | | @param gameRoleInfo |
| | | @result 错误码 |
| | | */ |
| | | - (int)enterYunKeFuCenter:(SMPCQuickSDKGameRoleInfo *)gameRoleInfo; |
| | | /** 显示是否同意游戏用户协议和隐私政策弹窗-可点击查看在QK后台自定义的用户协议和隐私政策详情 |
| | | * @param must 是否必须同意 YES:弹窗仅有同意按钮 NO同时显示不同意和同意按钮 |
| | | * @param resultBlock 结果回调 YES玩家已经同意 NO玩家没有同意 |
| | | */ |
| | | - (void)showGameCustomPrivacyViewMustAgree:(BOOL)must result:(void(^)(BOOL hasAgreed))resultBlock; |
| | | /** 用手机浏览器打开指定url |
| | | * @param url url地址 |
| | | */ |
| | | - (void)openUrlOutAppWithBrowser:(NSString *)url; |
| | | /** 在app内用WKWebView打开指定url |
| | | * @param url url地址 |
| | | */ |
| | | - (void)openUrlInAppFullScreen:(NSString *)url; |
| | | /** 在APP内用SFSafariViewController打开指定url |
| | | * @param url url地址 |
| | | * @param isCanClose 是否可以关闭浏览器 ,YES 可关闭 |
| | | */ |
| | | - (void)openBrowserPageWithUrlString:(NSString *)url isCanClose:(BOOL)isCanClose; |
| | | |
| | | /** 调用显示渠道用户隐私弹窗, 用户同意返回YES,不同意返回NO*/ |
| | | - (void)showPrivacyView:(void (^)(BOOL isAgreed))isAgreed; |
| | | |
| | | #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 |
New file |
| | |
| | | // |
| | | // SMPCQuickSDKDefines.h |
| | | // QuickSDKs |
| | | // |
| | | // |
| | | // |
| | | |
| | | #ifndef SMPCQuickSDKDefines_h |
| | | #define SMPCQuickSDKDefines_h |
| | | |
| | | #pragma mark - Notification Name |
| | | |
| | | extern NSString* const kSmpcQuickSDKNotiInitDidFinished; //初始化成功 |
| | | extern NSString* const kSmpcQuickSDKNotiLogin; //登录成功 如果没有设置切换账号block切换账号成功也会回调这个 |
| | | extern NSString* const kSmpcQCGetLocalizedNotification; //查询接商品信息的通知 |
| | | extern NSString* const kSmpcQuickSDKNotiLogout; //用户注销 |
| | | extern NSString* const kSmpcQuickSDKNotiRecharge; //充值结果 |
| | | extern NSString* const kSmpcQuickSDKNotiPauseOver; //暂停结束 这个回调可以不用监听 |
| | | extern NSString * const kSmpcQuickSDKNotiPlugin; /*组件通知 见该插件接入文档,默认可以不用监听*/ |
| | | extern NSString* const kSmpcQuickSDKNotiRealAuth; //实名认证结果通知 |
| | | extern NSString* const kSmpcQuickSDKNotiExtra; //特殊方法结果通知 |
| | | |
| | | #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_LOGINDISABLED = -5, /* 渠道禁止登录 */ |
| | | 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_CPSCHANNELID = 0, /*官方渠道cps渠道id*/ |
| | | 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 |
New file |
| | |
| | | // |
| | | // SMPCQuickSDKGameRoleInfo.h |
| | | // SMPCQuickSDK |
| | | // |
| | | // |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | #import <UIKit/UIKit.h> |
| | | |
| | | @interface SMPCQuickSDKGameRoleInfo : NSObject |
| | | |
| | | NS_ASSUME_NONNULL_BEGIN |
| | | @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 * creatTime; //角色创建时间(10位时间戳),必填,没有传0 |
| | | NS_ASSUME_NONNULL_END |
| | | @property (nonatomic,copy) NSString * _Nullable gameUserBalance; //玩家虚拟货币余额,选填,默认值0 |
| | | @property (nonatomic,copy) NSString * _Nullable vipLevel; //玩家vip等级,选填,默认值0 |
| | | @property (nonatomic,copy) NSString * _Nullable gameUserLevel; //玩家等级,选填,默认值0 |
| | | @property (nonatomic,copy) NSString * _Nullable partyName; //公会名称,选填,默认空字符串 |
| | | @property (nonatomic,copy) NSString * _Nullable partyId; //公会id,选填,默认空字符串 |
| | | @property (nonatomic, copy) NSString * _Nullable fightPower; //战力,选填,默认值0 |
| | | @property (nonatomic, copy) NSString * _Nullable professionId; //角色职业id, 选填,默认值,空字符串 |
| | | @property (nonatomic, copy) NSString * _Nullable profession; //角色职业, 选填,默认值,空字符串 |
| | | @property (nonatomic,copy) NSString * _Nullable roleGender; //角色性别,选填,默认值男 |
| | | @property (nonatomic,copy) NSString * _Nullable partyRoleId; //公会角色id,选填,默认空字符串 |
| | | @property (nonatomic,copy) NSString * _Nullable partyRoleName; //公会角色名,选填,默认空字符串 |
| | | @property(nonatomic,copy) NSString * _Nullable extrasParams; //预留参数,选填,默认空字符串 |
| | | @end |
New file |
| | |
| | | // |
| | | // 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 |
New file |
| | |
| | | // |
| | | // 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 |
New file |
| | |
| | | // |
| | | // 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 |
| | | |
| | | |
New file |
| | |
| | | <?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>
|
New file |
| | |
| | | //
|
| | | // UniversalSDK.h
|
| | | // Unity-iPhone
|
| | | //
|
| | | //
|
| | |
|
| | | #ifndef __UNIVERSALSDK_H_
|
| | | #define __UNIVERSALSDK_H_
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | | #import <UIKit/UIKit.h>
|
| | | #import <WebKit/WebKit.h>
|
| | |
|
| | | #define UNITY_OBJ_NAME "ynmbxxjUtil"
|
| | | #define UNITY_FUNC_NAME "HandleMsgWithSDK"
|
| | |
|
| | | #define PRODUCT_CODE @"79907663126877508537965509169167"
|
| | | #define PRODUCT_KEY @"06782414"
|
| | |
|
| | | #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<WKUIDelegate, WKNavigationDelegate> {
|
| | | WKWebView* m_UIWebView;
|
| | | WKWebView* m_fakeUIWebView;
|
| | | 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
|
New file |
| | |
| | | //
|
| | | // 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>
|
| | |
|
| | | @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;
|
| | | static NSString* channel;
|
| | |
|
| | | -(id)init
|
| | | {
|
| | | self = [super init];
|
| | | |
| | | m_fakeUIWebView = [[WKWebView alloc] initWithFrame:CGRectZero];
|
| | | NSURL *url = [NSURL URLWithString:@"www.baidu.com"];
|
| | | NSURLRequest *request = [NSURLRequest requestWithURL:url
|
| | | cachePolicy:NSURLRequestUseProtocolCachePolicy
|
| | | timeoutInterval:10.f];
|
| | | [m_fakeUIWebView loadRequest:request];
|
| | |
|
| | | return self;
|
| | | }
|
| | |
|
| | | -(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
|
| | | [m_fakeUIWebView evaluateJavaScript:@"navigator.userAgent" completionHandler:^(id _Nullable userAgent, NSError * _Nullable error) {
|
| | |
|
| | | NSLog(@"%@", userAgent);
|
| | | NSString* _userAgent = [NSString stringWithFormat:@"%@", userAgent];
|
| | | // 发送设备信息
|
| | | NSMutableDictionary *_dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
| | | _uniqueID,@"unique_id",
|
| | | _idfa,@"android_id",
|
| | | [NSNumber numberWithInt:S2U_DeviceInfo],@"code",
|
| | | _userAgent,@"userAgent",nil];
|
| | | [self SendMessageToUnity:_dict];
|
| | | }];
|
| | | |
| | | NSString *_appid = sAppID;
|
| | | NSLog(@"init _appid:%@",_appid);
|
| | | |
| | | NSMutableDictionary *_dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
| | | [NSNumber numberWithInt:S2U_SdkInitComplete], @"code",
|
| | | @"hygame2", @"channelPlatform",
|
| | | _appid, @"yj_appid", _appid, @"yj_spid", 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 = [[WKWebView alloc] initWithFrame:CGRectMake(_offsetX, _offsetY, _width, _height)];
|
| | | m_UIWebView.UIDelegate = self;
|
| | | m_UIWebView.navigationDelegate = self ;
|
| | | 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)webViewDidFinishLoad:(WKWebView *)webView{
|
| | | - (void)webView:(WKWebView *)webView didFinishNavigation:(null_unspecified WKNavigation *)navigation{
|
| | | |
| | | 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 - 600 * _scale, _height - 86 * _scale, 360 * _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];
|
| | | |
| | | UIView *view = UnityGetGLViewController().view;
|
| | | [view addSubview:m_UIWebView];
|
| | | }
|
| | |
|
| | | -(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;
|
| | | // }
|
| | |
|
| | | }
|
| | | 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];
|
| | | channel = [[SMPCQuickSDK defaultInstance] getConfigValue:@"channel"];
|
| | | if(channel&&[channel length]!=0)
|
| | | {
|
| | | |
| | | }
|
| | | else
|
| | | {
|
| | | channel = [NSString stringWithFormat:@"%d", [SMPCQuickSDK defaultInstance].channelType];
|
| | | }
|
| | | NSString *gameUID = [NSString stringWithFormat:@"%@@%@", uid, channel];
|
| | | 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\":\"%@\",\"serverid\":\"%@\",\"channelID\":\"%@\"}",
|
| | | _appid,
|
| | | [_dict objectForKey:@"cpInfo"],
|
| | | [_dict objectForKey:@"orderId"],
|
| | | [_dict objectForKey:@"sid"],
|
| | | channel
|
| | | ];
|
| | | // //个别渠道要求单价*数量==总价
|
| | | // 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+1);
|
| | | }
|
| | | 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;
|
| | | }
|