drgame-cc 1.0.57 → 1.0.59
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.
|
@@ -31,21 +31,22 @@ export class PlatformAdapter {
|
|
|
31
31
|
* @param minigameID 小游戏ID
|
|
32
32
|
* @param focusIcon 焦点的样式
|
|
33
33
|
*/
|
|
34
|
-
public static async init(cnName: string, minigameID: number, focusIcon: FingerStyle) {
|
|
34
|
+
public static async init(cnName: string, minigameID: number, focusIcon: FingerStyle = FingerStyle.Default) {
|
|
35
35
|
// ── 初始化渠道类型 ──
|
|
36
36
|
this.appItem = PlatformUtil.getUrlParam('item') as EAppItem || EAppItem.LeWo;
|
|
37
37
|
this.isVIP = PlatformUtil.getUrlParam('isVIP') === '1';
|
|
38
38
|
this.cpId = 'cp_001';
|
|
39
|
+
this.contentId = minigameID.toString();
|
|
40
|
+
|
|
41
|
+
// ── 初始化广告 SDK ──
|
|
42
|
+
await this.initAdSdk(cnName);
|
|
39
43
|
|
|
40
44
|
// ── UI 初始化 ──
|
|
41
45
|
this.focus.setFocusStyle(focusIcon);
|
|
42
46
|
UIAdapter._zhName = cnName;
|
|
43
47
|
await UIAdapter.init();
|
|
44
48
|
|
|
45
|
-
this.contentId = minigameID.toString();
|
|
46
49
|
|
|
47
|
-
// ── 初始化广告 SDK ──
|
|
48
|
-
await this.initAdSdk(cnName);
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
// ========================================================================
|
package/drscript/UIAdapter.ts
CHANGED
|
@@ -73,6 +73,8 @@ export class UIAdapter {
|
|
|
73
73
|
private static autoRegisterScene() {
|
|
74
74
|
let scene = cc.director.getScene();
|
|
75
75
|
if (scene && scene.uuid) {
|
|
76
|
+
// 场景切换后旧场景被销毁,附着在其上的 FocusVisualLayer 节点链已断裂,需要重建
|
|
77
|
+
FocusManager.initVisualLayer();
|
|
76
78
|
// 先清理场景已注册的失效 items
|
|
77
79
|
FocusManager.unregisterByRoot(scene);
|
|
78
80
|
// 注册所有 Button
|
|
@@ -123,6 +123,12 @@ export default class FocusVisualLayer {
|
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
// 检查自身的节点链是否完整(场景切换后父节点可能已被销毁)
|
|
127
|
+
if (!this.node || !this.node.isValid || !this.node.parent) {
|
|
128
|
+
this.hide();
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
126
132
|
// spine 未加载完成,记录 lastItem,等加载完成后再定位
|
|
127
133
|
if (!this.spineLoaded || !this.spine || !this.spineNode) {
|
|
128
134
|
if (this.spineNode) this.spineNode.active = false;
|