Back to index

freevial  1.2
Public Member Functions | Public Attributes
roda.Roda Class Reference

Empaquetat en una classe del selector. More...

List of all members.

Public Member Functions

def __init__
def canviacat
def juguem

Public Attributes

 game
 fons
 front
 categories
 categoriesagafades
 maxim_equips
 roda_so_dot
 roda_so_dot_vol
 roda_so_evil
 roda_so_evil_vol
 roda_so_sub
 roda_so_sub_vol
 tipografia
 score_figureta_visible
 figureta
 paper
 so_dot
 so_evil
 so_sub
 so_cat
 so_de_pas
 tipografia_mida
 paper_text_width
 paper_text_offsetX
 paper_offsetX
 help_overlay
 help_on_screen
 frate
 nom_equip_sfc

Detailed Description

Empaquetat en una classe del selector.

Definition at line 42 of file roda.py.


Constructor & Destructor Documentation

def roda.Roda.__init__ (   self,
  game 
)

Definition at line 44 of file roda.py.

00044 
00045        def __init__( self, game ):
00046               
00047               self.game = game
00048               
00049               game.skin.set_domain( 'wheel' )
00050               
00051               self.fons = game.skin.configGet( 'wheel_background' )
00052               self.front = game.skin.configGet( 'wheel_front' )
00053 
00054               self.categories = []
00055               self.categoriesagafades = []
00056               self.maxim_equips = game.skin.configGetInt( 'max_teams', 'game' )
00057               
00058               self.roda_so_dot = game.skin.configGet( 'sound_wheel_dot')
00059               self.roda_so_dot_vol = game.skin.configGet( 'sound_wheel_dot_vol')
00060               self.roda_so_evil = game.skin.configGet( 'sound_wheel_evil')
00061               self.roda_so_evil_vol = game.skin.configGet( 'sound_wheel_evil_vol')
00062               self.roda_so_sub = game.skin.configGet( 'sound_wheel_sub')
00063               self.roda_so_sub_vol = game.skin.configGet( 'sound_wheel_sub_vol')
00064               self.tipografia = game.skin.configGet( 'wheel_tipografia')
00065               
00066               self.score_figureta_visible = game.skin.configGetBool( 'figureta_visible') 
00067               
00068               if self.score_figureta_visible:
00069                      self.figureta = game.skin.LoadImageRange( 'figureta_mask', 64, 2)
00070                      
00071               self.fons = game.skin.LoadImage( 'wheel_background' )
00072               self.front = game.skin.LoadImage( 'wheel_front' )
00073               self.paper = game.skin.LoadImage( 'wheel_paper')
00074               self.so_dot = game.skin.LoadSound( 'sound_wheel_dot', 'sound_wheel_dot_vol')
00075               self.so_evil = game.skin.LoadSound( 'sound_wheel_evil', 'sound_wheel_evil_vol')
00076               self.so_sub = game.skin.LoadSound( 'sound_wheel_sub', 'sound_wheel_sub_vol')
00077               self.so_cat = range(0, 6)
00078 
00079               self.so_de_pas = game.skin.configGetInt( 'so_de_pas' )
00080 
00081               self.tipografia_mida = game.skin.configGetInt( 'wheel_tipografia_mida')
00082               self.paper_text_width = game.skin.configGetInt( 'paper_text_width' )
00083               self.paper_text_offsetX = game.skin.configGetInt( 'paper_text_offsetX' )
00084               self.paper_offsetX = game.skin.configGetInt( 'paper_offsetX' )
00085 
00086               for num in range(0, 6):
00087                      self.so_cat[num] = loadSound(get_databases(num).sound, volume = 1.0)
00088               self.canviacat()                   
00089               self.help_overlay = createHelpScreen( 'roda' )          
00090               
00091               self.help_on_screen = helpOnScreen( HOS_RODA_ATURA  )
00092               self.help_on_screen.sec_timeout = 10
       

Member Function Documentation

def roda.Roda.canviacat (   self)

Definition at line 93 of file roda.py.

00093 
00094        def canviacat( self ):
00095               
00096               self.categoriesagafades = []
00097               for num in range (0, 6):
00098                      self.categoriesagafades += (get_databases(num).name)
00099                      
00100               if self.categoriesagafades != self.categories:
00101                      self.categories = self.categoriesagafades
00102 
00103                      self.paper = self.game.skin.LoadImage( 'wheel_paper' )
00104                      for num in range(0, 6):
00105                             sfc = self.game.skin.render_text( get_databases(num).name, (0,0,0), self.tipografia_mida, 1, self.tipografia, self.paper_text_width );
00106                             self.paper.blit( sfc, (self.paper_text_offsetX+2, 2+(num * 200) + 100 - sfc.get_height() / 2 ))
00107                             sfc = self.game.skin.render_text( get_databases(num).name, colorsCategories()[num], self.tipografia_mida, 1, self.tipografia, self.paper_text_width );
00108                             self.paper.blit( sfc, (self.paper_text_offsetX, (num * 200) + 100 - sfc.get_height() / 2 ))
       

Here is the call graph for this function:

Here is the caller graph for this function:

def roda.Roda.juguem (   self)

Definition at line 109 of file roda.py.

00109 
00110        def juguem( self ):
00111               
00112               self.game.skin.set_domain( 'wheel' )
00113 
00114               self.canviacat()
00115 
00116               self.frate = frameRate( Global.fps_limit )
00117                             
00118               self.so_evil.stop()
00119               self.so_dot.play(100)
00120               
00121               velocitat = self.game.skin.configGetInt( 'wheel_speed' )
00122               deceleracio = 0
00123 
00124               waitForMouseRelease( )
00125                      
00126               pos = pos_fons = atura = frenant = time_fi = mostra_ajuda = mostra_credits = 0
00127               rodant = 1
00128               resultat = -1
00129               
00130               self.game.screen.blit( self.fons, (0,0) )
00131 
00132               self.nom_equip_sfc = self.game.skin.render_text( self.game.teams[self.game.current_team].nom, self.game.skin.configGetRGB( "team_name_color" ), 30, 1 )
00133               self.nom_equip_sfc = pygame.transform.rotate ( self.nom_equip_sfc, 90 )
00134 
00135               while 1:
00136 
00137                      for event in pygame.event.get():
00138 
00139                             eventhandle = EventHandle(event)
00140                             if eventhandle.handled: continue
00141                             
00142                             #self.help_on_screen.activitat(event)
00143                             
00144                             if eventhandle.keyUp('ESCAPE', 'q') and not Global.LOCKED_MODE:
00145                                    if not mostra_ajuda and not mostra_credits:
00146                                           if not (Global.MUSIC_MUTE or Global.SOUND_MUTE):
00147                                                  pygame.mixer.fadeout(500)
00148                                           return -1
00149                                    else:
00150                                           mostra_ajuda = mostra_credits = 0
00151                             
00152                             if eventhandle.keyUp('F1', 'h'):
00153                                    mostra_ajuda ^= 1    
00154                                    mostra_credits = 0                 
00155 
00156                             if eventhandle.keyUp('F2'):
00157                                    mostra_credits ^= 1
00158                                    mostra_ajuda = 0
00159                             
00160                             if  eventhandle.isRelease('primary') or eventhandle.keyUp('RETURN', 'SPACE', 'KP_ENTER') and rodant == 1:
00161                                    if resultat == -1:   
00162                                           atura = 1
00163                                    else:
00164                                           return resultat
00165                      
00166                      if atura == 1:
00167                             atura = 0
00168                             pas = 3
00169                             deceleracio = self.game.skin.configGetInt( 'wheel_deccel' )
00170                             time_fi = time.time()
00171                             
00172                             if not frenant:
00173                                    frenant = 1
00174                                    self.so_sub.play()
00175 
00176                      if time_fi != 0 and time.time() - time_fi > 2.5:
00177                             return resultat
00178 
00179                      # decelerem
00180                      velocitat -= deceleracio
00181                      if velocitat < 0: velocitat = 0
00182                      
00183                      # Si ja hem acabat de rodar afinem la selecció
00184                      # a l'element més proper
00185                      rpos = pos + 100
00186                      if velocitat == 0 and rodant != 0:
00187                             offset = int(rpos) % 200
00188                             if offset != 0: 
00189                                    if offset > 100:
00190                                           pos += deceleracio if ( offset < (200 - deceleracio) ) else 1
00191                                    
00192                                    elif offset <= 100:
00193                                           pos -= deceleracio if ( offset > deceleracio ) else 1
00194                                    
00195                                           if pos <= -1200: pos += 1200
00196                             
00197                             else:
00198                                    resultat = int( ( ( - ( pos - 1550 ) / 200 ) ) % 6 )
00199                                    self.so_dot.stop()
00200                                    self.so_cat[ resultat].play()
00201                                    if self.so_de_pas == 1:
00202                                           self.so_evil.play()
00203                                    if self.so_de_pas == 2:
00204                                           if not  self.game.teams[self.game.current_team].teCategoria( resultat ) :
00205                                                  self.so_evil.play()
00206                                    rodant = 0
00207                             
00208                      if rodant == 1:
00209                             pos_fons += velocitat * 2
00210                             if pos_fons >= 768:  pos_fons -= 768
00211                             
00212                             pos -= velocitat
00213                             if pos <= -1200: pos += 1200
00214                             
00215 
00216                      #pintem el paper freevial
00217                      self.game.screen.blit( self.fons, ( 0, pos_fons ) )
00218                      self.game.screen.blit( self.fons, ( 0, - 768 + pos_fons ) )
00219                      
00220                      #pintem el paper d'impressora
00221                      self.game.screen.blit( self.paper, ( self.paper_offsetX, pos ) )
00222                      self.game.screen.blit( self.paper, ( self.paper_offsetX, pos + 1200 ) )
00223                      
00224                      #pintem els marges vermells i degradats
00225                      self.game.screen.blit( self.front, (0,0) )       
00226                      
00227                      self.game.screen.blit( self.nom_equip_sfc, (20, 748 - self.nom_equip_sfc.get_height()))
00228                      
00229                      if( self.score_figureta_visible ):
00230                             self.game.screen.blit( self.figureta[self.game.teams[self.game.current_team].figureta], (70, 630) )
00231                                           
00232                      if mostra_ajuda: self.game.screen.blit( self.help_overlay, (0,0))
00233                      if mostra_credits: self.game.screen.blit( self.game.sfc_credits, (0,0))
00234 
00235                      self.help_on_screen.draw( self.game.screen, (350, 740) )
00236                      
00237                      self.frate.next( self.game.screen )
00238                      
00239                      # Exchange self.game.screen buffers
00240 
00241                      pygame.display.flip()

Here is the call graph for this function:


Member Data Documentation

Definition at line 53 of file roda.py.

Definition at line 54 of file roda.py.

Definition at line 68 of file roda.py.

Definition at line 50 of file roda.py.

Definition at line 115 of file roda.py.

Definition at line 51 of file roda.py.

Definition at line 46 of file roda.py.

Definition at line 90 of file roda.py.

Definition at line 88 of file roda.py.

Definition at line 55 of file roda.py.

Definition at line 131 of file roda.py.

Definition at line 72 of file roda.py.

Definition at line 83 of file roda.py.

Definition at line 82 of file roda.py.

Definition at line 81 of file roda.py.

Definition at line 57 of file roda.py.

Definition at line 58 of file roda.py.

Definition at line 59 of file roda.py.

Definition at line 60 of file roda.py.

Definition at line 61 of file roda.py.

Definition at line 62 of file roda.py.

Definition at line 65 of file roda.py.

Definition at line 76 of file roda.py.

Definition at line 78 of file roda.py.

Definition at line 73 of file roda.py.

Definition at line 74 of file roda.py.

Definition at line 75 of file roda.py.

Definition at line 63 of file roda.py.

Definition at line 80 of file roda.py.


The documentation for this class was generated from the following file: