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
a64a96d6
Commit
a64a96d6
authored
Dec 09, 2023
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改完成
parent
a41a6d6f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
87 additions
and
60 deletions
+87
-60
BOY04.fire
assets/BOY04/scene/BOY04.fire
+8
-8
BOY04.ts
assets/BOY04/scene/BOY04.ts
+55
-3
xiaodi.ts
assets/BOY04/scene/xiaodi.ts
+23
-48
defaultData.ts
assets/BOY04/script/defaultData.ts
+1
-1
No files found.
assets/BOY04/scene/BOY04.fire
View file @
a64a96d6
...
...
@@ -2132,7 +2132,7 @@
"__id__": 45
}
],
"_active":
tru
e,
"_active":
fals
e,
"_components": [
{
"__id__": 48
...
...
@@ -11723,7 +11723,7 @@
},
{
"__type__": "cc.Node",
"_name": "xiaodi",
"_name": "
layout_
xiaodi",
"_objFlags": 0,
"_parent": {
"__id__": 2
...
...
@@ -11830,15 +11830,15 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
495.934
,
-1
72.815
,
515.859
,
-1
96.362
,
0,
0,
0,
0,
1,
0.3
5
,
0.3
5
,
0.3,
0.3,
0.4
]
},
...
...
@@ -11937,7 +11937,7 @@
"ctor": "Float64Array",
"array": [
504.797,
95.957
,
41.045
,
0,
0,
0,
...
...
@@ -11986,7 +11986,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width":
97.87
,
"width":
0
,
"height": 50.4
},
"_anchorPoint": {
...
...
assets/BOY04/scene/BOY04.ts
View file @
a64a96d6
...
...
@@ -2,6 +2,7 @@ import { asyncDelay, onHomeworkFinish, RandomInt } from "../script/util";
import
{
MyCocosSceneComponent
}
from
"
../script/MyCocosSceneComponent
"
;
import
Game
from
"
./Game
"
;
import
pg
from
"
./pg
"
;
import
dg_xiaodi
from
"
./xiaodi
"
;
enum
touchState
{
NORMAL
,
...
...
@@ -64,6 +65,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this
.
initData
();
this
.
initView
();
this
.
startShowXiaodi
().
then
(()
=>
{
this
.
endShowXiaodi
();
this
.
showQuestion
();
this
.
showGame
();
})
}
_cantouch
=
null
;
...
...
@@ -75,14 +81,29 @@ export default class SceneComponent extends MyCocosSceneComponent {
// this._colors = ["#f87b8e", "#fdb652", "#4acfe0", "#30ff6d", "#848cff"];
}
startShowXiaodi
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
!
this
.
data
.
npcAudio
)
return
resolve
(
''
);
pg
.
view
.
find
(
this
,
'
layout_xiaodi/btn_go
'
).
active
=
false
;
pg
.
view
.
find
(
this
,
'
layout_xiaodi
'
).
active
=
true
;
pg
.
view
.
find
(
this
,
'
layout_xiaodi
'
).
getComponent
(
dg_xiaodi
).
playEnter
(
this
.
data
.
npcAudio
).
then
(()
=>
{
resolve
(
''
);
})
});
}
endShowXiaodi
()
{
if
(
!
this
.
data
.
npcAudio
)
return
;
pg
.
view
.
find
(
this
,
'
layout_xiaodi
'
).
active
=
true
;
pg
.
view
.
find
(
this
,
'
layout_xiaodi
'
).
getComponent
(
dg_xiaodi
).
playEnterEnd
()
}
// update (dt) {},
initView
()
{
let
topTitle
=
cc
.
find
(
"
top/topTitle
"
,
this
.
node
);
pg
.
view
.
touchOn
(
topTitle
,
this
.
playTopLaba
,
this
);
this
.
showQuestion
();
this
.
showGame
();
}
private
touchOver
()
{
this
.
playLocalAudio
(
"
finish
"
);
...
...
@@ -97,6 +118,37 @@ export default class SceneComponent extends MyCocosSceneComponent {
console
.
log
(
data
);
onHomeworkFinish
(
data
);
}
showXiaodi
()
{
if
(
!
this
.
data
.
npcAudioEnd
)
return
;
pg
.
view
.
find
(
this
,
'
layout_xiaodi/btn_go
'
).
active
=
false
;
pg
.
view
.
touchOn
(
pg
.
view
.
find
(
this
,
'
layout_xiaodi/btn_go
'
),
this
.
onTouchExit
,
this
);
pg
.
view
.
setString
(
pg
.
view
.
find
(
this
,
'
layout_xiaodi/btn_go/txt
'
),
this
.
data
.
npcAudioText
)
if
(
!
this
.
data
.
npcAudioText
)
{
pg
.
view
.
find
(
this
,
'
layout_xiaodi/btn_go
'
).
active
=
false
}
else
{
this
.
scheduleOnce
(()
=>
{
pg
.
view
.
find
(
this
,
'
layout_xiaodi/btn_go
'
).
active
=
true
;
},
0.5
)
}
pg
.
view
.
find
(
this
,
'
layout_xiaodi
'
).
active
=
true
;
pg
.
view
.
find
(
this
,
'
layout_xiaodi
'
).
getComponent
(
dg_xiaodi
).
playOver
(
this
.
data
.
npcAudioEnd
)
}
hideXiaodi
()
{
if
(
!
this
.
data
.
npcAudioEnd
)
return
;
pg
.
view
.
find
(
this
,
'
layout_xiaodi
'
).
active
=
false
;
pg
.
view
.
find
(
this
,
'
layout_xiaodi
'
).
getComponent
(
dg_xiaodi
).
playOverEnd
()
}
onTouchExit
()
{
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
)?.
getComponent
(
'
middleLayer
'
);
if
(
middleLayer
)
{
middleLayer
.
goNextPage
();
// 跳转到下一页
// middleLayer.exitGame(null);
}
else
{
console
.
log
(
"
==触发返回事件==
"
);
}
}
private
gameOver
()
{
this
.
scheduleOnce
(()
=>
{
let
btn_check
=
cc
.
find
(
"
btn_check
"
,
this
.
node
);
...
...
@@ -109,7 +161,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
},
0.1
)
this
.
scheduleOnce
(()
=>
{
// 展示小迪按钮
this
.
showXiaodi
();
},
1.3
)
}
private
showGame
()
{
...
...
assets/BOY04/scene/xiaodi.ts
View file @
a64a96d6
...
...
@@ -22,34 +22,14 @@ export default class dg_xiaodi extends cc.Component {
cc
.
tween
(
this
.
aniRole
)
.
call
(()
=>
{
pg
.
view
.
playDBAnimation
(
this
.
aniRole
,
'
run
'
);
if
(
this
.
moveX
<
0
)
{
this
.
aniRole
.
scaleX
=
-
this
.
aniRole
.
scaleX
;
}
})
.
to
(
0.5
,
{
x
:
0
})
.
to
(
0.5
,
{
x
:
51
0
})
.
call
(()
=>
{
if
(
this
.
moveX
<
0
)
{
this
.
aniRole
.
scaleX
=
-
this
.
aniRole
.
scaleX
;
}
pg
.
view
.
playDBAnimation
(
this
.
aniRole
,
'
talk
'
);
pg
.
audio
.
playAudioByUrl
(
audioUrl
,
()
=>
{
this
.
audioIdEnter
=
null
;
cc
.
tween
(
this
.
aniRole
)
.
call
(()
=>
{
pg
.
view
.
playDBAnimation
(
this
.
aniRole
,
'
run
'
);
if
(
this
.
moveX
<
0
)
{
this
.
aniRole
.
scaleX
=
-
this
.
aniRole
.
scaleX
;
}
})
.
to
(
0.5
,
{
x
:
-
1500
})
.
call
(()
=>
{
this
.
scheduleOnce
(()
=>
{
resolve
(
''
);
},
0.5
)
})
.
start
();
resolve
(
''
);
},
audioId
=>
{
this
.
audioIdEnter
=
audioId
;
})
...
...
@@ -58,38 +38,33 @@ export default class dg_xiaodi extends cc.Component {
});
}
playEnterEnd
()
{
this
.
node
.
active
=
false
;
if
(
this
.
audioIdEnter
)
{
cc
.
audioEngine
.
stopEffect
(
this
.
audioIdEnter
)
}
pg
.
view
.
playDBAnimation
(
this
.
aniRole
,
'
normal
'
);
// this.node.active = false;
// if (this.audioIdEnter) {
// cc.audioEngine.stopEffect(this.audioIdEnter)
// }
}
private
audioIdOver
:
any
;
playOver
(
audioUrl
)
{
this
.
node
.
active
=
true
;
let
startX
=
this
.
defaultX
+
this
.
moveX
;
this
.
aniRole
.
x
=
startX
;
cc
.
tween
(
this
.
aniRole
)
.
call
(()
=>
{
pg
.
view
.
playDBAnimation
(
this
.
aniRole
,
'
run
'
);
if
(
this
.
moveX
<
0
)
{
this
.
aniRole
.
scaleX
=
-
this
.
aniRole
.
scaleX
;
}
})
.
to
(
0.3
,
{
x
:
this
.
defaultX
})
.
call
(()
=>
{
if
(
this
.
moveX
<
0
)
{
this
.
aniRole
.
scaleX
=
-
this
.
aniRole
.
scaleX
;
}
pg
.
view
.
playDBAnimation
(
this
.
aniRole
,
'
talk
'
);
pg
.
audio
.
playAudioByUrl
(
audioUrl
,
()
=>
{
this
.
audioIdOver
=
null
;
pg
.
view
.
playDBAnimation
(
this
.
aniRole
,
'
normal
'
);
},
audioId
=>
{
this
.
audioIdOver
=
audioId
;
})
})
.
start
();
// this.aniRole.x = startX;
// cc.tween(this.aniRole)
// .call(() => {
// pg.view.playDBAnimation(this.aniRole, 'run');
// })
// .to(0.3, { x: this.defaultX })
// .call(() => {
pg
.
view
.
playDBAnimation
(
this
.
aniRole
,
'
talk
'
);
pg
.
audio
.
playAudioByUrl
(
audioUrl
,
()
=>
{
this
.
audioIdOver
=
null
;
pg
.
view
.
playDBAnimation
(
this
.
aniRole
,
'
normal
'
);
},
audioId
=>
{
this
.
audioIdOver
=
audioId
;
})
// })
// .start();
}
playOverEnd
()
{
this
.
node
.
active
=
false
;
...
...
assets/BOY04/script/defaultData.ts
View file @
a64a96d6
export
const
defaultData
=
{
"
npcAudioText
"
:
"
退出
"
,
"
npcAudioText
"
:
""
,
"
npcAudio
"
:
"
http://staging-teach.cdn.ireadabc.com/c14938125a52096dc0be9fbbf6638cb2_l.mp3
"
,
"
npcAudioName
"
:
"
paomo_hy11_plp.mp3
"
,
"
npcAudioEnd
"
:
"
http://staging-teach.cdn.ireadabc.com/c14938125a52096dc0be9fbbf6638cb2_l.mp3
"
,
...
...
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