Skip to content

Commit

Permalink
Reduce wait time and chances for the play button to get stuck as invi…
Browse files Browse the repository at this point in the history
…sible
  • Loading branch information
reconman committed Jan 7, 2024
1 parent 7f7b877 commit 8dd7383
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class ScriptManager @Inject constructor(
}

is AutoBattle.ExitException -> {
preferences.hidePlayButtonForScreenshot = false
preferences.hidePlayButton = false

if (e.reason !is AutoBattle.ExitReason.Abort) {
messages.notify(scriptExitedString)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fun ScriptRunnerUI(
enabled: Boolean,
isRecording: Boolean
) {
val hidePlayButtonForScreenshot by prefsCore.hidePlayButtonForScreenshot.remember()
val hidePlayButton by prefsCore.hidePlayButton.remember()
val script by prefsCore.scriptMode.remember()

FGATheme(
Expand All @@ -60,15 +60,15 @@ fun ScriptRunnerUI(
color = when (state) {
ScriptRunnerUIState.Running ->
MaterialTheme.colorScheme.surface.copy(
alpha = if (hidePlayButtonForScreenshot && script == ScriptModeEnum.Battle) 0f else 0.5f
alpha = if (hidePlayButton && script == ScriptModeEnum.Battle) 0f else 0.5f
)
else -> MaterialTheme.colorScheme.surface
},
contentColor = when (state) {
ScriptRunnerUIState.Running -> {
val color = if (isRecording) MaterialTheme.colorScheme.error else Color.White
color.copy(
alpha = if (hidePlayButtonForScreenshot && script == ScriptModeEnum.Battle) 0f else 0.5f
alpha = if (hidePlayButton && script == ScriptModeEnum.Battle) 0f else 0.5f
)
}
else -> Color.White
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class PreferencesImpl @Inject constructor(

override val screenshotBond by prefs.screenshotBond

override var hidePlayButtonForScreenshot by prefs.hidePlayButtonForScreenshot
override var hidePlayButton by prefs.hidePlayButton

override val stageCounterSimilarity by prefs.stageCounterSimilarity.map { it / 100.0 }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class PrefsCore @Inject constructor(
val screenshotDrops = maker.bool("screenshot_drops")
val screenshotDropsUnmodified = maker.bool("screenshot_drops_unmodified")
val screenshotBond = maker.bool("screenshot_bond")
val hidePlayButtonForScreenshot = maker.bool("hide_play_button_for_screenshot")
val hidePlayButton = maker.bool("hide_play_button")
val debugMode = maker.bool("debug_mode")
val autoStartService = maker.bool("auto_start_service")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,8 @@ class AutoBattle @Inject constructor(
private fun handleBondScreen(){
canScreenshotBondCE = true

screenshotDrops.screenshotBond()

if (prefs.screenshotBond){
screenshotDrops.screenshotBond()
messages.notify(ScriptNotify.BondLevelUp)
0.5.seconds.wait()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,18 @@ class ScreenshotDrops @Inject constructor(
if (!prefs.screenshotBond){
return
}
prefs.hidePlayButtonForScreenshot = true
1.seconds.wait()

useColor {
val pattern = screenshotService.takeScreenshot()
try {
prefs.hidePlayButton = true
1.seconds.wait()
val pattern = screenshotService.takeScreenshot()

storageProvider.dropBondScreenShot(pattern, server = prefs.gameServer)
storageProvider.dropBondScreenShot(pattern, server = prefs.gameServer)
}
finally {
prefs.hidePlayButton = false
}
}

prefs.hidePlayButtonForScreenshot = false
1.seconds.wait()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface IPreferences {
val screenshotDrops: Boolean
val screenshotDropsUnmodified: Boolean
val screenshotBond: Boolean
var hidePlayButtonForScreenshot: Boolean
var hidePlayButton: Boolean
var maxGoldEmberStackSize: Int
var maxGoldEmberTotalCount: Int
var stopAfterThisRun: Boolean
Expand Down

0 comments on commit 8dd7383

Please sign in to comment.