Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
interactiveGames_Level
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
xuxing@jiuaoedu.com
interactiveGames_Level
Commits
73be6b3e
Commit
73be6b3e
authored
Dec 08, 2021
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
可以打包了
parent
4d05e251
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
7 deletions
+32
-7
FaceRecognitionCtr.ts
...Bundle/games/FaceRecognition/script/FaceRecognitionCtr.ts
+21
-7
HtmlSendDataMgr.ts
assets/startFolder/script/HtmlSendDataMgr.ts
+11
-0
No files found.
assets/sceneBundle/games/FaceRecognition/script/FaceRecognitionCtr.ts
View file @
73be6b3e
import
{
_decorator
,
Component
,
Node
,
CCFloat
,
CCString
,
director
,
CCInteger
,
Label
,
find
,
Prefab
,
instantiate
,
math
}
from
'cc'
;
import
{
_decorator
,
Component
,
Node
,
CCFloat
,
CCString
,
director
,
CCInteger
,
Label
,
find
,
Prefab
,
instantiate
,
math
}
from
'cc'
;
import
{
AudioCtr
}
from
'../../../../startFolder/script/AudioCtr'
;
import
{
AudioCtr
}
from
'../../../../startFolder/script/AudioCtr'
;
import
{
failMus
,
rightMus
,
succMus
,
wrongMus
}
from
'../../../../startFolder/script/common/AudioDef'
;
import
{
AudioMgr
}
from
'../../../../startFolder/script/common/AudioMgr'
;
import
{
Utils
}
from
'../../../../startFolder/script/common/Utils'
;
import
{
Utils
}
from
'../../../../startFolder/script/common/Utils'
;
import
{
VIEW_DEF
}
from
'../../../../startFolder/script/common/ViewDef'
;
import
{
VIEW_DEF
}
from
'../../../../startFolder/script/common/ViewDef'
;
import
{
viewMgr
,
VIEW_INDEX
}
from
'../../../../startFolder/script/common/ViewMgr'
;
import
{
viewMgr
,
VIEW_INDEX
}
from
'../../../../startFolder/script/common/ViewMgr'
;
import
{
GameEndDataItf
,
htmlSendDataMgr
}
from
'../../../../startFolder/script/HtmlSendDataMgr'
;
import
{
GameEndDataItf
,
GameEndDataItf_1
,
htmlSendDataMgr
}
from
'../../../../startFolder/script/HtmlSendDataMgr'
;
import
{
AudioSrc
}
from
'../../commonView/script/AudioSrc'
;
import
{
AudioSrc
}
from
'../../commonView/script/AudioSrc'
;
import
{
BeginCountdownView
}
from
'../../commonView/script/BeginCountdownView'
;
import
{
BeginCountdownView
}
from
'../../commonView/script/BeginCountdownView'
;
import
{
ChallengeFailView
}
from
'../../commonView/script/ChallengeFailView'
;
import
{
ChallengeFailView
}
from
'../../commonView/script/ChallengeFailView'
;
...
@@ -120,13 +122,13 @@ export class FaceRecognitionCtr extends Component {
...
@@ -120,13 +122,13 @@ export class FaceRecognitionCtr extends Component {
viewMgr
.
openView
(
VIEW_DEF
.
SwitchOkView
,
(
node
)
=>
{
viewMgr
.
openView
(
VIEW_DEF
.
SwitchOkView
,
(
node
)
=>
{
node
.
getComponent
(
SwitchOkView
)?.
init
(
1.2
);
node
.
getComponent
(
SwitchOkView
)?.
init
(
1.2
);
});
});
find
(
"Audio"
)?.
getComponent
(
AudioCtr
)?.
playOneShot
(
this
.
audioSrc
.
getMus
(
"RIGHT"
)
!
);
AudioMgr
.
playOneShot
(
rightMus
);
}
}
else
{
else
{
viewMgr
.
openView
(
VIEW_DEF
.
SwitchErrorView
,
(
node
)
=>
{
viewMgr
.
openView
(
VIEW_DEF
.
SwitchErrorView
,
(
node
)
=>
{
node
.
getComponent
(
SwitchErrorView
)?.
init
(
1.2
);
node
.
getComponent
(
SwitchErrorView
)?.
init
(
1.2
);
});
});
find
(
"Audio"
)?.
getComponent
(
AudioCtr
)?.
playOneShot
(
this
.
audioSrc
.
getMus
(
"WRONG"
)
!
);
AudioMgr
.
playOneShot
(
wrongMus
);
}
}
this
.
creAnswerTwoView
();
this
.
creAnswerTwoView
();
});
});
...
@@ -139,13 +141,13 @@ export class FaceRecognitionCtr extends Component {
...
@@ -139,13 +141,13 @@ export class FaceRecognitionCtr extends Component {
viewMgr
.
openView
(
VIEW_DEF
.
SwitchOkView
,
(
node
)
=>
{
viewMgr
.
openView
(
VIEW_DEF
.
SwitchOkView
,
(
node
)
=>
{
node
.
getComponent
(
SwitchOkView
)?.
init
(
1.2
);
node
.
getComponent
(
SwitchOkView
)?.
init
(
1.2
);
});
});
find
(
"Audio"
)?.
getComponent
(
AudioCtr
)?.
playOneShot
(
this
.
audioSrc
.
getMus
(
"RIGHT"
)
!
);
AudioMgr
.
playOneShot
(
rightMus
);
}
}
else
{
else
{
viewMgr
.
openView
(
VIEW_DEF
.
SwitchErrorView
,
(
node
)
=>
{
viewMgr
.
openView
(
VIEW_DEF
.
SwitchErrorView
,
(
node
)
=>
{
node
.
getComponent
(
SwitchErrorView
)?.
init
(
1.2
);
node
.
getComponent
(
SwitchErrorView
)?.
init
(
1.2
);
});
});
find
(
"Audio"
)?.
getComponent
(
AudioCtr
)?.
playOneShot
(
this
.
audioSrc
.
getMus
(
"WRONG"
)
!
);
AudioMgr
.
playOneShot
(
wrongMus
);
}
}
this
.
startRound
(
true
);
this
.
startRound
(
true
);
});
});
...
@@ -246,7 +248,7 @@ export class FaceRecognitionCtr extends Component {
...
@@ -246,7 +248,7 @@ export class FaceRecognitionCtr extends Component {
// node?.getComponent(ChallengeSuccView)?.init();
// node?.getComponent(ChallengeSuccView)?.init();
// }, VIEW_INDEX.TOP);
// }, VIEW_INDEX.TOP);
viewMgr
.
openView
(
VIEW_DEF
.
ScoreSuccView
,
(
node
)
=>
{
viewMgr
.
openView
(
VIEW_DEF
.
ScoreSuccView
,
(
node
)
=>
{
find
(
"Audio"
)?.
getComponent
(
AudioCtr
)?.
playOneShot
(
this
.
audioSrc
.
getMus
(
"SCCESS"
)
!
);
AudioMgr
.
playOneShot
(
succMus
);
node
?.
getComponent
(
ScoreSuccView
)?.
setData
(
this
.
costTime
,
this
.
getEvaluation
(
this
.
curScore
));
node
?.
getComponent
(
ScoreSuccView
)?.
setData
(
this
.
costTime
,
this
.
getEvaluation
(
this
.
curScore
));
},
VIEW_INDEX
.
TOP
);
},
VIEW_INDEX
.
TOP
);
}
}
...
@@ -256,10 +258,22 @@ export class FaceRecognitionCtr extends Component {
...
@@ -256,10 +258,22 @@ export class FaceRecognitionCtr extends Component {
// node?.getComponent(ChallengeFailView);
// node?.getComponent(ChallengeFailView);
// }, VIEW_INDEX.TOP);
// }, VIEW_INDEX.TOP);
viewMgr
.
openView
(
VIEW_DEF
.
ScoreFailView
,
(
node
)
=>
{
viewMgr
.
openView
(
VIEW_DEF
.
ScoreFailView
,
(
node
)
=>
{
find
(
"Audio"
)?.
getComponent
(
AudioCtr
)?.
playOneShot
(
this
.
audioSrc
.
getMus
(
"FAIL"
)
!
);
AudioMgr
.
playOneShot
(
failMus
);
node
?.
getComponent
(
ScoreFailView
)?.
setData
(
this
.
costTime
,
this
.
getEvaluation
(
this
.
curScore
));
node
?.
getComponent
(
ScoreFailView
)?.
setData
(
this
.
costTime
,
this
.
getEvaluation
(
this
.
curScore
));
},
VIEW_INDEX
.
TOP
);
},
VIEW_INDEX
.
TOP
);
}
}
//把数据发给包裹游戏的容器
let
sendOutData
:
GameEndDataItf_1
=
{
gameId
:
this
.
gameId
,
gameScore
:
this
.
curScore
,
gameEvaluation
:
this
.
getEvaluation
(
this
.
curScore
),
durTime
:
Math
.
floor
(
this
.
costTime
*
1000
),
totalTime
:
Math
.
floor
(
this
.
costTime
*
1000
),
finishRate
:
<
number
><
any
>
(
this
.
curScore
/
this
.
succScore
).
toFixed
(
4
),
type
:
"cocos_game"
}
htmlSendDataMgr
.
sendDataOut
(
JSON
.
stringify
(
sendOutData
));
//************************** */
}
}
//随机生成一个人物信息
//随机生成一个人物信息
...
...
assets/startFolder/script/HtmlSendDataMgr.ts
View file @
73be6b3e
...
@@ -9,6 +9,17 @@ export interface GameEndDataItf {
...
@@ -9,6 +9,17 @@ export interface GameEndDataItf {
finishLevelCount
:
number
finishLevelCount
:
number
}
}
export
interface
GameEndDataItf_1
{
gameId
:
number
,
//游戏id
gameScore
:
number
,
//游戏分数
gameEvaluation
:
string
,
//评价
durTime
:
number
,
//游戏时间
totalTime
:
number
,
//游戏总时长
finishRate
:
number
,
//游戏完成率
type
:
string
//
}
class
HtmlSendDataMgr
{
class
HtmlSendDataMgr
{
private
constructor
()
{
}
private
constructor
()
{
}
private
static
_instance
:
HtmlSendDataMgr
=
null
!
;
private
static
_instance
:
HtmlSendDataMgr
=
null
!
;
...
...
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