ViewController.m 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //
  2. // ViewController.m
  3. // NatureDemo
  4. //
  5. // Created by SAGESSE on 2019/1/20.
  6. // Copyright © 2019 SAGESSE. All rights reserved.
  7. //
  8. #import "ViewController.h"
  9. #import <XenonSDK/XenonSDK-Export.h>
  10. #define GameSDK LieYanShaCheng
  11. @interface KL: UIView
  12. @end
  13. @implementation KL
  14. + (Class)layerClass {
  15. return CAGradientLayer.self;
  16. }
  17. @end
  18. @interface ViewController ()
  19. @end
  20. @implementation ViewController
  21. - (void)loadView {
  22. [super loadView];
  23. KL* view = [[KL alloc] initWithFrame:self.view.frame];
  24. CAGradientLayer* gr = (id)view.layer;
  25. gr.colors = @[(__bridge id)UIColor.orangeColor.CGColor,
  26. (__bridge id)UIColor.purpleColor.CGColor];
  27. view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
  28. [self.view insertSubview:view atIndex:0];
  29. }
  30. - (void)viewDidLoad {
  31. [super viewDidLoad];
  32. // Do any additional setup after loading the view, typically from a nib.
  33. [XenonSDK.sharedSDK initWithParameter:@"20194|1104|475316&iOScsyx_test_0001" complete:^(NSError * error) {
  34. [XenonSDK.sharedSDK loginWithComplete:^(id user, NSError * error) {
  35. NSLog(@"SDK初始化成功了");
  36. }];
  37. }];
  38. }
  39. - (IBAction)login:(id)sender {
  40. [XenonSDK.sharedSDK loginWithComplete:^(id user, NSError * error) {
  41. NSLog(@"SDK初始化d登录成功打印%@",user);
  42. }];
  43. }
  44. - (IBAction)logout:(id)sender {
  45. [XenonSDK.sharedSDK logoutWithComplete:^{
  46. NSLog(@"%s", __func__);
  47. }];
  48. }
  49. - (IBAction)pay:(id)sender {
  50. id ps = @{
  51. @"amount": @"6",
  52. @"productName": @"6元宝",
  53. @"productCode": @"6",
  54. @"roleName": @"roleName",
  55. @"orderId": NSUUID.UUID.UUIDString,
  56. @"serverId": @"serverId",
  57. @"extraInfo": @"extraInfo"
  58. };
  59. [XenonSDK.sharedSDK buy:ps complete:^(id order, NSError * error) {
  60. NSLog(@"%s %@/%@", __func__, error, order);
  61. }];
  62. }
  63. - (IBAction)userCenter:(id)sender {
  64. [XenonSDK.sharedSDK center];
  65. }
  66. @end