Updating manual_camera to api 9

This commit is contained in:
Vishal 2025-01-22 23:51:41 +05:30 committed by GitHub
parent 619998e218
commit 4d100d1ffd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 22 deletions

View file

@ -238,6 +238,7 @@
} }
], ],
"versions": { "versions": {
"1.1.0": null,
"1.0.0": { "1.0.0": {
"api_version": 8, "api_version": 8,
"commit_sha": "c26342d", "commit_sha": "c26342d",

View file

@ -1,4 +1,4 @@
# ba_meta require api 8 # ba_meta require api 9
################### ###################
# Credits - Droopy#3730. # # Credits - Droopy#3730. #
@ -10,16 +10,20 @@
from __future__ import annotations from __future__ import annotations
import _babase import _babase
import babase import babase
import bascenev1 as bs
import bauiv1 as bui import bauiv1 as bui
from bauiv1lib.mainmenu import MainMenuWindow from bauiv1lib.ingamemenu import InGameMenuWindow
class Manual_camera_window: class Manual_camera_window(bui.MainWindow):
def __init__(self): def __init__(self, origin_widget):
self._root_widget = bui.containerwidget( super().__init__(
on_outside_click_call=None, root_widget=bui.containerwidget(
size=(0, 0)) on_outside_click_call=None,
size=(0, 0)
),
transition='in_scale',
origin_widget=origin_widget,
)
button_size = (50, 50) button_size = (50, 50)
self._text = bui.textwidget(parent=self._root_widget, self._text = bui.textwidget(parent=self._root_widget,
scale=0.65, scale=0.65,
@ -149,15 +153,10 @@ class Manual_camera_window:
button_type='square', button_type='square',
autoselect=True, autoselect=True,
position=(520, -100), position=(520, -100),
on_activate_call=self._close) on_activate_call=self.main_window_back)
bui.containerwidget(edit=self._root_widget, bui.containerwidget(edit=self._root_widget,
cancel_button=self._done) cancel_button=self._done)
def _close(self):
bui.containerwidget(edit=self._root_widget,
transition=('out_scale'))
MainMenuWindow()
def _change_camera_position(self, direction): def _change_camera_position(self, direction):
camera = _babase.get_camera_position() camera = _babase.get_camera_position()
x = camera[0] x = camera[0]
@ -212,7 +211,7 @@ class Manual_camera_window:
_babase.set_camera_target(x, y, z) _babase.set_camera_target(x, y, z)
old_refresh_in_game = MainMenuWindow._refresh_in_game old_refresh_in_game = InGameMenuWindow._refresh_in_game
def my_refresh_in_game(self, *args, **kwargs): def my_refresh_in_game(self, *args, **kwargs):
@ -224,19 +223,23 @@ def my_refresh_in_game(self, *args, **kwargs):
size=(70, 50), size=(70, 50),
button_type='square', button_type='square',
label='Manual\nCamera', label='Manual\nCamera',
text_scale=1.5, text_scale=1.5)
on_activate_call=self._manual_camera)
bui.buttonwidget(edit=camera_button,
on_activate_call=bui.Call(self._manual_camera, camera_button)
return value return value
def _manual_camera(self): def _manual_camera(self, widget):
bui.containerwidget(edit=self._root_widget, transition='out_scale') if not self.main_window_has_control():
Manual_camera_window() return
self.main_window_replace(Manual_camera_window(origin_widget=widget))
# ba_meta export plugin # ba_meta export plugin
class ByDroopy(babase.Plugin): class ByDroopy(babase.Plugin):
def __init__(self): def __init__(self):
MainMenuWindow._refresh_in_game = my_refresh_in_game InGameMenuWindow._refresh_in_game = my_refresh_in_game
MainMenuWindow._manual_camera = _manual_camera InGameMenuWindow._manual_camera = _manual_camera