namespace UIWidgets.Menu
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using UIWidgets.Styles;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
///
/// Context menu.
/// Contains menu items and reference to the menu template.
///
public partial class ContextMenu : UIBehaviour, IPointerDownHandler, IPointerUpHandler, IPointerClickHandler
{
///
/// Menu instance.
///
protected class MenuInstance : IMenuSubscriber, IStylable
{
ContextMenuView template;
///
/// Template.
///
public ContextMenuView Template
{
get
{
return template;
}
set
{
if (value == null)
{
throw new ArgumentNullException("value");
}
if (template == value)
{
return;
}
if (template != null)
{
ResetMenu();
Template.Unsubscribe(this);
}
template = value;
ResetMenu();
Template.Subscribe(this);
if (IsOpened)
{
UpdateItems();
}
if (submenu != null)
{
submenu.Template = Template;
}
}
}
///
/// Preferred menu position.
///
protected Vector2 Position;
///
/// Menu items.
///
protected ReadOnlyCollection