From dad50e2141e1962294cd508dfc6464df32e774af Mon Sep 17 00:00:00 2001 From: Roman Trapeznikov Date: Thu, 25 Jan 2024 23:24:37 +0300 Subject: [PATCH] wired up ui --- CHANGELOG.md | 1 + src/assets/ba_data/python/bauiv1lib/mainmenu.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00f77a1e..070f0e72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ languages; I feel it helps keep logic more understandable and should help us catch problems where a base class changes or removes a method and child classes forget to adapt to the change. +- Replays now have rewind/fast-forward buttons!! (Thanks Dliwk, vishal332008!) ### 1.7.32 (build 21741, api 8, 2023-12-20) - Fixed a screen message that no one will ever see (Thanks vishal332008?...) diff --git a/src/assets/ba_data/python/bauiv1lib/mainmenu.py b/src/assets/ba_data/python/bauiv1lib/mainmenu.py index 07eee0f1..65457bdf 100644 --- a/src/assets/ba_data/python/bauiv1lib/mainmenu.py +++ b/src/assets/ba_data/python/bauiv1lib/mainmenu.py @@ -536,7 +536,7 @@ class MainMenuWindow(bui.Window): size=(b_size, b_size), label='', autoselect=True, - on_activate_call=bui.Call(self._change_replay_speed, -1), + on_activate_call=bui.WeakCall(self._rewind_replay), ) bui.textwidget( parent=self._root_widget, @@ -561,7 +561,7 @@ class MainMenuWindow(bui.Window): size=(b_size, b_size), label='', autoselect=True, - on_activate_call=bui.Call(bs.forward_replay), + on_activate_call=bui.WeakCall(self._forward_replay), ) bui.textwidget( parent=self._root_widget, @@ -577,6 +577,12 @@ class MainMenuWindow(bui.Window): scale=2.0 * t_scale, ) + def _rewind_replay(self) -> None: + bs.seek_replay(-2 * pow(2, bs.get_replay_speed_exponent())) + + def _forward_replay(self) -> None: + bs.seek_replay(2 * pow(2, bs.get_replay_speed_exponent())) + def _refresh_not_in_game( self, positions: list[tuple[float, float, float]] ) -> tuple[float, float, float]: