Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MingSnake_241120
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
SparkProjects
MingSnake_241120
Commits
3a0764c8
Commit
3a0764c8
authored
Dec 14, 2024
by
spc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
eb1968b2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
81 additions
and
13 deletions
+81
-13
DoubleExpPropBtn.ts
assets/Scripts/Scenes/MainGame/PropBtn/DoubleExpPropBtn.ts
+19
-3
GrowPropBtn.ts
assets/Scripts/Scenes/MainGame/PropBtn/GrowPropBtn.ts
+19
-3
ShieldPropBtn.ts
assets/Scripts/Scenes/MainGame/PropBtn/ShieldPropBtn.ts
+18
-3
SpeedPropBtn.ts
assets/Scripts/Scenes/MainGame/PropBtn/SpeedPropBtn.ts
+19
-3
Snake.ts
assets/Scripts/Scenes/MainGame/Snake.ts
+2
-0
gameStore.ts
assets/Scripts/store/gameStore.ts
+4
-1
No files found.
assets/Scripts/Scenes/MainGame/PropBtn/DoubleExpPropBtn.ts
View file @
3a0764c8
...
...
@@ -4,6 +4,8 @@ import { Target } from "../Components/Target";
import
{
EPropType
}
from
"../Common/Enums"
;
import
{
MainGame
}
from
"../MainGame"
;
import
gameStore
from
"../../../store/gameStore"
;
import
{
showToast
}
from
"db://assets/Module/UIFast"
;
import
{
_asyncThrottle
}
from
"../../../Utils/Utils"
;
const
{
ccclass
}
=
_decorator
;
@
ccclass
(
'DoubleExpPropBtn'
)
...
...
@@ -17,14 +19,28 @@ export class DoubleExpPropBtn extends PropBtn {
}
async
doUse
()
{
if
(
this
.
propNum
>
0
&&
MainGame
.
ins
.
player
.
isLife
&&
await
gameStore
.
useProps
(
'sp_experience_card'
))
{
doUse
=
_asyncThrottle
(
async
()
=>
{
if
(
!
MainGame
.
ins
.
player
.
isLife
)
{
return
}
if
(
this
.
propNum
<=
0
)
{
showToast
(
'请在首页【游戏道具】中购买'
)
return
}
if
(
gameStore
.
gameInfo
.
useSpCount
>=
gameStore
.
startInfo
.
eachUseLimitTimes
)
{
showToast
(
"本局使用道具达到上限"
)
return
}
if
(
await
gameStore
.
useProps
(
'sp_experience_card'
))
{
gameStore
.
gameInfo
.
useSpCount
+=
1
super
.
doUse
();
this
.
propNum
-=
1
;
MainGame
.
ins
.
player
.
useDouble
()
this
.
startCd
();
}
}
}
)
}
...
...
assets/Scripts/Scenes/MainGame/PropBtn/GrowPropBtn.ts
View file @
3a0764c8
...
...
@@ -2,6 +2,8 @@ import { _decorator, Component, Node, tween } from "cc";
import
{
PropBtn
}
from
"../Components/PropBtn"
;
import
{
MainGame
}
from
"../MainGame"
;
import
gameStore
from
"../../../store/gameStore"
;
import
{
showToast
}
from
"db://assets/Module/UIFast"
;
import
{
_asyncThrottle
}
from
"../../../Utils/Utils"
;
const
{
ccclass
,
property
}
=
_decorator
;
@
ccclass
(
'GrowPropBtn'
)
...
...
@@ -13,14 +15,28 @@ export class GrowPropBtn extends PropBtn {
}
async
doUse
()
{
if
(
this
.
propNum
>
0
&&
MainGame
.
ins
.
player
.
isLife
&&
await
gameStore
.
useProps
(
'sp_add_length'
))
{
doUse
=
_asyncThrottle
(
async
()
=>
{
if
(
!
MainGame
.
ins
.
player
.
isLife
)
{
return
}
if
(
this
.
propNum
<=
0
)
{
showToast
(
'请在首页【游戏道具】中购买'
)
return
}
if
(
gameStore
.
gameInfo
.
useSpCount
>=
gameStore
.
startInfo
.
eachUseLimitTimes
)
{
showToast
(
"本局使用道具达到上限"
)
return
}
if
(
await
gameStore
.
useProps
(
'sp_add_length'
))
{
gameStore
.
gameInfo
.
useSpCount
+=
1
super
.
doUse
();
this
.
propNum
-=
1
;
MainGame
.
ins
.
player
.
useGrow
()
this
.
startCd
();
}
}
}
)
}
...
...
assets/Scripts/Scenes/MainGame/PropBtn/ShieldPropBtn.ts
View file @
3a0764c8
...
...
@@ -5,6 +5,8 @@ import { Target } from "../Components/Target";
import
{
EPropType
}
from
"../Common/Enums"
;
import
{
MainGame
}
from
"../MainGame"
;
import
gameStore
from
"../../../store/gameStore"
;
import
{
showToast
}
from
"db://assets/Module/UIFast"
;
import
{
_asyncThrottle
}
from
"../../../Utils/Utils"
;
const
{
ccclass
}
=
_decorator
;
...
...
@@ -17,14 +19,27 @@ export class ShieldPropBtn extends PropBtn {
}
async
doUse
()
{
if
(
this
.
propNum
>
0
&&
MainGame
.
ins
.
player
.
isLife
&&
await
gameStore
.
useProps
(
'sp_shield_card'
))
{
doUse
=
_asyncThrottle
(
async
()
=>
{
if
(
!
MainGame
.
ins
.
player
.
isLife
)
{
return
}
if
(
this
.
propNum
<=
0
)
{
showToast
(
'请在首页【游戏道具】中购买'
)
return
}
if
(
gameStore
.
gameInfo
.
useSpCount
>=
gameStore
.
startInfo
.
eachUseLimitTimes
)
{
showToast
(
"本局使用道具达到上限"
)
return
}
if
(
await
gameStore
.
useProps
(
'sp_shield_card'
))
{
gameStore
.
gameInfo
.
useSpCount
+=
1
super
.
doUse
();
this
.
propNum
-=
1
;
MainGame
.
ins
.
player
.
useDefense
()
this
.
startCd
();
}
}
}
)
}
...
...
assets/Scripts/Scenes/MainGame/PropBtn/SpeedPropBtn.ts
View file @
3a0764c8
...
...
@@ -5,6 +5,8 @@ import { Global } from "../Global";
import
{
Target
}
from
"../Components/Target"
;
import
{
EPropType
}
from
"../Common/Enums"
;
import
gameStore
from
"../../../store/gameStore"
;
import
{
showToast
}
from
"db://assets/Module/UIFast"
;
import
{
_asyncThrottle
}
from
"../../../Utils/Utils"
;
const
{
ccclass
,
property
}
=
_decorator
;
@
ccclass
(
'SpeedPropBtn'
)
...
...
@@ -17,14 +19,28 @@ export class SpeedPropBtn extends PropBtn {
}
async
doUse
()
{
if
(
this
.
propNum
>
0
&&
MainGame
.
ins
.
player
.
isLife
&&
await
gameStore
.
useProps
(
'sp_agility_card'
))
{
doUse
=
_asyncThrottle
(
async
()
=>
{
if
(
!
MainGame
.
ins
.
player
.
isLife
)
{
return
}
if
(
this
.
propNum
<=
0
)
{
showToast
(
'请在首页【游戏道具】中购买'
)
return
}
if
(
gameStore
.
gameInfo
.
useSpCount
>=
gameStore
.
startInfo
.
eachUseLimitTimes
)
{
showToast
(
"本局使用道具达到上限"
)
return
}
if
(
await
gameStore
.
useProps
(
'sp_agility_card'
))
{
gameStore
.
gameInfo
.
useSpCount
+=
1
super
.
doUse
();
this
.
propNum
-=
1
;
MainGame
.
ins
.
player
.
useSpeed
()
this
.
startCd
();
}
}
})
}
...
...
assets/Scripts/Scenes/MainGame/Snake.ts
View file @
3a0764c8
...
...
@@ -651,6 +651,7 @@ export class Snake extends Component {
* 使用加速道具
*/
useSpeed
()
{
this
.
clearSpeed
()
this
.
moveScale
=
2
;
this
.
isSpeed
=
true
;
this
.
scheduleOnce
(
this
.
clearSpeed
,
Global
.
PROP_SPEED_DUR_TIME
)
...
...
@@ -674,6 +675,7 @@ export class Snake extends Component {
useDouble
()
{
this
.
clearDouble
()
this
.
doubleStatus
=
true
;
this
.
scheduleOnce
(
this
.
clearDouble
,
Global
.
PROP_DOUBLE_EXP_DUR_TIME
)
...
...
assets/Scripts/store/gameStore.ts
View file @
3a0764c8
...
...
@@ -31,6 +31,7 @@ export interface IStartInfo {
currentDressUp
:
"sp_decoration_default"
|
"sp_skin_snake_year"
,
// sp_decoration_default装扮默认皮肤,sp_skin_snake_year装扮蛇皮肤
startId
:
number
,
// 游戏记录ID
slideScore
:
number
,
// 校验滑块的分数值
eachUseLimitTimes
:
number
//每局可使用道具限制数量
}
...
...
@@ -40,7 +41,8 @@ class GameStore {
length
:
0
,
killNum
:
0
,
luckNum
:
0
,
composeSpList
:
{}
composeSpList
:
{},
useSpCount
:
0
};
startInfo
:
IStartInfo
=
null
;
...
...
@@ -65,6 +67,7 @@ class GameStore {
killNum
:
0
,
luckNum
:
0
,
composeSpList
:
{},
useSpCount
:
0
};
return
success
;
...
...
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