Skip to content

About

Game Frame X OperationKeyboard — mini-game keyboard channel registry with UI field binding: single-slot field arbitration, maxLength always -1, no-op without channel

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Game Frame X Logo

{'en': 'GameFrameX OperationKeyboard Package', 'zh-CN': 'GameFrameX OperationKeyboard 键盘组件', 'zh-TW': 'GameFrameX OperationKeyboard 鍵盤組件', 'ja': 'GameFrameX OperationKeyboard パッケージ', 'ko': 'GameFrameX OperationKeyboard 패키지'}

License Version Unity Version Documentation

All-in-One Solution for Indie Game Development · Empowering Indie Developers' Dreams


Documentation · Quick Start · QQ Group: 467608841 / 233840761


English | 简体中文 | 繁體中文 | 日本語 | 한국어

Table of Contents


Project Overview

GameFrameX OperationKeyboard is the keyboard core package of the GameFrameX framework: a channel registry drives the mini-game platform keyboards (WeChat / Alipay / Kuaishou / Douyin showKeyboard family), a UI-agnostic field contract drives input fields, and the static facade owns single-slot field arbitration.

Key Features

  • Single-Slot Field Arbitration - only one IOperationKeyboardField holds the keyboard at a time; attaching a new field automatically hides the keyboard and ends the previous field's session (fixes the double-subscription conflict of per-field adapters at the root)
  • Channel Registry - OperationKeyboardRegistry with registration-order mutually exclusive resolution, idempotent Register (first wins with a warning), Reset at SubsystemRegistration, lazy factory instantiation with caching
  • maxLength Always -1 - mini-game keyboards count the pinyin composition string, so a hard cap truncates Chinese input mid-composition (verified on device); the cap is always passed as -1 and length clamping is left to game code
  • No-Op Without Channel - Editor / native platforms / projects without a mini-game SDK: the facade intercepts nothing and the native TouchScreenKeyboard path is fully preserved

System Requirements

  • Unity 2019.4 or higher

Quick Start

Installation

Choose one of the following methods:

  1. Edit your Unity project's Packages/manifest.json and add the scopedRegistries section:

    {
      "scopedRegistries": [
        {
          "name": "GameFrameX",
          "url": "https://gameframex.upm.alianblank.uk",
          "scopes": [
            "com.gameframex"
          ]
        }
      ],
      "dependencies": {
        "com.gameframex.unity.operationkeyboard": "1.0.0"
      }
    }

    scopes controls which packages are resolved through this registry. Only packages whose names start with com.gameframex will be fetched from it.

  2. Add to manifest.json dependencies:

    {
       "com.gameframex.unity.operationkeyboard": "https://github.com/gameframex/com.gameframex.unity.operationkeyboard.git"
    }
  3. Use Package Manager in Unity with Git URL: https://github.com/gameframex/com.gameframex.unity.operationkeyboard.git

  4. Clone the repository into your Unity project's Packages directory. It will be loaded automatically.

Usage Examples

Basic Usage

using GameFrameX.OperationKeyboard.Runtime;

// UI binding packages (com.gameframex.unity.operationkeyboard.ugui) drive the session
// automatically on focus / blur - game code normally never touches the facade directly.

// Programmatic update while the keyboard is shown
OperationKeyboard.UpdateValue("programmatic value");

// Keyboard height for avoidance layout (0 = collapsed; empty implementation on platforms without the API)
OperationKeyboard.OnHeightChanged(height => { /* lift the UI here */ });

Field Session and Single-Slot Arbitration

OperationKeyboard.Attach(field) derives the keyboard option from the field contract (DefaultValue = field text, MaxLength always -1, Multiple, ConfirmType) and preempts any previous field (Hide() + one TriggerEndEdit() on the old field). The event flow mirrors native mobile so business callbacks need zero changes:

  • input - field.Text = value (onValueChanged fires as usual) + caret moved to the end;
  • confirm / complete - final value assigned, keyboard hidden, EndEdit triggered (same as the native Done button);
  • blur - Detach (keyboard hidden; the blur EndEdit is produced by the field's own blur chain, never duplicated).

Channel Registration (Bootstrap Self-Registration)

Each channel package registers its factory into OperationKeyboardRegistry via its own XxxOperationKeyboardBootstrap (RuntimeInitializeOnLoadMethod(BeforeSceneLoad)); uninstalled channel packages are stripped by the macro wall, so no registration happens (referencing means registering). When nothing is registered the facade is a no-op - the native keyboard path IS the fallback.

UI Binding Axis

The registry answers "which platform keyboard"; UI binding packages answer "which UI toolkit" - the two axes are orthogonal and combine into automatic adaptation. com.gameframex.unity.operationkeyboard.ugui binds InputField + TMP_InputField with an auto-binder (zero panel changes); the FairyGUI binding ships separately.

Main Classes and Interfaces

  • IOperationKeyboardManager: platform contract Show(OperationKeyboardShowOption) / Hide() / UpdateValue(string) + single-slot events OnInput / OnConfirm / OnComplete / OnHeightChanged; Hide must unregister every platform event.
  • IOperationKeyboardField: UI-agnostic field contract Text / IsFocused / Multiline / ConfirmType / MoveTextEnd() / TriggerEndEdit().
  • OperationKeyboardShowOption: show parameters; MaxLength is always -1.
  • OperationKeyboardRegistry / OperationKeyboardChannelRegistration: channel registry and registration descriptor (id + display name + factory).
  • OperationKeyboard: static facade; Attach / Detach / CurrentField single-slot session, Hide / UpdateValue / OnHeightChanged forwarding.

Platform Support

Platform Implementation
Editor / Standalone / Mobile native facade no-op, native TouchScreenKeyboard path preserved
WeChat / Alipay / Kuaishou / Douyin Mini Games channel packages

Documentation & Resources


Community & Support


Dependencies

Package Description
com.gameframex.unity GameFrameX core

Changelog

See Releases for changelog.

License

See LICENSE.md for license information.

About

Game Frame X OperationKeyboard — mini-game keyboard channel registry with UI field binding: single-slot field arbitration, maxLength always -1, no-op without channel

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages