Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
BOY04
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
BOY04
Commits
7076bf96
Commit
7076bf96
authored
Jun 28, 2022
by
yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分数调整
parent
f5a3c159
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
25 deletions
+22
-25
BOY04.ts
assets/BOY04/scene/BOY04.ts
+21
-24
Game.ts
assets/BOY04/scene/Game.ts
+1
-1
No files found.
assets/BOY04/scene/BOY04.ts
View file @
7076bf96
...
...
@@ -72,7 +72,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
logs
=
[];
this
.
_cantouch
=
true
;
Game
.
getIns
().
init
(
this
.
data
);
this
.
_colors
=
[
"
#f87b8e
"
,
"
#fdb652
"
,
"
#4acfe0
"
,
"
#30ff6d
"
,
"
#848cff
"
];
//
this._colors = ["#f87b8e", "#fdb652", "#4acfe0", "#30ff6d", "#848cff"];
}
...
...
@@ -176,7 +176,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
do
{
this
.
downArr
.
sort
(()
=>
Math
.
random
()
-
0.5
);
}
while
(
this
.
downArr
[
0
].
id
==
this
.
upArr
[
0
].
id
);
this
.
_colors
=
[].
concat
([
"
#f87b8e
"
,
"
#fdb652
"
,
"
#4acfe0
"
,
"
#30ff6d
"
,
"
#848cff
"
]);
this
.
_colors
.
sort
(()
=>
Math
.
random
()
-
0.5
);
}
...
...
@@ -372,24 +372,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
right
.
getComponent
(
cc
.
Button
).
interactable
=
false
;
this
.
drawLine
(
lift
,
right
);
let
page
=
Game
.
getIns
().
getDataByPage
(
this
.
roundIdx
).
page
;
let
log
=
this
.
logs
.
find
(
rli
=>
rli
.
option
.
page
==
page
);
console
.
log
(
"
pag:
"
+
Game
.
getIns
().
getDataByPage
(
this
.
roundIdx
).
page
)
if
(
log
)
{
log
.
option
=
Game
.
getIns
().
getDataByPage
(
this
.
roundIdx
);
// log.submit = datas;
log
.
isRight
=
true
;
log
.
score
=
isRight
?
log
.
score
+=
Game
.
getIns
().
score
:
log
.
score
+=
0
;
}
else
{
this
.
logs
.
push
({
option
:
Game
.
getIns
().
getDataByPage
(
this
.
roundIdx
),
// submit: datas,
isRight
:
true
,
score
:
isRight
?
Game
.
getIns
().
score
:
0
})
}
// } else {
// // pg.audio.playAudio(this.wrongClip, () => {
...
...
@@ -480,6 +462,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
gs
.
destroy
();
this
.
resetLeftCardStateById
(
gs
.
data
.
left
);
this
.
resetRightCardStateById
(
gs
.
data
.
right
);
this
.
_colors
.
push
(
gs
.
data
.
color
);
}
if
(
type
==
0
&&
gs
.
data
.
right
==
id
)
{
gs
.
getComponent
(
cc
.
Graphics
).
clear
();
...
...
@@ -488,6 +471,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
gs
.
destroy
();
this
.
resetRightCardStateById
(
gs
.
data
.
right
);
this
.
resetLeftCardStateById
(
gs
.
data
.
left
);
this
.
_colors
.
push
(
gs
.
data
.
color
);
}
})
}
...
...
@@ -510,10 +494,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
right
.
touch
=
touchState
.
FINISH
;
let
graphicsNode
=
cc
.
instantiate
(
cc
.
find
(
"
graphics
"
,
this
.
node
));
let
graphics
=
graphicsNode
.
getComponent
(
cc
.
Graphics
);
graphicsNode
.
data
=
{
left
:
lift
.
data
.
id
,
right
:
right
.
data
.
id
};
let
color
=
this
.
_colors
[
this
.
graphicsArr
.
length
];
let
color
=
this
.
_colors
.
splice
(
0
,
1
)[
0
];
graphics
.
strokeColor
=
new
cc
.
Color
().
fromHEX
(
color
);
graphicsNode
.
data
=
{
left
:
lift
.
data
.
id
,
right
:
right
.
data
.
id
,
color
:
color
};
// let line = [point1, point2, color];
// this.lined.push(line);
this
.
graphicsArr
.
push
(
graphicsNode
);
...
...
@@ -547,6 +532,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
_drawIndex
++
;
if
(
this
.
graphicsArr
.
length
>=
this
.
data
.
questions
[
this
.
roundIdx
].
options
.
length
)
{
this
.
scheduleOnce
(()
=>
{
this
.
addSendData
();
this
.
_drawIndex
=
0
;
this
.
roundIdx
++
;
if
(
this
.
roundIdx
<
this
.
data
.
questions
.
length
)
{
...
...
@@ -564,7 +550,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
private
addSendData
()
{
let
score
=
0
;
this
.
graphicsArr
.
forEach
((
item
)
=>
{
if
(
item
.
data
.
right
==
item
.
data
.
left
)
score
+=
Game
.
getIns
().
score
;
})
this
.
logs
.
push
({
option
:
Game
.
getIns
().
getDataByPage
(
this
.
roundIdx
),
// submit: datas,
isRight
:
true
,
score
:
score
})
}
...
...
assets/BOY04/scene/Game.ts
View file @
7076bf96
...
...
@@ -20,7 +20,7 @@ export default class Game {
}
private
data
:
any
;
private
lists
:
Array
<
any
>
public
score
:
N
umber
;
public
score
:
n
umber
;
constructor
()
{
//
this
.
start
=
false
;
...
...
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