Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
ngt7_fish
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
ngt7_fish
Commits
d1638871
Commit
d1638871
authored
Oct 23, 2022
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
音效添加完成
parent
964c8b01
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
1649 additions
and
355 deletions
+1649
-355
error.mp3
assets/ngt7_fish/audios/error.mp3
+0
-0
error.mp3.meta
assets/ngt7_fish/audios/error.mp3.meta
+7
-0
right.mp3
assets/ngt7_fish/audios/right.mp3
+0
-0
right.mp3.meta
assets/ngt7_fish/audios/right.mp3.meta
+7
-0
boatmove.ts
assets/ngt7_fish/scene/game/boatmove.ts
+42
-0
boatmove.ts.meta
assets/ngt7_fish/scene/game/boatmove.ts.meta
+9
-0
netscale.ts
assets/ngt7_fish/scene/game/netscale.ts
+42
-0
netscale.ts.meta
assets/ngt7_fish/scene/game/netscale.ts.meta
+9
-0
ngt7_fish.fire
assets/ngt7_fish/scene/ngt7_fish.fire
+1340
-335
ngt7_fish.ts
assets/ngt7_fish/scene/ngt7_fish.ts
+73
-20
voice.meta
assets/ngt7_fish/textures/fish/voice.meta
+12
-0
v1.png
assets/ngt7_fish/textures/fish/voice/v1.png
+0
-0
v1.png.meta
assets/ngt7_fish/textures/fish/voice/v1.png.meta
+36
-0
v2.png
assets/ngt7_fish/textures/fish/voice/v2.png
+0
-0
v2.png.meta
assets/ngt7_fish/textures/fish/voice/v2.png.meta
+36
-0
v3.png
assets/ngt7_fish/textures/fish/voice/v3.png
+0
-0
v3.png.meta
assets/ngt7_fish/textures/fish/voice/v3.png.meta
+36
-0
No files found.
assets/ngt7_fish/audios/error.mp3
0 → 100644
View file @
d1638871
File added
assets/ngt7_fish/audios/error.mp3.meta
0 → 100644
View file @
d1638871
{
"ver": "2.0.1",
"uuid": "816d8590-0603-4136-ab5b-9940e8616a2d",
"downloadMode": 0,
"duration": 1.306122,
"subMetas": {}
}
\ No newline at end of file
assets/ngt7_fish/audios/right.mp3
0 → 100644
View file @
d1638871
File added
assets/ngt7_fish/audios/right.mp3.meta
0 → 100644
View file @
d1638871
{
"ver": "2.0.1",
"uuid": "afb37858-5693-40e2-b4f9-156c2536bbef",
"downloadMode": 0,
"duration": 1.828571,
"subMetas": {}
}
\ No newline at end of file
assets/ngt7_fish/scene/game/boatmove.ts
0 → 100644
View file @
d1638871
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
NewClass
extends
cc
.
Component
{
@
property
firstUp
:
boolean
=
true
;
// LIFE-CYCLE CALLBACKS:
onLoad
()
{
if
(
this
.
firstUp
)
{
cc
.
tween
(
this
.
node
).
repeatForever
(
cc
.
tween
()
.
by
(
10
,
{
y
:
25
})
.
by
(
10
,
{
y
:
-
25
})
.
by
(
10
,
{
y
:
-
25
})
.
by
(
10
,
{
y
:
25
})
).
start
();
}
else
{
cc
.
tween
(
this
.
node
).
repeatForever
(
cc
.
tween
()
.
by
(
10
,
{
y
:
-
25
})
.
by
(
10
,
{
y
:
25
})
.
by
(
10
,
{
y
:
25
})
.
by
(
10
,
{
y
:
-
25
})
).
start
();
}
}
start
()
{
}
// update (dt) {}
}
assets/ngt7_fish/scene/game/boatmove.ts.meta
0 → 100644
View file @
d1638871
{
"ver": "1.0.8",
"uuid": "4937e51d-fabc-4acf-a0c7-d6d5bce868b0",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/ngt7_fish/scene/game/netscale.ts
0 → 100644
View file @
d1638871
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
NewClass
extends
cc
.
Component
{
@
property
firstUp
:
boolean
=
true
;
// LIFE-CYCLE CALLBACKS:
onLoad
()
{
if
(
this
.
firstUp
)
{
cc
.
tween
(
this
.
node
).
repeatForever
(
cc
.
tween
()
.
to
(
10
,
{
scale
:
0.97
})
.
to
(
10
,
{
scale
:
1.00
})
.
to
(
10
,
{
scale
:
1.03
})
.
to
(
10
,
{
scale
:
1.00
})
).
start
();
}
else
{
cc
.
tween
(
this
.
node
).
repeatForever
(
cc
.
tween
()
.
to
(
10
,
{
scale
:
1.03
})
.
to
(
10
,
{
scale
:
1.00
})
.
to
(
10
,
{
scale
:
0.97
})
.
to
(
10
,
{
scale
:
1.00
})
).
start
();
}
}
start
()
{
}
// update (dt) {}
}
assets/ngt7_fish/scene/game/netscale.ts.meta
0 → 100644
View file @
d1638871
{
"ver": "1.0.8",
"uuid": "dd0efcab-7baa-485c-8197-5c9fabdee674",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/ngt7_fish/scene/ngt7_fish.fire
View file @
d1638871
This diff is collapsed.
Click to expand it.
assets/ngt7_fish/scene/ngt7_fish.ts
View file @
d1638871
...
@@ -42,12 +42,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -42,12 +42,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg
.
event
.
clear
();
pg
.
event
.
clear
();
}
}
_cantouch
=
null
;
initData
()
{
initData
()
{
Game
.
getIns
().
init
(
this
.
data
);
Game
.
getIns
().
init
(
this
.
data
);
Game
.
getIns
().
reset
();
Game
.
getIns
().
reset
();
// 所有全局变量 默认都是null
this
.
touching
=
null
;
this
.
_cantouch
=
true
;
}
}
private
audioId
:
any
;
private
audioId
:
any
;
async
initView
()
{
async
initView
()
{
...
@@ -57,14 +55,45 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -57,14 +55,45 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg
.
view
.
setString
(
pg
.
view
.
find
(
boat_right
,
'
text
'
),
Game
.
getIns
().
boatRight
.
text
)
pg
.
view
.
setString
(
pg
.
view
.
find
(
boat_right
,
'
text
'
),
Game
.
getIns
().
boatRight
.
text
)
}
}
initEvent
()
{
initEvent
()
{
pg
.
event
.
on
(
"
game_time_over
"
,
()
=>
{
pg
.
view
.
touchOn
(
pg
.
view
.
find
(
this
,
'
layout_bottom/boat_left/boat
'
),
this
.
onTouchBoatLeft
,
this
)
// alert("game_time_over")
pg
.
view
.
touchOn
(
pg
.
view
.
find
(
this
,
'
layout_bottom/boat_right/boat
'
),
this
.
onTouchBoatRight
,
this
)
//这里的事件会发送的很早。但是我们需要等待动画执行完了之后再开始后续的内容
}
Game
.
getIns
().
addPage
();
onTouchBoatLeft
()
{
if
(
!
Game
.
getIns
().
isOver
)
{
let
voice
=
pg
.
view
.
find
(
this
,
'
layout_bottom/boat_left/boat/voice
'
)
return
;
let
count
=
0
;
}
voice
.
active
=
true
;
this
.
showGameOver
();
function
func
()
{
pg
.
view
.
find
(
voice
,
'
v1
'
).
active
=
count
%
4
==
1
;
pg
.
view
.
find
(
voice
,
'
v2
'
).
active
=
count
%
4
==
2
;
pg
.
view
.
find
(
voice
,
'
v3
'
).
active
=
count
%
4
==
3
;
count
++
;
}
this
.
schedule
(
func
,
0.3
)
pg
.
audio
.
playAudioByUrlThen
(
Game
.
getIns
().
boatLeft
.
audio
).
then
(()
=>
{
this
.
unschedule
(
func
)
pg
.
view
.
find
(
voice
,
'
v1
'
).
active
=
false
;
pg
.
view
.
find
(
voice
,
'
v2
'
).
active
=
false
;
pg
.
view
.
find
(
voice
,
'
v3
'
).
active
=
false
;
voice
.
active
=
false
;
})
}
onTouchBoatRight
()
{
let
voice
=
pg
.
view
.
find
(
this
,
'
layout_bottom/boat_right/boat/voice
'
)
let
count
=
0
;
voice
.
active
=
true
;
function
func
()
{
pg
.
view
.
find
(
voice
,
'
v1
'
).
active
=
count
%
4
==
1
;
pg
.
view
.
find
(
voice
,
'
v2
'
).
active
=
count
%
4
==
2
;
pg
.
view
.
find
(
voice
,
'
v3
'
).
active
=
count
%
4
==
3
;
count
++
;
}
this
.
schedule
(
func
,
0.3
)
pg
.
audio
.
playAudioByUrlThen
(
Game
.
getIns
().
boatRight
.
audio
).
then
(()
=>
{
this
.
unschedule
(
func
)
pg
.
view
.
find
(
voice
,
'
v1
'
).
active
=
false
;
pg
.
view
.
find
(
voice
,
'
v2
'
).
active
=
false
;
pg
.
view
.
find
(
voice
,
'
v3
'
).
active
=
false
;
voice
.
active
=
false
;
})
})
}
}
...
@@ -148,7 +177,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -148,7 +177,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
fishList
.
forEach
((
fish
,
index
)
=>
{
fishList
.
forEach
((
fish
,
index
)
=>
{
let
node
=
cc
.
instantiate
(
item
);
let
node
=
cc
.
instantiate
(
item
);
layout_fish
.
addChild
(
node
);
layout_fish
.
addChild
(
node
);
this
.
updateItem
(
node
,
fish
);
this
.
scheduleOnce
(()
=>
{
this
.
updateItem
(
node
,
fish
);
},
index
*
Math
.
random
())
});
});
}
}
updateItem
(
item
,
data
:
Option
)
{
updateItem
(
item
,
data
:
Option
)
{
...
@@ -200,23 +231,26 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -200,23 +231,26 @@ export default class SceneComponent extends MyCocosSceneComponent {
item
.
x
=
pos
.
x
;
item
.
x
=
pos
.
x
;
item
.
y
=
pos
.
y
;
item
.
y
=
pos
.
y
;
}
}
private
touching
:
any
;
onItemTouchStart
(
e
)
{
onItemTouchStart
(
e
)
{
if
(
this
.
touching
)
return
;
let
target
:
cc
.
Node
=
e
.
target
;
let
target
:
cc
.
Node
=
e
.
target
;
let
data
=
target
.
data
;
let
data
:
Option
=
target
.
data
;
if
(
data
.
isChecked
)
return
;
this
.
setTouchPos
(
e
);
this
.
setTouchPos
(
e
);
this
.
touching
=
data
;
}
}
onItemTouchMove
(
e
)
{
onItemTouchMove
(
e
)
{
let
target
:
cc
.
Node
=
e
.
target
;
let
target
:
cc
.
Node
=
e
.
target
;
let
data
=
target
.
data
;
let
data
=
target
.
data
;
if
(
data
.
isChecked
)
return
;
if
(
!
this
.
touching
)
return
;
if
(
this
.
touching
.
id
!=
data
.
id
)
return
;
this
.
setTouchPos
(
e
);
this
.
setTouchPos
(
e
);
}
}
onItemTouchEnd
(
e
)
{
onItemTouchEnd
(
e
)
{
//
let
target
:
cc
.
Node
=
e
.
target
;
let
target
:
cc
.
Node
=
e
.
target
;
let
data
=
target
.
data
;
let
data
=
target
.
data
;
if
(
data
.
isChecked
)
return
;
if
(
!
this
.
touching
)
return
;
if
(
this
.
touching
.
id
!=
data
.
id
)
return
;
// let rect = cc.rect(target.x, target.y, target.width, target.height);
// let rect = cc.rect(target.x, target.y, target.width, target.height);
let
rect
=
cc
.
rect
(
target
.
x
,
target
.
y
,
50
,
50
);
let
rect
=
cc
.
rect
(
target
.
x
,
target
.
y
,
50
,
50
);
...
@@ -236,11 +270,27 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -236,11 +270,27 @@ export default class SceneComponent extends MyCocosSceneComponent {
Game
.
getIns
().
boatRight
.
setRight
(
data
);
Game
.
getIns
().
boatRight
.
setRight
(
data
);
currentRect
=
rightRect
;
currentRect
=
rightRect
;
}
}
if
(
!
currentRect
)
return
;
if
(
!
currentRect
)
{
this
.
touching
=
null
;
this
.
playLocalAudio
(
'
error
'
).
then
(()
=>
{
this
.
touching
=
null
;
this
.
updateItem
(
target
,
data
);
})
return
;
}
if
(
isRight
)
{
if
(
isRight
)
{
// target
let
item
=
target
;
let
item
=
target
;
let
lastArea
=
100
;
let
lastArea
=
100
;
this
.
playLocalAudio
(
'
right
'
).
then
(()
=>
{
if
(
data
.
audioUrl
)
{
pg
.
audio
.
playAudioByUrlThen
(
data
.
audioUrl
).
then
(()
=>
{
this
.
touching
=
null
;
})
}
else
{
this
.
touching
=
null
;
}
})
if
(
item
.
scaleX
==
-
1
)
{
if
(
item
.
scaleX
==
-
1
)
{
// 计算当前坐标距离最左侧的距离
// 计算当前坐标距离最左侧的距离
let
space
=
currentRect
.
width
-
((
rect
.
x
+
rect
.
width
)
-
currentRect
.
x
)
-
lastArea
/
5
;
let
space
=
currentRect
.
width
-
((
rect
.
x
+
rect
.
width
)
-
currentRect
.
x
)
-
lastArea
/
5
;
...
@@ -258,7 +308,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -258,7 +308,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
item
.
off
(
cc
.
Node
.
EventType
.
TOUCH_CANCEL
,
this
.
onItemTouchCancel
,
this
);
item
.
off
(
cc
.
Node
.
EventType
.
TOUCH_CANCEL
,
this
.
onItemTouchCancel
,
this
);
pg
.
event
.
emit
(
'
mouse_05_add
'
)
pg
.
event
.
emit
(
'
mouse_05_add
'
)
}
else
{
}
else
{
this
.
updateItem
(
target
,
data
);
this
.
playLocalAudio
(
'
error
'
).
then
(()
=>
{
this
.
touching
=
null
;
this
.
updateItem
(
target
,
data
);
})
}
}
//判断是否结束了
//判断是否结束了
if
(
Game
.
getIns
().
boatLeft
.
isAllRight
()
&&
Game
.
getIns
().
boatRight
.
isAllRight
())
{
if
(
Game
.
getIns
().
boatLeft
.
isAllRight
()
&&
Game
.
getIns
().
boatRight
.
isAllRight
())
{
...
...
assets/ngt7_fish/textures/fish/voice.meta
0 → 100644
View file @
d1638871
{
"ver": "1.1.2",
"uuid": "d427b42b-3b60-403a-a224-7b0137a16c06",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
assets/ngt7_fish/textures/fish/voice/v1.png
0 → 100644
View file @
d1638871
1.5 KB
assets/ngt7_fish/textures/fish/voice/v1.png.meta
0 → 100644
View file @
d1638871
{
"ver": "2.3.5",
"uuid": "8f1ed432-166d-4cdc-8dab-c545657b906e",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 52,
"height": 76,
"platformSettings": {},
"subMetas": {
"v1": {
"ver": "1.0.4",
"uuid": "dc635d80-da93-4f22-b4f0-b182682262c2",
"rawTextureUuid": "8f1ed432-166d-4cdc-8dab-c545657b906e",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 19.5,
"offsetY": 2,
"trimX": 40,
"trimY": 24,
"width": 11,
"height": 24,
"rawWidth": 52,
"rawHeight": 76,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/ngt7_fish/textures/fish/voice/v2.png
0 → 100644
View file @
d1638871
2.4 KB
assets/ngt7_fish/textures/fish/voice/v2.png.meta
0 → 100644
View file @
d1638871
{
"ver": "2.3.5",
"uuid": "54bab549-e6ae-4d18-bec1-2c485ce342a8",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 52,
"height": 76,
"platformSettings": {},
"subMetas": {
"v2": {
"ver": "1.0.4",
"uuid": "6601c88f-dfbf-4ccb-9ff6-e44377e3bf66",
"rawTextureUuid": "54bab549-e6ae-4d18-bec1-2c485ce342a8",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 10.5,
"offsetY": 2,
"trimX": 22,
"trimY": 12,
"width": 29,
"height": 48,
"rawWidth": 52,
"rawHeight": 76,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/ngt7_fish/textures/fish/voice/v3.png
0 → 100644
View file @
d1638871
3.61 KB
assets/ngt7_fish/textures/fish/voice/v3.png.meta
0 → 100644
View file @
d1638871
{
"ver": "2.3.5",
"uuid": "f40b630a-635c-497a-8a8c-9b6bc74fce0d",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 52,
"height": 76,
"platformSettings": {},
"subMetas": {
"v3": {
"ver": "1.0.4",
"uuid": "195ea49e-9f29-4b2e-8baf-cfe83f99fafc",
"rawTextureUuid": "f40b630a-635c-497a-8a8c-9b6bc74fce0d",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 1,
"trimY": 1,
"width": 50,
"height": 74,
"rawWidth": 52,
"rawHeight": 76,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
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