UI HUGE UPDATE
This commit is contained in:
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
public class loadDlcListPrefab : MonoBehaviour
|
||||
{
|
||||
private static readonly bool VerboseLogs = false;
|
||||
private const string RuntimeInstalledColumnName = "Installed DLC";
|
||||
[System.Serializable]
|
||||
public class Column
|
||||
{
|
||||
@@ -16,6 +17,10 @@ public class loadDlcListPrefab : MonoBehaviour
|
||||
[Header("Inspector")]
|
||||
public List<Column> columns = new List<Column>();
|
||||
|
||||
[Header("Runtime DLC")]
|
||||
[SerializeField] bool includeRuntimeInstalledDlcs = true;
|
||||
[SerializeField] string runtimeInstalledColumnName = RuntimeInstalledColumnName;
|
||||
|
||||
[Header("Inspector")]
|
||||
public GameObject dlc_scContent;
|
||||
public GameObject columnPrefab;
|
||||
@@ -41,11 +46,12 @@ public class loadDlcListPrefab : MonoBehaviour
|
||||
#endif
|
||||
}
|
||||
|
||||
if (columns == null) return;
|
||||
List<Column> displayColumns = BuildDisplayColumns();
|
||||
if (displayColumns == null) return;
|
||||
|
||||
for (int colIndex = 0; colIndex < columns.Count; colIndex++)
|
||||
for (int colIndex = 0; colIndex < displayColumns.Count; colIndex++)
|
||||
{
|
||||
var col = columns[colIndex];
|
||||
var col = displayColumns[colIndex];
|
||||
|
||||
if (columnPrefab != null)
|
||||
{
|
||||
@@ -154,4 +160,80 @@ public class loadDlcListPrefab : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private List<Column> BuildDisplayColumns()
|
||||
{
|
||||
List<Column> result = new List<Column>();
|
||||
HashSet<dlcData> knownDlcs = new HashSet<dlcData>();
|
||||
|
||||
if (columns != null)
|
||||
{
|
||||
for (int i = 0; i < columns.Count; i++)
|
||||
{
|
||||
Column source = columns[i];
|
||||
if (source == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Column copy = new Column
|
||||
{
|
||||
columnName = source.columnName,
|
||||
dlcList = new List<dlcData>()
|
||||
};
|
||||
|
||||
if (source.dlcList != null)
|
||||
{
|
||||
for (int j = 0; j < source.dlcList.Count; j++)
|
||||
{
|
||||
dlcData item = source.dlcList[j];
|
||||
if (item == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
copy.dlcList.Add(item);
|
||||
knownDlcs.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
result.Add(copy);
|
||||
}
|
||||
}
|
||||
|
||||
if (!includeRuntimeInstalledDlcs)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
dlcData[] runtimeDlcs = DlcRuntimeRegistry.GetAllDlcs();
|
||||
if (runtimeDlcs == null || runtimeDlcs.Length == 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
Column runtimeColumn = new Column
|
||||
{
|
||||
columnName = string.IsNullOrWhiteSpace(runtimeInstalledColumnName) ? RuntimeInstalledColumnName : runtimeInstalledColumnName,
|
||||
dlcList = new List<dlcData>()
|
||||
};
|
||||
|
||||
for (int i = 0; i < runtimeDlcs.Length; i++)
|
||||
{
|
||||
dlcData dlc = runtimeDlcs[i];
|
||||
if (dlc == null || knownDlcs.Contains(dlc))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
runtimeColumn.dlcList.Add(dlc);
|
||||
}
|
||||
|
||||
if (runtimeColumn.dlcList.Count > 0)
|
||||
{
|
||||
result.Add(runtimeColumn);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user