Initial Commit
This commit is contained in:
commit
13767d3f40
160 changed files with 51070 additions and 0 deletions
8
MenuStyling/Editor.meta
Normal file
8
MenuStyling/Editor.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b36f0cd6b2bdf884da9e1ba6efbe0877
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
20
MenuStyling/Editor/MenuStylingEditorAsmdef.asmdef
Normal file
20
MenuStyling/Editor/MenuStylingEditorAsmdef.asmdef
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"name": "MenuStylingAsmdef",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:8a060350c9ddd424197c8fd1e0d63f72",
|
||||
"GUID:62ced99b048af7f4d8dfe4bed8373d76",
|
||||
"GUID:5718fb738711cd34ea54e9553040911d"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
7
MenuStyling/Editor/MenuStylingEditorAsmdef.asmdef.meta
Normal file
7
MenuStyling/Editor/MenuStylingEditorAsmdef.asmdef.meta
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2fcc8a126eba6304abed122e290e54c1
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
76
MenuStyling/Editor/MenuStylingPlugin.cs
Normal file
76
MenuStyling/Editor/MenuStylingPlugin.cs
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
using System.Collections.Generic;
|
||||
using gay.lilyy.MenuStyling;
|
||||
using nadena.dev.ndmf;
|
||||
using UnityEngine;
|
||||
using VRC.SDK3.Avatars.ScriptableObjects;
|
||||
using static VRC.SDK3.Avatars.ScriptableObjects.VRCExpressionsMenu;
|
||||
|
||||
[assembly: ExportsPlugin(typeof(MenuStylingPlugin))]
|
||||
|
||||
namespace gay.lilyy.MenuStyling
|
||||
{
|
||||
public class MenuStylingPlugin : Plugin<MenuStylingPlugin>
|
||||
{
|
||||
public override string DisplayName => "MenuStyling";
|
||||
public override string QualifiedName => "gay.lilyy.MenuStyling";
|
||||
protected override void Configure()
|
||||
{
|
||||
InPhase(BuildPhase.Optimizing).AfterPlugin("gay.lilyy.MenuIconRemover").Run("SetMenuStyling", ctx =>
|
||||
{
|
||||
var obj = ctx.AvatarRootObject.GetComponent<MenuStylingConfig>();
|
||||
if (obj != null)
|
||||
{
|
||||
ctx.AvatarDescriptor.expressionsMenu = DuplicateMenu(ctx.AvatarDescriptor.expressionsMenu);
|
||||
WalkMenu(obj, ctx.AvatarDescriptor.expressionsMenu);
|
||||
Object.DestroyImmediate(obj);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private VRCExpressionsMenu DuplicateMenu(VRCExpressionsMenu menu)
|
||||
{
|
||||
if (menu == null) return null;
|
||||
|
||||
var newMenu = ScriptableObject.CreateInstance<VRCExpressionsMenu>();
|
||||
newMenu.controls = new List<Control>();
|
||||
|
||||
foreach (var control in menu.controls)
|
||||
{
|
||||
var newControl = new Control
|
||||
{
|
||||
name = control.name,
|
||||
type = control.type,
|
||||
icon = control.icon,
|
||||
parameter = control.parameter,
|
||||
subMenu = DuplicateMenu(control.subMenu),
|
||||
value = control.value,
|
||||
style = control.style,
|
||||
labels = control.labels,
|
||||
subParameters = control.subParameters
|
||||
};
|
||||
newMenu.controls.Add(newControl);
|
||||
}
|
||||
|
||||
return newMenu;
|
||||
}
|
||||
|
||||
private void WalkMenu(MenuStylingConfig config, VRCExpressionsMenu menu)
|
||||
{
|
||||
foreach (var child in menu.controls)
|
||||
{
|
||||
if (!child.name.StartsWith(config.Prefix))
|
||||
{
|
||||
child.name = config.Prefix + child.name;
|
||||
}
|
||||
if (!child.name.EndsWith(config.Suffix))
|
||||
{
|
||||
child.name += config.Suffix;
|
||||
}
|
||||
if (child.type == Control.ControlType.SubMenu && child.subMenu != null)
|
||||
{
|
||||
WalkMenu(config, child.subMenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
MenuStyling/Editor/MenuStylingPlugin.cs.meta
Normal file
11
MenuStyling/Editor/MenuStylingPlugin.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 70d8d478556ad6041934e7fa2ec8ad7f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
MenuStyling/Runtime.meta
Normal file
8
MenuStyling/Runtime.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: de237b1c4fbb98f49bc90073ed3baf80
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
11
MenuStyling/Runtime/MenuStyling.cs
Normal file
11
MenuStyling/Runtime/MenuStyling.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
using UnityEngine;
|
||||
|
||||
namespace gay.lilyy.MenuStyling
|
||||
{
|
||||
public class MenuStylingConfig : MonoBehaviour, VRC.SDKBase.IEditorOnly
|
||||
{
|
||||
public string Prefix = "<b><color=#c481d6>";
|
||||
public string Suffix = "";
|
||||
}
|
||||
}
|
||||
11
MenuStyling/Runtime/MenuStyling.cs.meta
Normal file
11
MenuStyling/Runtime/MenuStyling.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 99e4fe2301861cf4ebff218a88d03c72
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
3
MenuStyling/Runtime/MenuStylingRuntimeAsmdef.asmdef
Normal file
3
MenuStyling/Runtime/MenuStylingRuntimeAsmdef.asmdef
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"name": "MenuStylingRuntimeAsmdef"
|
||||
}
|
||||
7
MenuStyling/Runtime/MenuStylingRuntimeAsmdef.asmdef.meta
Normal file
7
MenuStyling/Runtime/MenuStylingRuntimeAsmdef.asmdef.meta
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8a060350c9ddd424197c8fd1e0d63f72
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Add table
Add a link
Reference in a new issue