2022-03-24 20:02:21 +01:00
|
|
|
import pygame
|
2022-04-25 17:26:32 +02:00
|
|
|
from Field import Field
|
2022-04-20 18:27:24 +02:00
|
|
|
from Global_variables import Global_variables as G_var
|
2022-04-25 17:26:32 +02:00
|
|
|
from Package_types import Package_types
|
2022-03-24 20:02:21 +01:00
|
|
|
|
2022-04-25 17:26:32 +02:00
|
|
|
|
|
|
|
class Shelf(Field):
|
|
|
|
def __init__(self, window, x, y, type):
|
|
|
|
Field.__init__(self, window, x, y)
|
|
|
|
self.type = type
|
|
|
|
self.color = self.get_shelf_color(self.type)
|
|
|
|
self.block = pygame.Rect(self.x * G_var().RECT_SIZE, self.y *
|
|
|
|
G_var().RECT_SIZE, G_var().RECT_SIZE, G_var().RECT_SIZE)
|
2022-03-24 20:02:21 +01:00
|
|
|
|
|
|
|
def draw(self):
|
2022-04-25 17:26:32 +02:00
|
|
|
self.block = pygame.Rect(self.x * G_var().RECT_SIZE, self.y *
|
|
|
|
G_var().RECT_SIZE, G_var().RECT_SIZE, G_var().RECT_SIZE)
|
|
|
|
pygame.draw.rect(self.window, self.color, self.block)
|
|
|
|
|
|
|
|
def get_shelf_color(self, shelf_type):
|
|
|
|
color = (143, 68, 33)
|
|
|
|
if shelf_type == Package_types.fragile:
|
|
|
|
color = (191, 35, 15)
|
|
|
|
elif shelf_type == Package_types.priority:
|
|
|
|
color = (33, 46, 140)
|
|
|
|
return color
|