Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
paopao
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
cocktail-party
paopao
Commits
a92b6765
提交
a92b6765
authored
3月 23, 2026
作者:
lidongxu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
暂时适配了ipad_-但是大屏上球的飞行路径没了
上级
7dd0cad2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
25 行增加
和
5 行删除
+25
-5
constants.js
big-screen/src/constants.js
+15
-2
main.js
big-screen/src/main.js
+10
-3
没有找到文件。
big-screen/src/constants.js
浏览文件 @
a92b6765
/**
/**
* 大屏设计稿尺寸(与 minigame 竖版一致),所有渲染在此坐标系下绘制
* 大屏设计稿尺寸,所有渲染在此坐标系下绘制
* SCREEN_WIDTH 固定 375,SCREEN_HEIGHT 根据小游戏端屏幕比例动态调整
*/
*/
export
const
SCREEN_WIDTH
=
375
export
const
SCREEN_WIDTH
=
375
export
cons
t
SCREEN_HEIGHT
=
667
export
le
t
SCREEN_HEIGHT
=
667
export
const
SAFE_AREA_TOP
=
0
export
const
SAFE_AREA_TOP
=
0
export
const
SAFE_AREA_BOTTOM
=
0
export
const
SAFE_AREA_BOTTOM
=
0
/**
* 根据小游戏端的屏幕宽高比调整大屏设计稿高度
* 保持 SCREEN_WIDTH=375 不变,高度 = 375 / ratio
* @param {number} ratio 屏幕宽高比(width / height)
*/
export
function
configureScreenRatio
(
ratio
)
{
if
(
!
ratio
||
ratio
<=
0
)
return
const
newHeight
=
Math
.
round
(
SCREEN_WIDTH
/
ratio
)
if
(
newHeight
===
SCREEN_HEIGHT
)
return
SCREEN_HEIGHT
=
newHeight
}
big-screen/src/main.js
浏览文件 @
a92b6765
...
@@ -11,7 +11,7 @@ import { drawShooter } from './renderer/shooter.js'
...
@@ -11,7 +11,7 @@ import { drawShooter } from './renderer/shooter.js'
import
{
drawGameInfo
,
drawTeamResultOverlay
}
from
'./renderer/gameinfo.js'
import
{
drawGameInfo
,
drawTeamResultOverlay
}
from
'./renderer/gameinfo.js'
import
{
detectAndCreateBursts
,
updateAndDrawBursts
,
clearPrevGrid
}
from
'./renderer/explosion.js'
import
{
detectAndCreateBursts
,
updateAndDrawBursts
,
clearPrevGrid
}
from
'./renderer/explosion.js'
import
{
drawIdleScreen
}
from
'./renderer/idleScreen.js'
import
{
drawIdleScreen
}
from
'./renderer/idleScreen.js'
import
{
SCREEN_WIDTH
,
SCREEN_HEIGHT
}
from
'./constants.js'
import
{
SCREEN_WIDTH
,
SCREEN_HEIGHT
,
configureScreenRatio
}
from
'./constants.js'
const
container
=
document
.
getElementById
(
'game-container'
)
const
container
=
document
.
getElementById
(
'game-container'
)
const
canvas
=
document
.
getElementById
(
'game-canvas'
)
const
canvas
=
document
.
getElementById
(
'game-canvas'
)
...
@@ -188,6 +188,7 @@ function drawCountdownOverlay(totalWidth) {
...
@@ -188,6 +188,7 @@ function drawCountdownOverlay(totalWidth) {
// ─── 主循环 ───────────────────────────────────────────────────────────────────
// ─── 主循环 ───────────────────────────────────────────────────────────────────
let
_lastPlayerCount
=
1
let
_lastPlayerCount
=
1
let
_lastScreenHeight
=
SCREEN_HEIGHT
function
loop
()
{
function
loop
()
{
frameCount
++
frameCount
++
...
@@ -196,14 +197,20 @@ function loop() {
...
@@ -196,14 +197,20 @@ function loop() {
const
connStatus
=
getConnectionStatus
()
const
connStatus
=
getConnectionStatus
()
const
playerCount
=
states
.
length
||
1
const
playerCount
=
states
.
length
||
1
// 从任意一个玩家的 state 中提取屏幕比例,在渲染前统一配置
if
(
states
.
length
>
0
&&
states
[
0
].
screenRatio
)
{
configureScreenRatio
(
states
[
0
].
screenRatio
)
}
// 按队伍分组
// 按队伍分组
const
teamAStates
=
states
.
filter
(
s
=>
getPlayerTeam
(
s
.
playerId
??
1
)
===
'A'
)
const
teamAStates
=
states
.
filter
(
s
=>
getPlayerTeam
(
s
.
playerId
??
1
)
===
'A'
)
const
teamBStates
=
states
.
filter
(
s
=>
getPlayerTeam
(
s
.
playerId
??
1
)
===
'B'
)
const
teamBStates
=
states
.
filter
(
s
=>
getPlayerTeam
(
s
.
playerId
??
1
)
===
'B'
)
const
totalSlots
=
Math
.
max
(
teamAStates
.
length
+
teamBStates
.
length
,
1
)
const
totalSlots
=
Math
.
max
(
teamAStates
.
length
+
teamBStates
.
length
,
1
)
// 人数变化时重新计算缩放
// 人数变化
或 屏幕高度变化
时重新计算缩放
if
(
totalSlots
!==
_lastPlayerCount
)
{
if
(
totalSlots
!==
_lastPlayerCount
||
SCREEN_HEIGHT
!==
_lastScreenHeight
)
{
_lastPlayerCount
=
totalSlots
_lastPlayerCount
=
totalSlots
_lastScreenHeight
=
SCREEN_HEIGHT
applyScaler
(
totalSlots
)
applyScaler
(
totalSlots
)
// 清理消失玩家的碎裂列表和grid快照
// 清理消失玩家的碎裂列表和grid快照
for
(
const
pid
of
playerBursts
.
keys
())
{
for
(
const
pid
of
playerBursts
.
keys
())
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论