简体   繁体   English

从html页面控制键盘

[英]Controlling the keyboard from a html page

First of all let me explain my situation: 首先让我解释一下我的情况:

I am developing a 8 player game for a company, which is going to be placed in a Shopping mall, for customer's entertainment. 我正在为一家公司开发一款8人游戏,该公司将放置在购物中心中,以娱乐客户。

The Platform is a round table, where people can stand in a circle to play the game. 该平台是一个圆桌会议,人们可以围成一圈玩游戏。

The problem is , we want to let the users to connect their own Android Devices to the Game Computer via USB or WiFi or Bluetooth , and use their Android Devices like a controller. 问题是,我们要让用户通过USB或WiFi或蓝牙将自己的Android设备连接到游戏计算机,并像控制器​​一样使用其Android设备。 But not exactly like a controller , We just need 2-3 keystrokes from them, for instance lets say we need (WAS) from them to control the game character. 但是并不完全像控制器,我们只需要它们的2-3次击键,例如,说我们需要它们的(WAS)来控制游戏角色。

But there is some apps already in the Android Store which makes the Android device as a Keyboard and Mouse to control the computer. 但是Android商店中已经有一些应用程序,这些应用程序使Android设备成为控制计算机的键盘和鼠标。

But not every person would like to install an app in their devices right? 但是,不是每个人都希望在自己的设备中安装应用程序吗? So is there any other way? 那么还有其他办法吗?

Thanks in Advance. 提前致谢。

Game Development Using Unity3D 使用Unity3D开发游戏

Maybe you can build html page with that keys and send these commands to the server via ajax whenever users click some of them (this is easy task). 也许您可以使用这些键构建html页面,并在用户单击其中的一些命令时通过ajax将这些命令发送到服务器(这很容易)。 Also you can provide every visit to the page with different hash or id or something and send this value with every command sent to the server, so you can know where the commands come from... 此外,您还可以为每次访问页面提供不同的哈希或ID或其他内容,并通过发送给服务器的每个命令将其发送给此值,这样您就可以知道命令来自何处...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM