Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
ns16_mole
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
ns16_mole
Commits
9f8aa7ad
Commit
9f8aa7ad
authored
Oct 14, 2022
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
单机版完成
parent
807e2ac9
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
2576 additions
and
1400 deletions
+2576
-1400
layout_fish.ts
assets/gofishing/scene/game/layout_fish.ts
+177
-170
layout_info.ts
assets/gofishing/scene/game/layout_info.ts
+4
-2
gofishing.fire
assets/gofishing/scene/gofishing.fire
+2366
-1218
gofishing.ts
assets/gofishing/scene/gofishing.ts
+0
-4
Game.ts
assets/gofishing/scene/tool/Game.ts
+2
-0
defaultData.ts
assets/gofishing/script/defaultData.ts
+21
-1
view.png
assets/gofishing/textures/view.png
+0
-0
text_round.png.meta
assets/gofishing/textures/打地鼠/text_round.png.meta
+3
-3
creator.d.ts
creator.d.ts
+1
-0
ComponentBase.ts
form/src/app/form/ComponentBase.ts
+2
-2
No files found.
assets/gofishing/scene/game/layout_fish.ts
View file @
9f8aa7ad
// 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
import
Game
,
{
FISH_OUT
,
GAME_STATE
,
Option
}
from
"
../tool/Game
"
;
import
Game
,
{
FISH_OUT
,
GAME_STATE
,
Item
,
Option
}
from
"
../tool/Game
"
;
import
pg
from
"
../tool/pg
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
...
@@ -39,6 +32,10 @@ export default class NewClass extends cc.Component {
item_left
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
item_right
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
item
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
layout_card
:
cc
.
Node
=
null
;
onLoad
()
{
pg
.
event
.
on
(
"
game_start
"
,
()
=>
{
...
...
@@ -47,26 +44,76 @@ export default class NewClass extends cc.Component {
pg
.
event
.
on
(
"
game_time_over
"
,
()
=>
{
this
.
roundOver
();
})
pg
.
view
.
visible
(
pg
.
view
.
find
(
this
.
layout_card
,
'
bg_card_cover
'
),
false
)
this
.
initLayout
();
}
private
data
:
Item
;
private
count
:
number
;
private
list
:
Option
[];
private
fishs
:
cc
.
Node
[];
private
holes
:
Array
<
any
>
;
gameStart
()
{
//游戏开始。允许出鱼
let
page
=
Game
.
getIns
().
getCurrentPage
();
this
.
data
=
page
;
let
list
=
page
.
optionList
.
concat
();
list
=
JSON
.
parse
(
JSON
.
stringify
(
list
));
list
.
sort
((
A
,
B
)
=>
{
return
Math
.
random
()
<
0.5
});
//将list进行随机或者直接每次随机抽
this
.
list
=
list
;
this
.
holes
=
[];
this
.
count
=
0
;
this
.
lastCount
=
null
;
this
.
robotFishTime
=
null
;
this
.
fishs
=
[];
this
.
viewFishs
=
[];
this
.
touchFishs
=
[];
//根据顺序生成对应的鱼。
//顺序根据时间来进行跳动。当顺序跳动之后,就会产生新的鱼。
// 播放内容
this
.
showCard
().
then
(()
=>
{
Game
.
getIns
().
state
=
GAME_STATE
.
RUNNING
;
})
}
initLayout
()
{
// 平台处理
let
posOrg
=
cc
.
v2
(
-
424
,
95
)
let
posSpace
=
cc
.
v2
(
280
,
-
250
)
for
(
let
i
=
0
;
i
<
8
;
i
++
)
{
let
node
=
cc
.
instantiate
(
this
.
item
);
node
.
active
=
true
;
this
.
node
.
addChild
(
node
);
node
.
x
=
posOrg
.
x
+
posSpace
.
x
*
(
i
%
4
)
node
.
y
=
posOrg
.
y
+
posSpace
.
y
*
Math
.
floor
(
i
/
4
)
this
.
updateItem
(
node
,
null
);
pg
.
view
.
touchOn
(
pg
.
view
.
find
(
node
,
'
mask/mouse_normal
'
),
this
.
onTouchItem
,
this
);
}
}
showCard
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
card
=
this
.
layout_card
.
getChildByName
(
'
bg_card_cover
'
);
card
.
scale
=
1
;
card
.
x
=
0
;
card
.
y
=
15
;
card
.
opacity
=
0
;
card
.
active
=
true
;
// 执行翻转动画 飞向底部
let
bg_card_small
=
this
.
layout_card
.
getChildByName
(
'
bg_card_small
'
);
let
pos
=
cc
.
v2
(
bg_card_small
.
x
,
bg_card_small
.
y
);
let
bg_card
=
pg
.
view
.
find
(
card
,
"
bg_card
"
)
bg_card
.
active
=
false
;
cc
.
tween
(
card
).
to
(
0.5
,
{
opacity
:
255
}).
delay
(
0.5
).
to
(
0.3
,
{
scaleX
:
0
}).
call
(()
=>
{
bg_card
.
active
=
true
;
pg
.
view
.
setNetImg
(
pg
.
view
.
find
(
bg_card
,
"
img
"
),
this
.
data
.
img
,
{
w
:
480
,
h
:
300
})
}).
to
(
0.3
,
{
scaleX
:
1
}).
call
(()
=>
{
pg
.
event
.
on
(
'
game_play_laba_successed
'
,
()
=>
{
cc
.
tween
(
card
).
to
(
0.3
,
{
x
:
pos
.
x
,
y
:
pos
.
y
,
scale
:
0.3
}).
call
(()
=>
{
resolve
(
''
);
}).
start
();
})
pg
.
event
.
emit
(
'
game_play_laba
'
)
}).
start
();
});
}
roundOver
()
{
//当前的鱼都不能点击并且消失
...
...
@@ -74,164 +121,125 @@ export default class NewClass extends cc.Component {
cc
.
tween
(
data
.
fish
.
node
).
to
(
0.3
,
{
opacity
:
0
}).
start
();
})
}
private
lastCount
:
number
;
private
viewFishs
:
Option
[];
private
touchFishs
:
Option
[];
getFishByCount
(
count
)
{
if
(
count
<=
this
.
lastCount
)
return
null
;
if
(
!
this
.
list
)
return
;
if
(
this
.
list
.
length
==
this
.
touchFishs
.
length
)
{
Game
.
getIns
().
state
=
GAME_STATE
.
OVER
;
return
pg
.
event
.
emit
(
"
game_time_over
"
);
}
let
list
=
this
.
list
.
filter
((
li
)
=>
this
.
touchFishs
.
every
(
t
=>
t
.
id
!=
li
.
id
));
if
(
list
.
every
(
li
=>
!
li
.
right
))
{
Game
.
getIns
().
state
=
GAME_STATE
.
OVER
;
return
pg
.
event
.
emit
(
"
game_time_over
"
);
}
this
.
lastCount
=
count
;
list
=
list
.
filter
((
li
)
=>
this
.
viewFishs
.
every
(
v
=>
v
.
id
!=
li
.
id
));
if
(
list
.
length
==
0
)
return
null
;
let
data
=
JSON
.
parse
(
JSON
.
stringify
(
list
[
count
%
list
.
length
]));
data
.
fish
.
isLeft
=
Math
.
random
()
<
0.5
;
let
item_base
=
data
.
fish
.
isLeft
?
this
.
item_left
:
this
.
item_right
;
let
item
=
cc
.
instantiate
(
item_base
);
this
.
updateFish
(
item
,
data
);
this
.
viewFishs
.
push
(
data
);
return
item
;
}
private
fishCount
:
number
;
private
lastY
:
number
;
updateFish
(
item
,
data
:
Option
)
{
pg
.
view
.
touchOn
(
item
,
this
.
onTouchItem
,
this
);
if
(
!
this
.
fishCount
)
this
.
fishCount
=
0
;
let
id
=
this
.
fishCount
%
5
+
1
;
this
.
fishCount
++
;
pg
.
view
.
visible
(
pg
.
view
.
find
(
item
,
'
fish/icon_fish1
'
),
id
==
1
);
pg
.
view
.
visible
(
pg
.
view
.
find
(
item
,
'
fish/icon_fish2
'
),
id
==
2
);
pg
.
view
.
visible
(
pg
.
view
.
find
(
item
,
'
fish/icon_fish3
'
),
id
==
3
);
pg
.
view
.
visible
(
pg
.
view
.
find
(
item
,
'
fish/icon_fish4
'
),
id
==
4
);
pg
.
view
.
visible
(
pg
.
view
.
find
(
item
,
'
fish/icon_fish5
'
),
id
==
5
);
item
.
parent
=
this
.
node
;
item
.
data
=
data
;
data
.
fish
.
node
=
item
;
//渲染部分
if
(
data
.
type
==
"
txt
"
)
{
pg
.
view
.
visible
(
pg
.
view
.
find
(
item
,
'
layout_text
'
),
true
);
pg
.
view
.
visible
(
pg
.
view
.
find
(
item
,
'
layout_img
'
),
false
);
pg
.
view
.
setString
(
pg
.
view
.
find
(
item
,
"
layout_text/text
"
),
data
.
txt
);
}
else
{
pg
.
view
.
visible
(
pg
.
view
.
find
(
item
,
'
layout_text
'
),
false
);
pg
.
view
.
visible
(
pg
.
view
.
find
(
item
,
'
layout_img
'
),
true
);
pg
.
view
.
setNetImg
(
pg
.
view
.
find
(
item
,
'
layout_img/img
'
),
data
.
picUrl
,
{
w
:
118
,
h
:
110
})
}
//x y 起始点 和终点 进行 随机
cc
.
Tween
.
stopAllByTarget
(
item
);
let
random
=
0
;
do
{
random
=
Math
.
floor
(
Math
.
random
()
*
8
)
}
while
(
random
==
this
.
lastY
)
this
.
lastY
=
random
;
if
(
data
.
fish
.
isLeft
)
{
//左往右
item
.
x
=
-
(
1334
/
2
+
Math
.
random
()
*
200
)
item
.
y
=
-
290
+
random
*
60
;
//
cc
.
tween
(
item
).
to
(
7
+
Math
.
random
()
*
8
,
{
x
:
1500
}).
call
(()
=>
{
data
.
fish
.
isOut
=
FISH_OUT
.
OUT
;
this
.
viewFishs
=
this
.
viewFishs
.
filter
(
v
=>
v
.
id
!=
data
.
id
);
}).
start
();
}
else
{
//右往左
item
.
x
=
(
1334
/
2
)
+
Math
.
random
()
*
200
;
item
.
y
=
-
290
+
random
*
60
;
cc
.
tween
(
item
).
to
(
7
+
Math
.
random
()
*
8
,
{
x
:
-
1500
}).
call
(()
=>
{
data
.
fish
.
isOut
=
FISH_OUT
.
OUT
;
this
.
viewFishs
=
this
.
viewFishs
.
filter
(
v
=>
v
.
id
!=
data
.
id
);
}).
start
();
}
}
private
touching
:
boolean
;
private
fishAudioId
;
fishingRight
(
item
,
layout
,
data
:
Option
)
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
let
wave
=
pg
.
view
.
find
(
layout
,
'
wave
'
)
wave
.
active
=
true
;
wave
.
angle
=
getDegree
(
cc
.
v2
(
item
),
cc
.
v2
(
layout
).
add
(
cc
.
v2
(
wave
)));
let
text
=
pg
.
view
.
find
(
layout
,
"
text
"
);
text
.
active
=
true
;
pg
.
audio
.
stopAudio
(
this
.
fishAudioId
);
if
(
data
.
audioUrl
)
this
.
fishAudioId
=
await
pg
.
audio
.
playAudioByUrl
(
data
.
audioUrl
)
cc
.
tween
(
item
)
.
to
(
1
,
{
x
:
layout
.
x
,
y
:
layout
.
y
+
wave
.
y
,
scaleX
:
item
.
scaleX
*
0.1
,
scaleY
:
item
.
scaleY
*
0.1
}).
call
(()
=>
{
//处理内容
data
.
fish
.
isOut
=
FISH_OUT
.
OUT
;
wave
.
active
=
false
;
text
.
active
=
false
;
this
.
touching
=
false
;
item
.
active
=
false
;
resolve
(
''
);
scaleTo0
()
{
let
nodes
=
this
.
node
.
children
.
filter
(
item
=>
item
.
data
);
nodes
.
forEach
(
node
=>
{
// nodes进行隐藏
cc
.
tween
(
pg
.
view
.
find
(
node
,
'
mask
'
)).
to
(
1
,
{
scale
:
0
}).
call
(()
=>
{
node
.
data
=
null
}).
start
();
})
;
})
}
fishingError
(
item
,
layout
,
data
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
pg
.
audio
.
playLocalAudio
(
pg
.
view
.
find
(
this
.
res
,
"
audio/error
"
))
if
(
data
.
fish
.
isLeft
)
{
//左往右
cc
.
tween
(
item
).
to
(
3
,
{
x
:
1500
}).
call
(()
=>
{
data
.
fish
.
isOut
=
FISH_OUT
.
OUT
;
item
.
active
=
false
;
setTimeout
(()
=>
{
item
.
parent
=
null
;
},
1000
);
if
(
this
.
touchFishs
.
every
(
fish
=>
fish
.
id
!=
data
.
id
))
{
resolve
(
''
);
stopAllAni
()
{
let
nodes
=
this
.
node
.
children
.
filter
(
item
=>
item
.
data
);
nodes
.
forEach
(
node
=>
{
let
mouse_normal
=
pg
.
view
.
find
(
node
,
"
mask/mouse_normal
"
);
let
mouse_right
=
pg
.
view
.
find
(
node
,
"
mask/mouse_right
"
);
let
mouse_wrong
=
pg
.
view
.
find
(
node
,
"
mask/mouse_wrong
"
);
cc
.
Tween
.
stopAllByTarget
(
mouse_normal
)
cc
.
Tween
.
stopAllByTarget
(
mouse_right
)
cc
.
Tween
.
stopAllByTarget
(
mouse_wrong
)
})
}
}).
start
();
updateItem
(
item
,
data
:
Option
)
{
if
(
item
.
data
)
return
;
item
.
data
=
data
;
pg
.
view
.
find
(
item
,
'
mask
'
).
scale
=
1
;
let
mouse_normal
=
pg
.
view
.
find
(
item
,
"
mask/mouse_normal
"
);
let
mouse_right
=
pg
.
view
.
find
(
item
,
"
mask/mouse_right
"
);
let
mouse_wrong
=
pg
.
view
.
find
(
item
,
"
mask/mouse_wrong
"
);
let
img_add
=
pg
.
view
.
find
(
item
,
'
img_add
'
)
pg
.
view
.
visible
(
img_add
,
false
);
if
(
!
data
)
{
mouse_normal
.
active
=
false
;
mouse_right
.
active
=
false
;
mouse_wrong
.
active
=
false
;
}
else
{
//右往左
cc
.
tween
(
item
).
to
(
3
,
{
x
:
-
1500
}).
call
(()
=>
{
data
.
fish
.
isOut
=
FISH_OUT
.
OUT
;
item
.
active
=
false
;
setTimeout
(()
=>
{
item
.
parent
=
null
;
},
1000
);
if
(
this
.
touchFishs
.
every
(
fish
=>
fish
.
id
!=
data
.
id
))
{
resolve
(
''
);
console
.
log
(
data
.
picUrl
)
if
(
data
.
type
==
'
txt
'
)
{
pg
.
view
.
visible
(
pg
.
view
.
find
(
mouse_normal
,
'
img
'
),
false
)
pg
.
view
.
visible
(
pg
.
view
.
find
(
mouse_right
,
'
img
'
),
false
)
pg
.
view
.
visible
(
pg
.
view
.
find
(
mouse_wrong
,
'
img
'
),
false
)
pg
.
view
.
visible
(
pg
.
view
.
find
(
mouse_normal
,
'
text
'
),
true
)
pg
.
view
.
visible
(
pg
.
view
.
find
(
mouse_right
,
'
text
'
),
true
)
pg
.
view
.
visible
(
pg
.
view
.
find
(
mouse_wrong
,
'
text
'
),
true
)
pg
.
view
.
setString
(
pg
.
view
.
find
(
mouse_normal
,
'
text
'
),
data
.
txt
);
pg
.
view
.
setString
(
pg
.
view
.
find
(
mouse_right
,
'
text
'
),
data
.
txt
);
pg
.
view
.
setString
(
pg
.
view
.
find
(
mouse_wrong
,
'
text
'
),
data
.
txt
);
}
else
{
pg
.
view
.
visible
(
pg
.
view
.
find
(
mouse_normal
,
'
img
'
),
true
)
pg
.
view
.
visible
(
pg
.
view
.
find
(
mouse_right
,
'
img
'
),
true
)
pg
.
view
.
visible
(
pg
.
view
.
find
(
mouse_wrong
,
'
img
'
),
true
)
pg
.
view
.
visible
(
pg
.
view
.
find
(
mouse_normal
,
'
text
'
),
false
)
pg
.
view
.
visible
(
pg
.
view
.
find
(
mouse_right
,
'
text
'
),
false
)
pg
.
view
.
visible
(
pg
.
view
.
find
(
mouse_wrong
,
'
text
'
),
false
)
pg
.
view
.
setNetImg
(
pg
.
view
.
find
(
mouse_normal
,
'
img
'
),
data
.
picUrl
,
{
w
:
160
,
h
:
95
})
pg
.
view
.
setNetImg
(
pg
.
view
.
find
(
mouse_right
,
'
img
'
),
data
.
picUrl
,
{
w
:
160
,
h
:
95
})
pg
.
view
.
setNetImg
(
pg
.
view
.
find
(
mouse_wrong
,
'
img
'
),
data
.
picUrl
,
{
w
:
160
,
h
:
95
})
}
//执行出老鼠的动画
let
startPos
=
cc
.
v2
(
10
,
-
114
);
let
endPos
=
cc
.
v2
(
10
,
110
)
mouse_normal
.
position
=
cc
.
v3
(
startPos
);
mouse_normal
.
active
=
true
;
mouse_right
.
active
=
false
;
mouse_wrong
.
active
=
false
;
cc
.
tween
(
mouse_normal
).
to
(
1
,
{
y
:
endPos
.
y
}).
delay
(
3
).
to
(
1
,
{
y
:
startPos
.
y
}).
call
(()
=>
{
item
.
data
=
null
}).
start
();
}
setTimeout
(()
=>
{
this
.
touching
=
false
;
},
500
);
});
}
fishing
(
item
,
layout
)
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
let
data
=
item
.
data
;
//item停止动画并
cc
.
Tween
.
stopAllByTarget
(
item
);
if
(
data
.
right
)
{
await
this
.
fishingRight
(
item
,
layout
,
data
);
}
else
{
await
this
.
fishingError
(
item
,
layout
,
data
);
}
this
.
touchFishs
.
push
(
data
);
return
resolve
(
data
.
right
);
});
}
//开始点击 点击角色
async
onTouchItem
(
e
)
{
if
(
this
.
touching
)
return
;
// this.touching = true;
let
item
=
e
.
target
;
let
item
=
e
.
target
.
parent
.
parent
;
let
data
=
item
.
data
;
if
(
this
.
touchFishs
.
some
(
fish
=>
fish
.
id
==
data
.
id
))
return
;
if
(
data
.
fish
.
isOut
!=
FISH_OUT
.
RUNNING
)
return
;
data
.
fish
.
isOut
=
FISH_OUT
.
TOUCH
;
let
isRight
=
await
this
.
fishing
(
item
,
this
.
layout_player
);
isRight
&&
Game
.
getIns
().
player
.
addScore
();
!
isRight
&&
Game
.
getIns
().
player
.
addError
();
let
mouse_normal
=
pg
.
view
.
find
(
item
,
"
mask/mouse_normal
"
);
let
mouse_right
=
pg
.
view
.
find
(
item
,
"
mask/mouse_right
"
);
let
mouse_wrong
=
pg
.
view
.
find
(
item
,
"
mask/mouse_wrong
"
);
// 点击之后判断对错。
Game
.
getIns
().
state
=
GAME_STATE
.
OVER
;
this
.
stopAllAni
();
if
(
data
.
right
)
{
mouse_normal
.
active
=
false
;
mouse_right
.
active
=
true
;
mouse_wrong
.
active
=
false
;
// +1
let
img_add
=
pg
.
view
.
find
(
item
,
'
img_add
'
)
pg
.
view
.
visible
(
img_add
,
true
);
img_add
.
position
=
cc
.
v3
(
cc
.
v2
(
135
,
70
));
cc
.
tween
(
img_add
).
by
(
0.5
,
{
y
:
80
}).
delay
(
3
).
call
(()
=>
{
pg
.
view
.
visible
(
img_add
,
false
);
this
.
scaleTo0
();
Game
.
getIns
().
player
.
addScore
();
return
pg
.
event
.
emit
(
"
game_time_over
"
);
}).
start
();
}
else
{
mouse_normal
.
active
=
false
;
mouse_right
.
active
=
false
;
mouse_wrong
.
active
=
true
;
let
startPos
=
cc
.
v2
(
10
,
-
114
);
let
nodes
=
this
.
node
.
children
.
filter
(
item
=>
item
.
data
);
nodes
.
forEach
(
node
=>
{
cc
.
tween
(
pg
.
view
.
find
(
node
,
"
mask/mouse_normal
"
)).
to
(
0.5
,
{
y
:
startPos
.
y
}).
call
(()
=>
{
item
.
data
=
null
}).
start
();
})
this
.
scheduleOnce
(()
=>
{
Game
.
getIns
().
player
.
addError
();
return
pg
.
event
.
emit
(
"
game_time_over
"
);
},
2
)
}
}
//机器人随机钓鱼
private
robotFishTime
;
async
onRobotFishing
()
{
if
(
1
)
return
;
this
.
layout_robot
.
active
=
!
Game
.
getIns
().
singleGame
;
if
(
!
this
.
viewFishs
)
return
;
if
(
Game
.
getIns
().
singleGame
)
return
;
...
...
@@ -247,21 +255,18 @@ export default class NewClass extends cc.Component {
this
.
robotFishTime
=
nowTime
-
1000
;
//-1000 动画时间
if
(
!
data
.
right
)
return
;
this
.
touching
=
true
;
data
.
fish
.
isOut
=
FISH_OUT
.
TOUCH
;
let
isRight
=
await
this
.
fishing
(
data
.
fish
.
node
,
this
.
layout_robot
);
isRight
&&
Game
.
getIns
().
robot
.
addScore
();
!
isRight
&&
Game
.
getIns
().
player
.
addError
();
//
data.fish.isOut = FISH_OUT.TOUCH;
//
let isRight = await this.fishing(data.fish.node, this.layout_robot);
//
isRight && Game.getIns().robot.addScore();
//
!isRight && Game.getIns().player.addError();
}
}
get
fishLen
()
{
if
(
!
this
.
fishs
)
return
999
;
let
arr
=
this
.
fishs
.
filter
(
item
=>
{
let
data
:
Option
=
item
.
data
;
return
data
.
fish
.
isOut
==
FISH_OUT
.
RUNNING
;
})
this
.
fishs
=
arr
;
return
this
.
fishs
.
length
;
getMouse
()
{
return
this
.
list
[
Math
.
floor
(
Math
.
random
()
*
this
.
list
.
length
)]
}
getEmptyHole
()
{
let
list
=
this
.
node
.
children
.
filter
(
item
=>
!
item
.
data
);
return
list
[
Math
.
floor
(
Math
.
random
()
*
list
.
length
)];
}
private
updateTime
:
number
;
private
updateCratTime
:
number
;
...
...
@@ -271,11 +276,13 @@ export default class NewClass extends cc.Component {
if
(
nowTime
-
this
.
updateTime
<
1000
)
return
;
this
.
updateTime
=
nowTime
;
if
(
Game
.
getIns
().
state
!=
GAME_STATE
.
RUNNING
)
return
;
if
(
this
.
fishLen
<
5
)
this
.
count
++
;
this
.
onRobotFishing
();
if
(
!
this
.
updateCratTime
)
this
.
updateCratTime
=
nowTime
-
3000
;
if
(
nowTime
-
this
.
updateCratTime
<
3000
)
return
;
let
fish
=
this
.
getFishByCount
(
this
.
count
);
if
(
fish
)
this
.
fishs
.
push
(
fish
);
if
(
!
this
.
updateCratTime
)
this
.
updateCratTime
=
nowTime
-
500
;
if
(
nowTime
-
this
.
updateCratTime
<
500
)
return
;
let
mouse
=
this
.
getMouse
();
// 选择一个洞
let
hole
=
this
.
getEmptyHole
();
if
(
!
hole
)
return
;
// 出现
this
.
updateItem
(
hole
,
mouse
);
}
}
assets/gofishing/scene/game/layout_info.ts
View file @
9f8aa7ad
...
...
@@ -40,12 +40,13 @@ export default class NewClass extends cc.Component {
pg
.
event
.
on
(
"
game_set_game_time
"
,
(
count
)
=>
{
this
.
countDown
=
count
;
});
pg
.
event
.
on
(
"
game_play_laba
"
,
()
=>
{
this
.
playLaba
();
});
this
.
btn_laba
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
playLaba
,
this
);
}
private
gameStart
()
{
this
.
countDown
=
Game
.
getIns
().
getCurrentPage
().
duration
;
// this.showRound();
this
.
playLaba
();
}
private
bg_round
:
cc
.
Node
;
private
initView
()
{
...
...
@@ -82,6 +83,7 @@ export default class NewClass extends cc.Component {
if
(
stop
&&
count
%
3
==
2
)
{
this
.
playing
=
false
;
clearInterval
(
this
.
intervalId
);
pg
.
event
.
emit
(
"
game_play_laba_successed
"
);
}
},
150
);
pg
.
audio
.
playAudioByUrlThen
(
Game
.
getIns
().
getCurrentPage
().
audio
).
then
(()
=>
{
...
...
assets/gofishing/scene/gofishing.fire
View file @
9f8aa7ad
This source diff could not be displayed because it is too large. You can
view the blob
instead.
assets/gofishing/scene/gofishing.ts
View file @
9f8aa7ad
...
...
@@ -52,7 +52,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
audioId
=
await
pg
.
audio
.
playAudioByUrl
(
Game
.
getIns
().
question
.
audio
);
if
(
this
.
audioId
>
-
1
&&
Game
.
getIns
().
state
==
GAME_STATE
.
RUNNING
)
{
cc
.
audioEngine
.
stopAllEffects
();
// pg.audio.stopAudio(this.audioId);
}
}
initEvent
()
{
...
...
@@ -81,7 +80,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
layout_start
.
active
=
false
;
if
(
this
.
audioId
>
-
1
)
{
cc
.
audioEngine
.
stopAllEffects
();
// pg.audio.stopAudio(this.audioId);
}
if
(
!
Game
.
getIns
().
singleGame
)
{
this
.
showVs
();
...
...
@@ -91,12 +89,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
gameStart
()
{
Game
.
getIns
().
state
=
GAME_STATE
.
RUNNING
;
//游戏开始小鱼出现等等
this
.
layout_start
.
active
=
false
;
if
(
this
.
audioId
>
-
1
&&
Game
.
getIns
().
state
!=
GAME_STATE
.
WAIT
)
{
cc
.
audioEngine
.
stopAllEffects
();
// pg.audio.stopAudio(this.audioId);
}
}
private
showVs
()
{
...
...
assets/gofishing/scene/tool/Game.ts
View file @
9f8aa7ad
...
...
@@ -42,10 +42,12 @@ export class Item {
public
audio
;
public
duration
;
public
optionList
;
public
img
;
constructor
(
data
,
page
)
{
this
.
audio
=
data
.
questionAudio
;
this
.
duration
=
data
.
duration
;
let
id
=
0
;
this
.
img
=
data
.
questionImg
;
this
.
optionList
=
data
.
options
.
map
(
o
=>
{
return
new
Option
(
o
,
id
++
);
...
...
assets/gofishing/script/defaultData.ts
View file @
9f8aa7ad
...
...
@@ -2,5 +2,25 @@ export const defaultData =
{
"
onlineFlg
"
:
false
,
"
title
"
:
"
疯狂打地鼠
"
,
"
questionText
"
:
"
调皮的地鼠偷走了魔法卡牌,亲爱的小玩家,请仔细听游戏指令,快速找到藏着正确魔法卡牌的地鼠,用锤子敲打它,就能夺回魔法卡牌。在本次的游戏中,你将和其他玩家进行PK,游戏结束,获得魔法卡牌数量最多的玩家,将获得胜利。最后根据获得的魔法卡牌数量,你将获得相应的能量石奖励!开始挑战吧!
"
,
"
questionTextAudio
"
:
"
http://staging-teach.cdn.ireadabc.com/d08192ced3bd81941d38941bb36e5042_l.mp3
"
,
"
questions
"
:
[{
"
questionAudio
"
:
"
http://staging-teach.cdn.ireadabc.com/130feba39f7665f46adfc6765f86c6cd_l.mp3
"
,
"
duration
"
:
120
,
"
options
"
:
[{
"
type
"
:
"
img
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/317ef6895381d2f926a0d444326a5995.png
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/f03e207cb6808b17c1510b230a70bb1d_l.mp3
"
,
"
text
"
:
""
,
"
right
"
:
true
,
"
audioName
"
:
"
加分.mp3
"
},
{
"
type
"
:
"
txt
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/7432c9bfa754a4c9db54132308e8ce1f_l.mp3
"
,
"
text
"
:
"
xfuw
"
,
"
right
"
:
false
,
"
audioName
"
:
"
冒出.mp3
"
},
{
"
type
"
:
"
txt
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/274d8965edafabf1e8d1a01400db82b7_l.mp3
"
,
"
text
"
:
"
head
"
,
"
right
"
:
true
,
"
audioName
"
:
"
错误.mp3
"
},
{
"
type
"
:
"
img
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/fc1d670c1a3461136506195e3e9e3797.png
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/7432c9bfa754a4c9db54132308e8ce1f_l.mp3
"
,
"
text
"
:
""
,
"
right
"
:
false
,
"
audioName
"
:
"
冒出.mp3
"
}],
"
questionImg
"
:
"
http://staging-teach.cdn.ireadabc.com/317ef6895381d2f926a0d444326a5995.png
"
,
"
audioName
"
:
"
胜利.mp3
"
},
{
"
questionAudio
"
:
"
http://staging-teach.cdn.ireadabc.com/26e6e997562503a98918fadab7e7b6c2_l.mp3
"
,
"
duration
"
:
120
,
"
options
"
:
[{
"
type
"
:
"
img
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/fea420e83bd2ba03d014c279de780599.png
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/7432c9bfa754a4c9db54132308e8ce1f_l.mp3
"
,
"
text
"
:
""
,
"
right
"
:
true
,
"
audioName
"
:
"
冒出.mp3
"
},
{
"
type
"
:
"
txt
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/274d8965edafabf1e8d1a01400db82b7_l.mp3
"
,
"
text
"
:
"
eye
"
,
"
right
"
:
true
,
"
audioName
"
:
"
错误.mp3
"
},
{
"
type
"
:
"
txt
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/f03e207cb6808b17c1510b230a70bb1d_l.mp3
"
,
"
text
"
:
"
fffsxz
"
,
"
right
"
:
false
,
"
audioName
"
:
"
加分.mp3
"
},
{
"
type
"
:
"
img
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/01247e69d70b995da41e6b7e2000b540.png
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610_l.mp3
"
,
"
text
"
:
""
,
"
right
"
:
false
,
"
audioName
"
:
"
按钮.mp3
"
}],
"
questionImg
"
:
"
http://staging-teach.cdn.ireadabc.com/fea420e83bd2ba03d014c279de780599.png
"
,
"
audioName
"
:
"
失败.mp3
"
}],
"
audioName
"
:
"
头像移动.mp3
"
,
"
bgAudio
"
:
"
http://staging-teach.cdn.ireadabc.com/93bb9ed985cff104879f4b4fa6ace4ea_l.mp3
"
"
questionText
"
:
"
调皮的地鼠偷走了魔法卡牌,亲爱的小玩家,请仔细听游戏指令,快速找到藏着正确魔法卡牌的地鼠,用锤子敲打它,就能夺回魔法卡牌。在本次的游戏中,你将和其他玩家进行PK,游戏结束,获得魔法卡牌数量最多的玩家,将获得胜利。最后根据获得的魔法卡牌数量,你将获得相应的能量石奖励!开始挑战吧!
"
,
"
questionTextAudio
"
:
"
http://staging-teach.cdn.ireadabc.com/d08192ced3bd81941d38941bb36e5042_l.mp3
"
,
"
questions
"
:
[
{
"
questionAudio
"
:
"
http://staging-teach.cdn.ireadabc.com/130feba39f7665f46adfc6765f86c6cd_l.mp3
"
,
"
duration
"
:
120
,
"
options
"
:
[{
"
type
"
:
"
img
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/317ef6895381d2f926a0d444326a5995.png
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/f03e207cb6808b17c1510b230a70bb1d_l.mp3
"
,
"
text
"
:
""
,
"
right
"
:
true
,
"
audioName
"
:
"
加分.mp3
"
},
{
"
type
"
:
"
txt
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/7432c9bfa754a4c9db54132308e8ce1f_l.mp3
"
,
"
text
"
:
"
xfuw
"
,
"
right
"
:
false
,
"
audioName
"
:
"
冒出.mp3
"
},
{
"
type
"
:
"
txt
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/274d8965edafabf1e8d1a01400db82b7_l.mp3
"
,
"
text
"
:
"
head
"
,
"
right
"
:
true
,
"
audioName
"
:
"
错误.mp3
"
},
{
"
type
"
:
"
img
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/fc1d670c1a3461136506195e3e9e3797.png
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/7432c9bfa754a4c9db54132308e8ce1f_l.mp3
"
,
"
text
"
:
""
,
"
right
"
:
false
,
"
audioName
"
:
"
冒出.mp3
"
}],
"
questionImg
"
:
"
http://staging-teach.cdn.ireadabc.com/317ef6895381d2f926a0d444326a5995.png
"
,
"
audioName
"
:
"
胜利.mp3
"
},
{
"
questionAudio
"
:
"
http://staging-teach.cdn.ireadabc.com/26e6e997562503a98918fadab7e7b6c2_l.mp3
"
,
"
duration
"
:
120
,
"
options
"
:
[{
"
type
"
:
"
img
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/fea420e83bd2ba03d014c279de780599.png
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/7432c9bfa754a4c9db54132308e8ce1f_l.mp3
"
,
"
text
"
:
""
,
"
right
"
:
true
,
"
audioName
"
:
"
冒出.mp3
"
},
{
"
type
"
:
"
txt
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/274d8965edafabf1e8d1a01400db82b7_l.mp3
"
,
"
text
"
:
"
eye
"
,
"
right
"
:
true
,
"
audioName
"
:
"
错误.mp3
"
},
{
"
type
"
:
"
txt
"
,
"
image
"
:
""
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/f03e207cb6808b17c1510b230a70bb1d_l.mp3
"
,
"
text
"
:
"
fffsxz
"
,
"
right
"
:
false
,
"
audioName
"
:
"
加分.mp3
"
},
{
"
type
"
:
"
img
"
,
"
image
"
:
"
http://staging-teach.cdn.ireadabc.com/01247e69d70b995da41e6b7e2000b540.png
"
,
"
audio
"
:
"
http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610_l.mp3
"
,
"
text
"
:
""
,
"
right
"
:
false
,
"
audioName
"
:
"
按钮.mp3
"
}],
"
questionImg
"
:
"
http://staging-teach.cdn.ireadabc.com/fea420e83bd2ba03d014c279de780599.png
"
,
"
audioName
"
:
"
失败.mp3
"
}],
"
audioName
"
:
"
头像移动.mp3
"
,
"
bgAudio
"
:
"
http://staging-teach.cdn.ireadabc.com/93bb9ed985cff104879f4b4fa6ace4ea_l.mp3
"
}
\ No newline at end of file
assets/gofishing/textures/view.png
View replaced file @
807e2ac9
View file @
9f8aa7ad
435 KB
|
W:
|
H:
750 KB
|
W:
|
H:
2-up
Swipe
Onion skin
assets/gofishing/textures/打地鼠/text_round.png.meta
View file @
9f8aa7ad
{
"ver": "2.3.5",
"uuid": "
28a64216-70e2-481e-b68f-fe1903e2855c
",
"uuid": "
0dcbe4c6-9dc4-4f4d-84bc-81382889e5c5
",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
...
...
@@ -13,8 +13,8 @@
"subMetas": {
"text_round": {
"ver": "1.0.4",
"uuid": "8
5b42405-9be3-45cc-8094-724da319850f
",
"rawTextureUuid": "
28a64216-70e2-481e-b68f-fe1903e2855c
",
"uuid": "8
bf6fd14-026b-4777-b9b7-69d9b17d97f0
",
"rawTextureUuid": "
0dcbe4c6-9dc4-4f4d-84bc-81382889e5c5
",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
...
...
creator.d.ts
View file @
9f8aa7ad
...
...
@@ -4588,6 +4588,7 @@ declare namespace cc {
/** !#en Returns a normalized vector representing the forward direction (Z axis) of the node in world space.
!#zh 获取节点正前方(z 轴)面对的方向,返回值为世界坐标系下的归一化向量 */
forward
:
Vec3
;
data
:
Option
;
/**
@param name name
form/src/app/form/ComponentBase.ts
View file @
9f8aa7ad
...
...
@@ -67,12 +67,12 @@ export class ComponentBase {
* 储存音频数据
* @param e
*/
onAudioUploadSuccess
(
e
,
key
,
it
=
this
.
item
)
{
onAudioUploadSuccess
(
e
,
key
,
it
=
this
.
item
,
name
=
'
audioName
'
)
{
let
url
=
e
.
url
;
let
sp
=
url
.
split
(
"
.mp3
"
);
let
u
=
sp
[
0
]
+
"
_l.mp3
"
;
it
[
key
]
=
u
;
it
[
"
audioName
"
]
=
e
.
name
||
""
;
it
[
name
]
=
e
.
name
||
""
;
this
.
save
();
}
...
...
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