XenonSDK.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. //
  2. // XenonSDK.h
  3. // XenonSDK
  4. //
  5. // Created by SAGESSE on 2019/1/20.
  6. // Copyright © 2019 SAGESSE. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import "XSUtils.h"
  10. #import "XSTracker.h"
  11. #import "XSCollector.h"
  12. #import "XSNetwork.h"
  13. #import "XSUser.h"
  14. #import "XSConfiguration.h"
  15. #import "XSDataCenter.h"
  16. #import "FqGameAd.h"
  17. #import <AudioToolbox/AudioToolbox.h>
  18. ///
  19. /// Game SDK
  20. ///
  21. @interface XenonSDK : NSObject
  22. @property (nonatomic, strong) XSUser* user;
  23. @property (nonatomic, strong) XSConfiguration* configuration;
  24. @property (nonatomic, strong) void(^sdk_loginCallback)(id user);
  25. @property (nonatomic, strong) void(^sdk_logoutCallback)(id user);
  26. @property (nonatomic, strong) UIView* bubbleView;
  27. @property (nonatomic, strong) UIViewController* rootViewController;
  28. @property (nonatomic, strong) NSString* appId;
  29. @property (nonatomic, strong) NSString* channelId;
  30. @property (nonatomic, strong) NSString* adId;
  31. @property (nonatomic, strong) NSString* adFlag;
  32. @property (nonatomic, readonly) NSBundle* bundle;
  33. @property (nonatomic, readonly) NSString* version;
  34. @property (nonatomic, readonly) NSString* shortVersion;
  35. @property (nonatomic, readonly) NSString* model;
  36. @property (nonatomic, readonly) NSString* advertisingIdentifier;
  37. @property (nonatomic, readonly) NSString* advertisingVendor;
  38. @property (nonatomic, strong) NSString* token;
  39. /// A sington instance of SDK.
  40. + (instancetype)sharedSDK;
  41. /// Init the sdk with application code.
  42. - (void)initWithParameter:(NSString*)parameter complete:(void (^)(NSError* error))complete;
  43. /// Login the sdk.
  44. - (void)loginWithComplete:(void (^)(id user, NSError* error))complete;
  45. /// Logout the sdk.
  46. - (void)logoutWithComplete:(void (^)(void))complete;
  47. /// Logout the game and sdk.
  48. - (void)logoutWhenNotification:(void (^)(void))handler;
  49. /// Buy a product.
  50. - (void)buy:(NSDictionary*)parameters complete:(void (^)(id order, NSError* error))complete;
  51. /// User Center.
  52. - (void)center;
  53. /// Report role info.
  54. - (void)reportWithRoleName:(NSString*)roleName level:(NSInteger)level serverId:(NSString*)serverId;
  55. ///打开banner广告
  56. - (void)adBanner:(NSString*)adId;
  57. ///关闭banner广告
  58. - (void)closeBanner:(NSString*)adId;
  59. ///Inner广告
  60. - (void)adInner:(NSString*)adId complete:(void (^)(int))complete;
  61. ///视频激励广告
  62. - (void)adVideo:(NSString*)adId complete:(void (^)(int))complete;
  63. /// 打开一个原生广告
  64. /// @param adId 打开广告编号
  65. -(void)adNative:(NSString *)adId x:(int)x y:(int)y w:(int)width h:(int)hight;
  66. /// 获取某一个广告位广告是否可用
  67. /// @parm callback YES:可用, NO:不可用
  68. -(void)isAdReady:(NSString *)adName callback:(void(^)(BOOL))callback;
  69. /// 打开一个广告
  70. /// @param adName 广告位名称
  71. -(void)openAd:(NSString *)adName;
  72. /// 打开一个广告 带着播放结果回调
  73. -(void)openAd:(NSString *)adName callback:(void(^)(BOOL))callback;
  74. //关闭原生广告
  75. -(void)closeNative:(NSString *)adName;
  76. /// 生命周期启动入口
  77. /// @param application application对象
  78. -(void)applicationDidFinishLaunching:(UIApplication *)application;
  79. /// 游戏进入后台
  80. -(void)applicationDidEnterBackground;
  81. /// 游戏进入到前台
  82. -(void)applicationWillEnterForeground;
  83. /// 游戏开始活跃运行
  84. -(void)applicationDidBecomeActive;
  85. ///手机震动
  86. -(void)iphoneVibrate;
  87. ///跳转appstore评论
  88. -(void)skipToAppsotreWithID:(NSString *)appleId;
  89. ///自动登录
  90. -(void)autoLogin;
  91. ///手动登录
  92. -(void)manualLogin;
  93. /// 统计事件1
  94. /// @param eventName 事件名称
  95. -(void)tjEvent:(NSString *)eventName;
  96. /// 统计事件2
  97. /// @param eventName 事件名称
  98. /// @param value 事件对应值
  99. -(void)tjEvent:(NSString *)eventName value:(NSString *)value;
  100. @end