def __init__(self, scene): UIEnabledState.__init__(self, scene) self.pending_upgrade = None self.cursor_icon = None self.selection_info_text = None #self.back_button = None self.current_cursor = None
def enter(self): UIEnabledState.enter(self) self.panel = HelpPanel(V2(0, 0)) self.panel.add_all_to_group(self.scene.ui_group) self.panel.pos = V2(game.RES[0] / 2 - self.panel.width / 2, game.RES[1] / 2 - self.panel.height / 2) self.panel._reposition_children() self.panel.fade_in() self.scene.paused = True
def enter(self): self.scene.paused = True self.hover_filter = self.filter_only_panel_ui self.panel = OrderPanel(V2(0, 0), self.planet_from, self.planet_to, self.on_order) self.panel.position_nicely(self.scene) self.panel.add_all_to_group(self.scene.ui_group) self.panel.fade_in() self.arrow = OrderArrow() self.scene.ui_group.add(self.arrow) self.arrow.setup(self.planet_from, None, self.planet_to) sound.play("attackpanel") UIEnabledState.enter(self)
def enter(self): UIEnabledState.enter(self) self.selector = None # Selection object self.arrow = None # Order object self.current_panel = None self.mouse_pos = V2(0, 0) self.joy_controls_state = "default" self.joy_hover_filter = self.default_joy_hover_filter self.joy_arrow_from = None self.options_text = text.Text("", "small", V2(0, 0), PICO_PINK, multiline_width=200, shadow=PICO_BLACK, center=False) self.scene.ui_group.add(self.options_text)
def enter(self): self.scene.paused = True self.selected_targets = [] self.extras = [] self.panel = AnyUpgradePanel(V2(0,0), self.on_select) self.panel.add_all_to_group(self.scene.ui_group) self.panel.position_nicely(self.scene) self.hover_filter = self.filter_only_panel_ui return UIEnabledState.enter(self)
def start(self): self.group = pygame.sprite.LayeredDirty() self.game_group = pygame.sprite.LayeredDirty() self.ui_group = pygame.sprite.LayeredDirty() self.time = 0 galaxy = self.game.run_info.get_current_level_galaxy() self.galaxy = galaxy alien_code = galaxy['alien'] alien_obj = alien.ALIENS[alien_code] self.nametext = typewriter.Typewriter(alien_obj.title, "huge", V2(50, 31) + self.game.game_offset, multiline_width=500, center=False, time_offset = -1) self.group.add(self.nametext) self.group.add(typewriter.Typewriter("ALIEN FORCES", "big", V2(50, 15) + self.game.game_offset, PICO_LIGHTGRAY, multiline_width=300, center=False)) self.loading_text = Text("Loading...", "small", V2(game.RES[0] - 70, 326) + self.game.game_offset, center=False) self.loading_text.offset = (0.5, 0) self.group.add(self.loading_text) self.portrait = SimpleSprite(V2(50, 65) + self.game.game_offset, "assets/%sgraphic.png" % alien_code) pygame.draw.rect(self.portrait.image, PICO_BLACK, (0,0,self.portrait.width, self.portrait.height), 1) self.group.add(self.portrait) self.portrait.pos = (0,-1000) #self.portrait.visible = False self.tips = [] self.quote = None difficulty_width = 150 difficulty_pos = V2(game.RES[0] / 2 - difficulty_width / 2, 175) + self.game.game_offset if galaxy['difficulty'] > 1: difficulty_pos = V2(game.RES[0] * 0.3 - difficulty_width / 2, 215) + self.game.game_offset labels = ['Mining Rate', 'Attack Power', 'Tech Level'] images = ['econ', 'attack', 'tech'] elements = [] for i in range(3): pos = difficulty_pos + V2(0, i * 20) t = Text(labels[i], "small", pos + V2(60, 0), PICO_ORANGE) t.offset = (1,0) self.group.add(t) t.visible = False elements.append(t) maxelem = 5 if i == 2: maxelem = 3 for z in range(maxelem): f = FrameSprite(pos + V2(70 + z * 14, -3), "assets/enemystrength-%s.png" % images[i], 11) if z >= DIFFICULTY_VALUES[galaxy['difficulty']][i]: f.frame = 1 else: f.frame = 0 self.group.add(f) f.visible = False elements.append(f) self.tips.append(elements) if galaxy['difficulty'] > 1: tw = 150 if galaxy['difficulty'] < 3: i = 0 elif galaxy['difficulty'] < 6: i = 1 else: i = 2 tip = alien_obj.tips[i] x = game.RES[0] * 0.7 img = pygame.image.load(resource_path(tip[0])) s = SimpleSprite(V2(x, 165) + self.game.game_offset, img) s.offset = (0.5, 0) self.group.add(s) t = Text(tip[1], "small", V2(x - tw / 2, 240) + self.game.game_offset, multiline_width=tw, center=False) self.group.add(t) s.visible = False t.visible = False r = rectangle.Rectangle(V2(x - tw / 2, 169) + self.game.game_offset, (19, 11), PICO_YELLOW) t2 = Text("TIP", "small", V2(x - tw / 2 + 2, 171) + self.game.game_offset, PICO_BLACK) r.visible = False t2.visible = False self.group.add(r) self.group.add(t2) self.tips.append((r, t2)) self.tips.append((s, t)) else: self.quote = Text(alien_obj.get_quote(), "pixolde", V2(game.RES[0] / 2, 270) + self.game.game_offset, PICO_YELLOW, multiline_width=400) self.quote.offset = (0.5, 0) self.group.add(self.quote) self.quote.visible = False if galaxy['mods']: self.group.add(SimpleSprite(V2(61, 322) + self.game.game_offset, "assets/exclamation.png")) self.group.add(Text("DANGER", "small", V2(79, 320) + self.game.game_offset, PICO_YELLOW, multiline_width=400, center=False)) self.group.add(Text(MOD_STRINGS[galaxy['mods'][0]], "small", V2(79, 330) + self.game.game_offset, PICO_WHITE, multiline_width=400, center=False)) self.warnings = self.group.sprites()[-3:] for warning in self.warnings: warning.visible = False self.sm = Machine(UIEnabledState(self)) self.game.load_in_thread(self.load_level, self.on_loaded_level)
def __init__(self, scene, planet_from, planet_to, path=None): UIEnabledState.__init__(self, scene) self.planet_from = planet_from self.planet_to = planet_to self.path = path self.joystick_overlay = None
def __init__(self, scene): UIEnabledState.__init__(self, scene)
def enter(self): self.scene.paused = True self.selected_targets = [] self.extras = [] self.panel = None return UIEnabledState.enter(self)