Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sn04_classify
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
sn04_classify
Commits
c869828c
Commit
c869828c
authored
Nov 05, 2023
by
yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
2f32178a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
5 deletions
+24
-5
sn04_classify.ts
assets/sn04_classify/scene/sn04_classify.ts
+24
-5
No files found.
assets/sn04_classify/scene/sn04_classify.ts
View file @
c869828c
...
@@ -197,10 +197,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -197,10 +197,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
card
.
off
(
cc
.
Node
.
EventType
.
TOUCH_START
,
this
.
onItemTouchStart
,
this
);
card
.
off
(
cc
.
Node
.
EventType
.
TOUCH_START
,
this
.
onItemTouchStart
,
this
);
card
.
off
(
cc
.
Node
.
EventType
.
TOUCH_MOVE
,
this
.
onItemTouchMove
,
this
);
card
.
off
(
cc
.
Node
.
EventType
.
TOUCH_MOVE
,
this
.
onItemTouchMove
,
this
);
card
.
off
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onItemTouchEnd
,
this
);
card
.
off
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onItemTouchEnd
,
this
);
card
.
off
(
cc
.
Node
.
EventType
.
TOUCH_CANCEL
,
this
.
onItemTouchCancel
,
this
);
card
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
this
.
onItemTouchStart
,
this
);
card
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
this
.
onItemTouchStart
,
this
);
card
.
on
(
cc
.
Node
.
EventType
.
TOUCH_MOVE
,
this
.
onItemTouchMove
,
this
);
card
.
on
(
cc
.
Node
.
EventType
.
TOUCH_MOVE
,
this
.
onItemTouchMove
,
this
);
card
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onItemTouchEnd
,
this
);
card
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onItemTouchEnd
,
this
);
card
.
on
(
cc
.
Node
.
EventType
.
TOUCH_CANCEL
,
this
.
onItemTouchCancel
,
this
);
})
})
this
.
layout_box
.
getComponent
(
cc
.
Layout
).
spacingX
=
ques
.
length
>=
4
?
90
:
200
;
this
.
layout_box
.
getComponent
(
cc
.
Layout
).
spacingX
=
ques
.
length
>=
4
?
90
:
200
;
...
@@ -213,9 +215,20 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -213,9 +215,20 @@ export default class SceneComponent extends MyCocosSceneComponent {
})
})
}
}
onItemTouchCancel
(
e
)
{
this
.
isTouch
=
false
;
let
target
:
cc
.
Node
=
e
.
target
;
let
data
=
target
.
data
;
this
.
errorMove
=
true
;
this
.
playLocalAudio
(
"
error
"
);
target
.
parent
=
this
.
layout_card
;
target
.
x
=
data
.
x
;
target
.
y
=
data
.
y
;
}
private
isTouch
=
false
;
onItemTouchStart
(
e
)
{
onItemTouchStart
(
e
)
{
if
(
this
.
isFinish
)
return
;
if
(
this
.
isFinish
)
return
;
this
.
isTouch
=
true
;
this
.
playLocalAudio
(
"
click
"
);
this
.
playLocalAudio
(
"
click
"
);
// if (this.checkRoundOver()) return;
// if (this.checkRoundOver()) return;
let
target
:
cc
.
Node
=
e
.
target
;
let
target
:
cc
.
Node
=
e
.
target
;
...
@@ -228,6 +241,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -228,6 +241,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
onItemTouchMove
(
e
)
{
onItemTouchMove
(
e
)
{
if
(
this
.
isFinish
)
return
;
if
(
this
.
isFinish
)
return
;
this
.
isTouch
=
true
;
// if (this.checkRoundOver()) return;
// if (this.checkRoundOver()) return;
let
target
:
cc
.
Node
=
e
.
target
;
let
target
:
cc
.
Node
=
e
.
target
;
let
data
=
target
.
data
;
let
data
=
target
.
data
;
...
@@ -236,6 +250,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -236,6 +250,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
onItemTouchEnd
(
e
)
{
onItemTouchEnd
(
e
)
{
if
(
this
.
isFinish
)
return
;
if
(
this
.
isFinish
)
return
;
this
.
isTouch
=
false
;
cc
.
audioEngine
.
stopAllEffects
()
cc
.
audioEngine
.
stopAllEffects
()
// if (this.checkRoundOver()) return;
// if (this.checkRoundOver()) return;
let
target
:
cc
.
Node
=
e
.
target
;
let
target
:
cc
.
Node
=
e
.
target
;
...
@@ -257,12 +272,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -257,12 +272,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
return
;
return
;
}
}
if
(
itemBg
.
data
.
page
!=
data
.
page
)
{
if
(
itemBg
.
data
.
page
!=
data
.
page
)
{
this
.
errorMove
=
true
;
this
.
playLocalAudio
(
"
error
"
);
this
.
playLocalAudio
(
"
error
"
);
let
img_pro
=
cc
.
find
(
"
img_pro
"
,
target
);
let
img_pro
=
cc
.
find
(
"
img_pro
"
,
target
);
img_pro
.
active
=
true
;
img_pro
.
active
=
true
;
cc
.
tween
(
target
).
to
(
0.2
,
{
angle
:
15
}).
to
(
0.2
,
{
angle
:
-
15
}).
to
(
0.2
,
{
angle
:
15
}).
to
(
0.2
,
{
angle
:
-
15
}).
to
(
0.2
,
{
angle
:
0
}).
to
(
0.2
,
{
x
:
data
.
x
,
y
:
data
.
y
}).
call
(()
=>
{
cc
.
tween
(
target
).
to
(
0.2
,
{
angle
:
15
}).
to
(
0.2
,
{
angle
:
-
15
}).
to
(
0.2
,
{
angle
:
15
}).
to
(
0.2
,
{
angle
:
-
15
}).
to
(
0.2
,
{
angle
:
0
}).
to
(
0.2
,
{
x
:
data
.
x
,
y
:
data
.
y
}).
call
(()
=>
{
target
.
parent
=
this
.
layout_card
;
target
.
parent
=
this
.
layout_card
;
img_pro
.
active
=
false
;
img_pro
.
active
=
false
;
this
.
errorMove
=
false
;
}).
start
();
}).
start
();
return
;
return
;
}
}
...
@@ -289,9 +306,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -289,9 +306,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
target
.
destroy
();
target
.
destroy
();
bg_bar_font
.
active
=
true
;
bg_bar_font
.
active
=
true
;
bg_bar_img
.
active
=
false
;
bg_bar_img
.
active
=
false
;
if
(
this
.
layout_card
.
children
.
length
<=
0
)
{
if
(
!
this
.
errorMove
&&
!
this
.
isTouch
)
this
.
rundEnd
();
if
(
this
.
layout_card
.
children
.
length
<=
0
)
{
}
this
.
rundEnd
();
}
}).
start
();
}).
start
();
...
@@ -304,7 +322,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -304,7 +322,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
// this.playLocalAudio("right");
// this.playLocalAudio("right");
// pg.event.emit("mouse_08_add");
// pg.event.emit("mouse_08_add");
}
}
private
errorMove
=
false
;
private
setTouchPos
(
e
)
{
private
setTouchPos
(
e
)
{
let
location
=
e
.
getLocation
();
let
location
=
e
.
getLocation
();
let
size
=
cc
.
view
.
getCanvasSize
();
let
size
=
cc
.
view
.
getCanvasSize
();
...
@@ -419,6 +437,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -419,6 +437,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
})
})
}
}
private
rundEnd
()
{
private
rundEnd
()
{
if
(
Game
.
getIns
().
state
==
GAME_STATE
.
OVER
)
return
;
Game
.
getIns
().
state
=
GAME_STATE
.
OVER
;
Game
.
getIns
().
state
=
GAME_STATE
.
OVER
;
// this.sendData(this.data.questions.length * 3).then(() => {
// this.sendData(this.data.questions.length * 3).then(() => {
// let mid = cc.find('middleLayer');
// let mid = cc.find('middleLayer');
...
...
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