Animation finally working! Probably need better sprites.

This commit is contained in:
2018-02-15 16:57:46 +00:00
parent de5ec6cfd3
commit 4da26055a6
3 changed files with 60 additions and 18 deletions

View File

@ -70,6 +70,8 @@ namespace EduNetworkBuilder
private List<string> BrokenItems = new List<string>();
public bool IsRandomNetwork = false;
private List<AnimationClass> Animations = new List<AnimationClass>();
/// <summary>
/// WhatFrom: If we are launched from a homework, we remember it here.
/// </summary>
@ -1358,8 +1360,16 @@ namespace EduNetworkBuilder
public void Tick(bool SkipVisuals = false)
{
if(!SkipVisuals)
if (!SkipVisuals)
{
foreach (AnimationClass one in Animations)
one.EraseAnimation(TheNetImageBackground, myPBox, TheNetImage);
EraseOldPackets();
for(int i= Animations.Count-1; i>=0; i--)
{
if (Animations[i].AnimationDone) Animations.RemoveAt(i);
}
}
//if (myPackets.Count > 50)
//Console.WriteLine("Packets: " + myPackets.Count.ToString());
if (myPackets.Count > 0)
@ -1375,8 +1385,10 @@ namespace EduNetworkBuilder
{
//It has all been taken care of
}
if(!SkipVisuals)
if (!SkipVisuals)
{
DrawPackets();
}
//myPBox.Refresh();
previously_had_packets = true;
}
@ -1416,6 +1428,19 @@ namespace EduNetworkBuilder
}
previously_had_packets = false;
}
if (!SkipVisuals)
{
foreach (AnimationClass one in Animations)
{
one.DrawAnimation(TheNetImageBackground, myPBox);
}
myPBox.Refresh();
}
}
public void AddAnimation(AnimationName What, Rectangle Where)
{
Animations.Add(new AnimationClass(What, Where));
}
public void AddMessage(PacketMessage toAdd)