예제 #1
0
 def go(self,screen):
     if screen=="about":
         cnt=BoxLayout(padding=0,spacing=0)
         lbl=Label(text="  [size=20]pyPuzzle Game[/size]\n\nSimple fun memory game\n\n"
                        "Match simple jelly images\n\nEnter your scores.\n\n"
                        "www.yahyakesenek.com @2016",markup=True)
         cnt.add_widget(lbl)
         modal=ModalView(size_hint=(0.7,0.5),background_color=get_color_from_hex("#ff7373"))
         modal.add_widget(cnt)
         modal.open()
         modal.x=self.root.x-modal.width-10
         anim=Animation(center_x=self.root.center_x,center_y=self.root.center_y,d=2,t="out_expo")
         anim.start(modal)
         return
     if screen=="settings":
         cnt=BoxLayout()
         lbl=Label(text="Set Sound Volume :")
         sld=Slider(max=100,min=0,value=25)
         sld.bind(value=self.value_change)
         cnt.add_widget(lbl);cnt.add_widget(sld)
         modal=ModalView(size_hint=(0.8,0.2),background_color=get_color_from_hex("#ff7373"))
         modal.add_widget(cnt)
         modal.open()
         modal.x=self.root.x+modal.width+10
         anim=Animation(center_x=self.root.center_x,center_y=self.root.center_y,d=2,t="out_expo")
         anim.start(modal)
         self.sld=sld
         return
     if screen=="exit":
         cnt=BoxLayout(size_hint=(0.8,0.5),padding=4,spacing=5)
         lbl=Label(text="[size=35][color=#ae5a41]Quit?[/color][/size]",markup=True)
         btnyes=Button(text="Yes")
         btnno=Button(text="No")
         modal=ModalView(size_hint=(0.8,0.2))
         def quit(inst):
             exit()
         def cancel(inst):
             if modal:
                 modal.dismiss()
                 if self.root.current=="game_screen":
                     self.root.current_screen.newGame()
         btnyes.bind(on_release=quit)
         btnno.bind(on_release=cancel)
         cnt.add_widget(lbl)
         cnt.add_widget(btnyes)
         cnt.add_widget(btnno)
         modal.add_widget(cnt)
         modal.open()
         return
     if screen=="end_screen":
         self.level=1
     self.root.current=screen
     if self.root.current=="main_screen":
         if self.snd.state=="stop":
             self.snd.play()
     else:
         self.snd.stop()