超大量的更新 修复很多问题,gameplay特效初步
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
@@ -6,23 +6,23 @@ using System.IO;
|
||||
|
||||
public class dlcButton : MonoBehaviour
|
||||
{
|
||||
[Header("������")]
|
||||
[Header("Inspector")]
|
||||
public Image dlc_profileImgae;
|
||||
public Text dlcName;
|
||||
public Text dlcID;
|
||||
public Text dlcProducer;
|
||||
public Text dlcPubliushDate;
|
||||
public Image dlc_nowSelectedImageBoarder;
|
||||
[Header("����")]
|
||||
[Header("Inspector")]
|
||||
public Text dlcDescription;
|
||||
|
||||
[Header("DLC SO (���� Inspector ָ��)")]
|
||||
[Header("Inspector")]
|
||||
public dlcData dlcDataSO;
|
||||
|
||||
[Header("DLC ���� (����ʱ���ɽű����)")]
|
||||
[Header("Inspector")]
|
||||
public List<SongData> dlcContent = new List<SongData>();
|
||||
|
||||
[Header("����·�� (�༭��/����ʱ)")]
|
||||
[Header("Inspector")]
|
||||
public string editorSearchFolder = "Assets/Resources/dlc_dlcIndex";
|
||||
public string runtimeResourcesFolder = "Resources/dlc_dlcIndex";
|
||||
|
||||
@@ -139,6 +139,7 @@ public class dlcButton : MonoBehaviour
|
||||
|
||||
// fades the border in or out; if immediate, set without coroutine
|
||||
private Coroutine borderFadeCoroutine = null;
|
||||
private Coroutine showSongsRetryCoroutine = null;
|
||||
private void SetSelectedVisual(bool selected, bool immediate = false)
|
||||
{
|
||||
if (dlc_nowSelectedImageBoarder == null) return;
|
||||
@@ -216,15 +217,62 @@ public class dlcButton : MonoBehaviour
|
||||
// mark selection first
|
||||
Select();
|
||||
|
||||
var s = Object.FindAnyObjectByType<SongSelectUI>();
|
||||
if (s != null)
|
||||
if (TryDisplaySongsNow())
|
||||
{
|
||||
s.DisplaySongsFromList(dlcContent);
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
if (showSongsRetryCoroutine != null)
|
||||
{
|
||||
Debug.LogWarning("dlcButton: SongSelectUI not found in scene to display songs");
|
||||
StopCoroutine(showSongsRetryCoroutine);
|
||||
}
|
||||
showSongsRetryCoroutine = StartCoroutine(RetryDisplaySongsWhenUIReady());
|
||||
}
|
||||
|
||||
private SongSelectUI FindSongSelectUI()
|
||||
{
|
||||
var ui = Object.FindAnyObjectByType<SongSelectUI>();
|
||||
if (ui != null)
|
||||
{
|
||||
return ui;
|
||||
}
|
||||
|
||||
var all = Object.FindObjectsByType<SongSelectUI>(FindObjectsInactive.Include, FindObjectsSortMode.None);
|
||||
if (all != null && all.Length > 0)
|
||||
{
|
||||
return all[0];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private bool TryDisplaySongsNow()
|
||||
{
|
||||
var ui = FindSongSelectUI();
|
||||
if (ui == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ui.DisplaySongsFromList(dlcContent);
|
||||
return true;
|
||||
}
|
||||
|
||||
private IEnumerator RetryDisplaySongsWhenUIReady()
|
||||
{
|
||||
const int maxRetryFrames = 8;
|
||||
for (int i = 0; i < maxRetryFrames; i++)
|
||||
{
|
||||
yield return null;
|
||||
if (TryDisplaySongsNow())
|
||||
{
|
||||
showSongsRetryCoroutine = null;
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
showSongsRetryCoroutine = null;
|
||||
Debug.LogWarning("dlcButton: SongSelectUI not found in scene to display songs");
|
||||
}
|
||||
|
||||
// Try to find a dlcData SO by id and apply its songList to dlcContent
|
||||
|
||||
Reference in New Issue
Block a user