在我的编程中,我制作了两个攻击日志(它们是标签),它们显示了战斗中发生的事情......但是每当我运行代码时,两个标签都会跳过所有以前的代码并显示它被告知要显示的最后一件事。 ..
this -> EnemyAttackLog -> Text = "[Enemy Attack Log] " + EName + " Attacked!!";
Sleep(500);
damage = rnd4 -> Next(-2,3) + EnemyA;
if (D > EnemyA)
{
damage = rnd4 -> Next(3,6);
this -> AttackLog -> Text = "[Attack Log] Your Armor Reduced the Damage!";
}
Sleep(500);
this -> EnemyAttackLog -> Text = "[Enemy Attack Log] " + EName + " did " + damage + " Damage";
Hp -= damage;
this -> HealthBar -> Value = Hp;
Sleep(800);
damage = rnd4 -> Next(-2,3) + A;
if (EnemyD > A)
{
damage = rnd4 -> Next(3,6);
this -> EnemyAttackLog -> Text = "[Enemy Attack Log] " + EName + "'s armor reduced damage!";
}
Sleep(1500);
this -> AttackLog -> Text = "[Attack Log] " + Name + " did " + damage + " Damage";
EnemyHp -= damage;
this -> EnemyHealth -> Value = EnemyHp;
如果这做了我认为它会做的事情,它会显示
this -> EnemyAttackLog -> Text = "[Enemy Attack Log] " + EName + " Attacked!!";
半秒,然后继续显示下一个代码,再等半秒,但是,它所做的只是等待所有的睡眠功能(加起来是 3300 毫秒),然后在最后显示文本.. . 这是
this -> AttackLog -> Text = "[Attack Log] " + Name + " did " + damage + " Damage";
为什么它会跳过所有先前的命令(对于标签文本)但仍然等待 3300 毫秒?