42 lines
972 B
Python
42 lines
972 B
Python
|
import pygame
|
||
|
from models.Object import Object
|
||
|
|
||
|
|
||
|
class Table(Object):
|
||
|
def __init__(self, square_size, screen_size, left_square, top_square):
|
||
|
super().__init__(
|
||
|
'table',
|
||
|
square_size,
|
||
|
screen_size,
|
||
|
left_square,
|
||
|
top_square
|
||
|
)
|
||
|
|
||
|
self.state = 'table'
|
||
|
|
||
|
def new_order(self):
|
||
|
self.state = 'order'
|
||
|
self.update_pic()
|
||
|
|
||
|
def wait_order(self):
|
||
|
self.state = 'wait'
|
||
|
self.update_pic()
|
||
|
|
||
|
def done_order(self):
|
||
|
self.state = 'done'
|
||
|
self.update_pic()
|
||
|
|
||
|
def reset_order(self):
|
||
|
self.state = 'table'
|
||
|
self.update_pic()
|
||
|
|
||
|
def is_order(self) -> bool:
|
||
|
return self.state == 'order'
|
||
|
|
||
|
def is_done(self) -> bool:
|
||
|
return self.state == 'done'
|
||
|
|
||
|
def update_pic(self):
|
||
|
self.image = pygame.transform.scale(pygame.image.load(
|
||
|
'images/{0}.png'.format(self.state)), (self.square_size, self.square_size))
|