Skip to content

Commit

Permalink
Fix screenshot callback, adjust pipe options, fix relay interface
Browse files Browse the repository at this point in the history
  • Loading branch information
BOLL7708 committed Jul 24, 2024
1 parent 53e877b commit 6d4cb8e
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 15 deletions.
19 changes: 10 additions & 9 deletions app/src/Shared/Bot/Callbacks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {IOpenVR2WSRelay} from '../Classes/OpenVR2WS.js'
import Relay, {IRelayTempMessage} from '../Classes/Relay.js'
import Relay, {IRelay, IRelayTempMessage} from '../Classes/Relay.js'
import ModulesSingleton from '../Singletons/ModulesSingleton.js'
import StatesSingleton from '../Singletons/StatesSingleton.js'
import DataBaseHelper from '../Helpers/DataBaseHelper.js'
Expand Down Expand Up @@ -34,8 +33,8 @@ import AssetsHelper from '../Helpers/AssetsHelper.js'
import ActionSign from '../Objects/Data/Action/ActionSign.js'

export default class Callbacks {
private static _relays: Map<string, IOpenVR2WSRelay> = new Map()
public static registerRelay(relay: IOpenVR2WSRelay) {
private static _relays: Map<string, IRelay> = new Map()
public static registerRelay(relay: IRelay) {
this._relays.set(relay.key, relay)
}

Expand Down Expand Up @@ -298,10 +297,8 @@ export default class Callbacks {
const preset = DataUtils.ensureData(screenshotsConfig.callback.pipePreset)
if(preset) {
const configClone: PresetPipeCustom = Utils.clone(preset)
configClone.imageData = responseData.image
if(configClone.customProperties) {
configClone.customProperties.durationMs = screenshotsConfig.callback.pipePreset_forMs
const tas = configClone.customProperties.textAreas
if(configClone) {
const tas = configClone.textAreas
if(tas && tas.length > 0) {
tas[0].text = `${responseData.width}x${responseData.height}`
}
Expand All @@ -313,7 +310,11 @@ export default class Callbacks {
tas[1].text = title
}
}
modules.pipe.sendCustom(configClone).then()
modules.pipe.sendCustom(
configClone,
responseData.image,
screenshotsConfig.callback.pipePreset_forMs
).then()
}
}

Expand Down
6 changes: 6 additions & 0 deletions app/src/Shared/Classes/Relay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import DataBaseHelper from '../Helpers/DataBaseHelper.js'
import Utils from '../Utils/Utils.js'
import ConfigRelay from '../Objects/Data/Config/ConfigRelay.js'
import ConfigController from '../Objects/Data/Config/ConfigController.js'
import {ActionHandler} from 'src/Shared/Bot/Actions'

export default class Relay {
private readonly _logColor = Color.ForestGreen
Expand Down Expand Up @@ -110,4 +111,9 @@ export interface IOnRelayMessageCallback {
export interface IRelayTempMessage {
key: string,
data: string
}

export interface IRelay {
key: string
handler?: ActionHandler
}
1 change: 1 addition & 0 deletions app/src/Shared/Classes/SuperScreenShotterVR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export interface ISSSVRResponse {
image: string
width: number
height: number
filePath: string
message: string
error: string
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/Shared/Objects/Data/Trigger/TriggerRelay.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import AbstractTrigger from './AbstractTrigger.js'
import DataMap from '../DataMap.js'
import {IOpenVR2WSRelay} from '../../../Classes/OpenVR2WS.js'
import TextHelper from '../../../Helpers/TextHelper.js'
import {ActionHandler} from '../../../Bot/Actions.js'
import Callbacks from '../../../Bot/Callbacks.js'
import Utils from '../../../Utils/Utils.js'
import {IRelay} from '../../../Classes/Relay.js'

export default class TriggerRelay extends AbstractTrigger {
key: string = ''
Expand All @@ -21,7 +21,7 @@ export default class TriggerRelay extends AbstractTrigger {
}

register(eventKey: string) {
const relay: IOpenVR2WSRelay = {
const relay: IRelay = {
key: TextHelper.replaceTags(this.key, {eventKey: eventKey}),
handler: new ActionHandler(eventKey)
}
Expand Down
1 change: 1 addition & 0 deletions app/src/Shared/Objects/Options/OptionPipeAnimationPhase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import AbstractOption from './AbstractOption.js'
import OptionsMap from './OptionsMap.js'

export default class OptionPipeAnimationPhase extends AbstractOption {
static readonly Linear = 'Linear'
static readonly Sine = 'Sine'
static readonly Cosine = 'Cosine'
static readonly NegativeSine = 'NegativeSine'
Expand Down
4 changes: 2 additions & 2 deletions app/src/Shared/Objects/Options/OptionPipeAnimationProperty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export default class OptionPipeAnimationProperty extends AbstractOption {
static readonly Yaw = 'Yaw'
static readonly Pitch = 'Pitch'
static readonly Roll = 'Roll'
static readonly PositionZ = 'PositionZ'
static readonly PositionY = 'PositionY'
static readonly PositionX = 'PositionX'
static readonly PositionY = 'PositionY'
static readonly PositionZ = 'PositionZ'
static readonly Scale = 'Scale'
static readonly Opacity = 'Opacity'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import AbstractOption from './AbstractOption.js'
import OptionsMap from './OptionsMap.js'

export default class OptionPipeTextAreaVerticalAlignment extends AbstractOption {
static readonly Left = 'Top'
static readonly Top = 'Top'
static readonly Center = 'Center'
static readonly Right = 'Bottom'
static readonly Bottom = 'Bottom'
}
OptionsMap.addPrototype({
prototype: OptionPipeTextAreaVerticalAlignment,
Expand Down

0 comments on commit 6d4cb8e

Please sign in to comment.