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 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")