def update_pricing(self): self.pricing_top = '' self.pricing_bottom = '' if self.game.user_settings['Standard']['Free Play'].startswith('Y'): self.pricing_top='FREE PLAY' else: self.pricing_top=str(audits.display(self.game,'general','creditsCounter')+" CREDITS") if audits.display(self.game,'general','creditsCounter') >0 or self.game.user_settings['Standard']['Free Play'].startswith('Y'): self.pricing_bottom = 'PRESS START' else: self.pricing_bottom = 'INSERT COINS'
def sw_start_active(self, sw): if self.game.user_settings['Standard']['Free Play'].startswith('Y') or audits.display(self.game,'general','creditsCounter') >0: if self.game.trough.is_full(): # Remove attract mode from mode queue self.game.modes.remove(self) # Initialize game if self.game.switches.flipperLwR.is_active(0.5): self.game.start_game(force_moonlight=True) else: self.game.start_game(force_moonlight=False) # Add the first player self.game.add_player() # Start the ball. This includes ejecting a ball from the trough. self.game.start_ball() #sounds for first player start self.game.sound.play_voice('uhoh_rain') #set the gi self.game.coils.upperPlayfieldGIOff.enable() #self.game.coils.lowerPlayfieldGIOff.disable() else: self.game.score_display.cancel_script() time = 5 self.game.score_display.set_text("LOOKING",0,'center',seconds=time) self.game.score_display.set_text("FOR BALLS",1,'center',seconds=time) self.game.ball_search.perform_search(time) self.delay(name='restart_attract_display', event_type=None, delay=time, handler=self.attract_display) else: self.show_pricing() return True
def start_game(self, force_moonlight=False): super(Game, self).start_game() # update game start audits self.start_time = time.time() # audits.record_value(self,'gameStarted') if self.user_settings["Machine (Standard)"]["Free Play"].startswith("N"): credits = audits.display(self, "general", "creditsCounter") audits.update_counter(self, "credits", credits - 1) # moonlight check - from Eric P of CCC fame # ----------------------------------------- # Check the time now = datetime.datetime.now() self.log.info("Hour:%s Minutes:%s", now.hour, now.minute) # subtract the window minutes from 60 window = 60 - self.moonlight_minutes self.log.info("Moonlight window time:%s", window) # check for moonlight - always works at straight up midnight if now.hour == 0 and now.minute == 0: self.moonlight_flag = True # If not exactly midnight - check to see if we're within the time window elif now.hour == 23 and now.minute >= window: self.moonlight_flag = True # if force was passed - start it no matter what elif force_moonlight: self.moonlight_flag = True else: self.moonlight_flag = False self.log.info("Moonlight Flag:%s", self.moonlight_flag)
def update_pricing(self): self.pricing_top = '' self.pricing_bottom = '' if self.game.user_settings['Machine (Standard)']['Free Play'].startswith('Y'): self.pricing_top='FREE PLAY' else: self.pricing_top=str(audits.display(self.game,'general','creditsCounter')+" CREDITS") if audits.display(self.game,'general','creditsCounter') >0 or self.game.user_settings['Machine (Standard)']['Free Play'].startswith('Y'): self.pricing_bottom = 'PRESS START' else: self.pricing_bottom = 'INSERT COINS' self.coins_top_layer = dmd.TextLayer(128/2, 6, self.game.fonts['num_09Bx7'], "center", opaque=True).set_text(self.pricing_top,color=dmd.BROWN) #self.coins_top_layer.transition = dmd.PushTransition(direction='north') self.coins_bottom_layer = dmd.TextLayer(128/2, 18, self.game.fonts['num_09Bx7'], "center", opaque=False).set_text(self.pricing_bottom,color=dmd.GREEN) #self.coins_bottom_layer.transition = dmd.PushTransition(direction='south') self.coins_layer = dmd.GroupedLayer(128, 32, [self.coins_top_layer, self.coins_bottom_layer])
def __init__(self, game, priority, font, big_font, section_key, itemlist): super(AuditDisplay, self).__init__(game, priority, font) self.name = itemlist['label'] #name of section is set as a label, so the key is seperate self.items = [] for item in sorted(itemlist.iterkeys()): if item!='label': self.log.info("Stats Item:"+str(item)) audit_value = audits.display(self.game,section_key,item) #calc the required value from the audits database. formating is also handled in the audits class self.items.append( AuditItem(str(itemlist[item]['label']).upper(), audit_value))
def generate_match(self): #create the match value for comparison value = (random.randint(0, self.value_range))*10 if value==0: display = "0"+str(value) else: display = str(value) #set text self.match_layer.set_text(display) #work out if player has matched digits and award as necassary for i in range(len(self.game.players)): if self.player_digits[i]==value: self.player_layers[i].set_text(digit,blink_frames=10) self.credits = audits.display(self.game,'general','creditsCounter') audits.update_counter(self.game,'credits',self.credits+1)
def coin_switch_handler(self, sw): self.credits = audits.display(self.game,'general','creditsCounter') audits.update_counter(self.game,'credits',self.credits+1) self.show_pricing() self.game.sound.play("coin")
def sw_leftCoinChute_active(self, sw): self.credits = audits.display(self.game,'general','creditsCounter') audits.update_counter(self.game,'credits',self.credits+1) self.show_pricing() self.game.sound.play("coin")