Adam T - Final Projektu

This commit is contained in:
s444496 2020-06-15 13:14:46 +02:00
parent e6363ef448
commit a7d3f0b356

View File

@ -84,19 +84,23 @@ class Table(Drawable):
# self.__tableLock.release()
# return order
def get_order(self):
return self.__order
# def get_order(self):
# return self.__order
# def getOrder(self):
# order = None
# if self.__tableLock.acquire(False):
# try:
# if self.isStatus(Status.Ready) and self.hasOrder():
# order = self.__order
# self.setOrder([])
# finally:
# self.__tableLock.release()
# return order
def get_order(self):
order = None
if self.__tableLock.acquire(False):
try:
if self.isStatus(Status.Ready) and self.hasOrder():
# Generates order
order = []
for a in range(0, len(self.__guests)):
order.append(Tree_Builder.zgadnij(self.__zainteresowania[a], self.Decision_Tree))
print("Zamowienie: " + str(order))
self.setOrder([])
finally:
self.__tableLock.release()
return order
def setOrder(self, order):
self.__order = order
@ -111,7 +115,7 @@ class Table(Drawable):
self.__status = status
def __getImage(self, imageKind):
if imageKind in [Images.Guest1, Images.Guest2, Images.Guest3, Images.Plate, Images.Chicken]:
if imageKind in [Images.Guest1, Images.Guest2, Images.Guest3, Images.Plate]:
size = int(self.getCellSize() / 3)
else:
size = int(1.4 * self.getCellSize())
@ -164,15 +168,3 @@ class Table(Drawable):
screen.blit(imagePlate, (xBase + guest1XOffset, yBase + platesYOffset))
screen.blit(imagePlate, (xBase + guest2XOffset, yBase + platesYOffset))
screen.blit(imagePlate, (xBase + guest3XOffset, yBase + platesYOffset))
elif self.isStatus(Status.Served):
platesYOffset = int(0.3 * self.getCellSize())
imageChicken = self.__getImage(Images.Chicken)
if len(self.__guests) == 1:
screen.blit(imageChicken, (xBase + guest2XOffset, yBase + platesYOffset))
elif len(self.__guests) == 2:
screen.blit(imageChicken, (xBase + guest4XOffset, yBase + platesYOffset))
screen.blit(imageChicken, (xBase + guest5XOffset, yBase + platesYOffset))
elif len(self.__guests) == 3:
screen.blit(imageChicken, (xBase + guest1XOffset, yBase + platesYOffset))
screen.blit(imageChicken, (xBase + guest2XOffset, yBase + platesYOffset))
screen.blit(imageChicken, (xBase + guest3XOffset, yBase + platesYOffset))