gameplay手游触屏支持,一些小优化和修复
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public static class AllyHeroSkillSelectionValidator
|
||||
{
|
||||
public static IEnumerator ValidateAllHeroesAsync(int heroesPerFrame = 2, Action<bool> onCompleted = null)
|
||||
{
|
||||
AllyHero_SO[] heroes = RuntimeResourcesCache.LoadAllAllyHeroes();
|
||||
bool anyChanged = false;
|
||||
int processedThisFrame = 0;
|
||||
int batchSize = Mathf.Max(1, heroesPerFrame);
|
||||
|
||||
for (int i = 0; i < heroes.Length; i++)
|
||||
{
|
||||
AllyHero_SO hero = heroes[i];
|
||||
if (hero != null && hero.ValidateEquippedSkillSelections())
|
||||
{
|
||||
anyChanged = true;
|
||||
}
|
||||
|
||||
processedThisFrame++;
|
||||
if (processedThisFrame >= batchSize)
|
||||
{
|
||||
processedThisFrame = 0;
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
onCompleted?.Invoke(anyChanged);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user