mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-04-04 19:49:02 +08:00
chore: use simple suffixes
This commit is contained in:
parent
0138a89b54
commit
38be43163f
@ -72,19 +72,19 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
if (targetSubMenu != null) // If target SubMenu is found, add the toggles as children of it.
|
if (targetSubMenu != null) // If target SubMenu is found, add the toggles as children of it.
|
||||||
{
|
{
|
||||||
parent = targetSubMenu.gameObject;
|
parent = targetSubMenu.gameObject;
|
||||||
CreateToggleImpl(targets, parent, s => s.name, forSelection, createInstaller:false);
|
CreateToggleImpl(targets, parent, forSelection, createInstaller:false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (targets.Count() > 1) // Create a submenu and add the toggles as children of it.
|
if (targets.Count() > 1) // Create a submenu and add the toggles as children of it.
|
||||||
{
|
{
|
||||||
parent = CreateSubMenu(parent, subMenuName).gameObject;
|
parent = CreateSubMenu(parent, subMenuName).gameObject;
|
||||||
CreateToggleImpl(targets, parent, s => s.name, forSelection, createInstaller:false);
|
CreateToggleImpl(targets, parent, forSelection, createInstaller:false);
|
||||||
}
|
}
|
||||||
else // Create a single toggle with installer.
|
else // Create a single toggle with installer.
|
||||||
{
|
{
|
||||||
var target = targets.First();
|
var target = targets.First();
|
||||||
CreateToggleImpl(target, parent, target.name + " Toggle", forSelection, createInstaller:true);
|
CreateToggleImpl(target, parent, forSelection, createInstaller:true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
createInstaller = false;
|
createInstaller = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateToggleImpl(selected, parent, "New Toggle", createInstaller:createInstaller);
|
CreateToggleImpl(selected, parent, createInstaller:createInstaller);
|
||||||
}
|
}
|
||||||
|
|
||||||
Selection.objects = null;
|
Selection.objects = null;
|
||||||
@ -161,18 +161,21 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
return mami;
|
return mami;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CreateToggleImpl(IEnumerable<GameObject> selections, GameObject parent, Func<GameObject, string> nameFunc, bool forSelection = false, bool createInstaller = true)
|
private static void CreateToggleImpl(IEnumerable<GameObject> selections, GameObject parent, bool forSelection = false, bool createInstaller = true)
|
||||||
{
|
{
|
||||||
foreach (var selected in selections)
|
foreach (var selected in selections)
|
||||||
{
|
{
|
||||||
CreateToggleImpl(selected, parent, nameFunc(selected), forSelection, createInstaller);
|
CreateToggleImpl(selected, parent, forSelection, createInstaller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CreateToggleImpl(GameObject selected, GameObject parent, string name, bool forSelection = false, bool createInstaller = true)
|
private static void CreateToggleImpl(GameObject selected, GameObject parent, bool forSelection = false, bool createInstaller = true)
|
||||||
{
|
{
|
||||||
var avatarRoot = RuntimeUtil.FindAvatarTransformInParents(selected.transform);
|
var avatarRoot = RuntimeUtil.FindAvatarTransformInParents(selected.transform);
|
||||||
if (avatarRoot == null) return;
|
if (avatarRoot == null) return;
|
||||||
|
|
||||||
|
var suffix = selected.activeSelf ? "OFF" : "ON";
|
||||||
|
var name = forSelection ? $"{selected.name} {suffix}" : "New Toggle";
|
||||||
|
|
||||||
var toggle = new GameObject(name);
|
var toggle = new GameObject(name);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user