예제 #1
0
 def want_to_leave_construction(self, u):
     ok = thorpy.launch_binary_choice("Leave construction ?")
     if ok:
         what, t, unit = self.game.constructions[u.is_building]
         self.game.constructions[u.is_building] = (what, t, None)
         u.is_building = None
         return True
예제 #2
0
 def reac_p(self):
     near = None
     if self.near_village:
         near = self.near_village
     elif self.near_camp:
         near = self.near_camp
     if near and not self.aboard and not (self.stock.food <
                                          parameters.CRITICAL_FOOD):
         if thorpy.launch_binary_choice(
                 "Wait in the " + near.name +
                 " until the next season / until the food level is critical ?"
         ):
             self.waiting = True
             while self.waiting:
                 ##                    self.reac_time()
                 self.wait()
                 self.stock.refood_from(near)
                 if self.stock.food < parameters.CRITICAL_FOOD:
                     thorpy.launch_alert(
                         "Your food level is critical...\n Waiting mod is now off."
                     )
                     break
     else:
         sounds.cannot.play()
         self.monitor.launch_failure_alert(
             "You need to be in a camp/village and to have enough food to wait !"
         )
예제 #3
0
def ask_save(me):
    choice = thorpy.launch_binary_choice("Do you want to save this map ?")
    default_fn = me.get_fn().replace(".map","")
    if choice:
        fn = thorpy.get_user_text("Filename", default_fn, size=(me.W//2,40))
        fn += ".map"
        to_file(me, fn)
    thorpy.functions.quit_menu_func()
예제 #4
0
 def choice_repair():
     cost = (self.ovessel.max_life - self.ovessel.life)*300
     if cost <= parameters.player.money:
         if thorpy.launch_binary_choice("Are you sure? This will cost "+\
                                         str(cost)+"$"):
             self.ovessel.life = self.ovessel.max_life
             parameters.player.money -= cost
             refresh_repair()
     elif thorpy.launch_binary_choice("Repairing costs "+str(cost)+\
                                     " $. You don't have enough money.\n"+\
                                     "Do you want to use all your money for"+\
                                     " repairing as much as possible?"):
             #(after_repair - self.ovessel.life)*300 = money
             #==> after_repair = money/300 + self.ovessel.life
             repaired = int(parameters.player.money/300. + self.ovessel.life)
             parameters.player.money -= (repaired - self.ovessel.life)*300
             self.ovessel.life = repaired
             refresh_repair()
     self.e_bckgr.blit()
     self.refresh_display()
     pygame.display.flip()
예제 #5
0
        def choice_refuel():
            cost = (self.ovessel.engine.max_fuel - self.ovessel.engine.fuel)//2
            if cost <= parameters.player.money:
                if thorpy.launch_binary_choice("Are you sure? This will cost "+\
                                                str(cost)+"$"):
                    self.ovessel.engine.fuel = self.ovessel.engine.max_fuel
                    parameters.player.money -= cost
                    refresh_refuel()
##                    self.e_fuel.set_life(1.)
##                    self.e_fuel.set_life_text("Fuel: 100 %")
##                    parameters.player.money -= cost
##                    self.e_money.set_text("Money: "+str(parameters.player.money)+" $")
##                    self.ovessel.engine.fuel = self.ovessel.engine.max_fuel
            elif thorpy.launch_binary_choice("Refueling costs "+str(cost)+" $. You don't have enough money.\n"+\
                                        "Do you want to spend all your money to refuel as much as possible?"):
                #cost = (newfuel - fuel)//2 ==> 2*cost + fuel = newfuel
                self.ovessel.engine.fuel += 2*parameters.player.money
                parameters.player.money = 0
                refresh_refuel()
##                thorpy.launch_blocking_alert("Refueling costs "+str(cost)+" $. You don't have enough money.")
            self.e_bckgr.blit()
            self.refresh_display()
            pygame.display.flip()
예제 #6
0
파일: gui.py 프로젝트: GarrettSocling/Torus
 def load(filename):
     thorpy.launch_blocking_choices("What do you want to do ?",
                                    [("Load", None), ("Delete", delete),
                                     ("Cancel", cancel_func)])
     if not Choice.value:
         game.savefile = filename
         thorpy.functions.quit_menu_func()
         thorpy.functions.quit_menu_func()
     else:
         if Choice.value == "del":
             if thorpy.launch_binary_choice("   Are you sure?   \n\n"):
                 os.remove(filename)
                 thorpy.functions.quit_menu_func()
         else:
             thorpy.get_screen().fill((255, 255, 255))
             frame.blit()
             pygame.display.flip()
예제 #7
0
 def quit_forever():
     if thorpy.launch_binary_choice("Are you sure ?"):
         thorpy.functions.quit_func()
     else:
         self.e_bckgr.unblit_and_reblit()
예제 #8
0
파일: gui.py 프로젝트: GarrettSocling/Torus
 def choice1():
     if thorpy.launch_binary_choice("Are you sure?"):
         Choice.choice = "a"
         thorpy.functions.quit_menu_func()
     else:
         box.unblit_and_reblit()
예제 #9
0
 def leave():
     if thorpy.launch_binary_choice("Are you sure?"):
         parameters.scene.abandon = True
         thorpy.functions.quit_menu_func()
     func()