#if MA_VRCSDK3_AVATARS
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using VRC.SDK3.Avatars.ScriptableObjects;
// Internal runtime API for the Virtual Menu system.
//
// IMPORTANT: This API is currently considered unstable. Due to C# protection rules, we are required to make classes
// here public, but be aware that they may change without warning in the future.
namespace nadena.dev.modular_avatar.core.menu
{
///
/// A MenuNode represents a single VRCExpressionsMenu, prior to overflow splitting. MenuNodes form a directed graph,
/// which may contain cycles, and may include contributions from multiple MenuInstallers, or from the base avatar
/// menu.
///
public class VirtualMenuNode
{
public List Controls = new List();
///
/// The primary (serialized) object that contributed to this menu; if we want to add more items to it, we look
/// here. This can currently be either a VRCExpressionsMenu, a MAMenuItem, or a RootMenu.
///
public readonly object NodeKey;
internal VirtualMenuNode(object nodeKey)
{
NodeKey = nodeKey;
}
}
/**
* A single control on a MenuNode. The main difference between this and a true VRCExpressionsMenu.Control is that
* we use a MenuNode instead of a VRCExpressionsMenu for submenus.
*/
public class VirtualControl : VRCExpressionsMenu.Control
{
///
/// VirtualControls do not reference real VRCExpressionsMenu objects, but rather virtual MenuNodes.
///
public VirtualMenuNode SubmenuNode;
internal VirtualControl(VRCExpressionsMenu.Control control)
{
this.name = control.name;
this.type = control.type;
this.parameter = new Parameter() {name = control?.parameter?.name};
this.value = control.value;
this.icon = control.icon;
this.style = control.style;
this.subMenu = null;
this.subParameters = control.subParameters?.Select(p => new VRCExpressionsMenu.Control.Parameter()
{
name = p.name
})?.ToArray() ?? Array.Empty();
this.labels = control.labels?.ToArray() ?? Array.Empty