- 移除了原有的 Flash 相关代码和复杂布局 - 添加了 Ruffle 播放器配置和加载逻辑 - 优化了页面样式,使其全屏自适应 - 保留了原有的 SWF 文件,但更改了播放方式
54 lines
1.6 KiB
Go
54 lines
1.6 KiB
Go
<!DOCTYPE html>
|
|
<html lang="zh">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>游戏名称</title>
|
|
<link rel="stylesheet" href="style.css">
|
|
<style>
|
|
/* 确保html和body元素占满整个屏幕 */
|
|
html, body {
|
|
height: 100%;
|
|
margin: 0;
|
|
overflow: hidden; /* 隐藏滚动条 */
|
|
}
|
|
/* 使容器和Ruffle播放器全屏和自适应 */
|
|
#container {
|
|
width: 100%;
|
|
height: 100%;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
#container ruffle-player {
|
|
flex-shrink: 0; /* 防止播放器被压缩 */
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="container"></div>
|
|
<script src="//unpkg.com/@ruffle-rs/ruffle"></script>
|
|
<script>
|
|
window.addEventListener('load', async () => {
|
|
const ruffle = window.RufflePlayer.newest();
|
|
const player = ruffle.createPlayer();
|
|
const container = document.getElementById('container');
|
|
container.appendChild(player);
|
|
window.RufflePlayer.config = {
|
|
fontSources: ["fonts/simsun.ttf","fonts/Tahoma.ttf"], // load up fonts here
|
|
defaultFonts: {
|
|
sans: ["simsun"], // then replace them here.
|
|
// serif: ["simsun", ], // Multiple fonts can be provided
|
|
// typewriter: ["simsun"],
|
|
// japaneseGothic: ["font"],
|
|
// japaneseGothicMono: ["font"],
|
|
// japaneseMincho: ["font"],
|
|
}
|
|
}
|
|
player.load('Client.swf');
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|