Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hy17_hds
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
hy17_hds
Commits
87d4d7e5
Commit
87d4d7e5
authored
Jun 20, 2023
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
移除原始逻辑
parent
71ca2ec8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
155 deletions
+1
-155
hy01_danci.ts
assets/hy01_danci/scene/hy01_danci.ts
+1
-155
No files found.
assets/hy01_danci/scene/hy01_danci.ts
View file @
87d4d7e5
...
@@ -37,172 +37,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -37,172 +37,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 所有全局变量 默认都是null
// 所有全局变量 默认都是null
this
.
_cantouch
=
true
;
this
.
_cantouch
=
true
;
let
data
=
this
.
data
;
let
data
=
this
.
data
;
this
.
recordFlag
=
data
.
recordFlag
;
this
.
list
=
data
.
questions
[
0
].
options
;
this
.
layers
=
[];
}
}
private
layer_record
:
cc
.
Node
;
private
layer_game
:
cc
.
Node
;
private
layer_word
:
cc
.
Node
;
private
layer_word_little
:
cc
.
Node
;
private
layers
:
Array
<
cc
.
Node
>
;
initView
()
{
initView
()
{
this
.
layer_record
=
pg
.
view
.
find
(
this
,
'
layer_record
'
)
this
.
layer_game
=
pg
.
view
.
find
(
this
,
'
layer_game
'
)
this
.
layer_word
=
pg
.
view
.
find
(
this
,
'
layer_word
'
)
this
.
layer_word_little
=
pg
.
view
.
find
(
this
,
'
layer_word_little
'
)
}
}
initListener
()
{
initListener
()
{
pg
.
event
.
on
(
'
layer_record_score
'
,
(
score
)
=>
{
this
.
onRecorScore
(
score
);
})
}
private
get
CurrentData
()
{
return
this
.
list
[
this
.
count
]
}
private
get
NextData
()
{
return
this
.
list
[
this
.
count
+
1
]
}
private
get
OutData
()
{
return
this
.
list
[
this
.
count
+
2
]
}
private
get
CurrentLayer
()
{
return
this
.
layers
[
0
]
}
private
get
LittleLayer
()
{
return
this
.
layers
[
1
]
}
private
get
OutLayer
()
{
return
this
.
layers
[
2
]
}
}
private
count
:
number
;
initGame
()
{
initGame
()
{
this
.
count
=
0
;
let
currentLayer
=
this
.
createLayer
();
this
.
updateLayer
(
currentLayer
,
this
.
CurrentData
)
this
.
layers
.
push
(
currentLayer
)
let
nextLayer
=
this
.
createLittleLayer
();
this
.
updateLayer
(
nextLayer
,
this
.
NextData
)
this
.
layers
.
push
(
nextLayer
)
this
.
startPlay
();
}
startPlay
()
{
if
(
this
.
recordFlag
)
{
this
.
layer_record
.
active
=
true
;
}
else
{
if
(
this
.
CurrentData
.
type
.
indexOf
(
'
audio
'
)
>
-
1
)
{
pg
.
event
.
emit
(
'
img_voice_play_voice_start
'
)
pg
.
audio
.
playAudioByUrl
(
this
.
CurrentData
.
audio
,
()
=>
{
pg
.
event
.
emit
(
'
img_voice_play_voice_end
'
)
this
.
nextLayer
();
})
}
}
}
onRecorScore
(
score
)
{
this
.
layer_record
.
active
=
false
;
if
(
score
<
10
)
{
pg
.
event
.
on
(
'
layer_right_show_tryagain_end
'
,
()
=>
{
// alert('test')
if
(
this
.
recordFlag
)
{
this
.
layer_record
.
active
=
true
;
}
})
pg
.
event
.
emit
(
'
layer_right_show_tryagain
'
)
}
else
if
(
score
<
60
)
{
pg
.
event
.
on
(
'
layer_right_show_good_end
'
,
()
=>
{
this
.
nextLayer
();
})
pg
.
event
.
emit
(
'
layer_right_show_good
'
)
}
else
{
pg
.
event
.
on
(
'
layer_right_show_excellent_end
'
,
()
=>
{
this
.
nextLayer
();
})
pg
.
event
.
emit
(
'
layer_right_show_excellent
'
)
}
}
nextLayer
()
{
if
(
!
this
.
NextData
)
{
this
.
gameOver
();
return
;
}
if
(
this
.
OutData
)
{
let
outLayer
=
this
.
createLittleLayer
();
this
.
updateLayer
(
outLayer
,
this
.
OutData
)
outLayer
.
x
=
-
1500
;
this
.
layers
.
push
(
outLayer
)
}
cc
.
tween
(
this
.
CurrentLayer
).
to
(
3
,
{
x
:
2000
}).
start
();
if
(
this
.
LittleLayer
)
{
cc
.
tween
(
this
.
LittleLayer
).
to
(
3
,
{
x
:
0
,
y
:
0
,
scale
:
1
}).
start
();
}
if
(
this
.
OutLayer
)
{
cc
.
tween
(
this
.
OutLayer
).
to
(
3
,
{
x
:
this
.
layer_word_little
.
x
,
y
:
this
.
layer_word_little
.
y
}).
start
();
}
this
.
scheduleOnce
(()
=>
{
this
.
count
++
;
this
.
layers
.
shift
();
this
.
startPlay
();
},
3
)
}
gameOver
()
{
}
createLayer
()
{
let
layer
=
pg
.
view
.
clone
(
this
.
layer_word
);
layer
.
active
=
true
;
this
.
layer_game
.
addChild
(
layer
)
return
layer
;
}
createLittleLayer
()
{
let
layer
=
pg
.
view
.
clone
(
this
.
layer_word
);
layer
.
active
=
true
;
layer
.
x
=
this
.
layer_word_little
.
x
;
layer
.
y
=
this
.
layer_word_little
.
y
;
layer
.
scale
=
this
.
layer_word_little
.
scale
;
this
.
layer_game
.
addChild
(
layer
)
return
layer
;
}
updateLayer
(
layer
,
data
)
{
let
bg
=
pg
.
view
.
find
(
layer
,
'
bg
'
);
let
c1
=
pg
.
view
.
find
(
bg
,
'
c1
'
);
let
c2
=
pg
.
view
.
find
(
bg
,
'
c2
'
);
let
c3
=
pg
.
view
.
find
(
bg
,
'
c3
'
);
let
c4
=
pg
.
view
.
find
(
bg
,
'
c4
'
);
let
img
=
pg
.
view
.
find
(
layer
,
'
img
'
);
let
label
=
pg
.
view
.
find
(
layer
,
'
label
'
);
let
voice
=
pg
.
view
.
find
(
layer
,
'
voice
'
);
// 根据数据来渲染
img
.
active
=
true
;
pg
.
view
.
setNetImg
(
img
,
data
.
image
,
{
w
:
600
,
h
:
370
})
label
.
active
=
data
.
type
==
'
img_txt
'
||
data
.
type
==
'
img_txt_audio
'
pg
.
view
.
setString
(
label
,
data
.
text
);
voice
.
active
=
data
.
type
==
'
img_audio
'
||
data
.
type
==
'
img_txt_audio
'
pg
.
view
.
touchOn
(
voice
,
this
.
onTouchVoice
,
this
);
if
(
this
.
recordFlag
)
{
c1
.
active
=
false
;
c2
.
active
=
false
;
c3
.
active
=
false
;
c4
.
active
=
false
;
}
}
onTouchVoice
(
e
)
{
let
layer
=
e
.
target
.
parent
;
if
(
layer
===
this
.
CurrentLayer
)
{
pg
.
event
.
emit
(
'
img_voice_play_voice_start
'
)
pg
.
audio
.
playAudioByUrl
(
this
.
CurrentData
.
audio
,
()
=>
{
pg
.
event
.
emit
(
'
img_voice_play_voice_end
'
)
})
}
}
}
playLocalAudio
(
audioName
)
{
playLocalAudio
(
audioName
)
{
...
...
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