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
964c8b01
Commit
964c8b01
authored
Oct 23, 2022
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
通用部分添加完成
parent
b57939a8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
114 additions
and
29 deletions
+114
-29
ngt7_fish.fire
assets/ngt7_fish/scene/ngt7_fish.fire
+6
-0
ngt7_fish.ts
assets/ngt7_fish/scene/ngt7_fish.ts
+93
-25
ngt7_layout_mouse.ts
assets/ngt7_fish/scene/small/ngt7_layout_mouse.ts
+4
-4
Game.ts
assets/ngt7_fish/scene/tool/Game.ts
+8
-0
creator.d.ts
creator.d.ts
+3
-0
No files found.
assets/ngt7_fish/scene/ngt7_fish.fire
View file @
964c8b01
...
...
@@ -6949,6 +6949,12 @@
"__id__": 2
},
"_enabled": true,
"layout_start": {
"__id__": 141
},
"layout_finish": {
"__id__": 122
},
"_id": "eaTVUpqahPfZeO9+sUI7RP"
}
]
\ No newline at end of file
assets/ngt7_fish/scene/ngt7_fish.ts
View file @
964c8b01
...
...
@@ -8,6 +8,10 @@ const { ccclass, property } = cc._decorator;
@
ccclass
export
default
class
SceneComponent
extends
MyCocosSceneComponent
{
@
property
(
cc
.
Node
)
layout_start
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
layout_finish
:
cc
.
Node
=
null
;
addPreloadImage
()
{
// TODO 根据自己的配置预加载图片资源
this
.
_imageResList
.
push
({
url
:
this
.
data
.
pic_url
});
...
...
@@ -29,7 +33,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
initView
();
this
.
initEvent
();
this
.
log
(
"
statr!!!!!!!!!!!!!
"
)
this
.
gameStart
()
this
.
initStart
().
then
(()
=>
{
this
.
gameStart
()
})
}
protected
onDestroy
():
void
{
pg
.
event
.
clear
();
...
...
@@ -61,6 +68,69 @@ export default class SceneComponent extends MyCocosSceneComponent {
})
}
private
resetGame
()
{
cc
.
audioEngine
.
stopAllEffects
();
this
.
playLocalAudio
(
"
again
"
);
this
.
initData
();
this
.
gameStart
();
}
private
onAgain
()
{
this
.
layout_finish
.
active
=
false
;
this
.
resetGame
();
}
private
onNext
()
{
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
middleLayer
)
{
const
mc
=
middleLayer
.
getComponent
(
'
middleLayer
'
);
// // 切换下一页
mc
.
goNextPage
();
}
}
private
initStart
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
layout_start
.
active
=
true
;
cc
.
find
(
"
layout_top/label_title
"
,
this
.
node
).
getComponent
(
cc
.
Label
).
string
=
Game
.
getIns
().
title
;
pg
.
event
.
emit
(
"
mouse_09_num
"
,
Game
.
getIns
().
total
);
let
start_ske
=
cc
.
find
(
"
layout_start/start_ske
"
,
this
.
node
);
pg
.
load
.
loadDB
(
start_ske
,
{
ske
:
Game
.
getIns
().
aniEnter
.
ske
.
url
,
tex
:
Game
.
getIns
().
aniEnter
.
tex
.
url
,
png
:
Game
.
getIns
().
aniEnter
.
png
.
url
}).
then
((
animationName
)
=>
{
if
(
animationName
&&
animationName
!=
""
)
{
let
db
=
start_ske
.
getComponent
(
dragonBones
.
ArmatureDisplay
);
let
anis
=
db
.
getAnimationNames
(
db
.
armatureName
);
db
.
playAnimation
(
anis
[
0
],
0
);
cc
.
tween
(
start_ske
).
by
(
1
,
{
x
:
-
500
}).
call
(()
=>
{
pg
.
audio
.
playAudioByUrl
(
Game
.
getIns
().
startAudio
).
then
(()
=>
{
cc
.
tween
(
start_ske
).
delay
(
1
).
by
(
1
,
{
x
:
500
}).
call
(()
=>
{
this
.
layout_start
.
active
=
false
;
resolve
(
''
);
}).
start
();
});
}).
start
();
}
else
{
this
.
layout_start
.
active
=
false
;
resolve
(
''
);
}
})
});
}
private
showFinal
()
{
this
.
playLocalAudio
(
"
finish
"
);
let
layout_finish
=
cc
.
find
(
"
layout_finish
"
,
this
.
node
);
layout_finish
.
active
=
true
;
let
finish_db
=
cc
.
find
(
"
finish_db
"
,
layout_finish
);
let
btn_again
=
cc
.
find
(
"
btn_again
"
,
layout_finish
);
let
btn_next
=
cc
.
find
(
"
btn_next
"
,
layout_finish
);
btn_again
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onAgain
,
this
);
btn_next
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onNext
,
this
);
finish_db
.
active
=
true
;
btn_again
.
active
=
false
;
btn_next
.
active
=
false
;
finish_db
.
getComponent
(
dragonBones
.
ArmatureDisplay
).
playAnimation
(
"
newAnimation
"
,
1
);
this
.
playLocalAudio
(
"
finish
"
).
then
(()
=>
{
finish_db
.
active
=
false
;
btn_again
.
active
=
true
;
btn_next
.
active
=
true
;
});
}
gameStart
()
{
pg
.
audio
.
playLocalAudio
(
cc
.
find
(
`Canvas/res/audio/btn`
));
if
(
this
.
audioId
>
-
1
)
{
...
...
@@ -73,6 +143,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 出现鱼
let
fishList
=
Game
.
getIns
().
getFishList
();
let
layout_fish
=
pg
.
view
.
find
(
this
,
'
layout_bottom/layout_fish
'
)
layout_fish
.
removeAllChildren
();
let
item
=
pg
.
view
.
find
(
this
,
'
layout_bottom/item
'
)
fishList
.
forEach
((
fish
,
index
)
=>
{
let
node
=
cc
.
instantiate
(
item
);
...
...
@@ -121,16 +192,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
item
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onItemTouchEnd
,
this
);
item
.
on
(
cc
.
Node
.
EventType
.
TOUCH_CANCEL
,
this
.
onItemTouchCancel
,
this
);
}
onTouchItem
(
e
)
{
let
item
=
e
.
target
;
let
data
=
item
.
data
;
item
.
x
=
0
;
item
.
y
=
0
;
cc
.
Tween
.
stopAllByTarget
(
item
);
setTimeout
(()
=>
{
this
.
updateItem
(
item
,
data
);
},
100
);
}
private
setTouchPos
(
e
)
{
let
item
=
e
.
target
;
let
location
=
e
.
getLocation
();
...
...
@@ -175,6 +236,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
Game
.
getIns
().
boatRight
.
setRight
(
data
);
currentRect
=
rightRect
;
}
if
(
!
currentRect
)
return
;
if
(
isRight
)
{
// target
let
item
=
target
;
...
...
@@ -190,6 +252,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
let
time
=
space
/
10
;
cc
.
tween
(
item
).
by
(
time
,
{
x
:
-
space
}).
start
();
}
item
.
off
(
cc
.
Node
.
EventType
.
TOUCH_START
,
this
.
onItemTouchStart
,
this
);
item
.
off
(
cc
.
Node
.
EventType
.
TOUCH_MOVE
,
this
.
onItemTouchMove
,
this
);
item
.
off
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onItemTouchEnd
,
this
);
item
.
off
(
cc
.
Node
.
EventType
.
TOUCH_CANCEL
,
this
.
onItemTouchCancel
,
this
);
pg
.
event
.
emit
(
'
mouse_05_add
'
)
}
else
{
this
.
updateItem
(
target
,
data
);
}
...
...
@@ -204,20 +271,21 @@ export default class SceneComponent extends MyCocosSceneComponent {
private
showGameOver
()
{
let
gameover
=
cc
.
find
(
"
gameover
"
,
this
.
node
);
gameover
.
scale
=
3
;
gameover
.
active
=
true
;
this
.
playLocalAudio
(
"
gameover
"
);
cc
.
tween
(
gameover
).
to
(
0.3
,
{
scale
:
1
})
.
delay
(
2
)
.
call
(()
=>
{
gameover
.
active
=
false
;
//发送给上端最后的数据
// alert("game_finish")
let
player
=
{
right
:
Game
.
getIns
().
player
.
score
,
error
:
Game
.
getIns
().
player
.
error
}
onHomeworkFinish
(
player
)
this
.
log
(
"
player:
"
+
JSON
.
stringify
(
player
));
}).
start
();
this
.
showFinal
();
// let gameover = cc.find("gameover", this.node);
// gameover.scale = 3;
// gameover.active = true;
// this.playLocalAudio("gameover");
// cc.tween(gameover).to(0.3, { scale: 1 })
// .delay(2)
// .call(() => {
// gameover.active = false;
// //发送给上端最后的数据
// // alert("game_finish")
// let player = { right: Game.getIns().player.score, error: Game.getIns().player.error }
// onHomeworkFinish(player)
// this.log("player: " + JSON.stringify(player));
// }).start();
}
playLocalAudio
(
audioName
)
{
...
...
assets/ngt7_fish/scene/small/ngt7_layout_mouse.ts
View file @
964c8b01
...
...
@@ -5,7 +5,7 @@
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import
pg
from
"
../pg
"
;
import
pg
from
"
../
tool/
pg
"
;
// import Game from "../../scene/Game";
...
...
@@ -13,7 +13,7 @@ import pg from "../pg";
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
Ngt_star_
05
extends
cc
.
Component
{
export
default
class
Ngt_star_
7
extends
cc
.
Component
{
// LIFE-CYCLE CALLBACKS:
onLoad
()
{
pg
.
event
.
on
(
"
mouse_05_num
"
,
(
max
:
number
)
=>
{
...
...
@@ -110,7 +110,7 @@ export default class Ngt_star_05 extends cc.Component {
// this.checkGameEnd();
return
;
}
const
bigStarBg
=
this
.
bigStarArr
[
curGroupIndex
]
//[this.curGroupIndex++];
const
bigStarBg
=
this
.
bigStarArr
[
this
.
curGroupIndex
++
];
//[curGroupIndex]//
if
(
!
bigStarBg
)
return
;
const
star_wrong
=
bigStarBg
.
star_wrong
;
star_wrong
.
active
=
true
;
...
...
@@ -131,7 +131,7 @@ export default class Ngt_star_05 extends cc.Component {
if
(
!
this
.
bigStarArr
||
this
.
bigStarArr
.
length
<=
0
)
{
return
;
}
const
bigStarBg
=
this
.
bigStarArr
[
curGroupIndex
]
//[this.curGroupIndex++];
const
bigStarBg
=
this
.
bigStarArr
[
this
.
curGroupIndex
++
];
//[curGroupIndex]//
if
(
!
bigStarBg
)
return
;
const
starBig
=
bigStarBg
.
starBig
;
...
...
assets/ngt7_fish/scene/tool/Game.ts
View file @
964c8b01
...
...
@@ -107,6 +107,10 @@ export default class Game {
public
player
:
Player
;
public
state
:
GAME_STATE
;
public
title
:
string
;
public
total
:
number
;
public
aniEnter
;
public
startAudio
;
constructor
()
{
this
.
start
=
false
;
this
.
lists
=
[];
...
...
@@ -120,6 +124,10 @@ export default class Game {
this
.
start
=
false
;
this
.
lists
=
[];
this
.
data
=
data
.
questions
;
this
.
title
=
data
.
title
;
this
.
startAudio
=
data
.
startAudio
||
""
;
this
.
aniEnter
=
data
.
imgAni
;
}
public
start
:
boolean
;
public
boatLeft
:
Item
;
...
...
creator.d.ts
View file @
964c8b01
...
...
@@ -4589,6 +4589,9 @@ declare namespace cc {
!#zh 获取节点正前方(z 轴)面对的方向,返回值为世界坐标系下的归一化向量 */
forward
:
Vec3
;
data
:
Option
;
starBig
:
any
;
star
:
any
;
star_wrong
:
any
;
/**
@param name name
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