Commit f5b40cfd authored by hewenhao's avatar hewenhao

feat: 增加特别关卡

parent cf408658
...@@ -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;
......
...@@ -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;
......
...@@ -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>
{!isSpecialRound && (
<View className={styles.pk}> <View className={styles.pk}>
<View className={styles.pk_item}>{stage.pkWinNum ?? 0}</View> <View className={styles.pk_item}>{stage.pkWinNum ?? 0}</View>
<View className={classNames(styles.pk_item, styles.is_right)}>{stage.pkLoseNum ?? 0}</View> <View className={classNames(styles.pk_item, styles.is_right)}>{stage.pkLoseNum ?? 0}</View>
</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}>
{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>{!isProduction ? `${stage.id}.` : ''}{stage.name}</View>
)}
</View> </View>
</View> </View>
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment