drgame-cc 1.0.17 → 1.0.19
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.
- package/build-templates/web-mobile/bg.png +0 -0
- package/build-templates/web-mobile/index.html +3 -3
- package/build-templates/web-mobile/jz-jdt-3.png +0 -0
- package/build-templates/web-mobile/jz-jdt-4.png +0 -0
- package/build-templates/web-mobile/logo.png +0 -0
- package/build-templates/web-mobile/style-mobile.css +85 -73
- package/drscript/ExitWin.ts +0 -2
- package/drscript/GameAnalytics.ts +162 -0
- package/drscript/PlatformAdapter.ts +58 -12
- package/drscript/Util.ts +11 -0
- package/drscript/ad-sdk/reporters/reporter.js +19 -0
- package/drscript/ad-sdk/reporters/superset-lewo.js +382 -242
- package/drscript/focus/FocusManager.ts +8 -8
- package/drscript/focus/FocusVisualLayer.ts +40 -40
- package/drscript/input/KeyboardMove.ts +55 -0
- package/drscript/virtualgamepad/VirtualGamepadClient.ts +214 -0
- package/drscript/virtualgamepad/VirtualGamepadClient.ts.meta +10 -0
- package/drscript/virtualgamepad/VirtualGamepadConfig.ts +70 -0
- package/drscript/virtualgamepad/VirtualGamepadConfig.ts.meta +10 -0
- package/drscript/virtualgamepad/VirtualGamepadManager.ts +809 -0
- package/drscript/virtualgamepad/VirtualGamepadManager.ts.meta +10 -0
- package/drscript/virtualgamepad/VirtualGamepadView.ts +346 -0
- package/drscript/virtualgamepad/VirtualGamepadView.ts.meta +10 -0
- package/package.json +5 -4
- package/build-templates/web-mobile/bg1.jpg +0 -0
- package/build-templates/web-mobile/splash_en - /345/211/257/346/234/254.png +0 -0
- package/drscript/README - /345/211/257/346/234/254.md" +0 -814
|
Binary file
|
|
@@ -45,15 +45,15 @@
|
|
|
45
45
|
<body>
|
|
46
46
|
<canvas id="GameCanvas" oncontextmenu="event.preventDefault()" tabindex="-1" style="outline: none;"></canvas>
|
|
47
47
|
<div id="splash">
|
|
48
|
-
|
|
48
|
+
<img id="logo" src="logo.png" alt="Logo">
|
|
49
49
|
<div id="splash-info">首次加载时间较长,请耐心等待</div>
|
|
50
50
|
<div id="progress-status">正在启动引擎...0%</div>
|
|
51
51
|
<div class="progress-bar">
|
|
52
52
|
<span style="width: 0%"></span>
|
|
53
53
|
</div>
|
|
54
54
|
|
|
55
|
-
<div id="icp">备案号:豫ICP备18029698号-5A</div>
|
|
56
|
-
<img id="age-rating" src="16+.png" alt="16+">
|
|
55
|
+
<!-- <div id="icp">备案号:豫ICP备18029698号-5A</div> -->
|
|
56
|
+
<!-- <img id="age-rating" src="16+.png" alt="16+"> -->
|
|
57
57
|
</div>
|
|
58
58
|
<script src="src/settings.js" charset="utf-8"></script>
|
|
59
59
|
<script src="vconsole.min.js"></script>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -2,7 +2,9 @@ html {
|
|
|
2
2
|
-ms-touch-action: none;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
body,
|
|
5
|
+
body,
|
|
6
|
+
canvas,
|
|
7
|
+
div {
|
|
6
8
|
display: block;
|
|
7
9
|
outline: none;
|
|
8
10
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
@@ -18,9 +20,10 @@ body, canvas, div {
|
|
|
18
20
|
/* Remove spin of input type number */
|
|
19
21
|
input::-webkit-outer-spin-button,
|
|
20
22
|
input::-webkit-inner-spin-button {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
/* display: none; <- Crashes Chrome on hover */
|
|
24
|
+
-webkit-appearance: none;
|
|
25
|
+
margin: 0;
|
|
26
|
+
/* <-- Apparently some margin are still there even though it's hidden */
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
body {
|
|
@@ -42,7 +45,7 @@ body {
|
|
|
42
45
|
|
|
43
46
|
display: flex;
|
|
44
47
|
flex-direction: column;
|
|
45
|
-
|
|
48
|
+
|
|
46
49
|
/* fix bug: https://github.com/cocos-creator/2d-tasks/issues/791 */
|
|
47
50
|
/* overflow cannot be applied in Cocos2dGameContainer,
|
|
48
51
|
otherwise child elements will be hidden when Cocos2dGameContainer rotated 90 deg */
|
|
@@ -65,11 +68,13 @@ canvas {
|
|
|
65
68
|
background-color: rgba(0, 0, 0, 0);
|
|
66
69
|
}
|
|
67
70
|
|
|
68
|
-
a:link,
|
|
71
|
+
a:link,
|
|
72
|
+
a:visited {
|
|
69
73
|
color: #666;
|
|
70
74
|
}
|
|
71
75
|
|
|
72
|
-
a:active,
|
|
76
|
+
a:active,
|
|
77
|
+
a:hover {
|
|
73
78
|
color: #666;
|
|
74
79
|
}
|
|
75
80
|
|
|
@@ -87,101 +92,108 @@ p.footer {
|
|
|
87
92
|
left: 0;
|
|
88
93
|
width: 100%;
|
|
89
94
|
height: 100%;
|
|
90
|
-
background: #171717 url(./
|
|
95
|
+
background: #171717 url(./bg.png) no-repeat center center;
|
|
91
96
|
/* 固定 splash.png 大小为 300x300 并保持居中 */
|
|
92
97
|
background-size: cover;
|
|
93
|
-
|
|
98
|
+
|
|
94
99
|
}
|
|
95
100
|
|
|
96
101
|
.progress-bar {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
position: absolute;
|
|
103
|
+
left: 50%;
|
|
104
|
+
width: 40%;
|
|
105
|
+
height: 12px;
|
|
106
|
+
bottom: 13%;
|
|
107
|
+
transform: translateX(-50%);
|
|
108
|
+
border-radius: 3px;
|
|
109
|
+
/*margin: 0 -175px;
|
|
105
110
|
padding: 5px;
|
|
106
111
|
box-shadow: 0 1px 5px rgba(0, 0, 0, .6) inset, 0 1px 0 rgba(255, 255, .2);*/
|
|
107
|
-
|
|
108
|
-
|
|
112
|
+
background: url("jz-jdt-4.png") no-repeat center center;
|
|
113
|
+
background-size: 100% 100%;
|
|
109
114
|
}
|
|
110
115
|
|
|
111
116
|
.progress-bar span {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
display: block;
|
|
118
|
+
height: 100%;
|
|
119
|
+
width: 0%;
|
|
120
|
+
border-radius: 3px;
|
|
121
|
+
/*box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset;*/
|
|
122
|
+
transition: width .4s ease-in-out;
|
|
123
|
+
background: url("jz-jdt-3.png") no-repeat center center;
|
|
124
|
+
background-size: 100% 100%;
|
|
120
125
|
}
|
|
121
126
|
|
|
122
127
|
#splash-info {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
position: absolute;
|
|
129
|
+
left: 50%;
|
|
130
|
+
bottom: 16%;
|
|
131
|
+
transform: translateX(-50%);
|
|
132
|
+
color: #fdecc8;
|
|
133
|
+
font-size: clamp(12px, 1.5vw, 20px);
|
|
134
|
+
z-index: 1000;
|
|
135
|
+
|
|
131
136
|
}
|
|
132
137
|
|
|
133
138
|
#logo {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
position: absolute;
|
|
140
|
+
left: 50%;
|
|
141
|
+
top: 40%;
|
|
142
|
+
transform: translate(-50%, -50%);
|
|
143
|
+
z-index: 1000;
|
|
144
|
+
max-width: 46vw;
|
|
145
|
+
max-height: 24vh;
|
|
146
|
+
width: auto;
|
|
147
|
+
height: auto;
|
|
142
148
|
}
|
|
143
149
|
|
|
144
150
|
#progress-status {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
position: absolute;
|
|
152
|
+
left: 50%;
|
|
153
|
+
bottom: 9%;
|
|
154
|
+
transform: translateX(-50%);
|
|
155
|
+
color: #fdecc8;
|
|
156
|
+
font-size: clamp(12px, 1.5vw, 20px);
|
|
157
|
+
z-index: 1000;
|
|
158
|
+
|
|
153
159
|
}
|
|
154
160
|
|
|
155
161
|
|
|
156
162
|
.stripes span {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
+
background-size: 30px 30px;
|
|
164
|
+
background-image: linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%,
|
|
165
|
+
transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%,
|
|
166
|
+
transparent 75%, transparent);
|
|
167
|
+
|
|
168
|
+
animation: animate-stripes 1s linear infinite;
|
|
163
169
|
}
|
|
164
170
|
|
|
165
171
|
@keyframes animate-stripes {
|
|
166
|
-
|
|
172
|
+
0% {
|
|
173
|
+
background-position: 0 0;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
100% {
|
|
177
|
+
background-position: 60px 0;
|
|
178
|
+
}
|
|
167
179
|
}
|
|
168
180
|
|
|
169
181
|
#icp {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
182
|
+
position: absolute;
|
|
183
|
+
bottom: 2%;
|
|
184
|
+
left: 50%;
|
|
185
|
+
transform: translateX(-50%);
|
|
186
|
+
color: #ef6e28;
|
|
187
|
+
z-index: 1000;
|
|
188
|
+
font-size: clamp(10px, 1.5vw, 18px);
|
|
189
|
+
|
|
178
190
|
}
|
|
179
191
|
|
|
180
192
|
#age-rating {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
193
|
+
position: absolute;
|
|
194
|
+
top: 50px;
|
|
195
|
+
left: 50px;
|
|
196
|
+
z-index: 1000;
|
|
197
|
+
height: clamp(32px, 4vw, 56px);
|
|
198
|
+
width: auto;
|
|
199
|
+
}
|
package/drscript/ExitWin.ts
CHANGED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { ActionType, Reporter } from "./ad-sdk/ad-sdk";
|
|
2
|
+
|
|
3
|
+
export enum GameAnalyticsPlatform {
|
|
4
|
+
XiaomiTv = "xiaomi",
|
|
5
|
+
Lewo = "lewo",
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export enum AnalyticsEvent {
|
|
9
|
+
GameLoading = "game_loading",
|
|
10
|
+
StartGameButton = "start_game_button",
|
|
11
|
+
WatchVideoContinueButton = "watch_video_continue_button",
|
|
12
|
+
ReplayButton = "replay_button",
|
|
13
|
+
RewardVideoAd = "reward_video_ad",
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export enum AnalyticsAction {
|
|
17
|
+
Exposure = "exposure",
|
|
18
|
+
Click = "click",
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface GameAnalyticsConfig {
|
|
22
|
+
platform?: GameAnalyticsPlatform | string;
|
|
23
|
+
app_item?: string;
|
|
24
|
+
content_type?: string;
|
|
25
|
+
content_id?: string;
|
|
26
|
+
content_title?: string;
|
|
27
|
+
user_id?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface AnalyticsEventDefinition {
|
|
31
|
+
elementPosition: string;
|
|
32
|
+
exposureEventName?: string;
|
|
33
|
+
clickEventName?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const APP_ITEM_BY_PLATFORM: { [platform: string]: string } = {
|
|
37
|
+
xiaomi: "25",
|
|
38
|
+
lewo: "29",
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const REPORT_URL = "https://sup.daoran.tv/bi-api/api/game/lewo/batch";
|
|
42
|
+
|
|
43
|
+
export default class GameAnalytics {
|
|
44
|
+
private static initialized: boolean = false;
|
|
45
|
+
private static loadingReported: boolean = false;
|
|
46
|
+
private static reportedExposures: { [event: string]: boolean } = {};
|
|
47
|
+
|
|
48
|
+
private static readonly definitions: { [event: string]: AnalyticsEventDefinition } = {
|
|
49
|
+
game_loading: {
|
|
50
|
+
elementPosition: "game_loading",
|
|
51
|
+
exposureEventName: "game_loading_expose",
|
|
52
|
+
},
|
|
53
|
+
start_game_button: {
|
|
54
|
+
elementPosition: "start_game_button",
|
|
55
|
+
exposureEventName: "start_game_expose",
|
|
56
|
+
clickEventName: "start_game_click",
|
|
57
|
+
},
|
|
58
|
+
watch_video_continue_button: {
|
|
59
|
+
elementPosition: "watch_video_continue_button",
|
|
60
|
+
exposureEventName: "watch_video_continue_expose",
|
|
61
|
+
clickEventName: "watch_video_continue_click",
|
|
62
|
+
},
|
|
63
|
+
replay_button: {
|
|
64
|
+
elementPosition: "replay_button",
|
|
65
|
+
exposureEventName: "replay_expose",
|
|
66
|
+
clickEventName: "replay_click",
|
|
67
|
+
},
|
|
68
|
+
reward_video_ad: {
|
|
69
|
+
elementPosition: "reward_video_ad",
|
|
70
|
+
exposureEventName: "ad_expose",
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
public static init(config: GameAnalyticsConfig = {}): void {
|
|
75
|
+
if (this.initialized) {
|
|
76
|
+
if (config.user_id !== undefined) this.setUserId(config.user_id);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
try {
|
|
81
|
+
const platform = config.platform || GameAnalyticsPlatform.XiaomiTv;
|
|
82
|
+
Reporter.init({
|
|
83
|
+
report_url: REPORT_URL,
|
|
84
|
+
app_item: config.app_item || this.getAppItem(platform),
|
|
85
|
+
content_type: config.content_type || "独立游戏",
|
|
86
|
+
content_id: config.content_id || "rexueqiangshou",
|
|
87
|
+
content_title: config.content_title || "热血枪手",
|
|
88
|
+
});
|
|
89
|
+
this.initialized = true;
|
|
90
|
+
if (config.user_id !== undefined) this.setUserId(config.user_id);
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.warn("[GameAnalytics] init failed", error);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
public static setUserId(userId: string): void {
|
|
97
|
+
this.init();
|
|
98
|
+
if (!this.initialized) return;
|
|
99
|
+
try {
|
|
100
|
+
Reporter.setCommonInfo({ user_id: userId || "" });
|
|
101
|
+
} catch (error) {
|
|
102
|
+
console.warn("[GameAnalytics] set user id failed", error);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
public static reportLoadingOnce(): void {
|
|
107
|
+
if (this.loadingReported) return;
|
|
108
|
+
this.loadingReported = true;
|
|
109
|
+
this.report(AnalyticsEvent.GameLoading, AnalyticsAction.Exposure);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
public static reportExposureOnce(event: AnalyticsEvent): void {
|
|
113
|
+
if (this.reportedExposures[event]) return;
|
|
114
|
+
this.reportedExposures[event] = true;
|
|
115
|
+
this.report(event, AnalyticsAction.Exposure);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
public static report(
|
|
119
|
+
event: AnalyticsEvent,
|
|
120
|
+
action: AnalyticsAction,
|
|
121
|
+
adRequestId?: string
|
|
122
|
+
): void {
|
|
123
|
+
this.init();
|
|
124
|
+
if (!this.initialized) return;
|
|
125
|
+
|
|
126
|
+
const definition = this.definitions[event];
|
|
127
|
+
const eventName = definition && action === AnalyticsAction.Exposure
|
|
128
|
+
? definition.exposureEventName
|
|
129
|
+
: definition && definition.clickEventName;
|
|
130
|
+
if (!definition || !eventName) {
|
|
131
|
+
console.warn("[GameAnalytics] unsupported event/action", event, action);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
try {
|
|
136
|
+
const reportItem: any = {
|
|
137
|
+
element_position: definition.elementPosition,
|
|
138
|
+
action_type: action === AnalyticsAction.Exposure
|
|
139
|
+
? ActionType.Exposure
|
|
140
|
+
: ActionType.Click,
|
|
141
|
+
event_name: eventName,
|
|
142
|
+
};
|
|
143
|
+
if (event === AnalyticsEvent.RewardVideoAd) {
|
|
144
|
+
reportItem.ad_request_id = adRequestId || "";
|
|
145
|
+
}
|
|
146
|
+
Reporter.report(reportItem);
|
|
147
|
+
} catch (error) {
|
|
148
|
+
console.warn("[GameAnalytics] report failed", error);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
static getAppItem(platform: string): string {
|
|
153
|
+
const normalizedPlatform = (platform || "").toLowerCase();
|
|
154
|
+
const appItem = APP_ITEM_BY_PLATFORM[normalizedPlatform];
|
|
155
|
+
if (appItem) return appItem;
|
|
156
|
+
console.warn(
|
|
157
|
+
"[GameAnalytics] unknown platform, fallback to Xiaomi TV app_item=25",
|
|
158
|
+
platform
|
|
159
|
+
);
|
|
160
|
+
return APP_ITEM_BY_PLATFORM[GameAnalyticsPlatform.XiaomiTv];
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
import { BtnExtra } from "./BtnExtra";
|
|
3
3
|
import TvUi from "./core/TvUi";
|
|
4
4
|
import { EVideoScene } from "./Define";
|
|
5
|
+
import GameAnalytics, { AnalyticsAction, AnalyticsEvent, GameAnalyticsPlatform } from "./GameAnalytics";
|
|
5
6
|
import { showRewardVideo } from "./Info";
|
|
6
7
|
import { Loader } from "./Loader";
|
|
7
8
|
import ToastManager from "./toast/ToastManager";
|
|
8
|
-
|
|
9
|
+
import { Util } from "./Util";
|
|
9
10
|
/** 平台适配器,名字有点长防止和Platform,Adapter冲突 */
|
|
10
11
|
export class PlatformAdapter {
|
|
11
12
|
private static readonly cpId = "xhbj";
|
|
@@ -13,10 +14,13 @@ export class PlatformAdapter {
|
|
|
13
14
|
private static readonly designWidth = 1920;
|
|
14
15
|
private static readonly designHeight = 1080;
|
|
15
16
|
/** 初始化 */
|
|
16
|
-
public static async init() {
|
|
17
|
+
public static async init(znName: string) {
|
|
18
|
+
var platform = GameAnalyticsPlatform.XiaomiTv;//平台由sdk处理
|
|
19
|
+
var appItem = GameAnalytics.getAppItem(platform);
|
|
20
|
+
var contentId = Util.getChineseInitials(znName);
|
|
17
21
|
await ToastManager.Inst.init();
|
|
18
22
|
TvUi.init({
|
|
19
|
-
cpId:
|
|
23
|
+
cpId: contentId,
|
|
20
24
|
version: this.version,
|
|
21
25
|
designWidth: this.designWidth,
|
|
22
26
|
designHeight: this.designHeight,
|
|
@@ -27,7 +31,7 @@ export class PlatformAdapter {
|
|
|
27
31
|
defaultIconKey: "default"
|
|
28
32
|
},
|
|
29
33
|
adSdk: {
|
|
30
|
-
platform:
|
|
34
|
+
platform: platform
|
|
31
35
|
},
|
|
32
36
|
ads: {
|
|
33
37
|
reward: {
|
|
@@ -56,6 +60,15 @@ export class PlatformAdapter {
|
|
|
56
60
|
}
|
|
57
61
|
}
|
|
58
62
|
});
|
|
63
|
+
|
|
64
|
+
GameAnalytics.init({
|
|
65
|
+
platform: GameAnalyticsPlatform.XiaomiTv,
|
|
66
|
+
app_item: appItem,
|
|
67
|
+
content_type: "游戏", // 游戏(乐窝的游戏,这个字段都固定上报游戏)
|
|
68
|
+
content_id: contentId, // 游戏ID(具体乐窝的游戏ID)
|
|
69
|
+
content_title: znName, // 游戏名(具体的乐窝游戏名)
|
|
70
|
+
});
|
|
71
|
+
|
|
59
72
|
}
|
|
60
73
|
|
|
61
74
|
/**
|
|
@@ -72,7 +85,7 @@ export class PlatformAdapter {
|
|
|
72
85
|
* 注册按钮事件,有BtnExtra组件会自动切换按钮图片
|
|
73
86
|
* @param button 按钮组件
|
|
74
87
|
*/
|
|
75
|
-
public static registerButton(button: cc.
|
|
88
|
+
public static registerButton(button: cc.Node) {
|
|
76
89
|
var sprite = button.getComponent(cc.Sprite);
|
|
77
90
|
var btnExtra = button.getComponent(BtnExtra);
|
|
78
91
|
var onFocus = () => {
|
|
@@ -95,8 +108,8 @@ export class PlatformAdapter {
|
|
|
95
108
|
*/
|
|
96
109
|
public static registerButtonByName(name: string, parent: cc.Node = null) {
|
|
97
110
|
if (!parent) parent = cc.director.getScene();
|
|
98
|
-
let button = this.findChildByName(parent, name)
|
|
99
|
-
|
|
111
|
+
let button = this.findChildByName(parent, name);
|
|
112
|
+
|
|
100
113
|
this.registerButton(button);
|
|
101
114
|
}
|
|
102
115
|
|
|
@@ -108,13 +121,12 @@ export class PlatformAdapter {
|
|
|
108
121
|
*/
|
|
109
122
|
public static focusButtonByName(name: string, parent: cc.Node = null) {
|
|
110
123
|
if (!parent) parent = cc.director.getScene();
|
|
111
|
-
let button = this.findChildByName(parent, name)
|
|
112
|
-
|
|
113
|
-
TvUi.focus.focus(button.node);
|
|
124
|
+
let button = this.findChildByName(parent, name);
|
|
125
|
+
TvUi.focus.focus(button);
|
|
114
126
|
}
|
|
115
127
|
|
|
116
|
-
public static focusButton(btn: cc.
|
|
117
|
-
TvUi.focus.focus(btn
|
|
128
|
+
public static focusButton(btn: cc.Node) {
|
|
129
|
+
TvUi.focus.focus(btn);
|
|
118
130
|
}
|
|
119
131
|
|
|
120
132
|
/**
|
|
@@ -143,6 +155,7 @@ export class PlatformAdapter {
|
|
|
143
155
|
public static showWindow(window: cc.Node) {
|
|
144
156
|
TvUi.focus.pushScope(window.uuid, window);
|
|
145
157
|
TvUi.focus.registerButtons(window);
|
|
158
|
+
this.findBtnExtra(window);
|
|
146
159
|
}
|
|
147
160
|
|
|
148
161
|
/** 关闭界面取消注册按钮事件 */
|
|
@@ -154,6 +167,7 @@ export class PlatformAdapter {
|
|
|
154
167
|
/** 刷新界面按钮事件, 用于界面按钮变化(列表,下拉)后,需要刷新按钮事件 */
|
|
155
168
|
public static refreshWindow(window: cc.Node) {
|
|
156
169
|
TvUi.focus.registerButtons(window);
|
|
170
|
+
this.findBtnExtra(window);
|
|
157
171
|
}
|
|
158
172
|
|
|
159
173
|
public static async showExitWin() {
|
|
@@ -162,4 +176,36 @@ export class PlatformAdapter {
|
|
|
162
176
|
exitWin.parent = cc.director.getScene();
|
|
163
177
|
exitWin.setPosition(cc.v2(cc.winSize.width / 2, cc.winSize.height / 2));
|
|
164
178
|
}
|
|
179
|
+
|
|
180
|
+
private static findBtnExtra(node: cc.Node) {
|
|
181
|
+
for (let i = 0; i < node.children.length; i++) {
|
|
182
|
+
var child = node.children[i];
|
|
183
|
+
if (child.isValid === false || !child.activeInHierarchy) continue;
|
|
184
|
+
let btnExtra = child.getComponent(BtnExtra);
|
|
185
|
+
if (btnExtra) {
|
|
186
|
+
this.registerButton(child);
|
|
187
|
+
}
|
|
188
|
+
this.findBtnExtra(child);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/** 设置启动页进度条 */
|
|
193
|
+
public static setProgress(progress: number, tip: string) {
|
|
194
|
+
if (window["setProgress"]) window["setProgress"](progress, tip);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** 关闭启动页 */
|
|
198
|
+
public static closeLoading() {
|
|
199
|
+
if (window["closeLoading"]) window["closeLoading"]();
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* 上报事件
|
|
204
|
+
* @param event 事件类型
|
|
205
|
+
* @param action 事件操作 曝光or点击 默认点击
|
|
206
|
+
* @param adRequestId 广告请求ID
|
|
207
|
+
*/
|
|
208
|
+
public static report(event: AnalyticsEvent, action: AnalyticsAction = AnalyticsAction.Click, adRequestId?: string) {
|
|
209
|
+
GameAnalytics.report(event, action, adRequestId);
|
|
210
|
+
}
|
|
165
211
|
}
|
package/drscript/Util.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { pinyin } from "../node_modules/pinyin-pro/types/index";
|
|
2
|
+
|
|
3
|
+
export class Util {
|
|
4
|
+
public static getChineseInitials(str: string): string {
|
|
5
|
+
return pinyin(str, {
|
|
6
|
+
pattern: 'first',
|
|
7
|
+
toneType: 'none',
|
|
8
|
+
type: 'array'
|
|
9
|
+
}).join('').toLowerCase();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -68,6 +68,25 @@ var Reporter = {
|
|
|
68
68
|
this._commonInfo.device_id = supersetLewo.createDeviceId();
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
supersetLewo.initUserInfo({
|
|
72
|
+
os_type: "", // 系统类型安卓
|
|
73
|
+
os_version: "", // 安卓版本15
|
|
74
|
+
app_version: "1.0.0", // APP版本号
|
|
75
|
+
app_item: config.app_item, // 渠道编码
|
|
76
|
+
app_name: config.content_title, // APP展示名称
|
|
77
|
+
app_project: config.content_id, // 产品内部编码
|
|
78
|
+
province: "", // 省份编码
|
|
79
|
+
city: "", // 城市编码
|
|
80
|
+
uid: "", // 登录用户UID,未登录填空""
|
|
81
|
+
user_id: "", // 会员/游客ID,无则填空""
|
|
82
|
+
device_id: this._commonInfo.device_id, // 设备唯一ID,没有或不传则自动生成
|
|
83
|
+
device_brand: "", // 手机品牌小写
|
|
84
|
+
device_model: "", // 手机完整型号
|
|
85
|
+
network_type: "", // 蜂窝流量网络
|
|
86
|
+
carrier: "" // 运营商
|
|
87
|
+
// device_id 不传,内部自动生成UUID填充,无需手动传入
|
|
88
|
+
});
|
|
89
|
+
|
|
71
90
|
this._initialized = true;
|
|
72
91
|
console.log('[Reporter] Initialized, reportUrl:', supersetLewo.config.reportUrl);
|
|
73
92
|
},
|