mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-04-04 03:29: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.
|
||||
{
|
||||
parent = targetSubMenu.gameObject;
|
||||
CreateToggleImpl(targets, parent, s => s.name, forSelection, createInstaller:false);
|
||||
CreateToggleImpl(targets, parent, forSelection, createInstaller:false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (targets.Count() > 1) // Create a submenu and add the toggles as children of it.
|
||||
{
|
||||
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.
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
CreateToggleImpl(selected, parent, "New Toggle", createInstaller:createInstaller);
|
||||
CreateToggleImpl(selected, parent, createInstaller:createInstaller);
|
||||
}
|
||||
|
||||
Selection.objects = null;
|
||||
@ -161,18 +161,21 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
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)
|
||||
{
|
||||
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);
|
||||
if (avatarRoot == null) return;
|
||||
|
||||
var suffix = selected.activeSelf ? "OFF" : "ON";
|
||||
var name = forSelection ? $"{selected.name} {suffix}" : "New Toggle";
|
||||
|
||||
var toggle = new GameObject(name);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user