Ejemplo n.º 1
0
 def set_joystick_input(self):
     self.scene.game.input_mode = "joystick"
     if not self.joystick_overlay:
         self.joystick_overlay = joystickcursor.JoystickCursor(self.scene, self.scene.game.last_joystick_pos[0])
         self.joystick_overlay.layer = 20
         self.scene.ui_group.add(self.joystick_overlay)
     return super().set_joystick_input()
Ejemplo n.º 2
0
 def set_joystick_input(self):
     if not self.joystick_overlay:
         pid = self.scene.get_player_id(self.civ)
         self.joystick_overlay = joystickcursor.JoystickCursor(
             self.scene,
             self.scene.game.last_joystick_pos[pid],
             color=self.civ.color,
             player_id=pid)
         self.scene.ui_group.add(self.joystick_overlay)
Ejemplo n.º 3
0
    def setup_cursor_type(self, cursor):
        if self.joystick_overlay:
            self.joystick_overlay.kill()
            self.joystick_overlay = joystickcursor.JoystickCursor(self.scene, self.scene.game.last_joystick_pos[0])
            self.scene.ui_group.add(self.joystick_overlay)
            self.joystick_overlay.set_button_options(["[*x*] Select"])

        res = self.scene.game.game_resolution

        if self.panel:
            self.panel.kill()
        if cursor == "allied_planet":
            self.cursor_icon = SimpleSprite(V2(0,0), "assets/i-planet-cursor.png")
            self.hover_filter = self.filter_my_planets
            self.selection_info_text = text.Text("Select one of your Planets to apply upgrade", "big", V2(res.x / 2, res.y / 2), PICO_WHITE, multiline_width=180,shadow=PICO_BLACK, flash_color=PICO_YELLOW)
        elif cursor == "any_planet":
            self.cursor_icon = SimpleSprite(V2(0,0), "assets/i-planet-cursor.png")
            self.hover_filter = self.filter_any_planets
            self.selection_info_text = text.Text("Select any Planet to apply upgrade", "big", V2(res.x / 2, res.y / 2), PICO_WHITE, multiline_width=180,shadow=PICO_BLACK, flash_color=PICO_YELLOW)            
        elif cursor == "allied_fleet":
            self.scene.fleet_managers['my'].generate_selectable_objects()
            self.cursor_icon = SimpleSprite(V2(0,0), "assets/i-fleet-cursor.png")
            self.hover_filter = self.filter_my_fleets
            self.selection_info_text = text.Text("Select one of your Fleets to apply upgrade", "big", V2(res.x / 2, res.y / 2), PICO_WHITE, multiline_width=180,shadow=PICO_BLACK, flash_color=PICO_YELLOW)
        elif cursor == "point":
            self.cursor_icon = SimpleSprite(V2(0,0), "assets/i-point-cursor.png")
            self.hover_filter = self.filter_only_ui
            self.selection_info_text = text.Text("Select a point", "big", V2(res.x / 2, res.y / 2), PICO_WHITE, multiline_width=180,shadow=PICO_BLACK, flash_color=PICO_YELLOW)
        elif cursor == "nearby":
            self.cursor_icon = SimpleSprite(V2(0,0), "assets/i-point-cursor.png")
            self.range = RangeIndicator(self.selected_targets[0].pos, self.NEARBY_RANGE, PICO_LIGHTGRAY)
            self.scene.ui_group.add(self.range)
            self.extras.append(self.range)
            self.hover_filter = self.filter_only_ui
            self.selection_info_text = text.Text("Select a point nearby", "big", V2(res.x / 2, res.y / 2), PICO_WHITE, multiline_width=180,shadow=PICO_BLACK, flash_color=PICO_YELLOW)

        self.cursor_icon.offset = (0.5, 0.5)
        self.cursor_icon._recalc_rect()
        self.scene.ui_group.add(self.cursor_icon)
        self.selection_info_text.offset = (0.5,0.5)
        self.selection_info_text.layer = 15    
        self.scene.ui_group.add(self.selection_info_text)                             
        self.scene.pause_sprite.set_exceptions([s for s in self.scene.game_group.sprites() if self.hover_filter(s)])