技能主要更新,修复卡顿并加入动画,以及各种其他更新。
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class loadDlcListPrefab : MonoBehaviour
|
||||
@@ -106,14 +107,27 @@ public class loadDlcListPrefab : MonoBehaviour
|
||||
var rt = dlc_scContent.GetComponent<RectTransform>();
|
||||
if (rt != null) UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(rt);
|
||||
|
||||
// After all buttons are instantiated, have each dlcButton resolve its dlcData (deferred lookup)
|
||||
var allButtons = dlc_scContent.GetComponentsInChildren<dlcButton>(true);
|
||||
foreach (var b in allButtons)
|
||||
StartCoroutine(ResolveAndRestore(allButtons));
|
||||
}
|
||||
|
||||
private IEnumerator ResolveAndRestore(dlcButton[] allButtons)
|
||||
{
|
||||
if (allButtons != null)
|
||||
{
|
||||
if (b != null)
|
||||
b.ResolveDlcData();
|
||||
for (int i = 0; i < allButtons.Length; i++)
|
||||
{
|
||||
var b = allButtons[i];
|
||||
if (b != null)
|
||||
{
|
||||
yield return b.ResolveDlcDataAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Let layout and any fades settle for a frame
|
||||
yield return null;
|
||||
|
||||
// Restore last selected DLC button from PlayerPrefs and simulate a click on it
|
||||
int savedIndex = PlayerPrefs.GetInt("dlc_selected_index", 0);
|
||||
if (allButtons != null && allButtons.Length > 0)
|
||||
@@ -138,4 +152,5 @@ public class loadDlcListPrefab : MonoBehaviour
|
||||
Debug.LogWarning("loadDlcListPrefab: no dlc buttons found after RefreshUI");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user