Exemple #1
0
    def updateCard(self, card, id, desc, type):
        if isinstance(card, cardFactory.ColorCard):

            cardManager.CardManager().editCard(card, id, desc)
            print("Updated Color Card")
        elif isinstance(card, cardFactory.StudentCard):
            cardManager.CardManager().editCard(card, id, desc)
            print("Updated Student Card")
        else:
            print("method for this type of card not programmed")
Exemple #2
0
def main():

        
        
        # Initialize all singeltons
        gameController.GameController()                             # initialize Game Controller
        rFIDReader.RFIDReader()                                     # open serial interface manager
        cardFactory.CardFactory()                                   # initialize card factory manager
        cardManager.CardManager()                                   # initialize card manager

        
        gamePlayModes.GamePlayManager().setGamePlayMode(0)          # activate game play mode "simple"
        cardManager.CardManager().loadConfiguration()               # load config from pickle to card manager
        
        app = mainGUI.MainGui()                                     # start gui
        app.pack()
        app.master.title("ReaFID")
        app.mainloop()
Exemple #3
0
    def getRandomDescription(self):
        ''' get description of the matching card to update the MainGUI '''
        randomNumber = (GameLogic.getRandomNumber(self) - 1)
        print("random Color Number", randomNumber)

        card = cardManager.CardManager().getCardByNumber(randomNumber)
        checkType = type(
            cardManager.CardManager().getCardByNumber(randomNumber))
        #        print ("typ: " ,checkType)
        if (isinstance(card, cardFactory.ColorCard)):
            #            print("getRandomDescription: Color true")
            receivedCard = card.getColor()
        else:
            #            print("getRandomDescription: Color false")
            receivedCard = card.getName()
        return receivedCard


#GameLogic()
Exemple #4
0
 def getRandomNumber(self):
     ''' select a random number - but only  valid in the range of available cards '''
     cardArraySize = cardManager.CardManager().getSizeCardArray()
     #        print ("cardArraySize:", cardArraySize)
     if (cardArraySize != 0):
         validRandomNumber = random.randint(1, cardArraySize)
         #            print ("validRandomNumber:", validRandomNumber)
         return validRandomNumber
     else:
         print("Card Manager is still empty")
Exemple #5
0
    def test_openMainGUI(self):
        #        self.myController

        rFIDReader.RFIDReader()
        gamePlayModes.GamePlayManager().setGamePlayMode(0)
        cardFactory.CardFactory()
        myCardManager = cardManager.CardManager()
        myCardManager.loadConfiguration()

        app = mainGUI.MainGui()
        app.pack()
        app.master.title("ReaFID")
        app.mainloop()
Exemple #6
0
 def setUp(self):
     self.myCardFactory = cardFactory.CardFactory()
     self.card1 = self.myCardFactory.createCard("Color")
     self.card2 = self.myCardFactory.createCard("Color")
     self.card3 = self.myCardFactory.createCard("Color")
     self.card1.setColor("Red")
     self.card2.setColor("Blue")
     self.card3.setColor("Green")
     self.card1.setID("AD B8 57 94")
     self.card2.setID("B2 FB 30 E9")
     self.card3.setID("8D F4 61 94")
     self.myCardManager = cardManager.CardManager()
     self.myCardManager.addCard(self.card1)
     self.myCardManager.addCard(self.card2)
     self.myCardManager.addCard(self.card3)
Exemple #7
0
 def deleteCard(self, card):
     cardManager.CardManager().removeCard(card)
Exemple #8
0
 def getCardManager(self):
     return cardManager.CardManager()
Exemple #9
0
 def test_getCard(self):
     self.myCardManager = cardManager.CardManager()
     self.foundCard = self.myCardManager.getCardByID("AD B8 57 94")
     self.assertTrue(type(self.foundCard))
Exemple #10
0
    def test_loadStoredConfiguration(self):
        self.myCardManager = cardManager.CardManager()
        self.myCardManager.loadConfiguration()
        self.myCardManager.outputCards()

        self.assertEqual(self.myCardManager.getSizeCardArray(), 3)
Exemple #11
0
 def tearDown(self):
     cardManager.CardManager().getEmptyManager(self.myCardManager)