初始提交
This commit is contained in:
173
rg-09112127/html/test_button_detection.html
Normal file
173
rg-09112127/html/test_button_detection.html
Normal file
@@ -0,0 +1,173 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>按钮检测测试</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
padding: 20px;
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
.test-section {
|
||||
background: white;
|
||||
padding: 20px;
|
||||
margin: 20px 0;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.test-btn {
|
||||
padding: 10px 20px;
|
||||
margin: 10px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
}
|
||||
.test-btn:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
.log-area {
|
||||
background: #f8f9fa;
|
||||
border: 1px solid #dee2e6;
|
||||
border-radius: 5px;
|
||||
padding: 15px;
|
||||
margin: 10px 0;
|
||||
height: 300px;
|
||||
overflow-y: auto;
|
||||
font-family: monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
.box-body {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
border-radius: 15px;
|
||||
padding: 20px;
|
||||
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
|
||||
z-index: 2000;
|
||||
max-width: 500px;
|
||||
text-align: center;
|
||||
}
|
||||
.box-body img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
border-radius: 10px;
|
||||
margin: 10px 0;
|
||||
}
|
||||
.box-body div {
|
||||
margin: 10px 0;
|
||||
padding: 5px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>按钮检测测试页面</h1>
|
||||
|
||||
<div class="test-section">
|
||||
<h2>比大小游戏按钮</h2>
|
||||
<button class="test-btn" id="leftBtn">左手按钮</button>
|
||||
<button class="test-btn" id="rightBtn">右手按钮</button>
|
||||
<p>这些按钮模拟比大小游戏中的按钮</p>
|
||||
</div>
|
||||
|
||||
<div class="test-section">
|
||||
<h2>示例游戏选项按钮</h2>
|
||||
<button class="test-btn option-btn">选项A</button>
|
||||
<button class="test-btn option-btn">选项B</button>
|
||||
<p>这些按钮模拟示例游戏中的选项按钮</p>
|
||||
</div>
|
||||
|
||||
<div class="test-section">
|
||||
<h2>AI游戏选项按钮</h2>
|
||||
<button class="test-btn ai-option-btn">AI选项1</button>
|
||||
<button class="test-btn ai-option-btn">AI选项2</button>
|
||||
<p>这些按钮模拟AI游戏生成器中的选项按钮</p>
|
||||
</div>
|
||||
|
||||
<div class="test-section">
|
||||
<h2>courseHome按钮</h2>
|
||||
<button class="test-btn box-btn-left">课程选项A</button>
|
||||
<button class="test-btn box-btn-right">课程选项B</button>
|
||||
<p>这些按钮模拟courseHome页面中的按钮</p>
|
||||
</div>
|
||||
|
||||
<div class="test-section">
|
||||
<h2>测试控制</h2>
|
||||
<button class="test-btn" onclick="testLeftHand()">测试左手检测</button>
|
||||
<button class="test-btn" onclick="testRightHand()">测试右手检测</button>
|
||||
<button class="test-btn" onclick="clearLog()">清空日志</button>
|
||||
</div>
|
||||
|
||||
<div class="test-section">
|
||||
<h2>调试日志</h2>
|
||||
<div class="log-area" id="logArea"></div>
|
||||
</div>
|
||||
|
||||
<!-- 体感交互容器(用于directBodySensation.js) -->
|
||||
<div class="box-body" style="display: none">
|
||||
<div id="bodyConnectionStatus">未连接到服务器</div>
|
||||
<img id="bodyVideoFeed" src="" alt="体感检测视频" />
|
||||
<div id="bodyHandStatus">等待检测...</div>
|
||||
</div>
|
||||
|
||||
<script src="../js/directBodySensation.js"></script>
|
||||
<script>
|
||||
// 重写console.log来捕获日志
|
||||
const originalLog = console.log;
|
||||
const logArea = document.getElementById("logArea");
|
||||
|
||||
console.log = function (...args) {
|
||||
originalLog.apply(console, args);
|
||||
const logEntry = args
|
||||
.map((arg) =>
|
||||
typeof arg === "object" ? JSON.stringify(arg, null, 2) : String(arg)
|
||||
)
|
||||
.join(" ");
|
||||
logArea.innerHTML += `<div>[${new Date().toLocaleTimeString()}] ${logEntry}</div>`;
|
||||
logArea.scrollTop = logArea.scrollHeight;
|
||||
};
|
||||
|
||||
function testLeftHand() {
|
||||
console.log("🧪 开始测试左手检测...");
|
||||
if (typeof clickBth === "function") {
|
||||
clickBth("left");
|
||||
} else {
|
||||
console.log("❌ clickBth 函数未定义");
|
||||
}
|
||||
}
|
||||
|
||||
function testRightHand() {
|
||||
console.log("🧪 开始测试右手检测...");
|
||||
if (typeof clickBth === "function") {
|
||||
clickBth("right");
|
||||
} else {
|
||||
console.log("❌ clickBth 函数未定义");
|
||||
}
|
||||
}
|
||||
|
||||
function clearLog() {
|
||||
logArea.innerHTML = "";
|
||||
}
|
||||
|
||||
// 为所有按钮添加点击事件监听器
|
||||
document.querySelectorAll("button").forEach((btn) => {
|
||||
btn.addEventListener("click", function (e) {
|
||||
console.log(`🖱️ 按钮被点击: ${this.id || this.textContent}`);
|
||||
});
|
||||
});
|
||||
|
||||
console.log("✅ 按钮检测测试页面已加载");
|
||||
console.log("📋 页面包含以下按钮类型:");
|
||||
console.log("- 比大小游戏按钮: leftBtn, rightBtn");
|
||||
console.log("- 示例游戏按钮: .option-btn");
|
||||
console.log("- AI游戏按钮: .ai-option-btn");
|
||||
console.log("- courseHome按钮: .box-btn-left, .box-btn-right");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user