Skip to content

Commit 89920f7

Browse files
committed
u
1 parent 8710781 commit 89920f7

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

src/components/GameSetup.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@
4545
<div class="setup-section">
4646
<h3>棋钟</h3>
4747
<label class="slider-row">
48-
<span>限时(分钟)</span>
48+
<span>限时</span>
4949
<input v-model.number="timeMinutes" type="range" min="0" max="180" step="1" />
5050
<strong>{{ timeMinutes === 0 ? '无限制' : `${timeMinutes} 分钟` }}</strong>
5151
</label>
5252

5353
<label v-if="timeMinutes > 0" class="slider-row">
54-
<span>每步加时(秒)</span>
54+
<span>每步加时</span>
5555
<input v-model.number="incrementSeconds" type="range" min="0" max="30" step="1" />
5656
<strong>{{ incrementSeconds }} 秒</strong>
5757
</label>

src/components/Sidebar.vue

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,9 @@ const isGameActionDisabled = computed(() => {
143143
return !props.hasGameStarted || props.isGameOver || !!props.gameStatus
144144
})
145145
146-
// AI 对战时禁用"提议和棋",但"宣告和棋"仍可用
147146
const isDrawOfferDisabled = computed(() => {
148147
if (isGameActionDisabled.value) return true
149-
// "宣告和棋"(满足条件时)总是可用
150148
if (isClaimableDraw.value) return false
151-
// "提议和棋"在 AI 模式下禁用
152149
if (props.gameMode === 'ai') return true
153150
return false
154151
})
@@ -277,6 +274,14 @@ const INITIAL_PIECES: Record<PieceType, number> = {
277274
king: 1,
278275
}
279276
277+
// 辅助函数:当棋子数量超过 10 个时截断并加上省略号
278+
const formatPieceIcons = (pieces: string[], limit = 10): string => {
279+
if (pieces.length <= limit) {
280+
return pieces.join('')
281+
}
282+
return pieces.slice(0, limit).join('') + ''
283+
}
284+
280285
const materialDiffText = computed(() => {
281286
if (!props.board) return ''
282287
@@ -357,8 +362,8 @@ const materialDiffText = computed(() => {
357362
return ''
358363
}
359364
360-
// 根据玩家颜色决定显示顺序
361-
const isWhitePlayer = props.playerColor === 'white'
365+
const useWhitePerspective = props.gameMode === 'human' || props.playerColor === 'white'
366+
const isWhitePlayer = useWhitePerspective
362367
const myPieces = isWhitePlayer ? whiteDisplay : blackDisplay
363368
const opponentPieces = isWhitePlayer ? blackDisplay : whiteDisplay
364369
@@ -368,10 +373,10 @@ const materialDiffText = computed(() => {
368373
369374
const parts: string[] = []
370375
if (opponentPieces.length > 0) {
371-
parts.push(opponentPieces.join(''))
376+
parts.push(formatPieceIcons(opponentPieces, 10))
372377
}
373378
if (myPieces.length > 0) {
374-
parts.push(myPieces.join(''))
379+
parts.push(formatPieceIcons(myPieces, 10))
375380
}
376381
if (scoreStr) {
377382
parts.push(scoreStr)

0 commit comments

Comments
 (0)