-
-
Notifications
You must be signed in to change notification settings - Fork 1
Added gamepad input keyboard actions #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
5441827
86264c5
5994746
5dd9e1c
a0c4745
396f53c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2614,6 +2614,93 @@ function getInstanceJs(parentClass, addonTriggers, C3) { | |||||
| } | ||||||
| }, this.unsupportedEngine) | ||||||
|
|
||||||
| // Steam Gamepad Text Input | ||||||
| _ShowGamepadTextInputBase = this.wrap(super._ShowGamepadTextInput, async ( | ||||||
| /** @type {number} */ inputMode, | ||||||
| /** @type {number} */ inputLineMode, | ||||||
| /** @type {string} */ description, | ||||||
| /** @type {number} */ maxCharacters, | ||||||
| /** @type {string} */ existingText, | ||||||
| /** @type {Tag} */ tag | ||||||
| ) => { | ||||||
| try { | ||||||
| /** @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw<'input', 'showGamepadTextInput'>, 'input'>} */ | ||||||
| const order = { | ||||||
| url: '/steam/raw', | ||||||
| body: { | ||||||
| namespace: 'utils', | ||||||
| method: 'showGamepadTextInput', | ||||||
| args: [inputMode, inputLineMode, description, maxCharacters, existingText || undefined], | ||||||
| }, | ||||||
| }; | ||||||
| const answer = await this.ws?.sendAndWaitForResponse(order); | ||||||
| if (answer?.body.success === false) { | ||||||
| throw new Error('Failed') | ||||||
| } | ||||||
| this._ShowGamepadTextInputResultValue = answer?.body.data ?? null | ||||||
| this._ShowGamepadTextInputErrorValue = '' | ||||||
|
|
||||||
| await this.trigger(tag, [ | ||||||
| C3.Plugins.pipelabv2.Cnds.OnShowGamepadTextInputSuccess, | ||||||
| C3.Plugins.pipelabv2.Cnds.OnAnyShowGamepadTextInputSuccess | ||||||
| ]) | ||||||
| } catch (e) { | ||||||
| if (e instanceof Error) { | ||||||
| this._ShowGamepadTextInputErrorValue = e.message | ||||||
| this._ShowGamepadTextInputResultValue = null | ||||||
| await this.trigger(tag, [ | ||||||
| C3.Plugins.pipelabv2.Cnds.OnShowGamepadTextInputError, | ||||||
| C3.Plugins.pipelabv2.Cnds.OnAnyShowGamepadTextInputError | ||||||
| ]) | ||||||
| } | ||||||
| } | ||||||
| }, this.unsupportedEngine) | ||||||
| _ShowGamepadTextInput = this._ShowGamepadTextInputBase | ||||||
| _ShowGamepadTextInputSync = this._ShowGamepadTextInputBase | ||||||
|
Comment on lines
+2658
to
+2659
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| _ShowFloatingGamepadTextInputBase = this.wrap(super._ShowFloatingGamepadTextInput, async ( | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| /** @type {number} */ keyboardMode, | ||||||
| /** @type {number} */ x, | ||||||
| /** @type {number} */ y, | ||||||
| /** @type {number} */ width, | ||||||
| /** @type {number} */ height, | ||||||
| /** @type {Tag} */ tag | ||||||
| ) => { | ||||||
| try { | ||||||
| /** @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').SteamRaw<'input', 'showFloatingGamepadTextInput'>, 'input'>} */ | ||||||
| const order = { | ||||||
| url: '/steam/raw', | ||||||
| body: { | ||||||
| namespace: 'utils', | ||||||
| method: 'showFloatingGamepadTextInput', | ||||||
| args: [keyboardMode, x, y, width, height], | ||||||
| }, | ||||||
| }; | ||||||
| const answer = await this.ws?.sendAndWaitForResponse(order); | ||||||
| if (answer?.body.success === false) { | ||||||
| throw new Error('Failed') | ||||||
| } | ||||||
| this._ShowFloatingGamepadTextInputResultValue = answer?.body.data ? 1 : 0 | ||||||
| this._ShowFloatingGamepadTextInputErrorValue = '' | ||||||
|
|
||||||
| await this.trigger(tag, [ | ||||||
| C3.Plugins.pipelabv2.Cnds.OnShowFloatingGamepadTextInputSuccess, | ||||||
| C3.Plugins.pipelabv2.Cnds.OnAnyShowFloatingGamepadTextInputSuccess | ||||||
| ]) | ||||||
| } catch (e) { | ||||||
| if (e instanceof Error) { | ||||||
| this._ShowFloatingGamepadTextInputErrorValue = e.message | ||||||
| this._ShowFloatingGamepadTextInputResultValue = 0 | ||||||
| await this.trigger(tag, [ | ||||||
| C3.Plugins.pipelabv2.Cnds.OnShowFloatingGamepadTextInputError, | ||||||
| C3.Plugins.pipelabv2.Cnds.OnAnyShowFloatingGamepadTextInputError | ||||||
| ]) | ||||||
| } | ||||||
| } | ||||||
| }, this.unsupportedEngine) | ||||||
| _ShowFloatingGamepadTextInput = this._ShowFloatingGamepadTextInputBase | ||||||
| _ShowFloatingGamepadTextInputSync = this._ShowFloatingGamepadTextInputBase | ||||||
|
Comment on lines
+2701
to
+2702
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| // Steam Workshop | ||||||
| /** @type {Map<string, any>} */ | ||||||
| _workshopItemsMap = new Map() | ||||||
|
|
@@ -3851,6 +3938,16 @@ function getInstanceJs(parentClass, addonTriggers, C3) { | |||||
| _OnGetFriendNameError = this.wrap(super._OnGetFriendNameError, (/** @type {Tag} */ tag) => this._currentTag === tag) | ||||||
| _OnAnyGetFriendNameError = this.wrap(super._OnAnyGetFriendNameError, () => true) | ||||||
|
|
||||||
| _OnShowGamepadTextInputSuccess = this.wrap(super._OnShowGamepadTextInputSuccess, (/** @type {Tag} */ tag) => this._currentTag === tag) | ||||||
| _OnAnyShowGamepadTextInputSuccess = this.wrap(super._OnAnyShowGamepadTextInputSuccess, () => true) | ||||||
| _OnShowGamepadTextInputError = this.wrap(super._OnShowGamepadTextInputError, (/** @type {Tag} */ tag) => this._currentTag === tag) | ||||||
| _OnAnyShowGamepadTextInputError = this.wrap(super._OnAnyShowGamepadTextInputError, () => true) | ||||||
|
|
||||||
| _OnShowFloatingGamepadTextInputSuccess = this.wrap(super._OnShowFloatingGamepadTextInputSuccess, (/** @type {Tag} */ tag) => this._currentTag === tag) | ||||||
| _OnAnyShowFloatingGamepadTextInputSuccess = this.wrap(super._OnAnyShowFloatingGamepadTextInputSuccess, () => true) | ||||||
| _OnShowFloatingGamepadTextInputError = this.wrap(super._OnShowFloatingGamepadTextInputError, (/** @type {Tag} */ tag) => this._currentTag === tag) | ||||||
| _OnAnyShowFloatingGamepadTextInputError = this.wrap(super._OnAnyShowFloatingGamepadTextInputError, () => true) | ||||||
|
|
||||||
| _OnCreateWorkshopItemSuccess = this.wrap(super._OnCreateWorkshopItemSuccess, (/** @type {Tag} */ tag) => this._currentTag === tag) | ||||||
| _OnAnyCreateWorkshopItemSuccess = this.wrap(super._OnAnyCreateWorkshopItemSuccess, () => true) | ||||||
| _OnCreateWorkshopItemError = this.wrap(super._OnCreateWorkshopItemError, (/** @type {Tag} */ tag) => this._currentTag === tag) | ||||||
|
|
@@ -4507,6 +4604,20 @@ function getInstanceJs(parentClass, addonTriggers, C3) { | |||||
| return this._GetFriendNameResultValue | ||||||
| }) | ||||||
|
|
||||||
| _ShowGamepadTextInputError = this.exprs(super._ShowGamepadTextInputError, () => { | ||||||
| return this._ShowGamepadTextInputErrorValue | ||||||
| }) | ||||||
| _ShowGamepadTextInputResult = this.exprs(super._ShowGamepadTextInputResult, () => { | ||||||
| return this._ShowGamepadTextInputResultValue ?? '' | ||||||
| }) | ||||||
|
|
||||||
| _ShowFloatingGamepadTextInputError = this.exprs(super._ShowFloatingGamepadTextInputError, () => { | ||||||
| return this._ShowFloatingGamepadTextInputErrorValue | ||||||
| }) | ||||||
| _ShowFloatingGamepadTextInputResult = this.exprs(super._ShowFloatingGamepadTextInputResult, () => { | ||||||
| return this._ShowFloatingGamepadTextInputResultValue ?? 0 | ||||||
| }) | ||||||
|
|
||||||
| // Workshop expressions | ||||||
| _CreateWorkshopItemError = this.exprs(super._CreateWorkshopItemError, () => { | ||||||
| return this._CreateWorkshopItemErrorValue | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1397,6 +1397,110 @@ const CheckDLCIsInstalled = ACEGenerator("CheckDLCIsInstalled", /** @type {const | |
| description: "Checks if the user owns and has installed a specific DLC", | ||
| })) | ||
|
|
||
| // Steam Gamepad Text Input | ||
| const ShowGamepadTextInput = ACEGenerator("ShowGamepadTextInput", /** @type {const} */({ | ||
| category: "steam", | ||
| highlight: false, | ||
| deprecated: false, | ||
| params: [ | ||
| { | ||
| id: 'inputMode', | ||
| desc: "The input mode for the text entry", | ||
| name: "Input Mode", | ||
| type: 'combo', | ||
| items: [ | ||
| { "normal": "Normal" }, | ||
| { "password": "Password" }, | ||
| ] | ||
| }, | ||
| { | ||
| id: 'inputLineMode', | ||
| desc: "Whether to use single-line or multi-line input", | ||
| name: "Line Mode", | ||
| type: 'combo', | ||
| items: [ | ||
| { "singleLine": "Single Line" }, | ||
| { "multipleLines": "Multiple Lines" }, | ||
| ] | ||
| }, | ||
| { | ||
| id: 'description', | ||
| desc: "The description text to display to the user", | ||
| name: "Description", | ||
| type: 'string', | ||
| initialValue: "\"\"", | ||
| }, | ||
| { | ||
| id: 'maxCharacters', | ||
| desc: "The maximum number of characters allowed", | ||
| name: "Max Characters", | ||
| type: 'number', | ||
| initialValue: "256", | ||
| }, | ||
| { | ||
| id: 'existingText', | ||
| desc: "Optional existing text to pre-fill in the input (leave empty for none)", | ||
| name: "Existing Text", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't "Default value" a more standard label ? |
||
| type: 'string', | ||
| initialValue: "\"\"", | ||
| } | ||
| ], | ||
| listName: "Show gamepad text input", | ||
| displayText: "Show gamepad text input (mode: {0}, line: {1}, desc: [b]{2}[/b], max: {3}, existing: {4})", | ||
| description: "Shows the Steam gamepad text input dialog. Returns the entered text, or null if cancelled or could not show.", | ||
| })) | ||
|
|
||
| const ShowFloatingGamepadTextInput = ACEGenerator("ShowFloatingGamepadTextInput", /** @type {const} */({ | ||
| category: "steam", | ||
| highlight: false, | ||
| deprecated: false, | ||
| params: [ | ||
| { | ||
| id: 'keyboardMode', | ||
| desc: "The keyboard mode to display", | ||
| name: "Keyboard Mode", | ||
| type: 'combo', | ||
| items: [ | ||
| { "singleLine": "Single Line" }, | ||
| { "multipleLines": "Multiple Lines" }, | ||
| { "email": "Email" }, | ||
| { "numeric": "Numeric" }, | ||
| ] | ||
| }, | ||
| { | ||
| id: 'x', | ||
| desc: "The X position of the floating keyboard", | ||
| name: "X", | ||
| type: 'number', | ||
| initialValue: "0", | ||
| }, | ||
| { | ||
| id: 'y', | ||
| desc: "The Y position of the floating keyboard", | ||
| name: "Y", | ||
| type: 'number', | ||
| initialValue: "0", | ||
| }, | ||
| { | ||
| id: 'width', | ||
| desc: "The width of the floating keyboard", | ||
| name: "Width", | ||
| type: 'number', | ||
| initialValue: "800", | ||
| }, | ||
| { | ||
| id: 'height', | ||
| desc: "The height of the floating keyboard", | ||
| name: "Height", | ||
| type: 'number', | ||
| initialValue: "600", | ||
| } | ||
| ], | ||
| listName: "Show floating gamepad text input", | ||
| displayText: "Show floating gamepad text input (mode: {0}, x: {1}, y: {2}, size: {3}x{4})", | ||
| description: "Shows the Steam floating gamepad text input. Returns true if shown, otherwise false.", | ||
| })) | ||
|
|
||
| // Steam Workshop | ||
| const CreateWorkshopItem = ACEGenerator("CreateWorkshopItem", /** @type {const} */({ | ||
| category: "steam-workshop", | ||
|
|
@@ -1951,6 +2055,8 @@ const Config = /** @type {const} */({ | |
| ...SaveScreenshotFromURL.actions, | ||
| ...AddScreenshotToLibrary.actions, | ||
| ...CheckDLCIsInstalled.actions, | ||
| ...ShowGamepadTextInput.actions, | ||
| ...ShowFloatingGamepadTextInput.actions, | ||
| ...CreateWorkshopItem.actions, | ||
| ...UpdateWorkshopItem.actions, | ||
| ...GetSubscribedItemsWithMetadata.actions, | ||
|
|
@@ -2049,6 +2155,8 @@ const Config = /** @type {const} */({ | |
| ...SaveScreenshotFromURL.conditions, | ||
| ...AddScreenshotToLibrary.conditions, | ||
| ...CheckDLCIsInstalled.conditions, | ||
| ...ShowGamepadTextInput.conditions, | ||
| ...ShowFloatingGamepadTextInput.conditions, | ||
| ...CreateWorkshopItem.conditions, | ||
| ...UpdateWorkshopItem.conditions, | ||
| ...GetSubscribedItemsWithMetadata.conditions, | ||
|
|
@@ -2213,6 +2321,8 @@ const Config = /** @type {const} */({ | |
| ...SaveScreenshotFromURL.expressions, | ||
| ...AddScreenshotToLibrary.expressions, | ||
| ...CheckDLCIsInstalled.expressions, | ||
| ...ShowGamepadTextInput.expressions, | ||
| ...ShowFloatingGamepadTextInput.expressions, | ||
| ...CreateWorkshopItem.expressions, | ||
| ...UpdateWorkshopItem.expressions, | ||
| ...GetSubscribedItemsWithMetadata.expressions, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.