Changeset 289

Show
Ignore:
Timestamp:
05/25/2012 02:19:37 PM (2 years ago)
Author:
andefodahl
Message:

Fixed messages

Location:
traintris
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • traintris/comments.py

    r286 r289  
    9797        comments["HumanFood"] = "Requires all \ncarnivores" 
    9898        comments["HumanPredators"] = "None" 
    99         comments["message11"] = "You cannot place organisms here." 
    100         comments["message12"] = "You clicked outside the gameboard!" 
    101         comments["message13"] = "Click inside the gameboard to place animals!" 
    102         comments["message21"] = "You cannot place that here." 
    103         comments["message22"] = "There is already something in this spot!" 
    104         comments["message23"] = "For more information about plants and animals check 'more info'." 
    105         comments["message31"] = "You cannot place organisms here." 
    106         comments["message32"] = "This terrain is unsuitable for organisms." 
    107         comments["message33"] = "For more information about plants and animals check 'more info'." 
    108         comments["message41"] = "Congratulations, you have successfully placed a plant!" 
    109         comments["message42"] = "Click another cell to place  the Grows in Winter and now it is the Grows in Summer!" 
    110         comments["message53"] = "Place an animal while you wait out this season!" 
    111         comments["message61"] = "Congratulations, you have more plants!" 
    112         comments["message43"] = "Or click the back arrow to access more animals" 
    113         comments["message51"] = "Sorry, you cant place a plant a this time" 
    114         comments["message52"] = "This plant can only grow inuccessfully placed a plant!" 
    115         comments["message62"] = "Click another cell to place more plants" 
    116         comments["message63"] = "Or click the back arrow to access more animals"  
    117         comments["message71"] = "Sorry, you cant place a plant a this time" 
    118         comments["message72"] = "There is not enough sunlight to have plant growth" 
    119         comments["message73"] = "Place an animal while you wait out this season!" 
    120         comments["message81"] = "You have not selected any organism" 
    121         comments["message82"] = "You clicked on the board without selecting an organism" 
    122         comments["message83"] = "Click on the panel to select an organism" 
    123         comments["message91"] = "Congratulations, you have successfully placed a " 
    124         comments["message92"] = "Click another cell to place more organisms" 
    125         comments["message93"] = "Or click the back arrow to access more options" 
    126         comments["message01"] = "There is not enough food at this location" 
    127         comments["message02"] = "Invalid organism placement" 
    128         comments["message03"] = "Please check the organisms feeding area and diet" 
     99        comments["offBoard"] = "You cannot place organisms here." 
     100        comments["offBoard2"] = "You clicked outside the gameboard!" 
     101        comments["offBoard3"] = "Click inside the gameboard to place animals!" 
     102        comments["full"] = "You cannot place that here." 
     103        comments["full2"] = "There is already something in this spot!" 
     104        comments["full3"] = "For more information about plants and animals check 'more info'." 
     105        comments["badSoil"] = "You cannot place organisms here." 
     106        comments["badSoil2"] = "This terrain is unsuitable for organisms." 
     107        comments["badSoil3"] = "For more information about plants and animals check 'more info'." 
     108        comments["wrongSeason1"] = "Sorry, you cant place that plant a this time" 
     109        comments["wrongSeason12"] = "That plant only grows in winter!" 
     110        comments["wrongSeason13"] = "Place an animal while you wait out this season!" 
     111        comments["wrongSeason2"] = "Sorry, you cant place a plant a this time" 
     112        comments["wrongSeason22"] = "That plant only grows in summer!" 
     113        comments["wrongSeason23"] = "Place an animal while you wait out this season!" 
     114        comments["selectAnimal"] = "You have not selected any organism" 
     115        comments["selectAnimal2"] = "You clicked on the board without selecting an organism" 
     116        comments["selectAnimal3"] = "Click on the panel to select an organism" 
     117        comments["noFood"] = "There is not enough\nfood at this location" 
     118        comments["noFood2"] = "Invalid organism\nplacement" 
     119        comments["noFood3"] = "Please check the \norganism's feeding area\nand diet" 
    129120         
    130121        self.comments = comments 
  • traintris/gameboard.py

    r287 r289  
    7979        return self.height 
    8080 
    81     def sendInfo(self, name): 
    82         index = self.web.lookup(name) 
    83         name = self.foodweb[index][0][0] 
    84         rang = self.foodweb[index][0][1] 
    85         description = self.comments[name + "Info"] 
    86         diet = self.comments[name + "Food"] 
    87         predators =  self.comments[name + "Predators"] 
    88          
    89         ev = InfoBoxEvent(name, description, diet, rang, predators) 
     81    def sendInfo(self, name, type = "message"): 
     82        if type == "organism": 
     83            index = self.web.lookup(name) 
     84            name1 = self.foodweb[index][0][0] 
     85            rang = self.foodweb[index][0][1] 
     86            description = self.comments[name + "Info"] 
     87            diet = self.comments[name + "Food"] 
     88            predators =  self.comments[name + "Predators"] 
     89        else: 
     90            name1 = self.comments[name] 
     91            description = self.comments[(name + "2")] 
     92            diet = self.comments[(name + "3")] 
     93            rang = "" 
     94            predators = "" 
     95         
     96        ev = InfoBoxEvent(name1, description, diet, rang, predators) 
    9097        self.evManager.Post(ev) 
    9198         
     
    112119        if row < self.numbers["size1"] or row > self.numbers["size2"] - 1 \ 
    113120        or column < self.numbers["size1"] or column > self.numbers["size2"] - 1: 
    114             ev = Message("You cannot place organisms here",  
    115                          "You clicked outside the gameboard",  
    116                          "Click inside the gameboard to place animals!", 
    117                          False, False) 
    118             self.evManager.Post(ev) 
    119             pygame.display.update() 
     121            self.sendInfo("offBoard") 
    120122            return 0 
    121123     
     
    182184        if row < self.numbers["size1"] or row > self.numbers["size2"] -1 \ 
    183185        or column < self.numbers["size1"] or column > self.numbers["size2"] - 1: 
    184             ev = Message(self.comments["message11"],  
    185                          self.comments["message12"],  
    186                          self.comments["message13"], 
    187                          False, False) 
    188             self.evManager.Post(ev) 
    189             pygame.display.update() 
    190186            return 1 
    191187     
    192188     
    193189        if self.grid[row][column].isFull(): 
    194             ev = Message(self.comments["message21"], 
    195                          self.comments["message22"], 
    196                          self.comments["message23"], 
    197                          False, False) 
    198             self.evManager.Post(ev) 
    199             pygame.display.update() 
     190            self.sendInfo("full") 
    200191            return 1 
    201192 
     
    204195        #Unusable Terrain 
    205196        if terrain == 3: 
    206             ev = Message(self.comments["message31"], 
    207                          self.comments["message32"], 
    208                          self.comments["message33"], 
    209                          False, False) 
    210             self.evManager.Post(ev) 
     197            self.sendInfo("badSoil") 
    211198            pygame.display.update() 
    212199            return 1 
     
    215202        if self.selectRange == 1: 
    216203            if self.day >= self.numbers["season1"] and self.day < self.numbers["season2"] + 1: 
    217                 if self.foodType[0] == "Light": 
    218                      
    219                     ev = Message(self.comments["message41"], 
    220                                  self.comments["message42"], 
    221                                  self.comments["message43"], 
    222                                  False, False) 
     204                if self.foodType[0] == "Light":            
    223205                    self.food = 1 
    224                     self.evManager.Post(ev) 
    225                     pygame.display.update()  
    226206                    if  terrain == 1: 
    227207                        return 2 
     
    229209                        return 3 
    230210                else: 
    231                     ev = Message(self.comments["message51"], 
    232                                  self.comments["message52"], 
    233                                  self.comments["message53"], 
    234                                  False, False) 
    235                     self.evManager.Post(ev) 
     211                    self.sendInfo("wrongSeason1") 
    236212                    pygame.display.update() 
    237213                    return 1 
     
    239215            elif self.day >= self.numbers["season2"] + 1 and self.day < self.numbers["season3"]: 
    240216                if self.foodType[0] == "Winter": 
    241                     ev = Message(self.comments["message61"], 
    242                                  self.comments["message62"], 
    243                                  self.comments["message63"], 
    244                                  False, False) 
    245217                    self.food = 1 
    246                     self.evManager.Post(ev) 
    247                     pygame.display.update() 
    248218                    if  terrain == 1: 
    249219                        return 2 
     
    251221                        return 3 
    252222                else: 
    253                     ev = Message(self.comments["message71"], 
    254                                  self.comments["message72"], 
    255                                  self.comments["message73"], 
    256                                  False, False) 
    257                     self.evManager.Post(ev) 
    258                     pygame.display.update() 
     223                    self.sendInfo("wrongSeason2") 
    259224                    return 1 
    260225                 
     
    263228        # Detects if you have not selected an organism yet 
    264229        if not hasattr(self, 'food'): 
    265             ev = Message(self.comments["message81"],  
    266                          self.comments["message82"], 
    267                          self.comments["message83"], 
    268                          False, False) 
    269             self.evManager.Post(ev) 
    270             pygame.display.update() 
     230            self.sendInfo("selectAnimal") 
    271231            return 1 
    272232 
     
    276236            self.grid[row][column].foodquota = self.foodneeded 
    277237            self.grid[row][column].foodtype = self.foodType 
    278             ev = Message(self.comments["message91"] + str(self.selectSpecies) + "!", 
    279                          self.comments["message92"], 
    280                          self.comments["message93"], 
    281                          False, False) 
    282             self.evManager.Post(ev) 
    283238            return 2 
    284239 
    285240 
    286241        else: 
    287             ev = Message(self.comments["message01"], 
    288                          self.comments["message02"], 
    289                          self.comments["message03"], 
    290                          False, False) 
    291             self.evManager.Post(ev) 
    292             pygame.display.update() 
     242            self.sendInfo("noFood") 
    293243            return 1 
    294244 
     
    442392         
    443393        if isinstance(event, InfoRequest): 
    444             self.sendInfo(event.name) 
     394            self.sendInfo(event.name, "organism") 
    445395             
    446396        if isinstance(event, ChangeTutorial):