123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System.Text;
- namespace SinMaiLauncher
- {
- public static class TextAnimation
- {
- public static IEnumerable<string> LoadingTextSeq(int len)
- {
- IReadOnlyCollection<char> sym = ['甲', '申', '由', '申'];
- const char padding = '.';
- var symEnu = Loop(sym).GetEnumerator();
- while (true)
- {
- var sb = new StringBuilder();
- for (int i = 0; i < len; i++)
- {
- symEnu.MoveNext();
- sb.Clear();
- sb.Append(symEnu.Current);
- for (int j = 0; j < i; j++) sb.Append(padding);
- yield return sb.ToString();
- }
- }
- }
- private static IEnumerable<T> Loop<T>(IEnumerable<T> source)
- {
- while (true)
- {
- foreach (var item in source)
- {
- yield return item;
- }
- }
- }
- }
- }
|