Tytuł krótki
This commit is contained in:
parent
785f3cbd31
commit
e9d06336df
Binary file not shown.
@ -2,7 +2,7 @@
|
|||||||
<module type="PYTHON_MODULE" version="4">
|
<module type="PYTHON_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$" />
|
<content url="file://$MODULE_DIR$" />
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="jdk" jdkName="Python 3.7 (kelner)" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
<component name="TestRunnerService">
|
<component name="TestRunnerService">
|
||||||
|
@ -1,16 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="4be2149b-d9bc-4e21-8365-293320ae7f92" name="Default Changelist" comment="">
|
<list default="true" id="4be2149b-d9bc-4e21-8365-293320ae7f92" name="Default Changelist" comment="stoły mają 4 stany. Status gotowy do złożenia zamówienia ustawiany jest w nowym wątku w klasie TaskManager co 3 sekundy dla jednego stolika, kelner moze odbierać zamówienia od stolików gotowych do ich złożenia">
|
||||||
<change afterPath="$PROJECT_DIR$/images/srcWaiter.png" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/managers/MenuManager.py" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/managers/TaskManager.py" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/components/Drawable.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/Drawable.py" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/components/Table.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/Table.py" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/components/Waiter.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/Waiter.py" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/managers/DrawableCollection.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/managers/DrawableCollection.py" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
@ -36,7 +28,8 @@
|
|||||||
<property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
|
<property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
|
||||||
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
||||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||||
<property name="settings.editor.selected.configurable" value="settings.github" />
|
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||||
|
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
|
||||||
</component>
|
</component>
|
||||||
<component name="RecentsManager">
|
<component name="RecentsManager">
|
||||||
<key name="MoveFile.RECENT_KEYS">
|
<key name="MoveFile.RECENT_KEYS">
|
||||||
@ -115,6 +108,11 @@
|
|||||||
<workItem from="1586089047557" duration="6590000" />
|
<workItem from="1586089047557" duration="6590000" />
|
||||||
<workItem from="1586098345503" duration="112000" />
|
<workItem from="1586098345503" duration="112000" />
|
||||||
<workItem from="1586098478408" duration="902000" />
|
<workItem from="1586098478408" duration="902000" />
|
||||||
|
<workItem from="1586110377593" duration="1935000" />
|
||||||
|
<workItem from="1586119136965" duration="6415000" />
|
||||||
|
<workItem from="1586171095013" duration="3851000" />
|
||||||
|
<workItem from="1586175311822" duration="1170000" />
|
||||||
|
<workItem from="1586177130146" duration="43000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="klasa kelner">
|
<task id="LOCAL-00001" summary="klasa kelner">
|
||||||
<created>1584889744892</created>
|
<created>1584889744892</created>
|
||||||
@ -182,8 +180,8 @@
|
|||||||
<breakpoints>
|
<breakpoints>
|
||||||
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
||||||
<url>file://$PROJECT_DIR$/src/managers/DrawableCollection.py</url>
|
<url>file://$PROJECT_DIR$/src/managers/DrawableCollection.py</url>
|
||||||
<line>69</line>
|
<line>71</line>
|
||||||
<option name="timeStamp" value="6" />
|
<option name="timeStamp" value="8" />
|
||||||
</line-breakpoint>
|
</line-breakpoint>
|
||||||
</breakpoints>
|
</breakpoints>
|
||||||
<default-breakpoints>
|
<default-breakpoints>
|
||||||
@ -196,6 +194,6 @@
|
|||||||
</breakpoint-manager>
|
</breakpoint-manager>
|
||||||
</component>
|
</component>
|
||||||
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
||||||
<SUITE FILE_PATH="coverage/kelner$main.coverage" NAME="main Coverage Results" MODIFIED="1586100415912" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
<SUITE FILE_PATH="coverage/kelner$main.coverage" NAME="main Coverage Results" MODIFIED="1586177139696" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -7,14 +7,15 @@ from src.components.Table import Table
|
|||||||
from src.managers.TaskManager import TaskManager
|
from src.managers.TaskManager import TaskManager
|
||||||
|
|
||||||
#create screen consts
|
#create screen consts
|
||||||
CellSize = 50 #pixel size of 1 square cell in the grid
|
CellSize = 100 #pixel size of 1 square cell in the grid
|
||||||
GridCountX = 15 #number of columns in grid
|
GridCountX = 15 #number of columns in grid
|
||||||
GridCountY = 11 #number of rows in grid
|
GridCountY = 9 #number of rows in grid
|
||||||
ScreenWidth = CellSize * GridCountX #screen width in pixels
|
ScreenWidth = CellSize * GridCountX #screen width in pixels
|
||||||
ScreenHeight = CellSize * GridCountY #screen height in pixels
|
ScreenHeight = CellSize * GridCountY #screen height in pixels
|
||||||
|
Offset = 50
|
||||||
|
|
||||||
#initialize background
|
#initialize background
|
||||||
gridBoard = GridBoard(ScreenWidth, ScreenHeight, CellSize)
|
gridBoard = GridBoard(ScreenWidth+200, ScreenHeight+200, CellSize)
|
||||||
|
|
||||||
#initialize drawable objects manager
|
#initialize drawable objects manager
|
||||||
drawableManager = DrawableCollection()
|
drawableManager = DrawableCollection()
|
||||||
|
@ -9,6 +9,7 @@ class GridBoard:
|
|||||||
self.__height = height
|
self.__height = height
|
||||||
self.__cellSize = cellSize
|
self.__cellSize = cellSize
|
||||||
self.__screen = pygame.display.set_mode((width, height)) # initialize screen
|
self.__screen = pygame.display.set_mode((width, height)) # initialize screen
|
||||||
|
self.Offset = 50
|
||||||
|
|
||||||
#fills the screen with white and draws grid
|
#fills the screen with white and draws grid
|
||||||
def reinitialize(self):
|
def reinitialize(self):
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import pygame
|
import pygame
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from .Drawable import Drawable
|
from .Drawable import Drawable
|
||||||
|
import random
|
||||||
|
|
||||||
class Table(Drawable):
|
class Table(Drawable):
|
||||||
|
|
||||||
@ -9,24 +10,71 @@ class Table(Drawable):
|
|||||||
Drawable.__init__(self, 0, 0, minX, maxX, minY, maxY, ratio)
|
Drawable.__init__(self, 0, 0, minX, maxX, minY, maxY, ratio)
|
||||||
self.__order = []
|
self.__order = []
|
||||||
self.__status = Status.NotReady
|
self.__status = Status.NotReady
|
||||||
|
self.ilosc_klientow = random.randint(1,3)
|
||||||
|
self.guest1 = self.getGuest()
|
||||||
|
self.guest2 = self.getGuest()
|
||||||
|
self.guest3 = self.getGuest()
|
||||||
|
self.ksiazka = self.__loadImg('./images/ksiazka.png')
|
||||||
|
self.stol = self.__loadImg('./images/stol.png')
|
||||||
|
self.check = self.__loadImg('./images/check.png')
|
||||||
|
self.plate = self.__loadImg('./images/plate.png')
|
||||||
|
self.Offset = 100
|
||||||
|
|
||||||
#sets table color based on it's status
|
#sets table color based on it's status
|
||||||
def getColor(self):
|
def getColor(self):
|
||||||
color = None
|
color = None
|
||||||
if self.__status == Status.NotReady:
|
if self.__status == Status.NotReady:
|
||||||
color = self.GREY
|
color = self.__loadImg('./images/stol.png')
|
||||||
elif self.__status == Status.Ready:
|
elif self.__status == Status.Ready:
|
||||||
color = self.YELLOW
|
color = self.__loadImg('./images/kelner.png')
|
||||||
elif self.__status == Status.Waiting:
|
elif self.__status == Status.Waiting:
|
||||||
color = self.RED
|
color = self.__loadImg('./images/kelner.png')
|
||||||
elif self.__status == Status.Served:
|
elif self.__status == Status.Served:
|
||||||
color = self.GREEN
|
color = self.__loadImg('./images/kelner.png')
|
||||||
return color
|
return color
|
||||||
|
|
||||||
|
def getGuest(self):
|
||||||
|
guest = None
|
||||||
|
i = random.randint(1,3)
|
||||||
|
if i == 1:
|
||||||
|
guest = self.__loadImg('./images/wiking_blond.png')
|
||||||
|
elif i == 2:
|
||||||
|
guest = self.__loadImg('./images/wiking_rudy.png')
|
||||||
|
elif i == 3:
|
||||||
|
guest = self.__loadImg('./images/wiking_rudy2.png')
|
||||||
|
return guest
|
||||||
|
|
||||||
|
def __loadImg(self, filePath):
|
||||||
|
return pygame.transform.scale((pygame.image.load(filePath)),(140,140))
|
||||||
|
|
||||||
def draw(self, screen):
|
def draw(self, screen):
|
||||||
pygame.draw.circle(screen, self.getColor(), ((self.getX() * self.getRatio()) + (self.getRatio() // 2),
|
screen.blit(self.stol, (self.getX() * 100-20+self.Offset, self.getY() * 100-20+self.Offset))
|
||||||
(self.getY() * self.getRatio()) + (self.getRatio() // 2)),
|
if self.ilosc_klientow == 1:
|
||||||
(self.getRatio() // 3))
|
screen.blit(self.guest1, (self.getX() * 100 - 20+self.Offset, self.getY() * 100 - 60+self.Offset))
|
||||||
|
elif self.ilosc_klientow == 2:
|
||||||
|
screen.blit(self.guest1, (self.getX() * 100 - 62+self.Offset, self.getY() * 100 - 60+self.Offset))
|
||||||
|
screen.blit(self.guest2, (self.getX() * 100 - 20+self.Offset, self.getY() * 100 - 60+self.Offset))
|
||||||
|
elif self.ilosc_klientow == 3:
|
||||||
|
screen.blit(self.guest1, (self.getX() * 100 - 62+self.Offset, self.getY() * 100 - 60+self.Offset))
|
||||||
|
screen.blit(self.guest2, (self.getX() * 100 - 20+self.Offset, self.getY() * 100 - 60+self.Offset))
|
||||||
|
screen.blit(self.guest3, (self.getX() * 100 + 22+self.Offset, self.getY() * 100 - 60+self.Offset))
|
||||||
|
|
||||||
|
if self.__status == Status.NotReady:
|
||||||
|
screen.blit(self.ksiazka, (self.getX() * 100 - 20+self.Offset, self.getY() * 100 - 20+self.Offset))
|
||||||
|
elif self.__status == Status.Ready:
|
||||||
|
screen.blit(self.check, (self.getX() * 100 - 20+self.Offset, self.getY() * 100 - 20+self.Offset))
|
||||||
|
elif self.__status == Status.Waiting:
|
||||||
|
if self.ilosc_klientow == 1:
|
||||||
|
screen.blit(self.plate, (self.getX() * 100 - 20+self.Offset, self.getY() * 100 - 20+self.Offset))
|
||||||
|
elif self.ilosc_klientow == 2:
|
||||||
|
screen.blit(self.plate, (self.getX() * 100 - 62+self.Offset, self.getY() * 100 - 20+self.Offset))
|
||||||
|
screen.blit(self.plate, (self.getX() * 100 - 20+self.Offset, self.getY() * 100 - 20+self.Offset))
|
||||||
|
elif self.ilosc_klientow == 3:
|
||||||
|
screen.blit(self.plate, (self.getX() * 100 - 62+self.Offset, self.getY() * 100 - 20+self.Offset))
|
||||||
|
screen.blit(self.plate, (self.getX() * 100- 20+self.Offset, self.getY() * 100 - 20+self.Offset))
|
||||||
|
screen.blit(self.plate, (self.getX() * 100+ 22+self.Offset, self.getY() * 100 - 20+self.Offset))
|
||||||
|
|
||||||
|
|
||||||
def setOrder(self, order):
|
def setOrder(self, order):
|
||||||
self.__order = order
|
self.__order = order
|
||||||
|
|
||||||
|
@ -6,8 +6,10 @@ class Waiter(Drawable):
|
|||||||
def __init__(self, x, y, minX, maxX, minY, maxY, ratio):
|
def __init__(self, x, y, minX, maxX, minY, maxY, ratio):
|
||||||
#call base class constructor
|
#call base class constructor
|
||||||
Drawable.__init__(self, x, y, minX, maxX, minY, maxY, ratio)
|
Drawable.__init__(self, x, y, minX, maxX, minY, maxY, ratio)
|
||||||
self.__image = self.__loadImg('./images/waiter.png')
|
self.__image = self.__loadImg('./images/kelner.png')
|
||||||
self.__acceptedOrders = []
|
self.__acceptedOrders = []
|
||||||
|
self.Offset = 100
|
||||||
|
|
||||||
|
|
||||||
def moveUp(self):
|
def moveUp(self):
|
||||||
if self.getY() > self.getMinY():
|
if self.getY() > self.getMinY():
|
||||||
@ -42,7 +44,7 @@ class Waiter(Drawable):
|
|||||||
self.__acceptedOrders += [(table, table.getOrder())]
|
self.__acceptedOrders += [(table, table.getOrder())]
|
||||||
|
|
||||||
def __loadImg(self, filePath):
|
def __loadImg(self, filePath):
|
||||||
return pygame.image.load(filePath)
|
return pygame.transform.scale((pygame.image.load(filePath)),(140,140))
|
||||||
|
|
||||||
def draw(self, screen):
|
def draw(self, screen):
|
||||||
screen.blit(self.__image, (self.getX() * self.getRatio(), self.getY() * self.getRatio()))
|
screen.blit(self.__image, (self.getX()*100-20+self.Offset, self.getY()*100-20+self.Offset))
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import random
|
import random
|
||||||
from src.components.Table import Table, Status
|
from src.components.Table import Table, Status
|
||||||
from src.components.Waiter import Waiter
|
from src.components.Waiter import Waiter
|
||||||
|
import pygame
|
||||||
#drawable objects manager
|
#drawable objects manager
|
||||||
class DrawableCollection:
|
class DrawableCollection:
|
||||||
#const, minimal distance between objects
|
#const, minimal distance between objects
|
||||||
@ -10,6 +10,7 @@ class DrawableCollection:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
#collection that holds all drawable objects
|
#collection that holds all drawable objects
|
||||||
self.__drawables = []
|
self.__drawables = []
|
||||||
|
self.image = pygame.transform.scale((pygame.image.load('./images/Backgroud.png')),(1700,1100))
|
||||||
|
|
||||||
#adds drawable objects to the collection
|
#adds drawable objects to the collection
|
||||||
def add(self, drawable):
|
def add(self, drawable):
|
||||||
@ -32,6 +33,7 @@ class DrawableCollection:
|
|||||||
|
|
||||||
#draws all objects stored in collection
|
#draws all objects stored in collection
|
||||||
def draw(self, screen):
|
def draw(self, screen):
|
||||||
|
screen.blit(self.image, (0, 0))
|
||||||
for item in self.__drawables:
|
for item in self.__drawables:
|
||||||
item.draw(screen)
|
item.draw(screen)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user