@@ -107,6 +107,22 @@ namespace Ichni.RhythmGame
|
||||
matchedBM = new SkyboxSubsetter_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM,
|
||||
skyBoxThemeBundleList, skyboxNameList, blendTimeList, blendSpeedList);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 刷新 skyboxMaterialList 和 skyboxBlender.skyboxMaterials,使其与 theme/name 列表同步。
|
||||
/// </summary>
|
||||
public void RefreshSkyboxes()
|
||||
{
|
||||
skyboxMaterialList.Clear();
|
||||
skyboxBlender.skyboxMaterials.Clear();
|
||||
for (int i = 0; i < skyBoxThemeBundleList.Count && i < skyboxNameList.Count; i++)
|
||||
{
|
||||
var mat = ThemeBundleManager.instance.GetObject<Material>(skyBoxThemeBundleList[i], skyboxNameList[i]);
|
||||
skyboxMaterialList.Add(mat);
|
||||
skyboxBlender.skyboxMaterials.Add(mat);
|
||||
}
|
||||
skyboxBlender.InspectorAndAwakeChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public partial class SkyboxSubsetter
|
||||
@@ -134,19 +150,55 @@ namespace Ichni.RhythmGame
|
||||
DynamicUISubcontainer materialSettings = container.GenerateSubcontainer(3);
|
||||
// 新增:显示skybox配置情况//这他妈是什么
|
||||
|
||||
DynamicUISubcontainer Textsettings = container.GenerateSubcontainer(2);
|
||||
|
||||
for (int i = 0; i < (skyBoxThemeBundleList?.Count ?? 0); i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
DynamicUISubcontainer Textsettings = container.GenerateSubcontainer(3);
|
||||
// 安全访问元素:检查索引是否在所有列表的有效范围内
|
||||
string bundleName = i < skyBoxThemeBundleList.Count ? skyBoxThemeBundleList[i] : "<Missing Bundle>";
|
||||
string name = i < skyboxNameList.Count ? skyboxNameList[i] : "<Missing Name>";
|
||||
if (i > 0)
|
||||
{
|
||||
inspector.GenerateInputField(this, Textsettings, "Time", $"{nameof(blendTimeList)}.{i - 1}");
|
||||
inspector.GenerateInputField(this, Textsettings, "Speed", $"{nameof(blendSpeedList)}.{i - 1}");
|
||||
}
|
||||
else
|
||||
{
|
||||
inspector.GenerateHintText(this, Textsettings, "The First");
|
||||
inspector.GenerateHintText(this, Textsettings, "0");
|
||||
}
|
||||
|
||||
inspector.GenerateHintText(this, Textsettings, $"{i + 1}. [{bundleName}] {name}\n");
|
||||
inspector.GenerateHintText(this, Textsettings, $"{i + 1}. {name}");
|
||||
|
||||
|
||||
// inspector.GenerateInputField(this, Textsettings, "B", $"skyBoxThemeBundleList.{i}").AddListenerFunction(RefreshSkyboxes);
|
||||
// inspector.GenerateInputField(this, Textsettings, "N", $"skyboxNameList.{i}").AddListenerFunction(RefreshSkyboxes);
|
||||
inspector.GenerateDropdown(this, Textsettings, "B", themeBundleListForSelection, $"{nameof(skyBoxThemeBundleList)}.{i}")
|
||||
.AddListenerFunction(() => inspectorMain.SetInspector(this));
|
||||
List<string> skyboxNameListForSelection = new List<string>();
|
||||
string selectedThemeBundleL = skyBoxThemeBundleList[i];
|
||||
if (selectedThemeBundleL != String.Empty && ThemeBundleManager.instance.TryGetThemeBundle(selectedThemeBundleL, out ThemeBundle themeBundleLoop))
|
||||
{
|
||||
skyboxNameListForSelection = themeBundleLoop.assetList_Material.ConvertAll(x => x.name);
|
||||
var objectNameDropdown =
|
||||
inspector.GenerateDropdown(this, Textsettings, "Material Name", skyboxNameListForSelection, $"{nameof(skyboxNameList)}.{i}")
|
||||
.AddListenerFunction(() => inspectorMain.SetInspector(this))
|
||||
.AddListenerFunction(RefreshSkyboxes);
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// var objectNameDropdown =
|
||||
// inspector.GenerateDropdown(this, Textsettings, "Material Name", new List<string>(), $"{nameof(skyboxNameList)}.{i}");
|
||||
// objectNameDropdown.dropdown.interactable = false;
|
||||
// } // 如果没有选择主题包,则材质名称下拉框不可用
|
||||
// inspector.GenerateDropdown(this, Textsettings, "N", skyboxNameListForSelection, $"skyboxNameList.{i}")
|
||||
// .AddListenerFunction(RefreshSkyboxes);
|
||||
|
||||
// 创建局部变量解决闭包问题
|
||||
int index = i;
|
||||
|
||||
inspector.GenerateButton(this, Textsettings, "Remove Skybox", () =>
|
||||
{
|
||||
try
|
||||
@@ -179,11 +231,16 @@ namespace Ichni.RhythmGame
|
||||
Debug.LogError($"Error during removal: {ex.Message}");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError($"Error generating UI for index {i}: {ex.Message}");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Debug.Log((mainSettings == null) + " " + (themeBundleListForSelection == null) + " " + (selectedThemeBundle == null));
|
||||
|
||||
Reference in New Issue
Block a user