39 lines
798 B
Python
39 lines
798 B
Python
import pygame
|
|
|
|
|
|
class Shelf:
|
|
|
|
def __init__(self, field, color):
|
|
self.field = field
|
|
self.color = color
|
|
self.level1 = []
|
|
self.level2 = []
|
|
self.level3 = []
|
|
|
|
|
|
def add_product(self, product):
|
|
if product[7] == 1:
|
|
self.level1.append(product)
|
|
elif product[7] == 2:
|
|
self.level2.append(product)
|
|
else:
|
|
self.level3.append(product)
|
|
|
|
def get_field(self):
|
|
|
|
return self.field
|
|
|
|
def get_color(self):
|
|
return self.color
|
|
|
|
def levels(self):
|
|
r = ''
|
|
str = [0, 0, 0]
|
|
if len(self.level1) > 0:
|
|
str[0] = 1
|
|
if len(self.level2) > 0:
|
|
str[1] = 1
|
|
if len(self.level1) > 0:
|
|
str[2] = 1
|
|
r.join(str)
|
|
return r |