webGame.d.ts 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. declare var wtsdk: any;
  2. declare namespace webGame {
  3. class BasePlatform extends core.BasePlatform {
  4. /** 记录onHide前的静音状态,用于onShow时还原 */
  5. private _muted;
  6. systemInfo: SystemInfo;
  7. ad: BaseADManager;
  8. moneyActivity: MoneyActivity;
  9. constructor();
  10. /**web版本直接用Laya自带的方法获取保存数据本地缓存*/
  11. getStorageSync(key: string): any;
  12. setStorageSync(key: string, data: any): void;
  13. /** 初始化监听事件 */
  14. private initEvent;
  15. private stageVisibleChange;
  16. /**
  17. * 回到前台的事件处理函数
  18. */
  19. private onShow;
  20. /**
  21. * 小游戏隐藏到后台事件处理函数。
  22. */
  23. private onHide;
  24. /**
  25. * 初始化(登陆、获取用户信息、设置默认分享)
  26. */
  27. init(): void;
  28. /**
  29. * 登陆 - 获取Code
  30. */
  31. private login;
  32. private jsGetHttpParam;
  33. /**
  34. * 登陆完成回调
  35. */
  36. private loginComplete;
  37. private httpUserInfoCallback;
  38. /**震动 */
  39. vibrate(pattern: number | number[]): void;
  40. /** 创建桌面图标 */
  41. addToDeskIcon(isShow: boolean, x?: number, y?: number, parent?: Laya.Node): any;
  42. /** 保存最高分 */
  43. saveScore(score: number): void;
  44. /**游戏开始接口 */
  45. gameStarted(): void;
  46. /** 显示或隐藏Banner广告 */
  47. adBanner(isShow: boolean, position_id?: number): void;
  48. /** 显示激励式广告 */
  49. adRewardedVideo(position_id?: number): void;
  50. /** 显示插屏广告 */
  51. adInterstitial(position_id?: number): void;
  52. /** 显示全屏广告流广告 */
  53. adFullVideo(position_id?: number): void;
  54. /** 信息流(可以理解为Banner一样的东西) */
  55. adFeed(isShow: boolean, position_id?: number, gravity?: string): void;
  56. private _moreGameBtn;
  57. /**
  58. * 更多游戏图标
  59. * @parame isShow 是否显示
  60. */
  61. moreGameBtn(isShow: boolean): MoreGameIcon;
  62. /** 更多游戏按钮参数 */
  63. protected readonly moreGameParams: {
  64. x: number;
  65. y: number;
  66. w: number;
  67. h: number;
  68. appLaunchOptions: any[];
  69. };
  70. openMoneyActiviyView(type: core.MoneyActivityType, data?: any): void;
  71. /**账户的金币信息接口 */
  72. operateCoin(callback: Laya.Handler): void;
  73. /**账户的积分信息接口 */
  74. getUserCoinInfo(Type: core.MoneyType, callback: Laya.Handler): void;
  75. /**小迈--神策 --自定义事件上报 */
  76. wzFinishReward(sceneType: number, Level: number, moneyType?: number): void;
  77. loadRewardVideo(postionID: number): void;
  78. /**签到初始化 */
  79. loginSignInit(SuccessCallBack: Laya.Handler): void;
  80. /**签到一次,保存用户当天签到记录 */
  81. loginSignLog(onSuccess: Laya.Handler): void;
  82. /**签到提现 */
  83. loginSignWithdraw(day: any, amount: any, Rank: any, SuccessCallBack: Laya.Handler): void;
  84. /**
  85. * 进度值
  86. * @param data percent进度值,1-100
  87. */
  88. progress(data: {
  89. percent: number;
  90. }): any;
  91. }
  92. }
  93. declare namespace webGame {
  94. class Platform extends BasePlatform implements core.IPlatform {
  95. constructor();
  96. showTitle(score: number): void;
  97. sendLoginCheck(): void;
  98. /** 更多游戏按钮参数 */
  99. protected readonly moreGameParams: {
  100. x: number;
  101. y: number;
  102. w: number;
  103. h: number;
  104. appLaunchOptions: any[];
  105. };
  106. }
  107. }
  108. /**
  109. * 广告
  110. */
  111. declare namespace webGame {
  112. class BaseADManager {
  113. protected _bannerAd: any;
  114. protected _rewardedVideoAd: any;
  115. protected _interstitialAd: any;
  116. protected _FreeAD: any;
  117. protected _FullVideoAd: any;
  118. constructor();
  119. private createAD;
  120. /** 创建Banner广告 */
  121. private createBannerAd;
  122. /** banner报错 */
  123. protected onBannerError(err: any): void;
  124. /** 显示 banner 广告 */
  125. showBanner(posid: number): void;
  126. /** 隐藏 banner 广告 */
  127. hideBanner(posid: number): void;
  128. /** 创建插屏广告 */
  129. private createInterstitialAd;
  130. /** 插屏广告报错 */
  131. protected onInterstitialAdError(err: any): void;
  132. /** 插屏广告关闭 */
  133. protected onInterstitialAdClosed(res: any): void;
  134. /** 插屏广告加载完成 */
  135. protected onInterstitialAdLoaded(res: number): void;
  136. /** 插屏广告预加载 */
  137. LoadInterstitialAd(posId: number): void;
  138. /**
  139. * 显示插屏广告
  140. */
  141. showInterstitialAd(posid: number): void;
  142. /** 创建激励视频广告 */
  143. private createRewardedVideoAd;
  144. /** 激励视频广告报错 */
  145. protected onRewardedVideoAdError(err: any): void;
  146. /** 激励视频广告关闭 */
  147. protected onRewardedVideoAdClosed(res: any): void;
  148. /** 激励视频广告加载完成 */
  149. protected onRewardedVideoAdLoaded(res: any): void;
  150. /** 激励视频广告预加载 */
  151. LoadRewardedVideoAd(posId: number): void;
  152. /** 显示激励广告 */
  153. showRewardedVideoAd(posId: number): void;
  154. private createFreeAd;
  155. /** FreeAd报错 */
  156. protected onFreeAdError(err: any): void;
  157. /** 显示 FreeAd 广告 */
  158. showFreeAd(posid: number): void;
  159. /** 隐藏 FreeAd 广告 */
  160. hideFreeAd(posid: number): void;
  161. private createFullVideoAd;
  162. /** 全屏广告广告报错 */
  163. protected onFullVideoAdError(err: any): void;
  164. /** 全屏广告广告关闭 */
  165. protected onFullVideoAdClosed(res: any): void;
  166. /** 全屏广告广告加载完成 */
  167. protected onFullVideoAdLoaded(res: any): void;
  168. /** 全屏广告广告预加载 */
  169. protected LoadFullVideoAd(posId: number): void;
  170. /** 显示激励广告 */
  171. showFullVideoAd(posId: number): void;
  172. }
  173. }
  174. declare namespace webGame {
  175. class MoneyActivity {
  176. constructor();
  177. /**账户的金币信息接口 */
  178. operateCoin(callback: Laya.Handler): void;
  179. /**
  180. * 账户的积分信息接口
  181. * @param Type 货币类型
  182. * @param callback
  183. */
  184. getUserCoinInfo(Type: core.MoneyType, callback: Laya.Handler): void;
  185. /******************以下维特部分网赚接口是独立工程调起网赚页接口************************************************************************ */
  186. ActivityView(type: core.MoneyActivityType, data?: any): void;
  187. WeiTeSdkParame(type: core.MoneyActivityType, data?: any): any;
  188. }
  189. }
  190. declare namespace webGame {
  191. class SystemInfo {
  192. info: {
  193. appName: string;
  194. platform: string;
  195. };
  196. constructor();
  197. /** 设备:android,ios */
  198. readonly device: string;
  199. /** app名字 */
  200. readonly appName: string;
  201. }
  202. }
  203. declare namespace webGame {
  204. class AddToDeskIcon extends Laya.Image {
  205. private static _instance;
  206. static show(x?: number, y?: number, parent?: Laya.Node): AddToDeskIcon;
  207. static hide(): void;
  208. constructor();
  209. onEnable(): void;
  210. onDisable(): void;
  211. private onClick;
  212. destroy(): void;
  213. }
  214. }
  215. declare namespace webGame {
  216. class LoadADTipsView extends Laya.Box {
  217. private blackBg;
  218. private lable;
  219. private str;
  220. private timeNum;
  221. constructor();
  222. onAwake(): void;
  223. onEnable(): void;
  224. private onResize;
  225. private timeCount;
  226. onDisable(): void;
  227. destroy(): void;
  228. }
  229. }
  230. declare namespace webGame {
  231. class MoreGameIcon extends Laya.Box {
  232. private ICON_SIZE;
  233. private _icon;
  234. private _label;
  235. private _tweentimeLite;
  236. private _appLaunchOptions;
  237. private _iconUrls;
  238. private _index;
  239. constructor(params: {
  240. x: number;
  241. y: number;
  242. w: number;
  243. h: number;
  244. appLaunchOptions: any[];
  245. });
  246. onAwake(): void;
  247. private getRes;
  248. onEnable(): void;
  249. private changeSkin;
  250. private iconLoaded;
  251. private onClick;
  252. onDisable(): void;
  253. destroy(): void;
  254. }
  255. }
  256. //# sourceMappingURL=webGame.d.ts.map