drgame-cc 1.0.44 → 1.0.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/drres/focus/focus_1/gesture.atlas +34 -0
  2. package/drres/focus/focus_1/gesture.atlas.meta +6 -0
  3. package/drres/focus/focus_1/gesture.json +1 -0
  4. package/drres/focus/focus_1/gesture.json.meta +10 -0
  5. package/drres/focus/focus_1/gesture.png +0 -0
  6. package/drres/{icons/pointer-yellow-60.png.meta → focus/focus_1/gesture.png.meta} +14 -14
  7. package/drres/focus/focus_1.meta +13 -0
  8. package/drres/focus/focus_2/gesture.atlas +41 -0
  9. package/drres/focus/focus_2/gesture.atlas.meta +6 -0
  10. package/drres/focus/focus_2/gesture.json +1 -0
  11. package/drres/focus/focus_2/gesture.json.meta +10 -0
  12. package/drres/focus/focus_2/gesture.png +0 -0
  13. package/drres/{icons/pointer-blue-60.png.meta → focus/focus_2/gesture.png.meta} +13 -13
  14. package/drres/focus/focus_2.meta +13 -0
  15. package/drres/focus/focus_3/gesture.atlas +34 -0
  16. package/drres/focus/focus_3/gesture.atlas.meta +6 -0
  17. package/drres/focus/focus_3/gesture.json +1 -0
  18. package/drres/focus/focus_3/gesture.json.meta +10 -0
  19. package/drres/focus/focus_3/gesture.png +0 -0
  20. package/drres/{icons/pointer-pink-60.png.meta → focus/focus_3/gesture.png.meta} +12 -12
  21. package/drres/focus/focus_3.meta +13 -0
  22. package/drres/focus/focus_4/gesture.atlas +20 -0
  23. package/drres/focus/focus_4/gesture.atlas.meta +6 -0
  24. package/drres/focus/focus_4/gesture.json +1 -0
  25. package/drres/focus/focus_4/gesture.json.meta +10 -0
  26. package/drres/focus/focus_4/gesture.png +0 -0
  27. package/drres/focus/focus_4/gesture.png.meta +38 -0
  28. package/drres/focus/focus_4.meta +13 -0
  29. package/drres/focus.meta +13 -0
  30. package/drres/prefab/ExitWin.prefab +2 -2
  31. package/drres/prefab/Toast.prefab +378 -378
  32. package/drscript/{ad/AdManager.ts.meta → BtnExtra.ts.meta} +1 -1
  33. package/drscript/Define.ts +20 -0
  34. package/drscript/{ad/AdSlot.ts.meta → Define.ts.meta} +1 -1
  35. package/drscript/{ad/AggregateAdProvider.ts.meta → ExitWin.ts.meta} +1 -1
  36. package/drscript/GameAnalytics.ts +37 -118
  37. package/drscript/{ad/IAdProvider.ts.meta → GameAnalytics.ts.meta} +1 -1
  38. package/drscript/HelperWin.ts.meta +10 -0
  39. package/drscript/Info.ts.meta +10 -0
  40. package/drscript/InternalUitl.ts.meta +10 -0
  41. package/drscript/KeyAdapter.ts +133 -0
  42. package/drscript/KeyAdapter.ts.meta +10 -0
  43. package/drscript/Loader.ts.meta +10 -0
  44. package/drscript/PlatformAdapter.ts +179 -192
  45. package/drscript/PlatformAdapter.ts.meta +10 -0
  46. package/drscript/README.md +91 -805
  47. package/drscript/README.md.meta +6 -0
  48. package/drscript/UIAdapter.ts +324 -0
  49. package/drscript/UIAdapter.ts.meta +10 -0
  50. package/drscript/WebBridge.ts +1 -1
  51. package/drscript/WebBridge.ts.meta +10 -0
  52. package/drscript/ad-sdk/reporters/superset-lewo.js +6 -0
  53. package/drscript/ad-sdk/types/enums.d.ts +1 -0
  54. package/drscript/ad-sdk.meta +13 -0
  55. package/drscript/ad.meta +13 -0
  56. package/drscript/component/AlertTip.ts +25 -0
  57. package/drscript/component/AlertTip.ts.meta +10 -0
  58. package/drscript/component/BtnExtra.ts +17 -0
  59. package/drscript/component/BtnExtra.ts.meta +10 -0
  60. package/drscript/{ExitWin.ts → component/ExitWin.ts} +6 -8
  61. package/drscript/component/ExitWin.ts.meta +10 -0
  62. package/drscript/{HelperWin.ts → component/HelperWin.ts} +5 -19
  63. package/drscript/component/HelperWin.ts.meta +10 -0
  64. package/drscript/component.meta +13 -0
  65. package/drscript/config.meta +13 -0
  66. package/drscript/core.meta +13 -0
  67. package/drscript/focus/FocusItem.ts +1 -19
  68. package/drscript/focus/FocusManager.ts +132 -170
  69. package/drscript/focus/FocusVisualLayer.ts +74 -163
  70. package/drscript/focus.meta +13 -0
  71. package/drscript/input/KeyboardMove.ts +40 -11
  72. package/drscript/input/KeyboardMove.ts.meta +10 -0
  73. package/drscript/input.meta +13 -0
  74. package/drscript/interface.meta +13 -0
  75. package/drscript/pinyin.meta +13 -0
  76. package/drscript/toast.meta +13 -0
  77. package/drscript/virtualgamepad.meta +13 -0
  78. package/package.json +1 -1
  79. package/drres/config/default.json +0 -101
  80. package/drres/config/default.json.meta +0 -6
  81. package/drres/icons/pointer-blue-60.png +0 -0
  82. package/drres/icons/pointer-pink-60.png +0 -0
  83. package/drres/icons/pointer-yellow-60.png +0 -0
  84. package/drscript/Info.ts +0 -78
  85. package/drscript/InternalUitl.ts +0 -65
  86. package/drscript/ad/AdManager.ts +0 -174
  87. package/drscript/ad/AdSlot.ts +0 -44
  88. package/drscript/ad/AggregateAdProvider.ts +0 -149
  89. package/drscript/ad/IAdProvider.ts +0 -39
  90. package/drscript/ad/MockAdProvider.ts +0 -36
  91. package/drscript/ad/MockAdProvider.ts.meta +0 -10
  92. package/drscript/ad/SelfAdProvider.ts +0 -41
  93. package/drscript/ad/SelfAdProvider.ts.meta +0 -10
  94. package/drscript/config/TvUiConfig.ts +0 -155
  95. package/drscript/config/TvUiConfig.ts.meta +0 -10
  96. package/drscript/config/TvUiConfigManager.ts +0 -133
  97. package/drscript/config/TvUiConfigManager.ts.meta +0 -10
  98. package/drscript/core/BackManager.ts +0 -38
  99. package/drscript/core/BackManager.ts.meta +0 -10
  100. package/drscript/core/NativeBridge.ts +0 -137
  101. package/drscript/core/NativeBridge.ts.meta +0 -10
  102. package/drscript/core/TvUi.ts +0 -69
  103. package/drscript/core/TvUi.ts.meta +0 -10
  104. package/drscript/core/TvUiRoot.ts +0 -137
  105. package/drscript/core/TvUiRoot.ts.meta +0 -10
  106. package/drscript/icon/IconConfig.ts +0 -7
  107. package/drscript/icon/IconConfig.ts.meta +0 -10
  108. package/drscript/icon/IconManager.ts +0 -97
  109. package/drscript/icon/IconManager.ts.meta +0 -10
  110. package/drscript/input/KeyCodeAdapter.ts +0 -23
  111. package/drscript/input/RemoteInputManager.ts +0 -105
  112. package/drscript/interface/ILobbyBridge.ts +0 -5
  113. package/drscript/toast/ToastComponent.ts +0 -35
  114. package/drscript/toast/ToastComponent.ts.meta +0 -10
  115. package/drscript/toast/ToastManager.ts +0 -66
  116. package/drscript/toast/ToastManager.ts.meta +0 -10
  117. package/drscript/toast/TvExitConfirmDialog.ts +0 -334
  118. package/drscript/toast/TvExitConfirmDialog.ts.meta +0 -10
  119. package/drscript/toast/UIFunctions.ts +0 -150
  120. package/drscript/toast/UIFunctions.ts.meta +0 -10
@@ -1,96 +1,92 @@
1
-
2
- import { BtnExtra } from "./BtnExtra";
3
- import TvUi from "./core/TvUi";
4
- import { EVideoScene } from "./Define";
5
- import GameAnalytics, { AnalyticsAction, AnalyticsEvent, GameAnalyticsPlatform } from "./GameAnalytics";
6
- import { showRewardVideo } from "./Info";
1
+ import { AdEvent, AdPlatform, AdSdk, AdType } from "./ad-sdk/ad-sdk";
2
+ import { BtnExtra } from "./component/BtnExtra";
3
+ import HelperWin from "./component/HelperWin";
4
+ import { AnalyticsAction, AnalyticsEvent, EVideoScene, FingerStyle } from "./Define";
5
+ import FocusVisualLayer from "./focus/FocusVisualLayer";
6
+ import GameAnalytics from "./GameAnalytics";
7
7
  import { Loader } from "./Loader";
8
- import ToastManager from "./toast/ToastManager";
9
- import { InternalUitl } from "./InternalUitl";
8
+ import { UIAdapter } from "./UIAdapter";
10
9
  import { WebBridge } from "./WebBridge";
11
- import { AdPlatform, AdSdk } from "./ad-sdk/ad-sdk";
12
- import HelperWin from "./HelperWin";
13
- /** 平台适配器,名字有点长防止和Platform,Adapter冲突 */
10
+
11
+ /** 平台适配器,公共 API 入口 */
14
12
  export class PlatformAdapter {
15
- private static readonly version = "1.0.36";
16
- private static readonly designWidth = 1920;
17
- private static readonly designHeight = 1080;
18
- private static webBridge: WebBridge;
19
- private static _canWatchVideo: boolean;
20
- private static _isVIP: boolean;
21
- private static _zhName: string;
13
+ /** 焦点管理 */
14
+ public static focus = UIAdapter.focus;
15
+ /** 返回键管理 */
16
+ public static back = UIAdapter.back;
17
+ /** WebBridge */
18
+ public static get webBridge() { return UIAdapter.webBridge; }
19
+
20
+ private static contentId: string = "";
21
+
22
+ // ========================================================================
23
+ // 初始化
24
+ // ========================================================================
25
+
22
26
  /** 初始化
23
27
  * @param cnName 中文名称
24
- * @param minigameID 小游戏ID,文档地址:https://doc.weixin.qq.com/sheet/e3_AcEAlgaLALsCNiuHzH2NOQGCjVc3a?scode=AOcA0AdfAAoSqmh5BfAQIA6AYEAB4&tab=BB08J2
28
+ * @param minigameID 小游戏ID
25
29
  */
26
- public static async init(cnName: string, minigameID: number) {
27
- this._zhName = cnName;
28
- this.webBridge = new WebBridge();
29
- var platform = GameAnalyticsPlatform.XiaomiTv;//平台由sdk后续处理
30
- var appItem = GameAnalytics.getAppItem(platform);
31
- var contentId = minigameID.toString();//InternalUitl.getChineseInitials(cnName);
32
- console.log(`[sdk-version] ${this.version}`);
33
- TvUi.init({
34
- cpId: contentId,
35
- version: this.version,
36
- designWidth: this.designWidth,
37
- designHeight: this.designHeight,
38
- enableCursor: true,
39
- configPath: "drres/config/default",
40
- focus: {
41
- enabled: true,
42
- defaultIconKey: "default"
43
- },
44
- adSdk: {
45
- platform: platform
46
- },
47
- ads: {
48
- reward: {
49
- enabled: true,
50
- mode: "reward",
51
- channels: [
52
- { type: "aggregate", priority: 1, reward_type: "reward" },
53
- { type: "mock", priority: 100 }
54
- ]
55
- },
56
- popup: {
57
- enabled: true,
58
- mode: "popup",
59
- channels: [
60
- { type: "aggregate", priority: 1 },
61
- { type: "mock", priority: 100 }
62
- ]
63
- },
64
- game: {
65
- enabled: true,
66
- mode: "popup",
67
- channels: [
68
- { type: "aggregate", priority: 1 },
69
- { type: "mock", priority: 100 }
70
- ]
71
- }
72
- }
73
- });
30
+ public static async init(cnName: string, minigameID: number, focusIcon: FingerStyle) {
31
+ FocusVisualLayer.setStyle(focusIcon);
32
+ UIAdapter._zhName = cnName;
33
+ var platform: AdPlatform = AdPlatform.None;
34
+ UIAdapter.webBridge = new WebBridge();
35
+ if (UIAdapter.webBridge.isAvailable()) {
36
+ } else if (this.isXiaomi) {
37
+ platform = AdPlatform.Xiaomi;
38
+ }
39
+ this.contentId = minigameID.toString();
40
+ console.log(`[sdk-version] ${UIAdapter.version}`);
41
+ UIAdapter.init({ focusEnabled: true });
74
42
 
75
43
  GameAnalytics.init({
76
- platform: GameAnalyticsPlatform.XiaomiTv,
77
- app_item: appItem,
78
- content_type: "游戏", // 游戏(乐窝的游戏,这个字段都固定上报游戏)
79
- content_id: contentId, // 游戏ID(具体乐窝的游戏ID)
80
- content_title: cnName, // 游戏名(具体的乐窝游戏名)
44
+ app_item: "25",
45
+ content_type: "游戏",
46
+ content_id: this.contentId,
47
+ content_title: cnName,
81
48
  });
82
- if (this.isCocos)
83
- await ToastManager.Inst.init();
49
+ if (PlatformAdapter.isCocos) {
50
+ UIAdapter.toastPool = new cc.NodePool();
51
+ UIAdapter.prefab = await UIAdapter.loadPrefab('drres/prefab/Toast');
52
+ }
84
53
  let adapters: any = {};
85
- adapters[platform] = { cpId: contentId };
86
- await AdSdk.init({
87
- platform: AdPlatform.Xiaomi,
88
- adapters: adapters
89
- });
90
- AdSdk.onGameReady(this.version);
91
- // AdSdk.onKeyEvent(this.onKeyEvent.bind(this));
54
+ adapters[platform] = { cpId: this.contentId };
55
+ await AdSdk.init({ platform: AdPlatform.Xiaomi, adapters: adapters });
56
+ AdSdk.onGameReady(UIAdapter.version);
57
+ if (this.canWatchVideo) {
58
+ AdSdk.on(AdEvent.Closed, (data: any) => {
59
+ if (!data.isCompleted) {
60
+ PlatformAdapter.showTip("必须看完视频,才能获取奖励");
61
+ }
62
+ });
63
+ // 监听失败
64
+ AdSdk.on(AdEvent.Error, (data: any) => {
65
+ PlatformAdapter.showTip(`广告暂不可用,请稍后再试(${data.message})`);
66
+ });
67
+ }
68
+ // 预加载激励视频广告,让 native 侧提前准备,减少首次拉取失败率
69
+ UIAdapter.hookLoadScene();
70
+ UIAdapter.back.setFallback(() => UIAdapter.backHandler());
71
+ }
72
+
73
+ private static get isXiaomi() {
74
+ if (typeof window === 'undefined') return null;
75
+ return window['AppBridge'] || null;
92
76
  }
93
77
 
78
+ // ========================================================================
79
+ // Toast
80
+ // ========================================================================
81
+
82
+ public static showTip(text: string, dur = 1500) {
83
+ return UIAdapter.showTip(text, dur);
84
+ }
85
+
86
+ // ========================================================================
87
+ // 广告
88
+ // ========================================================================
89
+
94
90
  /**
95
91
  * 显示奖励视频
96
92
  * @param scene 视频场景
@@ -98,116 +94,124 @@ export class PlatformAdapter {
98
94
  * @param callback 回调函数
99
95
  * @param target 回调函数的this指向
100
96
  */
101
- public static showRewardVideo(scene: EVideoScene, rewardType: string, callback: Function, target?: any) {
102
- showRewardVideo(scene, rewardType, callback, target);
97
+ public static async showRewardVideo(scene: EVideoScene, rewardType: string, callback: Function, target?: any) {
98
+ let finishFired = false;
99
+ let fireFinish = () => {
100
+ if (finishFired) return;
101
+ finishFired = true;
102
+ };
103
+ let onSuccess = () => {
104
+ try {
105
+ PlatformAdapter.report(AnalyticsEvent.RewardVideoAd, AnalyticsAction.Exposure);
106
+ callback && callback.call(target);
107
+ } finally {
108
+ fireFinish();
109
+ }
110
+ };
111
+
112
+ if (PlatformAdapter.canWatchVideo) {
113
+ // 监听奖励(用户完整看完广告触发)
114
+ try {
115
+ const result = await AdSdk.requestAd({
116
+ adType: AdType.RewardVideo,
117
+ cpId: this.contentId,
118
+ rewardType: rewardType || "reward",
119
+ triggerScene: scene || "reward",
120
+ extra: {}
121
+ });
122
+ if (result && result.isCompleted === true) {
123
+ onSuccess();
124
+ return true;
125
+ }
126
+ onSuccess();
127
+ return false;
128
+ } catch (error: any) {
129
+ console.log("广告请求失败", error.code, error.message);
130
+ }
131
+ } else {
132
+ callback && callback.call(target);
133
+ }
103
134
  }
135
+
136
+ // ========================================================================
137
+ // 按钮注册
138
+ // ========================================================================
139
+
104
140
  /**
105
- * 注册按钮事件,有BtnExtra组件会自动切换按钮图片
106
- * @param button 按钮组件
141
+ * 注册按钮事件,有 BtnExtra 组件会自动切换按钮图片
142
+ * @param button 按钮节点
107
143
  */
108
144
  public static registerButton(button: cc.Node) {
109
145
  var sprite = button.getComponent(cc.Sprite);
110
146
  var btnExtra = button.getComponent(BtnExtra);
111
- var onFocus = () => {
112
- sprite.spriteFrame = btnExtra.hoverSprite;
113
- };
114
- var onRomove = () => {
115
- sprite.spriteFrame = btnExtra.normalSprite;
116
- };
117
- TvUi.focus.register(button, {
118
- onFocus: onFocus,
119
- onBlur: onRomove,
120
- });
147
+ var onFocus = () => { sprite.spriteFrame = btnExtra.hoverSprite; };
148
+ var onRomove = () => { sprite.spriteFrame = btnExtra.normalSprite; };
149
+ UIAdapter.focus.register(button, { onFocus: onFocus, onBlur: onRomove });
121
150
  }
122
151
 
123
152
  /**
124
- * 注册按钮事件,有BtnExtra组件会自动切换按钮图片
153
+ * 按名称注册按钮
125
154
  * @param name 按钮名称
126
- * @param parent 查找的父节点,如果没有指定父节点,默认查找场景节点
127
- * @returns
155
+ * @param parent 查找的父节点,默认场景节点
128
156
  */
129
157
  public static registerButtonByName(name: string, parent: cc.Node = null) {
130
158
  if (!parent) parent = cc.director.getScene();
131
- let button = this.findChildByName(parent, name);
132
-
133
- this.registerButton(button);
159
+ let button = PlatformAdapter.findChildByName(parent, name);
160
+ PlatformAdapter.registerButton(button);
134
161
  }
135
162
 
136
163
  /**
137
- * 导航到指定的按钮
164
+ * 导航到指定名称的按钮
138
165
  * @param name 按钮名称
139
- * @param parent 查找的父节点,如果没有指定父节点,默认查找场景节点
140
- * @returns
166
+ * @param parent 查找的父节点,默认场景节点
141
167
  */
142
168
  public static focusButtonByName(name: string, parent: cc.Node = null) {
143
169
  if (!parent) parent = cc.director.getScene();
144
- let button = this.findChildByName(parent, name);
145
- TvUi.focus.focus(button);
170
+ let button = PlatformAdapter.findChildByName(parent, name);
171
+ UIAdapter.focus.focus(button);
146
172
  }
147
173
 
174
+ /** 导航到指定按钮 */
148
175
  public static focusButton(btn: cc.Node) {
149
- TvUi.focus.focus(btn);
176
+ UIAdapter.focus.focus(btn);
150
177
  }
151
178
 
152
179
  /**
153
- * 查找指定名称的子节点
154
- * @param parent 查找的父节点
180
+ * 递归查找指定名称的子节点
181
+ * @param parent 父节点
155
182
  * @param name 子节点名称
156
- * @param name 子节点名称
157
- * @returns
158
183
  */
159
184
  public static findChildByName(parent: cc.Node, name: string): cc.Node | null {
160
- if (parent.name === name) {
161
- return parent;
162
- }
163
-
185
+ if (parent.name === name) return parent;
164
186
  for (let i = 0; i < parent.children.length; i++) {
165
- let result = this.findChildByName(parent.children[i], name);
166
- if (result) {
167
- return result;
168
- }
187
+ let result = PlatformAdapter.findChildByName(parent.children[i], name);
188
+ if (result) return result;
169
189
  }
170
190
  return null;
171
191
  }
172
192
 
193
+ // ========================================================================
194
+ // 场景 / 窗口 栈
195
+ // ========================================================================
173
196
 
174
- /** 打开界面注册导航按钮 */
175
- public static showWindow(window: cc.Node) {
176
- TvUi.focus.pushScope(window.uuid, window);
177
- TvUi.focus.registerButtons(window);
178
- this.findBtnExtra(window);
179
- }
180
-
181
- /** 关闭界面取消注册按钮事件 */
182
- public static hideWindow(window: cc.Node) {
183
- TvUi.focus.unregisterByRoot(window);
184
- TvUi.focus.popScope(window.uuid);
185
- }
186
-
187
- /** 刷新界面按钮事件, 用于界面按钮变化(列表,下拉)后,需要刷新按钮事件 */
188
- public static refreshWindow(window: cc.Node) {
189
- TvUi.focus.registerButtons(window);
190
- this.findBtnExtra(window);
191
- }
192
-
193
- public static async showExitWin() {
194
- let exitPfb = await Loader.loadRes('drres/prefab/ExitWin', cc.Prefab);
195
- let exitWin = cc.instantiate(exitPfb);
196
- exitWin.parent = cc.director.getScene();
197
- exitWin.setPosition(cc.v2(cc.winSize.width / 2, cc.winSize.height / 2));
198
- }
197
+ /** 显示预制体场景(压入场景栈,返回键可回溯)
198
+ * @param onBack 自定义返回处理,返回 false 表示不关闭,保留当前场景
199
+ */
200
+ public static showScene(scene: cc.Node, onBack?: () => boolean | void) { UIAdapter.showScene(scene, onBack); }
201
+ /** 关闭预制体场景(从栈中移除,不销毁) */
202
+ public static hideScene(scene: cc.Node) { UIAdapter.hideScene(scene); }
203
+ /** 打开界面
204
+ * @param onBack 自定义返回处理,返回 false 表示不关闭,保留当前窗口
205
+ */
206
+ public static showWindow(window: cc.Node, onBack?: () => boolean | void) { UIAdapter.showWindow(window, onBack); }
207
+ /** 关闭界面 */
208
+ public static hideWindow(window: cc.Node) { UIAdapter.hideWindow(window); }
209
+ /** 刷新导航按钮 */
210
+ public static refreshFocus(window: cc.Node) { UIAdapter.refreshFocus(window); }
199
211
 
200
- private static findBtnExtra(node: cc.Node) {
201
- for (let i = 0; i < node.children.length; i++) {
202
- var child = node.children[i];
203
- if (child.isValid === false || !child.activeInHierarchy) continue;
204
- let btnExtra = child.getComponent(BtnExtra);
205
- if (btnExtra) {
206
- this.registerButton(child);
207
- }
208
- this.findBtnExtra(child);
209
- }
210
- }
212
+ // ========================================================================
213
+ // 进度 / 加载
214
+ // ========================================================================
211
215
 
212
216
  /** 设置启动页进度条 */
213
217
  public static setProgress(progress: number, tip: string) {
@@ -219,58 +223,41 @@ export class PlatformAdapter {
219
223
  if (window["closeLoading"]) window["closeLoading"]();
220
224
  }
221
225
 
226
+ // ========================================================================
227
+ // 上报
228
+ // ========================================================================
229
+
222
230
  /**
223
- * 上报事件(缓存)
231
+ * 上报事件(缓存)
224
232
  * @param event 事件类型
225
- * @param action 事件操作 曝光or点击 默认点击
233
+ * @param action 操作类型,默认点击
226
234
  * @param adRequestId 广告请求ID
227
235
  */
228
236
  public static report(event: AnalyticsEvent, action: AnalyticsAction = AnalyticsAction.Click, adRequestId?: string) {
229
237
  GameAnalytics.report(event, action, adRequestId);
230
238
  }
231
239
 
232
- /**
233
- * 批量上报事件(不缓存,只在仅需要曝光多个时用,点击不会同时操作多个可忽略)
234
- * @param events 事件类型数组
235
- */
240
+ /** 批量上报事件 */
236
241
  public static reportBatch(events: AnalyticsEvent[]) {
237
242
  GameAnalytics.reportBatch(events);
238
243
  }
239
244
 
240
- public static get isCocos() {
241
- return window['cc'] != undefined;
242
- }
243
-
244
- /** 是否是基座环境 */
245
- public static get isWebBridge() {
246
- return this.webBridge.isAvailable();
247
- }
245
+ // ========================================================================
246
+ // 属性
247
+ // ========================================================================
248
248
 
249
+ /** 是否 Cocos 环境 */
250
+ public static get isCocos() { return window['cc'] != undefined; }
251
+ /** 是否基座环境 */
252
+ public static get isWebBridge() { return UIAdapter.webBridge.isAvailable(); }
249
253
  /** 是否可以观看视频 */
250
- public static get canWatchVideo() {
251
- return !this._canWatchVideo;
252
- }
253
-
254
- /** 是否是VIP用户 */
255
- public static get isVIP() {
256
- return this._isVIP;
257
- }
258
-
259
- /** 退出游戏 */
260
- public static exitGame() {
261
- if (this.isWebBridge) {
262
- this.webBridge.callHandler("router/navigateBack", {}, (a) => { cc.log(a); });
263
- return;
264
- }
265
- if (AdSdk.exitGame) AdSdk.exitGame();
266
- cc.game.end();
267
- // var GRoot = window['GRoot'];
268
- // let bridge: ILobbyBridge = GRoot && GRoot.inst.node.getComponentInChildren('LobbyBridge');
269
- // bridge && bridge.exitGame();
270
- }
254
+ public static get canWatchVideo() { return this.isXiaomi; }
255
+ /** 是否 VIP 用户 */
256
+ public static get isVIP() { return UIAdapter._isVIP; }
271
257
 
272
- public static async showHelper(url: string, cb: () => void) {
273
- var key = `${this._zhName}-isFirst`;
258
+ /** 显示帮助窗口 */
259
+ public static async showHelperWin(url: string, cb: () => void) {
260
+ var key = `${UIAdapter._zhName}-isFirst`;
274
261
  var isFirst = cc.sys.localStorage.getItem(key);
275
262
  if (!isFirst) {
276
263
  cc.sys.localStorage.setItem(key, false);
@@ -0,0 +1,10 @@
1
+ {
2
+ "ver": "1.1.0",
3
+ "uuid": "827ee68b-a1d6-474c-b8b6-5f4f4db7f9e8",
4
+ "importer": "typescript",
5
+ "isPlugin": false,
6
+ "loadPluginInWeb": true,
7
+ "loadPluginInNative": true,
8
+ "loadPluginInEditor": false,
9
+ "subMetas": {}
10
+ }