示例#1
0
 def advance(self):
     # advances to next research age...
     self.research.advance()
     if self.websocket != None:
         self.sendMessage(createMessage('updateResources',data=template('tpl/page_chunks/resourcebar',user=self)))
         return True
     else:
         print 'no websocket connected to user ',self.name
示例#2
0
 def advance(self):
     # advances to next research age...
     self.research.advance()
     if self.websocket != None:
         self.sendMessage(
             createMessage('updateResources',
                           data=template('tpl/page_chunks/resourcebar',
                                         user=self)))
         return True
     else:
         print 'no websocket connected to user ', self.name
示例#3
0
    def payFor(self, bal):
        # deducts item cost from resources,
        # returns true if purchase is sucessful 
        # assumes that user can afford item
            
        self.resources.applyBalance(bal)

        if self.websocket is not None:
            self.sendMessage(createMessage('updateResources', data=str(self.get_resource_balance_dict())))
            return True
        else:
            print 'no websocket connected to user ', self.name
示例#4
0
 def payFor(self,bal):
     # deducts item cost from resources,
     # returns true if purchase is sucessful 
     # assumes that user can afford item
         
     self.resources.applyBalance(bal)
     
     if self.websocket != None:
         self.websocket.send(createMessage('updateResources',data=template('tpl/page_chunks/resourcebar',user=self)))
         return True
     else:
         print 'no websocket connected to user ',self.name
示例#5
0
    def payFor(self, bal):
        # deducts item cost from resources,
        # returns true if purchase is sucessful
        # assumes that user can afford item

        self.resources.applyBalance(bal)

        if self.websocket is not None:
            self.sendMessage(
                createMessage('updateResources',
                              data=str(self.get_resource_balance_dict())))
            return True
        else:
            print 'no websocket connected to user ', self.name
示例#6
0
 def signOut(self):
     self.disconnected = True
     self.sendMessage(createMessage("Signout", "None"))