Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douyin_xiaoxiaole
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
douyin_xiaoxiaole
Commits
fc887792
Commit
fc887792
authored
Jul 12, 2023
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat
parent
762ae1c9
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
506 additions
and
46 deletions
+506
-46
douyin_xiaoxiaole.js
assets/douyin_xiaoxiaole/scene/douyin_xiaoxiaole.js
+2
-2
wordgame_syllabus.fire
assets/wordgame_syllabus/scene/wordgame_syllabus.fire
+446
-13
wordgame_syllabus.ts
assets/wordgame_syllabus/scene/wordgame_syllabus.ts
+58
-31
No files found.
assets/douyin_xiaoxiaole/scene/douyin_xiaoxiaole.js
View file @
fc887792
...
...
@@ -93,8 +93,8 @@ cc.Class({
this
.
uid
=
res
.
uid
;
// 测试数据
this
.
role
=
'
a
udience
'
;
this
.
uid
=
'
student
'
;
this
.
role
=
'
a
nchor
'
;
this
.
uid
=
'
teacher
'
;
const
nickObj
=
await
drawOpenNickName
(
res
.
nickName
);
...
...
assets/wordgame_syllabus/scene/wordgame_syllabus.fire
View file @
fc887792
This diff is collapsed.
Click to expand it.
assets/wordgame_syllabus/scene/wordgame_syllabus.ts
View file @
fc887792
import
{
MyCocosSceneComponent
}
from
"
../script/MyCocosSceneComponent
"
;
import
{
getRoomId
,
asyncCallNetworkApiGet
}
from
"
../../douyin_xiaoxiaole/script/supportToolsDy
"
;
import
{
asyncDelay
}
from
"
../../douyin_xiaoxiaole/script/hw_elimination_letter_util
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
...
@@ -12,6 +13,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
@
property
(
cc
.
Node
)
rankTemplate
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
rankpage
:
cc
.
Node
=
null
;
addPreloadImage
()
{
}
...
...
@@ -34,41 +38,39 @@ export default class SceneComponent extends MyCocosSceneComponent {
async
initView
()
{
const
startFlag
=
await
this
.
isGameStart
();
if
(
startFlag
)
{
// 直接显示排行榜
cc
.
find
(
`Canvas/rankpage`
).
active
=
true
;
this
.
runRankList
();
}
else
{
await
this
.
loadData
();
this
.
drawPage
();
}
// 直接显示排行榜
this
.
runRankList
();
await
this
.
loadData
();
this
.
drawPage
();
}
async
runRankList
()
{
let
rows
=
await
asyncCallNetworkApiGet
(
'
/api/douyin/v1/rank
'
,
{
roomid
:
this
.
roomId
});
// let rows = await asyncCallNetworkApiGet('/api/douyin/v1/rank', {roomid: "7248252618835790603"});
rows
=
JSON
.
parse
(
rows
);
this
.
rankContent
.
removeAllChildren
();
for
(
let
i
=
0
;
i
<
rows
.
length
;
i
++
)
{
const
row
=
rows
[
i
];
const
itemClone
=
cc
.
instantiate
(
this
.
rankTemplate
);
itemClone
.
parent
=
this
.
rankContent
;
itemClone
.
active
=
true
;
itemClone
.
attr
({
user_id
:
row
.
user_id
});
cc
.
find
(
`ready`
,
itemClone
).
active
=
false
;
cc
.
find
(
`score`
,
itemClone
).
active
=
true
;
cc
.
find
(
`score`
,
itemClone
).
getComponent
(
cc
.
Label
).
string
=
row
.
score
;
const
nickObj
=
JSON
.
parse
(
row
.
nick_name
);
await
this
.
drawNickName
(
itemClone
,
nickObj
);
const
startFlag
=
await
this
.
isGameStart
();
if
(
startFlag
)
{
this
.
rankpage
.
active
=
true
;
let
rows
=
await
asyncCallNetworkApiGet
(
'
/api/douyin/v1/rank
'
,
{
roomid
:
this
.
roomId
});
// let rows = await asyncCallNetworkApiGet('/api/douyin/v1/rank', {roomid: "7248252618835790603"});
rows
=
JSON
.
parse
(
rows
);
this
.
rankContent
.
removeAllChildren
();
for
(
let
i
=
0
;
i
<
rows
.
length
;
i
++
)
{
const
row
=
rows
[
i
];
const
itemClone
=
cc
.
instantiate
(
this
.
rankTemplate
);
itemClone
.
parent
=
this
.
rankContent
;
itemClone
.
active
=
true
;
itemClone
.
attr
({
user_id
:
row
.
user_id
});
cc
.
find
(
`ready`
,
itemClone
).
active
=
false
;
cc
.
find
(
`score`
,
itemClone
).
active
=
true
;
cc
.
find
(
`score`
,
itemClone
).
getComponent
(
cc
.
Label
).
string
=
row
.
score
;
const
nickObj
=
JSON
.
parse
(
row
.
nick_name
);
await
this
.
drawNickName
(
itemClone
,
nickObj
);
}
}
else
{
this
.
rankpage
.
active
=
false
;
}
this
.
scheduleOnce
(
async
()
=>
{
const
startFlag
=
await
this
.
isGameStart
();
if
(
startFlag
)
{
await
this
.
runRankList
();
}
await
this
.
runRankList
();
},
1
);
}
...
...
@@ -251,10 +253,35 @@ export default class SceneComponent extends MyCocosSceneComponent {
roomid
:
this
.
roomId
,
data
:
keys
.
join
(
"
,
"
),
});
this
.
rankpage
.
active
=
true
;
this
.
canTouch
=
true
;
}
// 显示排行榜
cc
.
find
(
`Canvas/rankpage`
).
active
=
true
;
this
.
runRankList
();
async
restart
()
{
if
(
!
this
.
canTouch
)
{
return
;
}
this
.
canTouch
=
false
;
cc
.
find
(
`Canvas/loading`
).
active
=
true
;
await
asyncCallNetworkApiGet
(
"
/api/douyin/v1/stopgame
"
,
{
roomid
:
this
.
roomId
});
await
asyncDelay
(
5
);
await
asyncCallNetworkApiGet
(
"
/api/douyin/v1/startgame
"
,
{
roomid
:
this
.
roomId
});
cc
.
find
(
`Canvas/loading`
).
active
=
false
;
this
.
canTouch
=
true
;
}
async
reset
()
{
if
(
!
this
.
canTouch
)
{
return
;
}
this
.
canTouch
=
false
;
await
asyncCallNetworkApiGet
(
"
/api/douyin/v1/stopgame
"
,
{
roomid
:
this
.
roomId
});
this
.
rankpage
.
active
=
false
;
this
.
canTouch
=
true
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment