class StatsDisplay(ServiceModeList): """Coil Test""" def __init__(self, game, priority, font, name, itemlist): super(StatsDisplay, self).__init__(game, priority, font) self.name = name self.value_layer = TextLayer(128/2, 22, font, "center") self.items = [] for item in sorted(itemlist.iterkeys()): if type(itemlist[item])==type({}): self.items.append( HighScoreItem(str(item), itemlist[item]['name'], itemlist[item]['score']) ) else: self.items.append( StatsItem(str(item), itemlist[item]) ) self.layer = GroupedLayer(128, 32, [self.title_layer, self.item_layer, self.value_layer]) def mode_started(self): super(StatsDisplay, self).mode_started() def change_item(self): super(StatsDisplay, self).change_item() try: self.item.score except: self.item.score = 'None' if self.item.score == 'None': self.value_layer.set_text(str(self.item.value)) else: self.value_layer.set_text(self.item.value + ": " + str(self.item.score)) def sw_enter_active(self, sw): return True
class ServiceModeSkeleton(Mode): """Service Mode List base class.""" def __init__(self, game, priority, font): super(ServiceModeSkeleton, self).__init__(game, priority) self.name = "" self.title_layer = TextLayer(1, 1, font, "left") self.item_layer = TextLayer(128/2, 12, font, "center") self.instruction_layer = TextLayer(1, 25, font, "left") self.layer = GroupedLayer(128, 32, [self.title_layer, self.item_layer, self.instruction_layer]) self.no_exit_switch = game.machine_type == 'sternWhitestar' def mode_started(self): self.title_layer.set_text(str(self.name)) self.game.sound.play('service_enter') def mode_stopped(self): self.game.sound.play('service_exit') def disable(self): pass def sw_down_active(self, sw): if self.game.switches.enter.is_active(): self.game.modes.remove(self) return True def sw_exit_active(self, sw): self.game.modes.remove(self) return True
class StatsDisplay(ServiceModeList): """Coil Test""" def __init__(self, game, priority, font, name, itemlist): super(StatsDisplay, self).__init__(game, priority, font) self.name = name self.value_layer = TextLayer(128/2, 22, font, "center") self.items = [] for item in itemlist: value = game.data[item["key"]] self.items.append( StatsItem(str(item["name"]).upper(), value) ) self.layer = GroupedLayer(128, 32, [self.title_layer, self.item_layer, self.value_layer]) def mode_started(self): super(StatsDisplay, self).mode_started() def change_item(self): super(StatsDisplay, self).change_item() try: self.item.score except: self.item.score = 'None' if self.item.score == 'None': self.value_layer.set_text(str(self.item.value)) else: self.value_layer.set_text(self.item.value + ": " + str(self.item.score)) def sw_serviceEnter_active(self, sw): return True
def __init__(self, game, priority, font): super(ServiceModeSkeleton, self).__init__(game, priority) self.name = "" self.title_layer = TextLayer(1, 1, font, "left") self.item_layer = TextLayer(128/2, 12, font, "center") self.instruction_layer = TextLayer(1, 25, font, "left") self.layer = GroupedLayer(128, 32, [self.title_layer, self.item_layer, self.instruction_layer]) self.no_exit_switch = game.machine_type == 'sternWhitestar'
def __init__(self, game, priority, font, name, itemlist): super(StatsDisplay, self).__init__(game, priority, font) self.name = name self.value_layer = TextLayer(128/2, 22, font, "center") self.items = [] for item in sorted(itemlist.iterkeys()): if type(itemlist[item])==type({}): self.items.append( HighScoreItem(str(item), itemlist[item]['name'], itemlist[item]['score']) ) else: self.items.append( StatsItem(str(item), itemlist[item]) ) self.layer = GroupedLayer(128, 32, [self.title_layer, self.item_layer, self.value_layer])
def __init__(self, game, priority, font, name, itemlist): super(SettingsEditor, self).__init__(game, priority, font) self.title_layer = TextLayer(1, 1, font, "left") self.item_layer = TextLayer(128/2, 12, font, "center") self.instruction_layer = TextLayer(1, 25, font, "left") self.no_exit_switch = game.machine_type == 'sternWhitestar' #self.title_layer.set_text('Settings') self.name = name self.items = [] self.value_layer = TextLayer(128/2, 19, font, "center") self.layer = GroupedLayer(128, 32, [self.title_layer, self.item_layer, self.value_layer, self.instruction_layer]) for item in sorted(itemlist.iterkeys()): #self.items.append( EditItem(str(item), itemlist[item]['options'], itemlist[item]['value'] ) ) if 'increments' in itemlist[item]: num_options = (itemlist[item]['options'][1]-itemlist[item]['options'][0]) / itemlist[item]['increments'] option_list = [] for i in range(0,num_options): option_list.append(itemlist[item]['options'][0] + (i * itemlist[item]['increments'])) self.items.append( EditItem(str(item), option_list, self.game.user_settings[self.name][item]) ) else: self.items.append( EditItem(str(item), itemlist[item]['options'], self.game.user_settings[self.name][item]) ) self.state = 'nav' self.stop_blinking = True self.item = self.items[0] self.value_layer.set_text(str(self.item.value)) self.option_index = self.item.options.index(self.item.value)
def __init__(self, game, priority, font, name, itemlist): super(StatsDisplay, self).__init__(game, priority, font) self.name = name self.value_layer = TextLayer(128/2, 22, font, "center") self.items = [] for item in itemlist: value = game.data[item["key"]] self.items.append( StatsItem(str(item["name"]).upper(), value) ) self.layer = GroupedLayer(128, 32, [self.title_layer, self.item_layer, self.value_layer])
class SettingsEditor(ServiceModeList): """Service Mode.""" def __init__(self, game, priority, font, name, itemlist): super(SettingsEditor, self).__init__(game, priority, font) self.title_layer = TextLayer(1, 1, font, "left") self.item_layer = TextLayer(128/2, 12, font, "center") self.instruction_layer = TextLayer(1, 25, font, "left") self.no_exit_switch = game.machine_type == 'sternWhitestar' #self.title_layer.set_text('Settings') self.name = name self.items = [] self.value_layer = TextLayer(128/2, 19, font, "center") self.layer = GroupedLayer(128, 32, [self.title_layer, self.item_layer, self.value_layer, self.instruction_layer]) for item in sorted(itemlist.iterkeys()): #self.items.append( EditItem(str(item), itemlist[item]['options'], itemlist[item]['value'] ) ) if 'increments' in itemlist[item]: num_options = (itemlist[item]['options'][1]-itemlist[item]['options'][0]) / itemlist[item]['increments'] option_list = [] for i in range(0,num_options): option_list.append(itemlist[item]['options'][0] + (i * itemlist[item]['increments'])) self.items.append( EditItem(str(item), option_list, self.game.user_settings[self.name][item]) ) else: self.items.append( EditItem(str(item), itemlist[item]['options'], self.game.user_settings[self.name][item]) ) self.state = 'nav' self.stop_blinking = True self.item = self.items[0] self.value_layer.set_text(str(self.item.value)) self.option_index = self.item.options.index(self.item.value) def mode_started(self): super(SettingsEditor, self).mode_started() def mode_stopped(self): self.game.sound.play('service_exit') def sw_enter_active(self, sw): if not self.no_exit_switch: self.process_enter() return True def process_enter(self): if self.state == 'nav': self.state = 'edit' self.blink = True self.stop_blinking = False self.delay(name='blink', event_type=None, delay=.3, handler=self.blinker) else: self.state = 'nav' self.instruction_layer.set_text("Change saved") self.delay(name='change_complete', event_type=None, delay=1, handler=self.change_complete) self.game.sound.play('service_save') self.game.user_settings[self.name][self.item.name]=self.item.value self.stop_blinking = True self.game.save_settings() def sw_exit_active(self, sw): self.process_exit() return True def process_exit(self): if self.state == 'nav': self.game.modes.remove(self) else: self.state = 'nav' self.value_layer.set_text(str(self.item.value)) self.stop_blinking = True self.game.sound.play('service_cancel') self.instruction_layer.set_text("Change cancelled") self.delay(name='change_complete', event_type=None, delay=1, handler=self.change_complete) def sw_up_active(self, sw): if self.game.switches.enter.is_inactive(): self.process_up() else: self.process_enter() return True def process_up(self): if self.state == 'nav': self.item.disable() if (self.iterator < self.max): self.iterator += 1 self.game.sound.play('service_next') self.change_item() else: if self.option_index < (len(self.item.options) - 1): self.option_index += 1 self.item.value = self.item.options[self.option_index] self.value_layer.set_text(str(self.item.value)) def sw_down_active(self, sw): if self.game.switches.enter.is_inactive(): self.process_down() else: self.process_exit() return True def process_down(self): if self.state == 'nav': self.item.disable() if (self.iterator > 0): self.iterator -= 1 self.game.sound.play('service_previous') self.change_item() else: if self.option_index > 0: self.option_index -= 1 self.item.value = self.item.options[self.option_index] self.value_layer.set_text(str(self.item.value)) def change_item(self): ctr = 0 for item in self.items: if ctr == self.iterator: self.item = item ctr += 1 self.max = ctr - 1 self.item_layer.set_text(self.item.name) self.value_layer.set_text(str(self.item.value)) self.option_index = self.item.options.index(self.item.value) def disable(self): pass def blinker(self): if self.blink: self.value_layer.set_text(str(self.item.value)) self.blink = False else: self.value_layer.set_text("") self.blink = True if not self.stop_blinking: self.delay(name='blink', event_type=None, delay=.3, handler=self.blinker) else: self.value_layer.set_text(str(self.item.value)) def change_complete(self): self.instruction_layer.set_text("")