Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
paopao
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
cocktail-party
paopao
Commits
f2fef882
提交
f2fef882
authored
3月 23, 2026
作者:
lidongxu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
大屏碎裂效果完美版本
上级
16dd650a
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
15 行增加
和
18 行删除
+15
-18
main.js
big-screen/src/main.js
+15
-18
explosion.js
big-screen/src/renderer/explosion.js
+0
-0
没有找到文件。
big-screen/src/main.js
浏览文件 @
f2fef882
...
...
@@ -9,7 +9,7 @@ import { drawBubbleGrid } from './renderer/bubbleGrid.js'
import
{
drawBubble3D
,
BUBBLE_RADIUS
}
from
'./renderer/bubble.js'
import
{
drawShooter
}
from
'./renderer/shooter.js'
import
{
drawGameInfo
,
drawTeamResultOverlay
}
from
'./renderer/gameinfo.js'
import
{
updateAndDrawExplosions
,
appendExplosionsFromState
,
Explosion
,
setExplosionQuality
}
from
'./renderer/explosion.js'
import
{
detectAndCreateBursts
,
updateAndDrawBursts
,
clearPrevGrid
}
from
'./renderer/explosion.js'
import
{
drawIdleScreen
}
from
'./renderer/idleScreen.js'
import
{
SCREEN_WIDTH
,
SCREEN_HEIGHT
}
from
'./constants.js'
...
...
@@ -19,8 +19,8 @@ const ctx = canvas.getContext('2d')
const
SCREEN_NAME
=
import
.
meta
.
env
.
VITE_SCREEN_NAME
||
'big-screen-1'
/** 每个玩家独立的
爆炸列表:Map<playerId, Explosion
[]> */
const
player
Explosion
s
=
new
Map
()
/** 每个玩家独立的
碎裂效果列表:Map<playerId, BubbleBurst
[]> */
const
player
Burst
s
=
new
Map
()
let
frameCount
=
0
...
...
@@ -42,9 +42,9 @@ function applyScaler(playerCount = 1) {
function
renderPlayer
(
state
,
offsetX
,
roomId
)
{
const
pid
=
state
.
playerId
??
1
// 初始化该玩家的
爆炸
列表
if
(
!
player
Explosions
.
has
(
pid
))
playerExplosion
s
.
set
(
pid
,
[])
const
explosions
=
playerExplosion
s
.
get
(
pid
)
// 初始化该玩家的
碎裂效果
列表
if
(
!
player
Bursts
.
has
(
pid
))
playerBurst
s
.
set
(
pid
,
[])
const
bursts
=
playerBurst
s
.
get
(
pid
)
ctx
.
save
()
ctx
.
translate
(
offsetX
,
0
)
...
...
@@ -63,12 +63,11 @@ function renderPlayer(state, offsetX, roomId) {
}
}
// 爆炸特效:消费后立即清空,避免下一帧重复添加
if
(
state
.
explosions
&&
state
.
explosions
.
length
)
{
appendExplosionsFromState
(
explosions
,
state
.
explosions
)
state
.
explosions
=
[]
// 碎裂特效:通过对比前后帧grid自动检测消失的球
if
(
state
.
grid
)
{
detectAndCreateBursts
(
bursts
,
pid
,
state
.
grid
,
state
.
pushAnimOffsetY
??
0
)
}
updateAndDraw
Explosions
(
ctx
,
explosion
s
)
updateAndDraw
Bursts
(
ctx
,
burst
s
)
// 射击器
if
(
state
.
shooter
)
{
...
...
@@ -196,15 +195,15 @@ function loop() {
const
teamBStates
=
states
.
filter
(
s
=>
getPlayerTeam
(
s
.
playerId
??
1
)
===
'B'
)
const
totalSlots
=
Math
.
max
(
teamAStates
.
length
+
teamBStates
.
length
,
1
)
// 人数变化时重新计算缩放
和爆炸质量
// 人数变化时重新计算缩放
if
(
totalSlots
!==
_lastPlayerCount
)
{
_lastPlayerCount
=
totalSlots
applyScaler
(
totalSlots
)
setExplosionQuality
(
totalSlots
)
// 根据人数调整爆炸效果质量
// 清理消失玩家的爆炸列表
for
(
const
pid
of
playerExplosions
.
keys
())
{
// 清理消失玩家的碎裂列表和grid快照
for
(
const
pid
of
playerBursts
.
keys
())
{
if
(
!
states
.
find
(
s
=>
(
s
.
playerId
??
1
)
===
pid
))
{
playerExplosions
.
delete
(
pid
)
playerBursts
.
delete
(
pid
)
clearPrevGrid
(
pid
)
}
}
}
...
...
@@ -250,11 +249,9 @@ function loop() {
// ── 检测是否所有玩家都结束,显示队伍比分 ─────────────────────────────
const
allGameOver
=
states
.
every
(
s
=>
s
.
isGameOver
)
console
.
log
(
'[BigScreen] 游戏状态检查'
,
{
allGameOver
,
statesCount
:
states
.
length
,
totalSlots
,
canvasWidth
:
canvas
.
width
,
SCREEN_WIDTH
})
if
(
allGameOver
&&
states
.
length
>
1
)
{
// 全屏显示队伍比分(传入实际的大屏宽度)
const
totalWidth
=
SCREEN_WIDTH
*
totalSlots
console
.
log
(
'[BigScreen] 显示队伍比分'
,
{
totalSlots
,
totalWidth
,
canvasWidth
:
canvas
.
width
,
states
:
states
.
length
})
ctx
.
save
()
ctx
.
setTransform
(
1
,
0
,
0
,
1
,
0
,
0
)
drawTeamResultOverlay
(
ctx
,
states
,
getPlayerTeam
,
totalWidth
)
...
...
big-screen/src/renderer/explosion.js
浏览文件 @
f2fef882
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论