Now its responsive
This commit is contained in:
+27
-27
@@ -15,9 +15,6 @@ namespace Caisses
|
||||
private List<GraphicalCheckout> _checkouts;
|
||||
private List<GraphicalClient> _clients;
|
||||
private int _timeOfTheDayInMinuts;
|
||||
private Bitmap _shelvesCorner;
|
||||
private Bitmap _checkoutCorner;
|
||||
private Bitmap _waitingCorner;
|
||||
private Random rnd;
|
||||
|
||||
/// Stats
|
||||
@@ -39,36 +36,30 @@ namespace Caisses
|
||||
public int TimeOfTheDayInMinuts { get => _timeOfTheDayInMinuts; set => _timeOfTheDayInMinuts = value; }
|
||||
public List<GraphicalClient> Clients { get => _clients; set => _clients = value; }
|
||||
internal List<GraphicalCheckout> Checkouts { get => _checkouts; set => _checkouts = value; }
|
||||
public Bitmap ShelvesCorner { get => _shelvesCorner; set => _shelvesCorner = value; }
|
||||
public Bitmap CheckoutCorner { get => _checkoutCorner; set => _checkoutCorner = value; }
|
||||
public Bitmap WaitingCorner { get => _waitingCorner; set => _waitingCorner = value; }
|
||||
|
||||
public int TimeOfTheDayInHours
|
||||
{
|
||||
get { return _timeOfTheDayInMinuts / 60; }
|
||||
}
|
||||
|
||||
public GraphicalStore(int startingHour, int checkoutNumber, Size shelvesCornerSize, Size checkoutCornerSize, Size waitingCornerSize)
|
||||
public GraphicalStore(int startingHour, int checkoutNumber, Size checkoutsRoom)
|
||||
{
|
||||
TimeOfTheDayInMinuts = startingHour * 60;
|
||||
Clients = new List<GraphicalClient>();
|
||||
Checkouts = new List<GraphicalCheckout>();
|
||||
CheckoutCorner = new Bitmap(checkoutCornerSize.Width, checkoutCornerSize.Height);
|
||||
ShelvesCorner = new Bitmap(shelvesCornerSize.Width, shelvesCornerSize.Height);
|
||||
WaitingCorner = new Bitmap(waitingCornerSize.Width, waitingCornerSize.Height);
|
||||
rnd = new Random();
|
||||
|
||||
FillStore(ATTENDANCE[TimeOfTheDayInHours]);
|
||||
populateCheckouts(checkoutNumber);
|
||||
populateCheckouts(checkoutsRoom,checkoutNumber);
|
||||
Tick();
|
||||
}
|
||||
public void populateCheckouts(int numberOfCheckouts)
|
||||
public void populateCheckouts(Size checkoutRoom,int checkoutNumber)
|
||||
{
|
||||
int checkoutWidth = CheckoutCorner.Width / numberOfCheckouts + 1;
|
||||
for (int i = 0; i < numberOfCheckouts; i++)
|
||||
int checkoutWidth = checkoutRoom.Width / checkoutNumber + 1;
|
||||
for (int i = 0; i < checkoutNumber; i++)
|
||||
{
|
||||
Point position = new Point(i * checkoutWidth + checkoutWidth / numberOfCheckouts, 0);
|
||||
Checkouts.Add(new GraphicalCheckout(position, new Rectangle(new Point(0, 0), new Size(CheckoutCorner.Width, CheckoutCorner.Height)), numberOfCheckouts));
|
||||
Point position = new Point(i * checkoutWidth + checkoutWidth / checkoutNumber, 0);
|
||||
Checkouts.Add(new GraphicalCheckout());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,26 +184,35 @@ namespace Caisses
|
||||
}
|
||||
}
|
||||
}
|
||||
public List<Bitmap> Draw()
|
||||
public List<Bitmap> Draw(Size shelvesRoom,Size waitRoom,Size checkoutsRoom)
|
||||
{
|
||||
ShelvesCorner = new Bitmap(ShelvesCorner.Width, ShelvesCorner.Height);
|
||||
CheckoutCorner = new Bitmap(CheckoutCorner.Width, CheckoutCorner.Height);
|
||||
WaitingCorner = new Bitmap(WaitingCorner.Width, WaitingCorner.Height);
|
||||
Bitmap shelvesImage = new Bitmap(shelvesRoom.Width,shelvesRoom.Height);
|
||||
Bitmap waitingRoomImage = new Bitmap(waitRoom.Width, waitRoom.Height);
|
||||
Bitmap checkoutsImage= new Bitmap(checkoutsRoom.Width,checkoutsRoom.Height);
|
||||
foreach (GraphicalClient client in Clients)
|
||||
{
|
||||
client.Draw(ShelvesCorner,WaitingCorner);
|
||||
client.Draw(shelvesImage, waitingRoomImage);
|
||||
}
|
||||
|
||||
foreach (GraphicalCheckout checkout in Checkouts)
|
||||
for (int i = 0; i < Checkouts.Count; i++)
|
||||
{
|
||||
checkout.Draw(CheckoutCorner);
|
||||
foreach (GraphicalClient client in checkout.Clients)
|
||||
Checkouts[i].Draw(checkoutsImage, Checkouts.Count,i);
|
||||
foreach (GraphicalClient client in Checkouts[i].Clients)
|
||||
{
|
||||
client.Draw(ShelvesCorner,WaitingCorner);
|
||||
client.Draw(shelvesImage, waitingRoomImage);
|
||||
}
|
||||
}
|
||||
|
||||
return new List<Bitmap> { ShelvesCorner, CheckoutCorner, WaitingCorner};
|
||||
/*
|
||||
foreach (GraphicalCheckout checkout in Checkouts)
|
||||
{
|
||||
checkout.Draw(checkoutsImage,Checkouts.Count, );
|
||||
foreach (GraphicalClient client in checkout.Clients)
|
||||
{
|
||||
client.Draw(shelvesImage,waitingRoomImage);
|
||||
}
|
||||
}
|
||||
*/
|
||||
return new List<Bitmap> { shelvesImage, waitingRoomImage, checkoutsImage};
|
||||
}
|
||||
public virtual void FillStore(int amountOfNewClients)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user