mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
为超长时间的循环动画提供新线程以避免stackoverflow
This commit is contained in:
parent
d3a72367bc
commit
30e6193d41
@ -176,7 +176,12 @@ namespace VPet_Simulator.Core
|
|||||||
case TaskControl.ControlType.Continue:
|
case TaskControl.ControlType.Continue:
|
||||||
if (++parent.nowid >= parent.Animations.Count)
|
if (++parent.nowid >= parent.Animations.Count)
|
||||||
if (parent.IsLoop)
|
if (parent.IsLoop)
|
||||||
|
{
|
||||||
parent.nowid = 0;
|
parent.nowid = 0;
|
||||||
|
//让循环动画重新开始立线程,不stackoverflow
|
||||||
|
Task.Run(() => parent.Animations[0].Run(This, Control));
|
||||||
|
return;
|
||||||
|
}
|
||||||
else if (Control.Type == TaskControl.ControlType.Continue)
|
else if (Control.Type == TaskControl.ControlType.Continue)
|
||||||
{
|
{
|
||||||
Control.Type = TaskControl.ControlType.Status_Quo;
|
Control.Type = TaskControl.ControlType.Status_Quo;
|
||||||
|
@ -202,7 +202,12 @@ namespace VPet_Simulator.Core
|
|||||||
case TaskControl.ControlType.Continue:
|
case TaskControl.ControlType.Continue:
|
||||||
if (++parent.nowid >= parent.Animations.Count)
|
if (++parent.nowid >= parent.Animations.Count)
|
||||||
if (parent.IsLoop)
|
if (parent.IsLoop)
|
||||||
|
{
|
||||||
parent.nowid = 0;
|
parent.nowid = 0;
|
||||||
|
//让循环动画重新开始立线程,不stackoverflow
|
||||||
|
Task.Run(() => parent.Animations[0].Run(This, Control));
|
||||||
|
return;
|
||||||
|
}
|
||||||
else if (Control.Type == TaskControl.ControlType.Continue)
|
else if (Control.Type == TaskControl.ControlType.Continue)
|
||||||
{
|
{
|
||||||
Control.Type = TaskControl.ControlType.Status_Quo;
|
Control.Type = TaskControl.ControlType.Status_Quo;
|
||||||
|
@ -146,7 +146,7 @@ namespace VPet_Simulator.Core
|
|||||||
case TaskControl.ControlType.Status_Quo:
|
case TaskControl.ControlType.Status_Quo:
|
||||||
if (IsLoop)
|
if (IsLoop)
|
||||||
{
|
{
|
||||||
Run(Control);
|
Task.Run(() => Run(Control));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user