Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
ET04_hahaclass
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
ET04_hahaclass
Commits
1803ac39
Commit
1803ac39
authored
Aug 10, 2022
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复问题
1. 图片超出边框 2. 卡片一次移动未完成就开始第二次拖动引起的程序异常 3. 适配最多20道题
parent
d0fe6be8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
134 additions
and
75 deletions
+134
-75
ET04_hahaclass.fire
assets/ET04_hahaclass/scene/ET04_hahaclass.fire
+89
-59
ET04_hahaclass.js
assets/ET04_hahaclass/scene/ET04_hahaclass.js
+23
-5
op_pic.js
assets/ET04_hahaclass/script/op_pic.js
+21
-11
op_sound.js
assets/ET04_hahaclass/script/op_sound.js
+1
-0
No files found.
assets/ET04_hahaclass/scene/ET04_hahaclass.fire
View file @
1803ac39
...
...
@@ -75,31 +75,31 @@
"__id__": 5
},
{
"__id__":
7
"__id__":
8
},
{
"__id__": 1
6
"__id__": 1
7
},
{
"__id__": 2
6
"__id__": 2
7
},
{
"__id__":
29
"__id__":
30
},
{
"__id__": 3
2
"__id__": 3
3
}
],
"_active": true,
"_components": [
{
"__id__": 36
},
{
"__id__": 37
},
{
"__id__": 38
},
{
"__id__": 39
}
],
"_prefab": null,
...
...
@@ -260,6 +260,9 @@
"_components": [
{
"__id__": 6
},
{
"__id__": 7
}
],
"_prefab": null,
...
...
@@ -342,6 +345,33 @@
"_atlas": null,
"_id": "97/S6HDq9MeqgmV1Zwnhbb"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 1280,
"_originalHeight": 720,
"_id": "29e0TJZt5M/ooP7dZ716YU"
},
{
"__type__": "cc.Node",
"_name": "title",
...
...
@@ -351,19 +381,19 @@
},
"_children": [
{
"__id__":
8
"__id__":
9
}
],
"_active": true,
"_components": [
{
"__id__": 12
},
{
"__id__": 13
},
{
"__id__": 14
},
{
"__id__": 15
}
],
"_prefab": null,
...
...
@@ -419,19 +449,19 @@
"_name": "label",
"_objFlags": 0,
"_parent": {
"__id__":
7
"__id__":
8
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 9
},
{
"__id__": 10
},
{
"__id__": 11
},
{
"__id__": 12
}
],
"_prefab": null,
...
...
@@ -487,7 +517,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
8
"__id__":
9
},
"_enabled": true,
"_materials": [
...
...
@@ -522,7 +552,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
8
"__id__":
9
},
"_enabled": true,
"alignMode": 1,
...
...
@@ -549,7 +579,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
8
"__id__":
9
},
"_enabled": true,
"_color": {
...
...
@@ -567,7 +597,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
7
"__id__":
8
},
"_enabled": true,
"_materials": [
...
...
@@ -599,7 +629,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
7
"__id__":
8
},
"_enabled": true,
"alignMode": 1,
...
...
@@ -626,7 +656,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
7
"__id__":
8
},
"_enabled": true,
"_normalMaterial": null,
...
...
@@ -635,7 +665,7 @@
"zoomScale": 1.2,
"clickEvents": [
{
"__id__": 1
5
"__id__": 1
6
}
],
"_N$interactable": true,
...
...
@@ -712,13 +742,13 @@
},
"_children": [
{
"__id__": 1
7
"__id__": 1
8
},
{
"__id__": 2
0
"__id__": 2
1
},
{
"__id__": 2
3
"__id__": 2
4
}
],
"_active": false,
...
...
@@ -776,11 +806,11 @@
"_name": "font",
"_objFlags": 0,
"_parent": {
"__id__": 1
6
"__id__": 1
7
},
"_children": [
{
"__id__": 1
8
"__id__": 1
9
}
],
"_active": true,
...
...
@@ -838,13 +868,13 @@
"_name": "BRLNSDB",
"_objFlags": 0,
"_parent": {
"__id__": 1
7
"__id__": 1
8
},
"_children": [],
"_active": true,
"_components": [
{
"__id__":
19
"__id__":
20
}
],
"_prefab": null,
...
...
@@ -900,7 +930,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
8
"__id__": 1
9
},
"_enabled": true,
"_materials": [],
...
...
@@ -931,11 +961,11 @@
"_name": "img",
"_objFlags": 0,
"_parent": {
"__id__": 1
6
"__id__": 1
7
},
"_children": [
{
"__id__": 2
1
"__id__": 2
2
}
],
"_active": true,
...
...
@@ -993,13 +1023,13 @@
"_name": "icon",
"_objFlags": 0,
"_parent": {
"__id__": 2
0
"__id__": 2
1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 2
2
"__id__": 2
3
}
],
"_prefab": null,
...
...
@@ -1055,7 +1085,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
1
"__id__": 2
2
},
"_enabled": true,
"_materials": [],
...
...
@@ -1081,11 +1111,11 @@
"_name": "audio",
"_objFlags": 0,
"_parent": {
"__id__": 1
6
"__id__": 1
7
},
"_children": [
{
"__id__": 2
4
"__id__": 2
5
}
],
"_active": true,
...
...
@@ -1143,13 +1173,13 @@
"_name": "btn",
"_objFlags": 0,
"_parent": {
"__id__": 2
3
"__id__": 2
4
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 2
5
"__id__": 2
6
}
],
"_prefab": null,
...
...
@@ -1205,7 +1235,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
4
"__id__": 2
5
},
"_enabled": true,
"_clip": {
...
...
@@ -1230,10 +1260,10 @@
"_active": true,
"_components": [
{
"__id__": 2
7
"__id__": 2
8
},
{
"__id__": 2
8
"__id__": 2
9
}
],
"_prefab": null,
...
...
@@ -1289,7 +1319,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
6
"__id__": 2
7
},
"_enabled": true,
"alignMode": 1,
...
...
@@ -1316,7 +1346,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
6
"__id__": 2
7
},
"_enabled": true,
"_layoutSize": {
...
...
@@ -1354,10 +1384,10 @@
"_active": true,
"_components": [
{
"__id__": 3
0
"__id__": 3
1
},
{
"__id__": 3
1
"__id__": 3
2
}
],
"_prefab": null,
...
...
@@ -1413,7 +1443,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
29
"__id__":
30
},
"_enabled": true,
"alignMode": 1,
...
...
@@ -1440,7 +1470,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
29
"__id__":
30
},
"_enabled": true,
"_layoutSize": {
...
...
@@ -1478,14 +1508,14 @@
"_active": false,
"_components": [
{
"__id__": 3
3
"__id__": 3
4
},
{
"__id__": 3
4
"__id__": 3
5
}
],
"_prefab": {
"__id__": 3
5
"__id__": 3
6
},
"_opacity": 255,
"_color": {
...
...
@@ -1539,7 +1569,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
2
"__id__": 3
3
},
"_enabled": true,
"_materials": [
...
...
@@ -1642,7 +1672,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
2
"__id__": 3
3
},
"_enabled": true,
"alignMode": 1,
...
...
@@ -1667,7 +1697,7 @@
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 3
2
"__id__": 3
3
},
"asset": {
"__uuid__": "d30b053b-c7eb-4811-951c-01c98b5825bf"
...
...
@@ -1728,13 +1758,13 @@
},
"_enabled": true,
"title": {
"__id__":
9
"__id__":
10
},
"sounds_container": {
"__id__": 2
6
"__id__": 2
7
},
"pic_container": {
"__id__":
29
"__id__":
30
},
"op_sound": {
"__uuid__": "f816bebc-d7fa-41ca-aa93-efe1af15931d"
...
...
@@ -1751,7 +1781,7 @@
}
],
"particle_paper": {
"__id__": 3
2
"__id__": 3
3
},
"_opSoundPos": [],
"_opPicPos": [],
...
...
assets/ET04_hahaclass/scene/ET04_hahaclass.js
View file @
1803ac39
...
...
@@ -200,10 +200,30 @@ cc.Class({
var
self
=
this
;
let
scale
=
1
;
let
count
=
this
.
data
.
options
.
length
-
4
;
if
(
count
>
0
)
{
scale
=
1
-
count
*
0.16
;
let
count
=
this
.
data
.
options
.
length
;
switch
(
count
)
{
case
1
:
scale
=
1
;
break
;
case
2
:
scale
=
1
;
break
;
case
3
:
scale
=
1
;
break
;
case
5
:
scale
=
0.85
;
break
;
case
6
:
scale
=
0.7
;
break
;
case
7
:
scale
=
0.6
;
break
;
case
8
:
scale
=
0.5
;
break
;
case
9
:
scale
=
0.45
;
break
;
case
10
:
scale
=
0.4
;
break
;
case
11
:
scale
=
0.37
;
break
;
case
12
:
scale
=
0.35
;
break
;
case
13
:
scale
=
0.32
;
break
;
case
14
:
scale
=
0.3
;
break
;
case
15
:
scale
=
0.28
;
break
;
case
16
:
scale
=
0.26
;
break
;
case
17
:
scale
=
0.24
;
break
;
case
18
:
scale
=
0.22
;
break
;
case
19
:
scale
=
0.2
;
break
;
case
20
:
scale
=
0.18
;
break
;
default
:
scale
=
0.16
;
}
this
.
pic_container
.
scale
=
scale
;
this
.
sounds_container
.
scale
=
scale
;
...
...
@@ -236,9 +256,7 @@ cc.Class({
for
(
let
i
=
0
;
i
<
this
.
sounds_container
.
children
.
length
;
i
++
)
{
this
.
sounds_container
.
children
[
i
].
setPosition
(
this
.
_opSoundPos
[
i
]);
this
.
pic_container
.
children
[
i
].
setPosition
(
this
.
_opPicPos
[
i
]);
this
.
pic_container
.
children
[
i
].
getComponent
(
"
op_pic
"
).
_ori_pos
=
this
.
_opPicPos
[
i
];
this
.
pic_container
.
children
[
i
].
getComponent
(
"
op_pic
"
).
setPic
();
}
},
0.5
);
...
...
assets/ET04_hahaclass/script/op_pic.js
View file @
1803ac39
...
...
@@ -35,14 +35,17 @@ cc.Class({
_height
:
null
,
_isMoved
:
false
,
_scale
:
1
,
_canMove
:
true
,
// 移动开关 防止其他卡片还没有完成移动 就触发了新的卡片移动
},
onEnable
()
{
cc
.
game
.
on
(
"
SELECT
"
,
this
.
selected
,
this
);
cc
.
game
.
on
(
"
MOVE_CONTROL
"
,
this
.
moveControl
,
this
);
},
onDisable
()
{
cc
.
game
.
off
(
"
SELECT
"
,
this
.
selected
,
this
);
cc
.
game
.
on
(
"
MOVE_CONTROL
"
,
this
.
moveControl
,
this
);
},
onLoad
()
{
...
...
@@ -63,18 +66,12 @@ cc.Class({
this
.
_spriteFrame
=
frame
;
let
scale
=
1
;
if
(
frameSize
.
height
>
168
)
{
scale
=
168
/
frameSize
.
height
;
}
this
.
pic
.
spriteFrame
=
frame
;
this
.
pic
.
node
.
width
=
frameSize
.
width
*
scale
;
this
.
pic
.
node
.
height
=
frameSize
.
height
*
scale
;
let
scaleX
=
cale
=
168
/
frameSize
.
width
;
let
scaleY
=
cale
=
168
/
frameSize
.
height
;
scale
=
scaleX
<=
scaleY
?
scaleX
:
scaleY
scale
=
1
;
if
(
frameSize
.
width
>
168
)
{
scale
=
168
/
frameSize
.
width
;
}
this
.
pic
.
spriteFrame
=
frame
;
this
.
pic
.
node
.
width
=
frameSize
.
width
*
scale
;
this
.
pic
.
node
.
height
=
frameSize
.
height
*
scale
;
...
...
@@ -84,12 +81,20 @@ cc.Class({
},
onTouchStart
(
event
)
{
if
(
!
this
.
_canMove
)
{
// 禁止移动
return
}
this
.
pic_selected
.
active
=
true
;
cc
.
game
.
emit
(
"
SELECT
"
,
this
.
_opId
);
},
//触摸移动;
onTouchMove
(
touch
,
event
)
{
if
(
!
this
.
_canMove
)
{
// 禁止移动
return
}
let
delta
=
touch
.
getDelta
();
this
.
node
.
x
+=
delta
.
x
/
this
.
_scale
;
this
.
node
.
y
+=
delta
.
y
/
this
.
_scale
;
...
...
@@ -102,12 +107,12 @@ cc.Class({
console
.
log
(
"
enter right
"
);
cc
.
game
.
emit
(
"
STOP_ALL_AUDIO
"
);
this
.
playSound
(
0
);
this
.
_soundOp
.
node
.
getComponent
(
"
op_sound
"
).
correct
(
this
.
_spriteFrame
,
this
.
_width
,
this
.
_height
);
this
.
node
.
destroy
();
}
else
{
console
.
log
(
"
enter false
"
);
cc
.
game
.
emit
(
"
STOP_ALL_AUDIO
"
);
cc
.
game
.
emit
(
"
MOVE_CONTROL
"
,
false
);
// 广播事件 全集禁止拖动
this
.
playSound
(
1
);
this
.
node
.
active
=
false
;
this
.
_soundOp
.
node
.
getComponent
(
"
op_sound
"
).
wrong
(
this
.
_spriteFrame
,
this
.
_width
,
this
.
_height
);
...
...
@@ -122,6 +127,11 @@ cc.Class({
}
},
// 移动控制
moveControl
(
status
)
{
this
.
_canMove
=
status
?
true
:
false
;
},
/**
* 当碰撞产生的时候调用
* @param {Collider} other 产生碰撞的另一个碰撞组件
...
...
assets/ET04_hahaclass/script/op_sound.js
View file @
1803ac39
...
...
@@ -113,6 +113,7 @@ cc.Class({
this
.
rightPic
.
spriteFrame
=
null
;
this
.
_opPic
.
node
.
active
=
true
;
this
.
_opPic
.
node
.
getComponent
(
"
op_pic
"
).
resetPos
();
cc
.
game
.
emit
(
"
MOVE_CONTROL
"
,
true
);
// 广播事件 开启拖动
},
1.2
);
},
...
...
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