Skip to content

Commit f08e515

Browse files
author
ranpeng
committed
refactor: 更新 demo
1 parent e7e2262 commit f08e515

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

samples/mobile/index.html

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,12 @@
5858
UserId: 'user-id',
5959
ClientSession: TCGSDK.getClientSession(),
6060
});
61-
const { code, data: { Error } } = data;
62-
61+
6362
console.log('%c StartGame res', 'color: blue; font-size: 14px', data);
6463

65-
if (code === 0) {
64+
const { Code, SessionDescribe: { ServerSession } } = data;
65+
66+
if (Code === 0) {
6667
TCGSDK.start(ServerSession);
6768
} else {
6869
// your logics
@@ -81,11 +82,12 @@
8182
UserId: 'user-id',
8283
ClientSession: TCGSDK.getClientSession(),
8384
});
84-
const { code, data: { Error } } = data;
85-
85+
8686
console.log('%c StartProject res', 'color: blue; font-size: 14px', data);
8787

88-
if (code === 0) {
88+
const { Code, SessionDescribe: { ServerSession } } = data;
89+
90+
if (Code === 0) {
8991
TCGSDK.start(ServerSession);
9092
} else {
9193
// your logics

samples/pc/index.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@
4848
UserId: 'user-id',
4949
ClientSession: TCGSDK.getClientSession(),
5050
});
51-
const { code, data: { Error } } = data;
5251

5352
console.log('%c StartGame res', 'color: blue; font-size: 14px', data);
5453

55-
if (code === 0) {
54+
const { Code, SessionDescribe: { ServerSession } } = data;
55+
56+
if (Code === 0) {
5657
TCGSDK.start(ServerSession);
5758
} else {
5859
// your logics
@@ -71,11 +72,12 @@
7172
UserId: 'user-id',
7273
ClientSession: TCGSDK.getClientSession(),
7374
});
74-
const { code, data: { Error } } = data;
7575

7676
console.log('%c StartProject res', 'color: blue; font-size: 14px', data);
7777

78-
if (code === 0) {
78+
const { Code, SessionDescribe: { ServerSession } } = data;
79+
80+
if (Code === 0) {
7981
TCGSDK.start(ServerSession);
8082
} else {
8183
// your logics

0 commit comments

Comments
 (0)