Commit 4c7cd90d212e4f4d28ab00692ae35aa75b76fef1
1 parent
4d882ee7bd
Exists in
master
增加第三方支付完成回调,版本v3.3.11
Showing 4 changed files with 4 additions and 2 deletions Inline Diff
ios/GameSDK.framework/Versions/A/GameSDK
No preview for this file type
ios/GameSDK.framework/Versions/A/Headers/LetsGameAPI.h
1 | 1 | ||
2 | #import <Foundation/Foundation.h> | 2 | #import <Foundation/Foundation.h> |
3 | #import "LSGAccount.h" | 3 | #import "LSGAccount.h" |
4 | #import "VKBridgeProtocol.h" | 4 | #import "VKBridgeProtocol.h" |
5 | 5 | ||
6 | 6 | ||
7 | typedef void (^LSGLoginSuccBlock)(NSString *userId, NSString *sessionKey, LSGAccountType type); | 7 | typedef void (^LSGLoginSuccBlock)(NSString *userId, NSString *sessionKey, LSGAccountType type); |
8 | 8 | ||
9 | typedef void (^LSGDismissBlock)(void); | 9 | typedef void (^LSGDismissBlock)(void); |
10 | 10 | ||
11 | static BOOL isDisableFB = NO; | 11 | static BOOL isDisableFB = NO; |
12 | 12 | ||
13 | static BOOL isEnableVK = NO; | 13 | static BOOL isEnableVK = NO; |
14 | 14 | ||
15 | static BOOL hiddenLogo = NO; | 15 | static BOOL hiddenLogo = NO; |
16 | 16 | ||
17 | static NSString *version = @"3.3.10"; | 17 | static NSString *version = @"3.3.10"; |
18 | 18 | ||
19 | @interface LetsGameAPI : NSObject<UIApplicationDelegate> | 19 | @interface LetsGameAPI : NSObject<UIApplicationDelegate> |
20 | 20 | ||
21 | @property (nonatomic, strong) NSString *appId; | 21 | @property (nonatomic, strong) NSString *appId; |
22 | @property (nonatomic, strong) NSString *appKey; | 22 | @property (nonatomic, strong) NSString *appKey; |
23 | @property (nonatomic, copy) LSGLoginSuccBlock succBlock; | 23 | @property (nonatomic, copy) LSGLoginSuccBlock succBlock; |
24 | @property (nonatomic, copy) LSGDismissBlock dismissBlock; | 24 | @property (nonatomic, copy) LSGDismissBlock dismissBlock; |
25 | @property (nonatomic, assign) int isDebug; | 25 | @property (nonatomic, assign) int isDebug; |
26 | 26 | ||
27 | @property (nonatomic,retain) id<VKBridgeProtocol> vkBridge; | 27 | @property (nonatomic,retain) id<VKBridgeProtocol> vkBridge; |
28 | //@property(nonatomic,strong) NSString *version; | 28 | //@property(nonatomic,strong) NSString *version; |
29 | 29 | ||
30 | + (instancetype)instance; | 30 | + (instancetype)instance; |
31 | 31 | ||
32 | -(NSString*)version; | 32 | -(NSString*)version; |
33 | 33 | ||
34 | - (void)showLoginView; | 34 | - (void)showLoginView; |
35 | - (void)showLoginViewInView:(UIView *)view; | 35 | - (void)showLoginViewInView:(UIView *)view; |
36 | 36 | ||
37 | +(void)disableFB:(BOOL)isDisable; | 37 | +(void)disableFB:(BOOL)isDisable; |
38 | +(BOOL)isFBDisable; | 38 | +(BOOL)isFBDisable; |
39 | +(BOOL)isVKEnable; | 39 | +(BOOL)isVKEnable; |
40 | +(void)hiddenLogo:(BOOL)isHidden; | 40 | +(void)hiddenLogo:(BOOL)isHidden; |
41 | +(BOOL)isHiddenLogo; | 41 | +(BOOL)isHiddenLogo; |
42 | 42 | ||
43 | - (void)logout; | 43 | - (void)logout; |
44 | 44 | ||
45 | - (void)hide; | 45 | - (void)hide; |
46 | 46 | ||
47 | - (BOOL)handleOpenURL:(NSURL *)url | 47 | - (BOOL)handleOpenURL:(NSURL *)url |
48 | sourceApplication:(NSString *)sourceApplication; | 48 | sourceApplication:(NSString *)sourceApplication; |
49 | 49 | ||
50 | -(void)pay:(NSDictionary*) payInfo; | 50 | -(void)pay:(NSDictionary*) payInfo handleCallBack:(void (^)()) paySuccessCallback; |
51 | 51 | ||
52 | -(void)iap:(NSDictionary*) payInfo forUser:(NSString*) uid handleCallback:(void (^)(NSString* orderId)) callback; | 52 | -(void)iap:(NSDictionary*) payInfo forUser:(NSString*) uid handleCallback:(void (^)(NSString* orderId)) callback; |
53 | 53 | ||
54 | -(void)registeIapObserver; | 54 | -(void)registeIapObserver; |
55 | 55 | ||
56 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; | 56 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; |
57 | 57 | ||
58 | -(void)applicationWillTerminate:(UIApplication *)application; | 58 | -(void)applicationWillTerminate:(UIApplication *)application; |
59 | 59 | ||
60 | -(void)decideIsDebug:(int)isDebug; | 60 | -(void)decideIsDebug:(int)isDebug; |
61 | 61 | ||
62 | @end | 62 | @end |
63 | 63 |
ios/GameSDKDemo/GameSDKDemo.xcodeproj/project.xcworkspace/xcuserdata/yanglele.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
ios/GameSDKDemo/letsgameDemo/LSGMainViewController.m
1 | // | 1 | // |
2 | // LSGMainViewController.m | 2 | // LSGMainViewController.m |
3 | // letsgameDemo | 3 | // letsgameDemo |
4 | // | 4 | // |
5 | // Created by zhy on 14-5-24. | 5 | // Created by zhy on 14-5-24. |
6 | // | 6 | // |
7 | // | 7 | // |
8 | 8 | ||
9 | #import "LSGMainViewController.h" | 9 | #import "LSGMainViewController.h" |
10 | #import "LetsGameAPI.h" | 10 | #import "LetsGameAPI.h" |
11 | #import "VKBridge.h" | 11 | #import "VKBridge.h" |
12 | 12 | ||
13 | 13 | ||
14 | @interface LSGMainViewController () | 14 | @interface LSGMainViewController () |
15 | 15 | ||
16 | @property (nonatomic, strong) UILabel *resultLabel; | 16 | @property (nonatomic, strong) UILabel *resultLabel; |
17 | 17 | ||
18 | @property(nonatomic,strong) UIButton *vkActivityShareBtn; | 18 | @property(nonatomic,strong) UIButton *vkActivityShareBtn; |
19 | 19 | ||
20 | @property(nonatomic,copy) NSString *sessionKey; | 20 | @property(nonatomic,copy) NSString *sessionKey; |
21 | @end | 21 | @end |
22 | 22 | ||
23 | @implementation LSGMainViewController | 23 | @implementation LSGMainViewController |
24 | 24 | ||
25 | - (void)loadView { | 25 | - (void)loadView { |
26 | [super loadView]; | 26 | [super loadView]; |
27 | NSLog(@"i come in"); | 27 | NSLog(@"i come in"); |
28 | self.view.backgroundColor = [UIColor whiteColor]; | 28 | self.view.backgroundColor = [UIColor whiteColor]; |
29 | 29 | ||
30 | UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(110, 40, 100, 30)]; | 30 | UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(110, 40, 100, 30)]; |
31 | btn.backgroundColor = [UIColor orangeColor]; | 31 | btn.backgroundColor = [UIColor orangeColor]; |
32 | [btn setTitle:@"测试入口" forState:UIControlStateNormal]; | 32 | [btn setTitle:@"测试入口" forState:UIControlStateNormal]; |
33 | [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | 33 | [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
34 | btn.titleLabel.font = [UIFont systemFontOfSize:15]; | 34 | btn.titleLabel.font = [UIFont systemFontOfSize:15]; |
35 | [btn addTarget:self action:@selector(onClickTest) forControlEvents:UIControlEventTouchUpInside]; | 35 | [btn addTarget:self action:@selector(onClickTest) forControlEvents:UIControlEventTouchUpInside]; |
36 | [self.view addSubview:btn]; | 36 | [self.view addSubview:btn]; |
37 | 37 | ||
38 | 38 | ||
39 | 39 | ||
40 | UIButton *bindtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 100, 100, 30)]; | 40 | UIButton *bindtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 100, 100, 30)]; |
41 | bindtn.backgroundColor = [UIColor orangeColor]; | 41 | bindtn.backgroundColor = [UIColor orangeColor]; |
42 | [bindtn setTitle:@"退出账号" forState:UIControlStateNormal]; | 42 | [bindtn setTitle:@"退出账号" forState:UIControlStateNormal]; |
43 | [bindtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | 43 | [bindtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
44 | bindtn.titleLabel.font = [UIFont systemFontOfSize:15]; | 44 | bindtn.titleLabel.font = [UIFont systemFontOfSize:15]; |
45 | [bindtn addTarget:self action:@selector(onLogoutTest) forControlEvents:UIControlEventTouchUpInside]; | 45 | [bindtn addTarget:self action:@selector(onLogoutTest) forControlEvents:UIControlEventTouchUpInside]; |
46 | [self.view addSubview:bindtn]; | 46 | [self.view addSubview:bindtn]; |
47 | 47 | ||
48 | UIButton *payBtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 160, 100, 30)]; | 48 | UIButton *payBtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 160, 100, 30)]; |
49 | payBtn.backgroundColor = [UIColor orangeColor]; | 49 | payBtn.backgroundColor = [UIColor orangeColor]; |
50 | [payBtn setTitle:@"支付" forState:UIControlStateNormal]; | 50 | [payBtn setTitle:@"支付" forState:UIControlStateNormal]; |
51 | [payBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | 51 | [payBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
52 | payBtn.titleLabel.font = [UIFont systemFontOfSize:15]; | 52 | payBtn.titleLabel.font = [UIFont systemFontOfSize:15]; |
53 | [payBtn addTarget:self action:@selector(onPayTest) forControlEvents:UIControlEventTouchUpInside]; | 53 | [payBtn addTarget:self action:@selector(onPayTest) forControlEvents:UIControlEventTouchUpInside]; |
54 | [self.view addSubview:payBtn]; | 54 | [self.view addSubview:payBtn]; |
55 | 55 | ||
56 | UIButton *iapBtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 220, 100, 30)]; | 56 | UIButton *iapBtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 220, 100, 30)]; |
57 | iapBtn.backgroundColor = [UIColor orangeColor]; | 57 | iapBtn.backgroundColor = [UIColor orangeColor]; |
58 | [iapBtn setTitle:@"IAP" forState:UIControlStateNormal]; | 58 | [iapBtn setTitle:@"IAP" forState:UIControlStateNormal]; |
59 | [iapBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | 59 | [iapBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
60 | iapBtn.titleLabel.font = [UIFont systemFontOfSize:15]; | 60 | iapBtn.titleLabel.font = [UIFont systemFontOfSize:15]; |
61 | [iapBtn addTarget:self action:@selector(onIapTest) forControlEvents:UIControlEventTouchUpInside]; | 61 | [iapBtn addTarget:self action:@selector(onIapTest) forControlEvents:UIControlEventTouchUpInside]; |
62 | [self.view addSubview:iapBtn]; | 62 | [self.view addSubview:iapBtn]; |
63 | 63 | ||
64 | 64 | ||
65 | } | 65 | } |
66 | 66 | ||
67 | - (UILabel *)resultLabel { | 67 | - (UILabel *)resultLabel { |
68 | if (!_resultLabel) { | 68 | if (!_resultLabel) { |
69 | _resultLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.view.frame) - 90, self.view.frame.size.width, 60)]; | 69 | _resultLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.view.frame) - 90, self.view.frame.size.width, 60)]; |
70 | _resultLabel.backgroundColor = [UIColor clearColor]; | 70 | _resultLabel.backgroundColor = [UIColor clearColor]; |
71 | _resultLabel.textAlignment = NSTextAlignmentCenter; | 71 | _resultLabel.textAlignment = NSTextAlignmentCenter; |
72 | _resultLabel.textColor = [UIColor redColor]; | 72 | _resultLabel.textColor = [UIColor redColor]; |
73 | _resultLabel.font = [UIFont systemFontOfSize:15]; | 73 | _resultLabel.font = [UIFont systemFontOfSize:15]; |
74 | _resultLabel.numberOfLines = 4; | 74 | _resultLabel.numberOfLines = 4; |
75 | _resultLabel.lineBreakMode = NSLineBreakByWordWrapping; | 75 | _resultLabel.lineBreakMode = NSLineBreakByWordWrapping; |
76 | [self.view addSubview:_resultLabel]; | 76 | [self.view addSubview:_resultLabel]; |
77 | } | 77 | } |
78 | 78 | ||
79 | return _resultLabel; | 79 | return _resultLabel; |
80 | } | 80 | } |
81 | 81 | ||
82 | 82 | ||
83 | - (void)onClickTest { | 83 | - (void)onClickTest { |
84 | 84 | ||
85 | [LetsGameAPI instance].appId = @"10047"; | 85 | [LetsGameAPI instance].appId = @"10047"; |
86 | [LetsGameAPI instance].appKey = @"eccd9f7dc92858b741132fda313130cf"; | 86 | [LetsGameAPI instance].appKey = @"eccd9f7dc92858b741132fda313130cf"; |
87 | [LetsGameAPI hiddenLogo:YES]; | 87 | [LetsGameAPI hiddenLogo:YES]; |
88 | // [LetsGameAPI disableFB:NO]; | 88 | // [LetsGameAPI disableFB:NO]; |
89 | NSLog(@"sdk version:%@",[[LetsGameAPI instance] version]); | 89 | NSLog(@"sdk version:%@",[[LetsGameAPI instance] version]); |
90 | //启用vk登录 | 90 | //启用vk登录 |
91 | VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"]; | 91 | VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"]; |
92 | [LetsGameAPI instance].vkBridge = vkBridge; | 92 | [LetsGameAPI instance].vkBridge = vkBridge; |
93 | 93 | ||
94 | [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) { | 94 | [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) { |
95 | self.sessionKey = sessionKey; | 95 | self.sessionKey = sessionKey; |
96 | self.resultLabel.text = [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %ld", userId, sessionKey, type]; | 96 | self.resultLabel.text = [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %ld", userId, sessionKey, type]; |
97 | }; | 97 | }; |
98 | [LetsGameAPI instance].dismissBlock = ^() { | 98 | [LetsGameAPI instance].dismissBlock = ^() { |
99 | self.resultLabel.text = @"dismiss without login"; | 99 | self.resultLabel.text = @"dismiss without login"; |
100 | }; | 100 | }; |
101 | 101 | ||
102 | [[LetsGameAPI instance] showLoginView]; | 102 | [[LetsGameAPI instance] showLoginView]; |
103 | } | 103 | } |
104 | 104 | ||
105 | 105 | ||
106 | - (void)onLogoutTest { | 106 | - (void)onLogoutTest { |
107 | [LetsGameAPI instance].appId = @"10000"; | 107 | [LetsGameAPI instance].appId = @"10000"; |
108 | [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab"; | 108 | [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab"; |
109 | [[LetsGameAPI instance] logout]; | 109 | [[LetsGameAPI instance] logout]; |
110 | 110 | ||
111 | } | 111 | } |
112 | 112 | ||
113 | -(void)onPayTest{ | 113 | -(void)onPayTest{ |
114 | [LetsGameAPI instance].appId = @"10022"; | 114 | [LetsGameAPI instance].appId = @"10022"; |
115 | [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab"; | 115 | [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab"; |
116 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; | 116 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; |
117 | [payInfo setValue:@"100" forKey:@"serverId"]; | 117 | [payInfo setValue:@"100" forKey:@"serverId"]; |
118 | [payInfo setValue:@"10010" forKey:@"roleId"]; | 118 | [payInfo setValue:@"10010" forKey:@"roleId"]; |
119 | [payInfo setValue:@"1000" forKey:@"channelId"]; | 119 | [payInfo setValue:@"1000" forKey:@"channelId"]; |
120 | [payInfo setValue:@"10" forKey:@"amount"]; | 120 | [payInfo setValue:@"10" forKey:@"amount"]; |
121 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"]; | 121 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"]; |
122 | [payInfo setValue:@"元宝" forKey:@"product"]; | 122 | [payInfo setValue:@"元宝" forKey:@"product"]; |
123 | [payInfo setValue:self.sessionKey forKey:@"sessionKey"]; | 123 | [payInfo setValue:self.sessionKey forKey:@"sessionKey"]; |
124 | [[LetsGameAPI instance] pay:payInfo]; | 124 | [[LetsGameAPI instance] pay:payInfo handleCallBack:^{ |
125 | NSLog(@"第三方支付完成"); | ||
126 | }]; | ||
125 | } | 127 | } |
126 | 128 | ||
127 | -(void)onIapTest{ | 129 | -(void)onIapTest{ |
128 | [LetsGameAPI instance].appId = @"10022"; | 130 | [LetsGameAPI instance].appId = @"10022"; |
129 | [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab"; | 131 | [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab"; |
130 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; | 132 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; |
131 | [payInfo setValue:@"5001" forKey:@"serverId"]; | 133 | [payInfo setValue:@"5001" forKey:@"serverId"]; |
132 | [payInfo setValue:@"10010" forKey:@"roleId"]; | 134 | [payInfo setValue:@"10010" forKey:@"roleId"]; |
133 | [payInfo setValue:@"1000" forKey:@"channelId"]; | 135 | [payInfo setValue:@"1000" forKey:@"channelId"]; |
134 | [payInfo setValue:@"10" forKey:@"amount"]; | 136 | [payInfo setValue:@"10" forKey:@"amount"]; |
135 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"]; | 137 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"]; |
136 | [payInfo setValue:@"test.product.1" forKey:@"product"]; | 138 | [payInfo setValue:@"test.product.1" forKey:@"product"]; |
137 | [[LetsGameAPI instance] iap:payInfo forUser:@"" handleCallback:^(NSString* orderId){ | 139 | [[LetsGameAPI instance] iap:payInfo forUser:@"" handleCallback:^(NSString* orderId){ |
138 | NSLog(@"IAP completed orderId of Gumptech:%@",orderId); | 140 | NSLog(@"IAP completed orderId of Gumptech:%@",orderId); |
139 | }]; | 141 | }]; |
140 | } | 142 | } |
141 | 143 | ||
142 | 144 | ||
143 | - (BOOL)shouldAutorotate { | 145 | - (BOOL)shouldAutorotate { |
144 | return YES; | 146 | return YES; |
145 | } | 147 | } |
146 | 148 | ||
147 | -(UIInterfaceOrientationMask)supportedInterfaceOrientations{ | 149 | -(UIInterfaceOrientationMask)supportedInterfaceOrientations{ |
148 | return UIInterfaceOrientationMaskAll; | 150 | return UIInterfaceOrientationMaskAll; |
149 | } | 151 | } |
150 | 152 | ||
151 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { | 153 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { |
152 | return YES; | 154 | return YES; |
153 | } | 155 | } |
154 | 156 | ||
155 | @end | 157 | @end |
156 | 158 |