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 {
...
@@ -69,6 +69,8 @@ export interface Stage {
type
?:
StageType
;
type
?:
StageType
;
upGear
:
boolean
;
upGear
:
boolean
;
part
?:
number
;
part
?:
number
;
/** 星星限制数量 */
limitStar
:
number
;
/** pk负 */
/** pk负 */
pkLoseNum
:
number
|
null
;
pkLoseNum
:
number
|
null
;
...
...
src/pages/main/main-underground/scene/stage.module.scss
View file @
f5b40cfd
...
@@ -151,6 +151,17 @@
...
@@ -151,6 +151,17 @@
flex-direction
:
column
;
flex-direction
:
column
;
align-items
:
center
;
align-items
:
center
;
}
}
.special_name
{
display
:
flex
;
align-items
:
center
;
}
.special_star
{
width
:
40px
;
height
:
40px
;
display
:
block
;
margin-right
:
6px
;
}
.score
{
.score
{
position
:
absolute
;
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'
...
@@ -4,12 +4,13 @@ import assetsRoundNext from '@/assets/oss/assets-round-next'
import
{
useMemo
}
from
'react'
import
{
useMemo
}
from
'react'
import
classNames
from
'classnames'
import
classNames
from
'classnames'
import
{
cs
}
from
'@/styles'
import
{
cs
}
from
'@/styles'
import
{
navigateTo
}
from
'@tarojs/taro'
import
{
navigateTo
,
showToast
}
from
'@tarojs/taro'
import
type
{
ImageSource
}
from
'@/types'
import
type
{
ImageSource
}
from
'@/types'
import
{
useStoreActions
,
useStoreState
}
from
'@/store/hooks'
import
{
useStoreActions
,
useStoreState
}
from
'@/store/hooks'
import
{
UserGuideView
}
from
'@/components'
import
{
UserGuideView
}
from
'@/components'
import
tutorial
from
'@/assets/oss/assets-tutorial'
import
tutorial
from
'@/assets/oss/assets-tutorial'
import
assetsGuide
from
'@/assets/oss/assets-guide'
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
{
type
Stage
,
StageType
,
StageStatus
,
StageLevel
,
CurrentRoundId
}
from
'./constants'
import
StageTag
from
'./stage-tag'
import
StageTag
from
'./stage-tag'
...
@@ -152,6 +153,7 @@ const StageComp = (props: StageProps) => {
...
@@ -152,6 +153,7 @@ const StageComp = (props: StageProps) => {
const
nextPkGuide
=
useStoreActions
(
state
=>
state
.
guideModel
.
nextPkGuide
)
const
nextPkGuide
=
useStoreActions
(
state
=>
state
.
guideModel
.
nextPkGuide
)
const
showPkGuideFromHis
=
useStoreState
(
state
=>
state
.
guideModel
.
showPkGuideFromHis
)
const
showPkGuideFromHis
=
useStoreState
(
state
=>
state
.
guideModel
.
showPkGuideFromHis
)
const
updateGuideState
=
useStoreActions
(
state
=>
state
.
guideModel
.
updateState
)
const
updateGuideState
=
useStoreActions
(
state
=>
state
.
guideModel
.
updateState
)
const
pkDetails
=
useStoreState
(
state
=>
state
.
userModel
.
pkDetails
)
const
isPkGuideShow
=
useMemo
(()
=>
{
const
isPkGuideShow
=
useMemo
(()
=>
{
const
force
=
pkGuideStep
===
2
&&
pkGuideActive
&&
stage
.
$stageIndex
===
1
const
force
=
pkGuideStep
===
2
&&
pkGuideActive
&&
stage
.
$stageIndex
===
1
...
@@ -164,8 +166,18 @@ const StageComp = (props: StageProps) => {
...
@@ -164,8 +166,18 @@ const StageComp = (props: StageProps) => {
}
}
},
[
pkGuideActive
,
pkGuideStep
,
stage
,
showPkGuideFromHis
])
},
[
pkGuideActive
,
pkGuideStep
,
stage
,
showPkGuideFromHis
])
const
isSpecialRound
=
useMemo
(()
=>
{
return
stage
.
type
===
StageType
.
Special
},
[
stage
])
const
handleClick
=
()
=>
{
const
handleClick
=
()
=>
{
if
(
stage
.
status
!==
StageStatus
.
DISABLED
||
!
isProduction
)
{
if
(
stage
.
status
!==
StageStatus
.
DISABLED
||
!
isProduction
)
{
if
(
isSpecialRound
)
{
if
((
pkDetails
?.
stars
??
0
)
<
stage
.
limitStar
)
{
showToast
({
title
:
'星星数量不够,快去收集吧~'
,
icon
:
'none'
})
return
}
}
/** 从首页进入更新状态 */
/** 从首页进入更新状态 */
updateState
({
isSubmit
:
false
})
updateState
({
isSubmit
:
false
})
navigateTo
({
url
:
`/pages/prepare/index?id=
${
stage
.
id
}
`
})
navigateTo
({
url
:
`/pages/prepare/index?id=
${
stage
.
id
}
`
})
...
@@ -174,6 +186,7 @@ const StageComp = (props: StageProps) => {
...
@@ -174,6 +186,7 @@ const StageComp = (props: StageProps) => {
}
}
const
handleLongPress
=
()
=>
{
const
handleLongPress
=
()
=>
{
if
(
isSpecialRound
)
return
if
(
stage
.
status
===
StageStatus
.
PASSED
)
{
if
(
stage
.
status
===
StageStatus
.
PASSED
)
{
updateMainModelState
({
isCreatePkShow
:
true
,
currentPkStage
:
stage
})
updateMainModelState
({
isCreatePkShow
:
true
,
currentPkStage
:
stage
})
}
}
...
@@ -202,6 +215,12 @@ const StageComp = (props: StageProps) => {
...
@@ -202,6 +215,12 @@ const StageComp = (props: StageProps) => {
}
}
case
StageStatus
.
CURRENT
:
{
case
StageStatus
.
CURRENT
:
{
if
(
isSpecialRound
&&
(
pkDetails
?.
stars
??
0
)
<
stage
.
limitStar
)
{
return
(
<
Image
src=
{
getLockedIcon
(
stage
.
type
).
u
}
className=
{
getIconClassNames
(
stage
.
type
)
}
/>
)
}
return
(
return
(
<
UserGuideView
<
UserGuideView
src=
{
getUnlockedIcon
(
stage
.
type
).
u
}
src=
{
getUnlockedIcon
(
stage
.
type
).
u
}
...
@@ -249,10 +268,12 @@ const StageComp = (props: StageProps) => {
...
@@ -249,10 +268,12 @@ const StageComp = (props: StageProps) => {
<
Image
src=
{
getStarSrc
(
1
,
starNum
)
}
className=
{
styles
.
star_1
}
></
Image
>
<
Image
src=
{
getStarSrc
(
1
,
starNum
)
}
className=
{
styles
.
star_1
}
></
Image
>
<
Image
src=
{
getStarSrc
(
2
,
starNum
)
}
className=
{
styles
.
star_2
}
></
Image
>
<
Image
src=
{
getStarSrc
(
2
,
starNum
)
}
className=
{
styles
.
star_2
}
></
Image
>
<
Image
src=
{
getStarSrc
(
3
,
starNum
)
}
className=
{
styles
.
star_3
}
></
Image
>
<
Image
src=
{
getStarSrc
(
3
,
starNum
)
}
className=
{
styles
.
star_3
}
></
Image
>
<
View
className=
{
styles
.
pk
}
>
{
!
isSpecialRound
&&
(
<
View
className=
{
styles
.
pk_item
}
>
{
stage
.
pkWinNum
??
0
}
</
View
>
<
View
className=
{
styles
.
pk
}
>
<
View
className=
{
classNames
(
styles
.
pk_item
,
styles
.
is_right
)
}
>
{
stage
.
pkLoseNum
??
0
}
</
View
>
<
View
className=
{
styles
.
pk_item
}
>
{
stage
.
pkWinNum
??
0
}
</
View
>
</
View
>
<
View
className=
{
classNames
(
styles
.
pk_item
,
styles
.
is_right
)
}
>
{
stage
.
pkLoseNum
??
0
}
</
View
>
</
View
>
)
}
</
UserGuideView
>
</
UserGuideView
>
)
)
}
}
...
@@ -274,7 +295,14 @@ const StageComp = (props: StageProps) => {
...
@@ -274,7 +295,14 @@ const StageComp = (props: StageProps) => {
>
>
{
renderRound
(
isReady
)
}
{
renderRound
(
isReady
)
}
<
View
className=
{
styles
.
roundName
}
>
<
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
>
</
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