Add Version Label

This commit is contained in:
copecone committed 2026-08-20 08:39:17 +09:00
1 parent 27be2141f7
commit f14942a287
1 file changed
+40 -1
+40 -1
View File
@@ -27,6 +27,7 @@ internal class RenderConfigUIManager : MonoBehaviour
private Button _advancedSettingsButton = null!; private Button _advancedSettingsButton = null!;
private VisualElement? _advancedConfigContainer; private VisualElement? _advancedConfigContainer;
private Label _versionLabel = null!;
private void Awake() private void Awake()
{ {
@@ -113,6 +114,45 @@ internal class RenderConfigUIManager : MonoBehaviour
} }
_advancedSettingsButton.RegisterCallback<ClickEvent>(_ => OpenAdvancedConfig()); _advancedSettingsButton.RegisterCallback<ClickEvent>(_ => OpenAdvancedConfig());
_versionLabel = _root.Q<Label>("VersionLabel");
if (_versionLabel == null)
{
_versionLabel = new Label($"<a href=\"https://git.yunizun.org/ADOFAIEditorForum/ADOFAIRenderer\">ADOFAIRenderer v{Melon<RenderMod>.Instance.Info.Version}</a>")
{
name = "VersionLabel",
pickingMode = PickingMode.Ignore,
style =
{
position = Position.Absolute,
left = 25f, bottom = 25f,
fontSize = 24f,
paddingTop = 0, paddingBottom = 0, paddingLeft = 0, paddingRight = 0,
marginTop = 0, marginBottom = 0, marginLeft = 0, marginRight = 0,
color = new StyleColor(new Color(0f, 0f, 0f, 0.3f))
}
};
// 기존 UI와 동일한 나눔스퀘어 폰트 적용
if (RenderMod.FontBundle)
{
try
{
var font = RenderMod.FontBundle.LoadAsset<Font>("NanumSquareNeoOTF-Bd");
if (font) { _versionLabel.style.unityFontDefinition = FontDefinition.FromFont(font); }
}
catch { /* ignored */ }
}
var targetContainer = _root.childCount > 0 ? _root[0] : _root;
targetContainer.Add(_versionLabel);
Melon<RenderMod>.Logger.Msg("[UI] VersionLabel 동적 생성 완료.");
}
else
{
_versionLabel.text = "Hello World";
Melon<RenderMod>.Logger.Msg($"[UI] VersionLabel 발견: {_versionLabel.text}");
}
} }
private void OpenAdvancedConfig() private void OpenAdvancedConfig()
@@ -1114,7 +1154,6 @@ internal class RenderConfigUIManager : MonoBehaviour
} }
_presetConfigContainer.style.display = showPreset ? DisplayStyle.Flex : DisplayStyle.None; _presetConfigContainer.style.display = showPreset ? DisplayStyle.Flex : DisplayStyle.None;
} }
} }
private VisualElement CreateRow() private VisualElement CreateRow()