# Released under the MIT License. See LICENSE for details.#"""Provides a window which shows info about resource types."""from__future__importannotationsfromtypingimportoverride,TYPE_CHECKING,assert_neverfrombauiv1lib.popupimportPopupWindowimportbauiv1asbuiifTYPE_CHECKING:fromtypingimportLiteral
[docs]classResourceTypeInfoWindow(PopupWindow):"""Popup window providing info about resource types."""def__init__(self,resource_type:Literal['tickets','tokens','trophies','xp'],origin_widget:bui.Widget,):assertbui.app.classicisnotNoneuiscale=bui.app.ui_v1.uiscalescale=(2.0ifuiscaleisbui.UIScale.SMALLelse1.5ifuiscaleisbui.UIScale.MEDIUMelse1.0)self._transitioning_out=Falseself._width=570self._height=350bg_color=(0.5,0.4,0.6)super().__init__(size=(self._width,self._height),toolbar_visibility='inherit',scale=scale,bg_color=bg_color,position=origin_widget.get_screen_space_center(),edge_buffer_scale=4.0,)self._cancel_button=bui.buttonwidget(parent=self.root_widget,position=(40,self._height-40),size=(50,50),scale=0.7,label='',color=bg_color,on_activate_call=self._on_cancel_press,autoselect=True,icon=bui.gettexture('crossOut'),iconscale=1.2,)ifresource_type=='tickets':rdesc='Will describe tickets.'elifresource_type=='tokens':rdesc='Will describe tokens.'elifresource_type=='trophies':rdesc='Will show trophies & league rankings.'elifresource_type=='xp':rdesc='Will describe xp/levels.'else:assert_never(resource_type)bui.textwidget(parent=self.root_widget,h_align='center',v_align='center',size=(0,0),position=(self._width*0.5,self._height*0.5),text=(f'UNDER CONSTRUCTION.\n({rdesc})'),)def_on_cancel_press(self)->None:self._transition_out()def_transition_out(self)->None:ifnotself._transitioning_out:self._transitioning_out=Truebui.containerwidget(edit=self.root_widget,transition='out_scale')