Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
op_09
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
op_09
Commits
1334df83
Commit
1334df83
authored
Sep 18, 2021
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 屏幕适配
parent
5a133171
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
758 additions
and
46 deletions
+758
-46
CoolCatBegin.mp3
play/assets/op_09/audios/CoolCatBegin.mp3
+0
-0
CoolCatBegin.mp3.meta
play/assets/op_09/audios/CoolCatBegin.mp3.meta
+7
-0
CoolCatFinish.mp3
play/assets/op_09/audios/CoolCatFinish.mp3
+0
-0
CoolCatFinish.mp3.meta
play/assets/op_09/audios/CoolCatFinish.mp3.meta
+7
-0
CoolCatRight.mp3
play/assets/op_09/audios/CoolCatRight.mp3
+0
-0
CoolCatRight.mp3.meta
play/assets/op_09/audios/CoolCatRight.mp3.meta
+7
-0
CoolCatWrong.mp3
play/assets/op_09/audios/CoolCatWrong.mp3
+0
-0
CoolCatWrong.mp3.meta
play/assets/op_09/audios/CoolCatWrong.mp3.meta
+7
-0
mao.meta
play/assets/op_09/dragonBones/mao.meta
+12
-0
mao_ske.json
play/assets/op_09/dragonBones/mao/mao_ske.json
+1
-0
mao_ske.json.meta
play/assets/op_09/dragonBones/mao/mao_ske.json.meta
+5
-0
mao_tex.json
play/assets/op_09/dragonBones/mao/mao_tex.json
+1
-0
mao_tex.json.meta
play/assets/op_09/dragonBones/mao/mao_tex.json.meta
+5
-0
mao_tex.png
play/assets/op_09/dragonBones/mao/mao_tex.png
+0
-0
mao_tex.png.meta
play/assets/op_09/dragonBones/mao/mao_tex.png.meta
+36
-0
op_09.fire
play/assets/op_09/scene/op_09.fire
+566
-32
op_09.js
play/assets/op_09/scene/op_09.js
+69
-13
util.js
play/assets/op_09/script/util.js
+35
-1
No files found.
play/assets/op_09/audios/CoolCatBegin.mp3
0 → 100644
View file @
1334df83
File added
play/assets/op_09/audios/CoolCatBegin.mp3.meta
0 → 100644
View file @
1334df83
{
"ver": "2.0.1",
"uuid": "d7ee13c8-7c6f-4ed4-bf81-c85ae91edfa9",
"downloadMode": 0,
"duration": 7.74,
"subMetas": {}
}
\ No newline at end of file
play/assets/op_09/audios/CoolCatFinish.mp3
0 → 100644
View file @
1334df83
File added
play/assets/op_09/audios/CoolCatFinish.mp3.meta
0 → 100644
View file @
1334df83
{
"ver": "2.0.1",
"uuid": "fc2be55f-3d94-44e0-9ebf-09e0eaa47873",
"downloadMode": 0,
"duration": 10.944,
"subMetas": {}
}
\ No newline at end of file
play/assets/op_09/audios/CoolCatRight.mp3
0 → 100644
View file @
1334df83
File added
play/assets/op_09/audios/CoolCatRight.mp3.meta
0 → 100644
View file @
1334df83
{
"ver": "2.0.1",
"uuid": "4d2df5f4-a774-4e06-a410-4e38195952ad",
"downloadMode": 0,
"duration": 0.972,
"subMetas": {}
}
\ No newline at end of file
play/assets/op_09/audios/CoolCatWrong.mp3
0 → 100644
View file @
1334df83
File added
play/assets/op_09/audios/CoolCatWrong.mp3.meta
0 → 100644
View file @
1334df83
{
"ver": "2.0.1",
"uuid": "0d2dd7a8-9bc2-4cd5-a432-a13f8fb43033",
"downloadMode": 0,
"duration": 1.188,
"subMetas": {}
}
\ No newline at end of file
play/assets/op_09/dragonBones/mao.meta
0 → 100644
View file @
1334df83
{
"ver": "1.1.2",
"uuid": "ac17bb63-beac-4d42-bc52-1d53b848082f",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
play/assets/op_09/dragonBones/mao/mao_ske.json
0 → 100644
View file @
1334df83
This diff is collapsed.
Click to expand it.
play/assets/op_09/dragonBones/mao/mao_ske.json.meta
0 → 100644
View file @
1334df83
{
"ver": "1.0.1",
"uuid": "42cb15db-315a-4d11-9814-0fe5f8808a72",
"subMetas": {}
}
\ No newline at end of file
play/assets/op_09/dragonBones/mao/mao_tex.json
0 → 100644
View file @
1334df83
{
"name"
:
"mao"
,
"imagePath"
:
"mao_tex.png"
,
"SubTexture"
:[{
"name"
:
"猫01/影子"
,
"x"
:
1
,
"height"
:
66
,
"y"
:
343
,
"width"
:
337
},{
"name"
:
"猫01/尾巴"
,
"x"
:
1
,
"height"
:
109
,
"y"
:
188
,
"width"
:
175
},{
"name"
:
"猫01/右腿"
,
"x"
:
178
,
"height"
:
117
,
"y"
:
188
,
"width"
:
104
},{
"name"
:
"猫01/左腿"
,
"x"
:
1
,
"height"
:
115
,
"y"
:
569
,
"width"
:
64
},{
"name"
:
"猫01/右手"
,
"x"
:
427
,
"height"
:
122
,
"y"
:
590
,
"width"
:
69
},{
"name"
:
"猫01/左手"
,
"x"
:
301
,
"height"
:
74
,
"y"
:
590
,
"width"
:
124
},{
"name"
:
"猫01伸/左手伸直"
,
"x"
:
299
,
"height"
:
169
,
"y"
:
1
,
"width"
:
168
},{
"name"
:
"猫01伸/右手伸直"
,
"x"
:
299
,
"height"
:
169
,
"y"
:
172
,
"width"
:
168
},{
"name"
:
"猫01/身体"
,
"x"
:
340
,
"height"
:
180
,
"y"
:
343
,
"width"
:
122
},{
"name"
:
"猫01/领带"
,
"x"
:
1
,
"height"
:
156
,
"y"
:
411
,
"width"
:
120
},{
"name"
:
"猫01/右耳"
,
"x"
:
155
,
"height"
:
76
,
"y"
:
602
,
"width"
:
90
},{
"name"
:
"猫01/左耳"
,
"x"
:
67
,
"height"
:
85
,
"y"
:
602
,
"width"
:
86
},{
"name"
:
"猫01/组_1"
,
"x"
:
1
,
"height"
:
185
,
"y"
:
1
,
"width"
:
296
},{
"name"
:
"猫01/右眼"
,
"x"
:
1
,
"height"
:
60
,
"y"
:
686
,
"width"
:
59
},{
"name"
:
"猫01/右眉毛"
,
"x"
:
67
,
"height"
:
5
,
"y"
:
595
,
"width"
:
33
},{
"name"
:
"猫01/左眼"
,
"x"
:
247
,
"height"
:
60
,
"y"
:
666
,
"width"
:
59
},{
"name"
:
"猫01/左眉毛"
,
"x"
:
247
,
"height"
:
12
,
"y"
:
602
,
"width"
:
31
},{
"name"
:
"猫01/眼镜"
,
"x"
:
301
,
"height"
:
63
,
"y"
:
525
,
"width"
:
170
},{
"name"
:
"猫01/胡子"
,
"x"
:
123
,
"height"
:
85
,
"y"
:
515
,
"width"
:
176
},{
"name"
:
"猫01/鼻子"
,
"x"
:
67
,
"height"
:
24
,
"y"
:
569
,
"width"
:
28
},{
"name"
:
"猫01/嘴"
,
"x"
:
1
,
"height"
:
30
,
"y"
:
299
,
"width"
:
65
},{
"name"
:
"猫01/帽子"
,
"x"
:
123
,
"height"
:
102
,
"y"
:
411
,
"width"
:
158
}],
"height"
:
1024
,
"width"
:
512
}
\ No newline at end of file
play/assets/op_09/dragonBones/mao/mao_tex.json.meta
0 → 100644
View file @
1334df83
{
"ver": "1.0.1",
"uuid": "b2242a6f-c54f-4b2d-8151-89a713576e41",
"subMetas": {}
}
\ No newline at end of file
play/assets/op_09/dragonBones/mao/mao_tex.png
0 → 100644
View file @
1334df83
112 KB
play/assets/op_09/dragonBones/mao/mao_tex.png.meta
0 → 100644
View file @
1334df83
{
"ver": "2.3.5",
"uuid": "c8f02f6a-80f7-4712-8a8c-26db0a90ab03",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 512,
"height": 1024,
"platformSettings": {},
"subMetas": {
"mao_tex": {
"ver": "1.0.4",
"uuid": "837a88a0-d171-4421-8e58-63a525eabc62",
"rawTextureUuid": "c8f02f6a-80f7-4712-8a8c-26db0a90ab03",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -7.5,
"offsetY": 138.5,
"trimX": 1,
"trimY": 1,
"width": 495,
"height": 745,
"rawWidth": 512,
"rawHeight": 1024,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
play/assets/op_09/scene/op_09.fire
View file @
1334df83
This diff is collapsed.
Click to expand it.
play/assets/op_09/scene/op_09.js
View file @
1334df83
import
{
onHomeworkFinish
,
randomSortByArr
}
from
"
../script/util
"
;
import
{
onHomeworkFinish
,
randomSortByArr
,
playDragonBoneAnimation
}
from
"
../script/util
"
;
import
{
defaultData
}
from
"
../script/defaultData
"
;
cc
.
Class
({
...
...
@@ -150,11 +150,26 @@ cc.Class({
},
initView
()
{
this
.
refreshCoolCatPosition
();
this
.
coolCatSpeakStart
(()
=>
{
this
.
jumpToQuestion
(
this
.
status
.
currentQuestionIdx
);
const
audioUrl
=
this
.
data
.
question_arr
[
this
.
status
.
currentQuestionIdx
].
question_audio_url
;
this
.
playAudioByUrl
(
audioUrl
,
()
=>
{
this
.
jumpToQuestion
(
this
.
status
.
currentQuestionIdx
);
});
});
},
refreshCoolCatPosition
()
{
const
cat
=
cc
.
find
(
'
Canvas/bg/catFrame/CoolCat
'
);
const
canvasWidth
=
cc
.
find
(
'
Canvas
'
).
width
;
const
canvasHeight
=
cc
.
find
(
'
Canvas
'
).
height
;
console
.
log
(
'
canvasWidth =
'
+
canvasWidth
);
console
.
log
(
'
canvasHeight =
'
+
canvasHeight
);
},
jumpToQuestion
(
questionIdx
)
{
const
box
=
cc
.
find
(
'
Canvas/bg/box
'
);
box
.
removeAllChildren
();
...
...
@@ -171,8 +186,12 @@ cc.Class({
optionNode
.
name
=
`option_
${
idx
}
`
;
optionNode
.
x
=
(
maxOptionWidth
)
*
(
idx
+
0.5
)
-
canvasWidth
/
2
-
box
.
x
;
optionNode
.
y
=
canvasHeight
/
2
-
box
.
y
-
300
;
optionNode
.
scale
=
Math
.
min
(
1
,
(
maxOptionWidth
-
10
)
/
optionNode
.
width
,
maxOptionHeight
/
optionNode
.
height
)
;
optionNode
.
scale
=
0
;
optionNode
.
parent
=
box
;
cc
.
tween
(
optionNode
)
.
to
(
0.1
,
{
scale
:
Math
.
min
(
1
,
(
maxOptionWidth
-
10
)
/
optionNode
.
width
,
maxOptionHeight
/
optionNode
.
height
)
})
.
start
();
});
},
...
...
@@ -266,12 +285,13 @@ cc.Class({
if
(
box
.
children
.
every
(
child
=>
child
.
optionData
.
selected
==
child
.
optionData
.
is_right
))
{
this
.
onAnswerRight
();
}
else
{
if
(
!
this
.
status
.
wrongOnce
)
{
this
.
status
.
wrongOnce
=
true
;
this
.
onAnswerWrong
();
}
else
{
this
.
onAnswerWrongTwice
();
}
this
.
coolCatSpeakWrong
(()
=>
{
if
(
!
this
.
status
.
wrongOnce
)
{
this
.
onAnswerWrong
();
}
else
{
this
.
onAnswerWrongTwice
();
}
});
}
});
...
...
@@ -282,10 +302,13 @@ cc.Class({
},
onAnswerRight
()
{
this
.
nextQuestion
();
this
.
coolCatSpeakRight
(()
=>
{
this
.
nextQuestion
();
});
},
onAnswerWrong
()
{
this
.
status
.
wrongOnce
=
true
;
const
box
=
cc
.
find
(
'
Canvas/bg/box
'
);
box
.
children
.
filter
(
child
=>
child
.
optionData
.
selected
)
...
...
@@ -320,8 +343,10 @@ cc.Class({
this
.
jumpToQuestion
(
this
.
status
.
currentQuestionIdx
);
},
0.1
*
1000
);
}
else
{
this
.
submitBtnMoveOut
();
this
.
showNextBtn
();
this
.
coolCatSpeakEnd
(()
=>
{
this
.
submitBtnMoveOut
();
this
.
showNextBtn
();
});
}
},
...
...
@@ -354,10 +379,41 @@ cc.Class({
},
coolCatSpeakStart
(
cb
)
{
const
cat
=
cc
.
find
(
'
Canvas/bg/catFrame/CoolCat
'
);
playDragonBoneAnimation
(
cat
,
'
begin
'
,
-
1
);
this
.
playEffect
(
'
CoolCatBegin
'
,
()
=>
{
playDragonBoneAnimation
(
cat
,
'
normal
'
,
-
1
);
cb
();
});
},
coolCatSpeakRight
(
cb
)
{
const
cat
=
cc
.
find
(
'
Canvas/bg/catFrame/CoolCat
'
);
playDragonBoneAnimation
(
cat
,
'
right
'
,
-
1
);
this
.
playEffect
(
'
CoolCatRight
'
,
()
=>
{
playDragonBoneAnimation
(
cat
,
'
normal
'
,
-
1
);
cb
();
});
},
coolCatSpeakWrong
(
cb
)
{
const
cat
=
cc
.
find
(
'
Canvas/bg/catFrame/CoolCat
'
);
playDragonBoneAnimation
(
cat
,
'
wrong
'
,
-
1
);
this
.
playEffect
(
'
CoolCatWrong
'
,
()
=>
{
playDragonBoneAnimation
(
cat
,
'
normal
'
,
-
1
);
cb
();
});
},
coolCatSpeakEnd
(
cb
)
{
const
cat
=
cc
.
find
(
'
Canvas/bg/catFrame/CoolCat
'
);
playDragonBoneAnimation
(
cat
,
'
finish
'
,
-
1
);
this
.
playEffect
(
'
CoolCatFinish
'
,
()
=>
{
playDragonBoneAnimation
(
cat
,
'
normal
'
,
-
1
);
});
cb
();
},
...
...
play/assets/op_09/script/util.js
View file @
1334df83
...
...
@@ -351,4 +351,38 @@ export function onHomeworkFinish() {
}
else
{
console
.
log
(
'
onHomeworkFinish
'
);
}
}
\ No newline at end of file
}
export
async
function
asyncPlayDragonBoneAnimation
(
node
,
animationName
,
time
=
1
,
onFrameEvent
=
null
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
armatureDisplay
=
node
.
getComponent
(
dragonBones
.
ArmatureDisplay
);
armatureDisplay
.
timeScale
=
1
;
armatureDisplay
.
once
(
dragonBones
.
EventObject
.
COMPLETE
,
()
=>
{
resolve
();
});
armatureDisplay
.
on
(
dragonBones
.
EventObject
.
FRAME_EVENT
,
(
event
)
=>
{
if
(
onFrameEvent
)
{
onFrameEvent
(
event
);
}
});
armatureDisplay
.
playAnimation
(
animationName
,
time
);
});
}
export
function
playDragonBoneAnimation
(
node
,
animationName
,
time
=
1
,
onFinish
=
null
,
onFrameEvent
=
null
)
{
const
armatureDisplay
=
node
.
getComponent
(
dragonBones
.
ArmatureDisplay
);
armatureDisplay
.
timeScale
=
1
;
armatureDisplay
.
once
(
dragonBones
.
EventObject
.
COMPLETE
,
()
=>
{
if
(
onFinish
)
{
onFinish
();
}
});
armatureDisplay
.
on
(
dragonBones
.
EventObject
.
FRAME_EVENT
,
(
event
)
=>
{
if
(
onFrameEvent
)
{
onFrameEvent
(
event
);
}
});
armatureDisplay
.
playAnimation
(
animationName
,
time
);
}
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