26 lines
767 B
C#
26 lines
767 B
C#
using System;
|
|
using Cysharp.Threading.Tasks;
|
|
using SLSUtilities.General;
|
|
using UnityEngine;
|
|
|
|
namespace SLSUtilities.General
|
|
{
|
|
/// <summary>等待指定秒数后在控制台输出一条信息。</summary>
|
|
public class Cmd_WaitAndLog : CommandBase
|
|
{
|
|
private readonly float duration;
|
|
private readonly string message;
|
|
|
|
public Cmd_WaitAndLog(float duration, string message)
|
|
{
|
|
this.duration = duration;
|
|
this.message = message;
|
|
}
|
|
|
|
protected override async UniTask ExecuteAsync(CommandContext outerContext)
|
|
{
|
|
await UniTask.Delay(TimeSpan.FromSeconds(duration));
|
|
Debug.Log($"[Cmd_WaitAndLog] 等待 {duration} 秒后... 输出: '{message}'");
|
|
}
|
|
}
|
|
} |