輸入支援
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本主題說明在 Google Play 遊戲電腦版中,處理使用者輸入內容時需考量的設計要點及最佳做法。
Google Play 遊戲電腦版的玩家會使用滑鼠和鍵盤輸入內容,而非使用觸控螢幕。設計滑鼠和鍵盤體驗時,請把重心放在為電腦或筆電玩家帶來最佳使用者體驗。如要開始使用,請參閱 Chromebook 適用的 Android 應用程式輸入相容性指南。
我們推薦以下最佳做法,用於設計和建構玩家互動。
- 所有目標都能用滑鼠點選。
- 所有可捲動的介面都會依滑鼠滾輪事件捲動。
- 當滑鼠游標懸停在可點選的介面時,請醒目顯示該介面,並運用最佳判斷改善 UI 探索機制,無需向玩家顯示過多內容。
- 提供快速鍵,讓使用者快速開啟控制項。
- 將拇指搖桿、螢幕按鈕等觸控式控制選項改為滑鼠控制選項和快速鍵。
- 如果手機遊戲動作需要採用多點觸控手勢,請確保玩家能透過操控鍵盤或滑鼠達到相同目的,例如使用滑鼠滾輪做出與雙指撥動同等的操作。
如需更多詳細資料和最佳做法,請參閱最佳化滑鼠和鍵盤的 ChromeOS Android 應用程式指南。
國際化注意事項
為國際觀眾設計遊戲時,請務必測試遊戲,並將鍵盤配置設為遊戲支援的每種語言。否則玩家可能無法使用遊戲內聊天等功能。你可以在系統設定中變更輸入語言,變更會自動套用至 Google Play Games on PC。在行動裝置上,由於您是透過虛擬鍵盤接收文字,引擎中的許多問題可能會因此隱藏。電腦版常見問題包括:
- 「替代圖形」(AltGr) 鍵碼處理方式有誤。在許多語言環境中,這項功能可用於輸入變音符號,例如重音符號,或是特定語言環境的特殊符號,例如區域貨幣字元。
- 不正確處理「輸入法擴充功能」(IME)輸入內容。這個方法通常用於支援非拉丁字母,讓使用者能將多個按鍵組合轉換成單一字元。
GameTextInput
和 EditText
已瞭解國際鍵盤配置和輸入法。
以下清單列出許多遊戲的常用動作,以及開發人員常用於 Google Play 遊戲電腦版的實作方式:
- 使用 Enter 鍵傳送訊息,或透過文字輸入欄位提交文字。
- 使用 Escape 鍵取消選單和對話方塊。
- 使用 Enter 鍵瀏覽故事元素和對話方塊。
- 使用滾輪垂直捲動文字。
- 使用滾輪放大或縮小畫面 (特別是如果遊戲的行動版是以雙指撥動進行同樣操作)。
- 使用 W、A、S 和 D 鍵瀏覽您經常執行點選及拖曳動作的地圖。
雖然以上動作很常見,不過您還是應該透過輸入 SDK 項目向玩家清楚展示,確保使用者都能找到這些控制說明。
相容性模式
根據預設,Google Play 遊戲電腦版會將遊戲設為「輸入相容性模式」。因此,在遊戲中按下滑鼠左鍵時,便會發生觸控事件。詳情請參閱「滑鼠輸入」指南。
教學課程與使用者說明
在某些情況下,玩家可以利用遊戲內教學課程瞭解遊戲操控方式,並查看滑鼠和鍵盤控制選項。建議您在遊戲中加入教學課程和學習功能,介紹滑鼠和鍵盤的正確操控方式,並針對電腦版遊戲移除有關觸控式控制選項的教學內容。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[null,null,["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# Input support\n\nThis topic covers design considerations and best practices for handling user\ninput in Google Play Games on PC.\n\nGoogle Play Games on PC relies on a mouse and keyboard for player input rather\nthan a touchscreen. When designing your mouse and keyboard experience, focus on\nbuilding the best user experience for desktop or laptop PC users. To get\nstarted, see our guide on\n[Android app input compatibility for Chromebooks](/topic/arc/input-compatibility).\n\nBest practices\n--------------\n\nWe recommend the following best practices for designing and building player\ninteractions.\n\n- All targets should be clickable with a mouse.\n- All scrollable surfaces scroll on mouse wheel events.\n- Highlight clickable surfaces when hovered, and use your best judgment to improve UI discovery without overwhelming the user.\n- Provide hotkeys for users to quickly bring up controls.\n- Replace touch-based controls (for example, thumb joysticks or on-screen buttons) with mouse-based controls and hotkeys.\n- For actions in your mobile game that require multi-touch gestures, ensure the same actions are supported with a keyboard or mouse control (for example, using the scroll wheel of the mouse to replace a two-finger pinch).\n\nFor additional details and best practices, see our guide on\n[optimizing your ChromeOS Android app for mouse and keyboard](/topic/arc/optimizing#keyboard).\n\n### Internationalization considerations\n\nWhen designing a game for an international audience, it is important that you\ntest your game with your keyboard layout set to each language supported by your\ngame. Failure to do so may block players from using features such as in-game\nchat. You can change your input locale\n[in your system settings](https://support.microsoft.com/en-us/windows/manage-the-input-and-display-language-settings-in-windows-12a10cb4-8626-9b77-0ccb-5013e0c7c7a2)\nand the changes will apply automatically to Google Play Games on PC. On\nmobile, many issues in your engine may be hidden by the fact that you're\nreceiving text from a virtual keyboard. Common issues on PC include:\n\n- Incorrect handling of \"alternative graphic\" (AltGr) keycodes. In many locales this is used to type diacritical marks such as accents or special locale-specific symbols such as regional currency glyphs.\n- Incorrect handling of [\"input method extension\" (IME)](/reference/android/view/inputmethod/InputMethodManager) inputs. This method is commonly used to support non-Latin alphabets by allowing users to combine several keystrokes into a single character.\n\n[`GameTextInput`](/games/agdk/add-support-for-text-input) and\n[`EditText`](/reference/android/widget/EditText) are already aware of\ninternational keyboard layouts and input methods.\n\n### Recommended input mappings\n\nThe following list includes actions many games have in common, and the typical\nimplementation developers use on Google Play Games on PC:\n\n- Use the enter key to send messages or submit text in text entry fields.\n- Menus and dialogs should be cancellable with the escape key.\n- Use the enter key to progress through story elements and dialog boxes.\n- Use the scroll wheel to scroll text vertically.\n- Use the scroll wheel to zoom in or out, especially if you use a two-finger pinch in your mobile build.\n- Use W, A, S, and D navigate around a map that you'd normally use a click and drag motion on.\n\nEven though these actions are common, you should still explicitly present them\nto the player with the [Input SDK](/games/playgames/input-sdk) to make sure they're\nproperly discoverable.\n\nCompatibility mode\n------------------\n\nGoogle Play Games on PC places your game into \"input compatibility mode\" by\ndefault. This means that when you press the left mouse button, your game is\ngiven a touch event. See the [mouse input](/games/playgames/input-mouse) guide for more\ninformation.\n\nTutorials and user education\n----------------------------\n\nIn some cases, users can benefit from in-game tutorials that teach them the\ncontrols to the game, in addition to being able to view the mouse and keyboard\ncontrols. We recommend including in-game tutorials and educational features with\nthe correct controls for mouse and keyboard, and removing tutorials relevant to\ntouch-based controls for the PC version of your game."]]