예제 #1
0
 def makeSign(self,
              topStr,
              signStr,
              textId,
              scale=TTLocalizer.BCHQLsignText):
     if signStr != 'sign_2':
         text = TextEncoder.upper(
             TTLocalizer.GlobalStreetNames[textId][(-1)])
     else:
         text = 'The Chairman'
     if topStr != '':
         top = self.geom.find('**/' + topStr)
         sign = top.find('**/' + signStr)
         if topStr == 'TunnelEntrance':
             topple = top.find('**/TunnelFront')
             locator = topple.find('**/sign_origin')
         else:
             locator = top.find('**/sign_origin')
         signText = DirectGui.OnscreenText(
             text=text,
             font=ToontownGlobals.getSuitFont(),
             scale=scale,
             fg=(0, 0, 0, 1),
             parent=sign)
         signText.setPosHpr(locator, 0, -0.1, -0.25, 0, 0, 0)
     else:
         sign = self.geom.find('**/' + signStr)
         signText = DirectGui.OnscreenText(
             text=text,
             font=ToontownGlobals.getSuitFont(),
             scale=scale,
             fg=(0, 0, 0, 1),
             parent=sign)
         signText.setPosHpr(sign, 0.4, -174.5, -8.75, 0, 0, 0)
     signText.setDepthWrite(0)
예제 #2
0
        def _callback(texture: core.Texture):
            if parent_frame.is_empty():
                return

            frame_size = gui.size_inside_square_for_texture(texture, 0.2)

            if frame_size is None:
                return

            tile = DirectGui.DirectButton(
                parent=parent_frame,
                frameSize=(0.01, frame_size.x - 0.01, -0.01, -(frame_size.y - 0.01)),
                frameTexture=texture,
                relief=DirectGuiGlobals.FLAT,
                command=self._select_tile,
                extraArgs=[picnum],
            )
            self._bind_scroll(tile)

            tile_number = DirectGui.DirectLabel(
                parent=tile,
                pos=core.Vec3(0, 0, -constants.TEXT_SIZE),
                scale=constants.TEXT_SIZE,
                text=str(picnum),
                frameColor=(0, 0, 0, 0),
                text_align=core.TextNode.A_left,
                text_fg=(1, 1, 1, 0.75),
            )
            self._bind_scroll(tile_number)
 def loadPlaceGeom(self, zoneId):
     self.notify.info('loadPlaceGeom: %s' % zoneId)
     zoneId = zoneId - zoneId % 100
     self.__handleInterests(zoneId)
     if zoneId == ToontownGlobals.CashbotHQ:
         self.geom = loader.loadModel(self.cogHQExteriorModelPath)
         ddLinkTunnel = self.geom.find('**/LinkTunnel1')
         ddLinkTunnel.setName('linktunnel_dl_9252_DNARoot')
         locator = self.geom.find('**/sign_origin')
         backgroundGeom = self.geom.find('**/EntranceFrameFront')
         backgroundGeom.node().setEffect(DecalEffect.make())
         signText = DirectGui.OnscreenText(
             text=TTLocalizer.DonaldsDreamland[-1],
             font=ToontownGlobals.getSuitFont(),
             scale=3,
             fg=(0.87, 0.87, 0.87, 1),
             mayChange=False,
             parent=backgroundGeom)
         signText.setPosHpr(locator, 0, 0, 0, 0, 0, 0)
         signText.setDepthWrite(0)
     elif zoneId == ToontownGlobals.CashbotLobby:
         if base.config.GetBool('want-qa-regression', 0):
             self.notify.info('QA-REGRESSION: COGHQ: Visit CashbotLobby')
         self.geom = loader.loadModel(self.cogHQLobbyModelPath)
     else:
         self.notify.warning('loadPlaceGeom: unclassified zone %s' % zoneId)
     CogHQLoader.CogHQLoader.loadPlaceGeom(self, zoneId)
예제 #4
0
    def __init__(self, parent: core.NodePath, parent_menu: "Menu" = None):
        self._parent = parent
        self._parent_menu = parent_menu
        self._task_manager = TaskManagerGlobal.taskMgr

        self._frame = DirectGui.DirectFrame(
            parent=parent,
            frameSize=(-constants.PADDING, constants.PADDING, 0,
                       constants.PADDING),
            relief=DirectGuiGlobals.RAISED,
            borderWidth=(0.01, 0.01),
            state=DirectGuiGlobals.NORMAL,
        )
        self._frame.hide()
        self._items: typing.List[DirectGui.DirectButton] = []
        self._bottom = 0.0
        self._width = 0.0
        self._sub_menus: typing.List[Menu] = []
        self._mouse_within = False

        self.destroy = self._frame.destroy
        self.set_pos = self._frame.set_pos

        self._frame.bind(DirectGuiGlobals.WITHIN, self._mouse_in)
        self._frame.bind(DirectGuiGlobals.WITHOUT, self._mouse_out)

        self._auto_hide_task: Task.Task = None
예제 #5
0
 def setupEndSection(self, index):
     aspectSF = 0.7227
     self.endSectionNP = NodePath('EndSection')
     self.endSectionNP.reparentTo(self.game.assetMgr.world)
     self.endSectionNP.setX(self.incrementX)
     self.endWall = self.game.assetMgr.startingWall.copyTo(self.endSectionNP)
     self.endWall.setPos(100, 0, 4)
     self.endWall.setScale(0.8)
     self.endArrow = self.game.assetMgr.arrow.copyTo(self.endSectionNP)
     self.endArrow.setPos(6, 1.5, 12.76)
     self.exitElevator = self.game.assetMgr.exitElevator.copyTo(self.endSectionNP)
     self.exitElevator.setPos(52, -2, 12.7)
     cogSignModel = loader.loadModel('phase_4/models/props/sign_sellBotHeadHQ')
     cogSign = cogSignModel.find('**/sign_sellBotHeadHQ')
     cogSignSF = 23
     elevatorSignSF = 15
     sideDoor = self.exitElevator.find('**/doorway2')
     sdSign = cogSign.copyTo(sideDoor)
     sdSign.setPosHprScale(0, 1.9, 15, 0, 0, 0, elevatorSignSF, elevatorSignSF, elevatorSignSF * aspectSF)
     sdSign.node().setEffect(DecalEffect.make())
     sdText = DirectGui.OnscreenText(text=TTLocalizer.TwoDGameElevatorExit, font=ToontownGlobals.getSuitFont(), pos=(0,
                                                                                                                     -0.34), scale=0.15, mayChange=False, parent=sdSign)
     sdText.setDepthWrite(0)
     self.sectionNPList.append(self.endSectionNP)
     endSectionInfo = ('end', [], [],
      [
       0], [])
     endSection = TwoDSection.TwoDSection(index, endSectionInfo, self.endSectionNP, self)
     self.sections.append(endSection)
     self.incrementX += endSection.length
 def setMintId(self, mintId):
     self.mintId = mintId
     mintId2originId = {
         ToontownGlobals.CashbotMintIntA: 1,
         ToontownGlobals.CashbotMintIntB: 2,
         ToontownGlobals.CashbotMintIntC: 0
     }
     originId = mintId2originId[self.mintId]
     geom = self.cr.playGame.hood.loader.geom
     locator = geom.find('**/elevator_origin_%s' % originId)
     if locator:
         self.elevatorModel.setPosHpr(locator, 0, 0, 0, 0, 0, 0)
     else:
         self.notify.error('No origin found for originId: %s' % originId)
     locator = geom.find('**/elevator_signorigin_%s' % originId)
     backgroundGeom = geom.find('**/ElevatorFrameFront_%d' % originId)
     backgroundGeom.node().setEffect(DecalEffect.make())
     signText = DirectGui.OnscreenText(text=TextEncoder.upper(
         TTLocalizer.GlobalStreetNames[mintId][(-1)]),
                                       font=ToontownGlobals.getSuitFont(),
                                       scale=TTLocalizer.DMEEsignText,
                                       fg=(0.87, 0.87, 0.87, 1),
                                       mayChange=False,
                                       parent=backgroundGeom)
     signText.setPosHpr(locator, 0, 0, 0, 0, 0, 0)
     signText.setDepthWrite(0)
예제 #7
0
 def makeGui(self):
     self.notify.debugStateCall(self)
     if hasattr(self, 'cancelButton'):
         return
     else:
         fishGui = loader.loadModel('phase_4/models/gui/fishingGui')
         self.cancelButton = DirectGui.DirectButton(
             relief=None,
             scale=0.67,
             parent=base.a2dBottomRight,
             pos=(-0.173333, 0, 0.1),
             text=('', TTLocalizer.FishingExit, TTLocalizer.FishingExit),
             text_align=TextNode.ACenter,
             text_fg=Vec4(1, 1, 1, 1),
             text_shadow=Vec4(0, 0, 0, 1),
             text_pos=(0.0, -0.12),
             textMayChange=0,
             text_scale=0.1,
             image=(fishGui.find('**/exit_buttonUp'),
                    fishGui.find('**/exit_buttonDown'),
                    fishGui.find('**/exit_buttonRollover')),
             text_font=ToontownGlobals.getInterfaceFont(),
             command=self.d_requestExit)
         self.cancelButton.hide()
         return
예제 #8
0
    def makeGui(self):
        self.notify.debugStateCall(self)

        # Check if the timer exists, if so then the gui has been
        # made.
        if (hasattr(self, 'cancelButton')):
            return
        fishGui = loader.loadModel("phase_4/models/gui/fishingGui")
        self.cancelButton = DirectGui.DirectButton(
            relief=None,
            scale=(0.67),
            pos=(-0.133, 0.0, 0.13),
            #pos = (0,0,0),
            text=("", TTLocalizer.FishingExit, TTLocalizer.FishingExit),
            text_align=TextNode.ACenter,
            text_fg=Vec4(1, 1, 1, 1),
            text_shadow=Vec4(0, 0, 0, 1),
            text_pos=(0.0, -0.12),
            textMayChange=0,
            text_scale=0.1,
            image=(fishGui.find("**/exit_buttonUp"),
                   fishGui.find("**/exit_buttonDown"),
                   fishGui.find("**/exit_buttonRollover")),
            text_font=ToontownGlobals.getInterfaceFont(),
            command=self.d_requestExit,
            parent=base.a2dBottomRight
            #pressEffect = False,
        )
        self.cancelButton.hide()
예제 #9
0
 def loadPlaceGeom(self, zoneId):
     self.notify.info('loadPlaceGeom: %s' % zoneId)
     zoneId = zoneId - zoneId % 100
     if zoneId == ToontownGlobals.BoardbotHQ:
         self.geom = loader.loadModel(self.cogHQExteriorModelPath)
         #ddLinkTunnel = self.geom.find('**/tunnel1')
         #ddLinkTunnel.setName('linktunnel_dl_9252_DNARoot')
         locator = self.geom.find('**/sign_origin')
         signText = DirectGui.OnscreenText(
             text=TTLocalizer.DonaldsDreamland[-1],
             font=ToontownGlobals.getSuitFont(),
             scale=3,
             fg=(0.87, 0.87, 0.87, 1),
             mayChange=False,
             parent=self.geom)
         signText.setPosHpr(locator, 0, 0, 0, 0, 0, 0)
         signText.setDepthWrite(0)
         self.geom.flattenMedium()
     elif zoneId == ToontownGlobals.BoardbotOfficeLobby:
         self.geom = loader.loadModel(self.factoryExteriorModelPath)
         self.geom.flattenMedium()
     elif zoneId == ToontownGlobals.BoardbotLobby:
         if base.config.GetBool('want-qa-regression', 0):
             self.notify.info('QA-REGRESSION: COGHQ: Visit BoardbotLobby')
         self.geom = loader.loadModel(self.cogHQLobbyModelPath)
         self.geom.flattenMedium()
     else:
         self.notify.warning('loadPlaceGeom: unclassified zone %s' % zoneId)
     CogHQLoader.CogHQLoader.loadPlaceGeom(self, zoneId)
예제 #10
0
 def makeSign(topStr, signStr, textId):
     top = self.geom.find('**/' + topStr)
     sign = top.find('**/' + signStr)
     locator = top.find('**/sign_origin')
     signText = DirectGui.OnscreenText(text=TextEncoder.upper(TTLocalizer.GlobalStreetNames[textId][-1]), font=ToontownGlobals.getSuitFont(), scale=TTLocalizer.BCHQLsignText, fg=(0, 0, 0, 1), parent=sign)
     signText.setPosHpr(locator, 0, -0.1, -0.25, 0, 0, 0)
     signText.setDepthWrite(0)
예제 #11
0
 def drawBattleCellLabel(self, marker, cellId=0):
     marker.setTag('cellId', '%d' % cellId)
     label = DirectGui.DirectLabel(text='%d' % cellId,
                                   parent=marker,
                                   relief=None,
                                   scale=3)
     label.setBillboardPointEye(0)
     label.setScale(0.4)
예제 #12
0
    def __init__(self, showbase):
        super().__init__(showbase)

        self.roots.append(
            dgui.OnscreenText(parent=showbase.aspect2d,
                              text='Load',
                              scale=0.20,
                              pos=(0, 0.75, 0.0),
                              fg=(0.8, 0.8, 0.8, 1.0)))

        self.menu = SavesMenu(showbase)
예제 #13
0
 def doEnterZone(self, newZoneId):
     Street.Street.doEnterZone(self, newZoneId)
     top = render.find('**/linktunnel_bosshq_10000_DNARoot')
     if top.isEmpty():
         return
     sign = top.find('**/Sign_5')
     sign.node().setEffect(DecalEffect.make())
     locator = top.find('**/sign_origin')
     signText = DirectGui.OnscreenText(text=TextEncoder.upper(TTLocalizer.BossbotHQ[-1]), font=ToontownGlobals.getSuitFont(), scale=TTLocalizer.GZSZLsignText, fg=(0, 0, 0, 1), mayChange=False, parent=sign)
     signText.setPosHpr(locator, 0, 0, -0.3, 0, 0, 0)
     signText.setDepthWrite(0)
예제 #14
0
    def __init__(
        self,
        parent: core.NodePath,
        tile_manager: manager.Manager,
        edit_mode: edit_mode.EditMode,
        task_manager: Task.TaskManager,
    ):
        self._dialog = DirectGui.DirectFrame(parent=parent,
                                             frameSize=(-1.1, 1.1, -0.9, 0.9))
        self._dialog.hide()

        self._tile_manager = tile_manager
        self._tile_selected: typing.Optional[typing.Callable[[int],
                                                             None]] = None
        DirectGui.DirectButton(
            parent=self._dialog,
            text="Ok",
            scale=0.05,
            pos=core.Vec3(0.81, -0.85),
            command=self._confirm,
        )
        DirectGui.DirectButton(
            parent=self._dialog,
            text="Cancel",
            scale=0.05,
            pos=core.Vec3(0.95, -0.85),
            command=self._hide,
        )

        self._tiles = tile_view.TileView(
            self._dialog,
            (-1.05, 1.05, -0.8, 0.88),
            self._tile_manager,
            self._select_tile,
        )
        self._tiles.load_tiles()

        self._task_manager = task_manager

        self._edit_mode = edit_mode
        self._selected_picnum: typing.Optional[int] = None
예제 #15
0
    def setupEndSection(self, index):
        # Used to compensate for scaling of Cog tunnel sign's
        # original aspect ratio of 1125x813 to a uniform ratio,
        # scale z by factor of 0.7227
        aspectSF = 0.7227
        self.endSectionNP = NodePath('EndSection')
        self.endSectionNP.reparentTo(self.game.assetMgr.world)
        self.endSectionNP.setX(self.incrementX)

        # Creating the wall
        self.endWall = self.game.assetMgr.startingWall.copyTo(
            self.endSectionNP)
        self.endWall.setPos(100, 0, 4)
        self.endWall.setScale(0.8)
        # Creating the arrow
        self.endArrow = self.game.assetMgr.arrow.copyTo(self.endSectionNP)
        self.endArrow.setPos(6, 1.5, 12.76)
        # Creating the exitElevator
        self.exitElevator = self.game.assetMgr.exitElevator.copyTo(
            self.endSectionNP)
        self.exitElevator.setPos(52, -2, 12.7)
        # Elevator EXIT sign
        cogSignModel = loader.loadModel(
            'phase_4/models/props/sign_sellBotHeadHQ')
        cogSign = cogSignModel.find('**/sign_sellBotHeadHQ')
        cogSignSF = 23
        elevatorSignSF = 15
        sideDoor = self.exitElevator.find('**/doorway2')
        sdSign = cogSign.copyTo(sideDoor)
        sdSign.setPosHprScale(0, 1.9, 15, 0, 0, 0, elevatorSignSF,
                              elevatorSignSF, elevatorSignSF * aspectSF)
        sdSign.node().setEffect(DecalEffect.make())
        sdText = DirectGui.OnscreenText(
            text=TTLocalizer.TwoDGameElevatorExit,
            font=ToontownGlobals.getSuitFont(),
            pos=(0, -0.34),
            scale=0.15,
            # required for DecalEffect (must be a GeomNode, not a TextNode)
            mayChange=False,
            parent=sdSign)
        sdText.setDepthWrite(0)

        # We create a section for the end section because it has a spawnPoint.
        # Creating a section makes it easier to handle that without repeating code.
        self.sectionNPList.append(self.endSectionNP)
        # Emulating the info what setupSections() in DistributedTwoDGameAI would have sent.
        endSectionInfo = ('end', [], [], [0], [])
        endSection = TwoDSection.TwoDSection(index, endSectionInfo,
                                             self.endSectionNP, self)
        self.sections.append(endSection)
        self.incrementX += endSection.length
예제 #16
0
 def makeSign(topStr, signStr, textId):
     top = self.geom.find("**/" + topStr)
     sign = top.find("**/" + signStr)
     #sign.node().setEffect(DecalEffect.make())
     locator = top.find("**/sign_origin")
     signText = DirectGui.OnscreenText(
         text=TextEncoder.upper(
             TTLocalizer.GlobalStreetNames[textId][-1]),
         font=ToontownGlobals.getSuitFont(),
         scale=TTLocalizer.BCHQLmakeSign,
         fg=(0, 0, 0, 1),
         parent=sign)
     signText.setPosHpr(locator, 0, -0.1, -0.25, 0, 0, 0)
     signText.setDepthOffset(1)
예제 #17
0
    def __init__(self, parent: core.NodePath,
                 edit_mode_selector: edit_mode.EditMode):
        self._edit_mode_selector = edit_mode_selector
        self._type_selected: typing.Optional[typing.Callable[[str],
                                                             None]] = None

        self._frame = DirectGui.DirectFrame(
            parent=parent,
            pos=core.Vec3(-0.18, -0.1),
            frameSize=(0, 0.36, 0, 0.24),
            relief=DirectGuiGlobals.RAISED,
            borderWidth=(0.01, 0.01),
        )
        self._frame.hide()

        self._ror_type_selector = DirectGui.DirectOptionMenu(
            parent=self._frame,
            pos=core.Vec3(0.04, 0.14),
            scale=constants.HUGE_TEXT_SIZE,
            items=[
                ror_constants.ROR_TYPE_LINK,
                ror_constants.ROR_TYPE_STACK,
                ror_constants.ROR_TYPE_WATER,
                ror_constants.ROR_TYPE_GOO,
            ],
        )

        DirectGui.DirectButton(
            parent=self._frame,
            pos=core.Vec3(0.18, 0.05),
            frameSize=core.Vec4(-0.06, 0.06, -0.02, 0.06) /
            constants.BIG_TEXT_SIZE,
            scale=constants.BIG_TEXT_SIZE,
            text="Ok",
            command=self._confirm,
        )
예제 #18
0
    def loadPlaceGeom(self, zoneId):

        self.notify.info("loadPlaceGeom: %s" % zoneId)

        # We shoud not look at the last 2 digits to match against these constants
        zoneId = (zoneId - (zoneId % 100))

        if zoneId == ToontownGlobals.CashbotHQ:
            self.geom = loader.loadModel(self.cogHQExteriorModelPath)

            # Rename the link tunnels so they will hook up properly
            ddLinkTunnel = self.geom.find("**/LinkTunnel1")
            ddLinkTunnel.setName("linktunnel_dl_9252_DNARoot")

            # Put a handy sign on the link tunnel
            locator = self.geom.find('**/sign_origin')
            backgroundGeom = self.geom.find('**/EntranceFrameFront')
            #backgroundGeom.node().setEffect(DecalEffect.make())
            signText = DirectGui.OnscreenText(
                text=TTLocalizer.DonaldsDreamland[-1],
                font=ToontownGlobals.getSuitFont(),
                scale=3,
                fg=(0.87, 0.87, 0.87, 1),
                # required for DecalEffect (must be a GeomNode, not a TextNode)
                mayChange=False,
                parent=backgroundGeom)
            signText.setPosHpr(locator, 0, 0, 0, 0, 0, 0)
            signText.setDepthOffset(1)

        elif zoneId == ToontownGlobals.CashbotLobby:
            if ConfigVariableBool('want-qa-regression', 0).getValue():
                self.notify.info('QA-REGRESSION: COGHQ: Visit CashbotLobby')

            self.geom = loader.loadModel(self.cogHQLobbyModelPath)

        # Note: the factory interior has a dynamically allocated zone but
        # that is ok because we do not need to load any models - they all
        # get loaded by the distributed object

        else:
            self.notify.warning("loadPlaceGeom: unclassified zone %s" % zoneId)

        # Flatten the geom a bit
        if self.geom:
            self.geom.flattenStrong()

        CogHQLoader.CogHQLoader.loadPlaceGeom(self, zoneId)
예제 #19
0
    def _get_tile_frame(self, picnum: int):
        if picnum not in self._tile_frames:
            frame = DirectGui.DirectButton(
                parent=self._canvas,
                frameSize=(0, 0.2, 0, -0.2),
                frameColor=(0, 0, 0, 0),
                relief=DirectGuiGlobals.FLAT,
                command=self._select_tile,
                extraArgs=[picnum],
            )
            frame.set_python_tag("picnum", picnum)
            self._bind_scroll(frame)
            self._tile_frames[picnum] = frame

            callback = self._make_tile_callback(frame, picnum)
            self._tile_manager.get_tile_async(picnum, 0, callback)

        return self._tile_frames[picnum]
예제 #20
0
    def enterPlayground(self, requestStatus):
        """
        """
        self.playgroundClass = GZPlayground
        SafeZoneLoader.enterPlayground(self, requestStatus)

        # add the bbhq sign
        top = self.geom.find("**/linktunnel_bosshq_10000_DNARoot")
        sign = top.find("**/Sign_5")
        sign.node().setEffect(DecalEffect.make())
        locator = top.find("**/sign_origin")
        signText = DirectGui.OnscreenText(
            text=TextEncoder.upper(TTLocalizer.BossbotHQ[-1]),
            font=ToontownGlobals.getSuitFont(),
            scale=TTLocalizer.GSZLbossbotSignScale,
            fg=(0, 0, 0, 1),
            # required for DecalEffect (must be a GeomNode, not a TextNode)
            mayChange=False,
            parent=sign)
        signText.setPosHpr(locator, 0, 0, -0.3, 0, 0, 0)
        signText.setDepthWrite(0)
예제 #21
0
    def __init__(
        self,
        parent: core.NodePath,
        edit_mode_selector: edit_mode.EditMode,
        audio_manager: audio.Manager,
        get_addons: typing.Callable[[], typing.List[addon.Addon]],
    ):
        self._edit_mode_selector = edit_mode_selector
        self._audio_manager = audio_manager
        self._get_addons = get_addons
        self._addons: typing.List[addon.Addon] = []
        self._editor: map_editor.MapEditor = None
        self._map_path: str = None

        self._dialog = DirectGui.DirectFrame(
            parent=parent,
            pos=core.Vec3(-1.1, -0.9),
            frameSize=(0, 2.2, 0, 1.8),
            relief=DirectGuiGlobals.RAISED,
            borderWidth=(0.01, 0.01),
        )
        self._dialog.hide()
예제 #22
0
    def add_command(self, text: str,
                    command: typing.Optional[typing.Callable[[], None]]):
        new_button = DirectGui.DirectButton(
            parent=self._frame,
            pos=core.Vec3(
                0, self._bottom - self._TEXT_SIZE / 2 - constants.PADDING),
            text=text,
            text_align=core.TextNode.A_left,
            scale=self._TEXT_SIZE,
            command=self._wrapped_command(command),
            relief=DirectGuiGlobals.FLAT,
            pressEffect=False,
            frameColor=(0, 0, 0, 0),
        )
        self._adjust_frame(new_button)
        new_button.bind(DirectGuiGlobals.ENTER,
                        self._highlight_button,
                        extraArgs=[new_button])
        new_button.bind(DirectGuiGlobals.EXIT,
                        self._unhighlight_button,
                        extraArgs=[new_button])

        return new_button
예제 #23
0
    def __init__(
        self,
        parent: core.NodePath,
        tile_manager: manager.Manager,
        handle_type_selected: typing.Callable[
            [map_objects.sprite_type_descriptor.Descriptor], None],
    ):
        self._tile_manager = tile_manager
        self._handle_type_selected = handle_type_selected

        self._frame = DirectGui.DirectScrolledFrame(
            parent=parent,
            pos=core.Vec3(0.04, 0),
            canvasSize=(0, 0.54, -1, 0),
            frameSize=(0, 0.6, 0.05, 1.68),
            frameColor=(0.65, 0.65, 0.65, 1),
            relief=DirectGuiGlobals.SUNKEN,
            scrollBarWidth=0.04,
            state=DirectGuiGlobals.NORMAL,
        )
        self._selected_frame: DirectGui.DirectButton = None
        self._sprite_frames: typing.List[DirectGui.DirectButton] = []
        self._bind_scroll(self._frame)
        self._top = 0.0
예제 #24
0
    def __init__(
        self,
        parent: DirectGui.DirectFrame,
        frame_size: typing.Tuple[float, float, float, float],
        tile_manager: manager.Manager,
        on_tile_selected: typing.Callable[[int], None],
    ):
        self._tile_manager = tile_manager
        self._on_tile_selected = on_tile_selected
        self._tile_indices: typing.Optional[typing.List[int]] = None

        self._frame = DirectGui.DirectScrolledFrame(
            parent=parent,
            canvasSize=(0, 1, -1, 0),
            frameSize=frame_size,
            frameColor=(0.65, 0.65, 0.65, 1),
            relief=DirectGuiGlobals.SUNKEN,
            scrollBarWidth=0.04,
            state=DirectGuiGlobals.NORMAL,
        )
        self._bind_scroll(self._frame)

        self._selected_tile: DirectGui.DirectFrame = None
        self._tile_frames: typing.Dict[int, DirectGui.DirectFrame] = {}