Skip to content

Commit

Permalink
feat(obs2): 进入战斗时若未链接则尝试链接
Browse files Browse the repository at this point in the history
  • Loading branch information
Souma-Sumire committed Oct 25, 2024
1 parent 8ed6bd0 commit 920b355
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/pages/obs2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class Obs {
})
}
connect() {
connect(callback?: () => void) {
if (!(userConfig.value.host && userConfig.value.password)) {
return
}
Expand All @@ -163,6 +163,9 @@ class Obs {
status: 'success',
duration: 2000,
})
if (callback) {
callback()
}
}).finally(() => {
this.status.connecting = false
if (!userConfig.value.path) {
Expand Down Expand Up @@ -308,7 +311,6 @@ function getZoneType(zoneInfo: (typeof ZoneInfo)[number]): typeof CONTENT_TYPES[
}
function checkCondition(condition: ConditionType) {
const recording = obs.status.recording
const zoneType = getZoneType(playerZoneInfo.value)
if (!userContentSetting.value.find(item => item.type === zoneType && item[condition])) {
return
Expand All @@ -317,7 +319,12 @@ function checkCondition(condition: ConditionType) {
case 'enter':
case 'countdown':
case 'combatStart':
if (!recording) {
if (!obs.status.connected) {
obs.connect(() => {
obs.startRecord()
})
}
else if (!obs.status.recording) {
obs.startRecord()
}
else {
Expand All @@ -326,7 +333,7 @@ function checkCondition(condition: ConditionType) {
return
case 'combatEnd':
case 'wipe':
if (recording) {
if (obs.status.recording) {
obs.stopRecord()
}
}
Expand Down

0 comments on commit 920b355

Please sign in to comment.