39 lines
1.4 KiB
Python
39 lines
1.4 KiB
Python
import pygame
|
|
from Field import Field
|
|
from Global_variables import Global_variables as G_var
|
|
from Sectors_types import Sectors_types
|
|
from Types_colors import Types_colors
|
|
|
|
|
|
class Shelf(Field):
|
|
def __init__(self, window, x, y, type, sector):
|
|
Field.__init__(self, window, x, y)
|
|
self.type = type
|
|
self.color = Types_colors.get_shelf_color(type)
|
|
self.sector = sector
|
|
self.rect = pygame.Rect(self.x * G_var().RECT_SIZE, self.y *
|
|
G_var().RECT_SIZE, G_var().RECT_SIZE, G_var().RECT_SIZE)
|
|
|
|
|
|
|
|
def draw(self):
|
|
my_font = pygame.font.SysFont('Arial', 30)
|
|
self.rect = 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.rect)
|
|
text = self.choose_letter_acc_to_sector()
|
|
text_surface = my_font.render(text, False, (255, 255, 255))
|
|
self.window.blit(text_surface, (self.x * G_var().RECT_SIZE, self.y *
|
|
G_var().RECT_SIZE))
|
|
|
|
def choose_letter_acc_to_sector(self):
|
|
if self.sector == Sectors_types.normal:
|
|
letter = "N"
|
|
elif self.sector == Sectors_types.fragile:
|
|
letter = "F"
|
|
elif self.sector == Sectors_types.shipping_today:
|
|
letter = "T!"
|
|
else:
|
|
letter = "T"
|
|
return letter
|