Skip to main content

InputModeTypeSelector

Selects the most recent input mode and attempts to identify the best state from it.

Properties

Changed

InputModeTypeSelector.Changed: Signal<InputModeType,InputModeType>--newMode,oldMode

Event that fires whenever the active mode changes.

Value

InputModeTypeSelector.Value: InputModeType?

The current active input mode

Functions

new

InputModeTypeSelector.new(
serviceBagServiceBag,
inputModesTypes{InputModeType}
) → InputModeTypeSelector

Constructs a new InputModeTypeSelector

fromObservableBrio

InputModeTypeSelector.fromObservableBrio(
serviceBagServiceBag,
observeInputModesBrioObservable<Brio<InputModeType>>
) → InputModeTypeSelector

Constructs a new InputModeTypeSelector

GetActiveInputType

InputModeTypeSelector:GetActiveInputType() → InputModeType

Returns the current active mode

ObserveActiveInputType

InputModeTypeSelector:ObserveActiveInputType() → Observable<InputModeType>

Observes the current active mode

IsActive

InputModeTypeSelector:IsActive(inputModeTypeInputModeType) → boolean

Returns true if the input mode is the most recently activated one

ObserveIsActive

InputModeTypeSelector:ObserveIsActive(inputModeTypeInputModeType) → Observable<boolean>

Observes if the input mode is the most recently activated one

Bind

InputModeTypeSelector:Bind(updateBindFunction(
newModeInputModeType,
modeMaidMaid
) → ()) → InputModeTypeSelector

Binds the updateBindFunction to the mode selector

local inputModeTypeSelector = InputModeTypeSelector.new({
	InputModeTypes.Mouse;
	InputModeTypes.Touch;
})

inputModeTypeSelector:Bind(function(inputModeType)
	if inputModeType == InputModeTypes.Mouse then
		print("Show mouse input hints")
	elseif inputModeType == InputModeTypes.Touch then
		print("Show touch input hints")
	else
		-- Unknown input mode
		warn("Unknown input mode") -- should not occur
	end
end)

RemoveInputModeType

InputModeTypeSelector:RemoveInputModeType(inputModeTypeInputModeType) → ()

Removes the input mode

AddInputModeType

InputModeTypeSelector:AddInputModeType(inputModeTypeInputModeType) → ()

Adds a new input mode

Destroy

InputModeTypeSelector:Destroy() → ()

Cleans up the input mode selector.

info

This should be called whenever the mode selector is done being used.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Constructs a new InputModeTypeSelector",
            "params": [
                {
                    "name": "serviceBag",
                    "desc": "",
                    "lua_type": "ServiceBag"
                },
                {
                    "name": "inputModesTypes",
                    "desc": "",
                    "lua_type": "{ InputModeType }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "InputModeTypeSelector"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 31,
                "path": "src/inputmode/src/Client/InputModeTypeSelector.lua"
            }
        },
        {
            "name": "fromObservableBrio",
            "desc": "Constructs a new InputModeTypeSelector",
            "params": [
                {
                    "name": "serviceBag",
                    "desc": "",
                    "lua_type": "ServiceBag"
                },
                {
                    "name": "observeInputModesBrio",
                    "desc": "",
                    "lua_type": "Observable<Brio<InputModeType>>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "InputModeTypeSelector"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 68,
                "path": "src/inputmode/src/Client/InputModeTypeSelector.lua"
            }
        },
        {
            "name": "GetActiveInputType",
            "desc": "Returns the current active mode",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "InputModeType"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 94,
                "path": "src/inputmode/src/Client/InputModeTypeSelector.lua"
            }
        },
        {
            "name": "ObserveActiveInputType",
            "desc": "Observes the current active mode",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<InputModeType>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 102,
                "path": "src/inputmode/src/Client/InputModeTypeSelector.lua"
            }
        },
        {
            "name": "IsActive",
            "desc": "Returns true if the input mode is the most recently activated one",
            "params": [
                {
                    "name": "inputModeType",
                    "desc": "",
                    "lua_type": "InputModeType"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 112,
                "path": "src/inputmode/src/Client/InputModeTypeSelector.lua"
            }
        },
        {
            "name": "ObserveIsActive",
            "desc": "Observes if the input mode is the most recently activated one",
            "params": [
                {
                    "name": "inputModeType",
                    "desc": "",
                    "lua_type": "InputModeType"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<boolean>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 124,
                "path": "src/inputmode/src/Client/InputModeTypeSelector.lua"
            }
        },
        {
            "name": "Bind",
            "desc": "Binds the updateBindFunction to the mode selector\n\n```lua\nlocal inputModeTypeSelector = InputModeTypeSelector.new({\n\tInputModeTypes.Mouse;\n\tInputModeTypes.Touch;\n})\n\ninputModeTypeSelector:Bind(function(inputModeType)\n\tif inputModeType == InputModeTypes.Mouse then\n\t\tprint(\"Show mouse input hints\")\n\telseif inputModeType == InputModeTypes.Touch then\n\t\tprint(\"Show touch input hints\")\n\telse\n\t\t-- Unknown input mode\n\t\twarn(\"Unknown input mode\") -- should not occur\n\tend\nend)\n```",
            "params": [
                {
                    "name": "updateBindFunction",
                    "desc": "",
                    "lua_type": "(newMode: InputModeType, modeMaid: Maid) -> ()"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "InputModeTypeSelector"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 179,
                "path": "src/inputmode/src/Client/InputModeTypeSelector.lua"
            }
        },
        {
            "name": "RemoveInputModeType",
            "desc": "Removes the input mode",
            "params": [
                {
                    "name": "inputModeType",
                    "desc": "",
                    "lua_type": "InputModeType"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 206,
                "path": "src/inputmode/src/Client/InputModeTypeSelector.lua"
            }
        },
        {
            "name": "AddInputModeType",
            "desc": "Adds a new input mode",
            "params": [
                {
                    "name": "inputModeType",
                    "desc": "",
                    "lua_type": "InputModeType"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 231,
                "path": "src/inputmode/src/Client/InputModeTypeSelector.lua"
            }
        },
        {
            "name": "Destroy",
            "desc": "Cleans up the input mode selector.\n\n:::info\nThis should be called whenever the mode selector is done being used.\n:::",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 271,
                "path": "src/inputmode/src/Client/InputModeTypeSelector.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "Changed",
            "desc": "Event that fires whenever the active mode changes.",
            "lua_type": "Signal<InputModeType, InputModeType> -- newMode, oldMode",
            "source": {
                "line": 52,
                "path": "src/inputmode/src/Client/InputModeTypeSelector.lua"
            }
        },
        {
            "name": "Value",
            "desc": "The current active input mode",
            "lua_type": "InputModeType?",
            "source": {
                "line": 140,
                "path": "src/inputmode/src/Client/InputModeTypeSelector.lua"
            }
        }
    ],
    "types": [],
    "name": "InputModeTypeSelector",
    "desc": "Selects the most recent input mode and attempts to identify the best state from it.",
    "source": {
        "line": 5,
        "path": "src/inputmode/src/Client/InputModeTypeSelector.lua"
    }
}