Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
GeekLearnMathWeapp
Project
Project
Details
Activity
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
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
frontend
GeekLearnMathWeapp
Commits
f5b40cfd
Commit
f5b40cfd
authored
Jun 20, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 增加特别关卡
parent
cf408658
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
6 deletions
+47
-6
game.ts
src/api/game.ts
+2
-0
stage.module.scss
src/pages/main/main-underground/scene/stage.module.scss
+11
-0
stage.tsx
src/pages/main/main-underground/scene/stage.tsx
+34
-6
No files found.
src/api/game.ts
View file @
f5b40cfd
...
...
@@ -69,6 +69,8 @@ export interface Stage {
type
?:
StageType
;
upGear
:
boolean
;
part
?:
number
;
/** 星星限制数量 */
limitStar
:
number
;
/** pk负 */
pkLoseNum
:
number
|
null
;
...
...
src/pages/main/main-underground/scene/stage.module.scss
View file @
f5b40cfd
...
...
@@ -151,6 +151,17 @@
flex-direction
:
column
;
align-items
:
center
;
}
.special_name
{
display
:
flex
;
align-items
:
center
;
}
.special_star
{
width
:
40px
;
height
:
40px
;
display
:
block
;
margin-right
:
6px
;
}
.score
{
position
:
absolute
;
...
...
src/pages/main/main-underground/scene/stage.tsx
View file @
f5b40cfd
...
...
@@ -4,12 +4,13 @@ import assetsRoundNext from '@/assets/oss/assets-round-next'
import
{
useMemo
}
from
'react'
import
classNames
from
'classnames'
import
{
cs
}
from
'@/styles'
import
{
navigateTo
}
from
'@tarojs/taro'
import
{
navigateTo
,
showToast
}
from
'@tarojs/taro'
import
type
{
ImageSource
}
from
'@/types'
import
{
useStoreActions
,
useStoreState
}
from
'@/store/hooks'
import
{
UserGuideView
}
from
'@/components'
import
tutorial
from
'@/assets/oss/assets-tutorial'
import
assetsGuide
from
'@/assets/oss/assets-guide'
import
assetsMainNext
from
'@/assets/oss/assets-main-next'
import
{
type
Stage
,
StageType
,
StageStatus
,
StageLevel
,
CurrentRoundId
}
from
'./constants'
import
StageTag
from
'./stage-tag'
...
...
@@ -152,6 +153,7 @@ const StageComp = (props: StageProps) => {
const
nextPkGuide
=
useStoreActions
(
state
=>
state
.
guideModel
.
nextPkGuide
)
const
showPkGuideFromHis
=
useStoreState
(
state
=>
state
.
guideModel
.
showPkGuideFromHis
)
const
updateGuideState
=
useStoreActions
(
state
=>
state
.
guideModel
.
updateState
)
const
pkDetails
=
useStoreState
(
state
=>
state
.
userModel
.
pkDetails
)
const
isPkGuideShow
=
useMemo
(()
=>
{
const
force
=
pkGuideStep
===
2
&&
pkGuideActive
&&
stage
.
$stageIndex
===
1
...
...
@@ -164,8 +166,18 @@ const StageComp = (props: StageProps) => {
}
},
[
pkGuideActive
,
pkGuideStep
,
stage
,
showPkGuideFromHis
])
const
isSpecialRound
=
useMemo
(()
=>
{
return
stage
.
type
===
StageType
.
Special
},
[
stage
])
const
handleClick
=
()
=>
{
if
(
stage
.
status
!==
StageStatus
.
DISABLED
||
!
isProduction
)
{
if
(
isSpecialRound
)
{
if
((
pkDetails
?.
stars
??
0
)
<
stage
.
limitStar
)
{
showToast
({
title
:
'星星数量不够,快去收集吧~'
,
icon
:
'none'
})
return
}
}
/** 从首页进入更新状态 */
updateState
({
isSubmit
:
false
})
navigateTo
({
url
:
`/pages/prepare/index?id=
${
stage
.
id
}
`
})
...
...
@@ -174,6 +186,7 @@ const StageComp = (props: StageProps) => {
}
const
handleLongPress
=
()
=>
{
if
(
isSpecialRound
)
return
if
(
stage
.
status
===
StageStatus
.
PASSED
)
{
updateMainModelState
({
isCreatePkShow
:
true
,
currentPkStage
:
stage
})
}
...
...
@@ -202,6 +215,12 @@ const StageComp = (props: StageProps) => {
}
case
StageStatus
.
CURRENT
:
{
if
(
isSpecialRound
&&
(
pkDetails
?.
stars
??
0
)
<
stage
.
limitStar
)
{
return
(
<
Image
src=
{
getLockedIcon
(
stage
.
type
).
u
}
className=
{
getIconClassNames
(
stage
.
type
)
}
/>
)
}
return
(
<
UserGuideView
src=
{
getUnlockedIcon
(
stage
.
type
).
u
}
...
...
@@ -249,10 +268,12 @@ const StageComp = (props: StageProps) => {
<
Image
src=
{
getStarSrc
(
1
,
starNum
)
}
className=
{
styles
.
star_1
}
></
Image
>
<
Image
src=
{
getStarSrc
(
2
,
starNum
)
}
className=
{
styles
.
star_2
}
></
Image
>
<
Image
src=
{
getStarSrc
(
3
,
starNum
)
}
className=
{
styles
.
star_3
}
></
Image
>
<
View
className=
{
styles
.
pk
}
>
<
View
className=
{
styles
.
pk_item
}
>
{
stage
.
pkWinNum
??
0
}
</
View
>
<
View
className=
{
classNames
(
styles
.
pk_item
,
styles
.
is_right
)
}
>
{
stage
.
pkLoseNum
??
0
}
</
View
>
</
View
>
{
!
isSpecialRound
&&
(
<
View
className=
{
styles
.
pk
}
>
<
View
className=
{
styles
.
pk_item
}
>
{
stage
.
pkWinNum
??
0
}
</
View
>
<
View
className=
{
classNames
(
styles
.
pk_item
,
styles
.
is_right
)
}
>
{
stage
.
pkLoseNum
??
0
}
</
View
>
</
View
>
)
}
</
UserGuideView
>
)
}
...
...
@@ -274,7 +295,14 @@ const StageComp = (props: StageProps) => {
>
{
renderRound
(
isReady
)
}
<
View
className=
{
styles
.
roundName
}
>
<
View
>
{
!
isProduction
?
`${stage.id}.`
:
''
}{
stage
.
name
}
</
View
>
{
isSpecialRound
?
(
<
View
className=
{
styles
.
special_name
}
>
<
Image
src=
{
assetsMainNext
[
'star.png'
].
u
}
className=
{
styles
.
special_star
}
/>
星星
{
pkDetails
?.
stars
??
0
}
/
{
stage
.
limitStar
}
</
View
>
)
:
(
<
View
>
{
!
isProduction
?
`${stage.id}.`
:
''
}{
stage
.
name
}
</
View
>
)
}
</
View
>
</
View
>
)
...
...
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