//public IVRPanelLayout m_Layout = IVRPanelLayout.Low;
    //private List<AnchorWidget> mChildWidgetList = new List<AnchorWidget>();
    //private List<AnchorWidget> mFocusChildList = new List<AnchorWidget>();

    //void Update()
    //{
    //    //If no panel is locked, or if the panel is the last one locked, then determine whether the focus was received
    //    if (!IVRAnchorHandler.Instance.isHaveLocker() || IVRAnchorHandler.Instance.CheckTopLocker(this))
    //    {
    //        HoverUpdate();
    //    }
    //}

    ///// <summary>
    ///// Update the focus status of all the children in this panel
    ///// </summary>
    //private void HoverUpdate()
    //{
    //    List<AnchorWidget> allFocusWidgetList = IVRAnchorHandler.Instance.GetCanUseWidgets();
    //    //If this sub-class of panel is in the activated widget list, add it to the focus list, and trigger the focus event
    //    for (int i = 0; i < allFocusWidgetList.Count; i++)
    //    {
    //        if (!mFocusChildList.Contains(allFocusWidgetList[i]) && mChildWidgetList.Contains(allFocusWidgetList[i]))
    //        {
    //            allFocusWidgetList[i].RunOnHover(true);
    //            mFocusChildList.Add(allFocusWidgetList[i]);
    //        }
    //    }

    //    //If the widget in the received focus list lost focus, remove it from the focus list, and trigger the lost focus event
    //    for (int i = 0; i < mFocusChildList.Count; i++)
    //    {
    //        if (!allFocusWidgetList.Contains(mFocusChildList[i]))
    //        {
    //            mFocusChildList[i].RunOnHover(false);
    //            mFocusChildList.Remove(mFocusChildList[i]);
    //        }
    //    }
    //}

    ///// <summary>
    ///// Add Widget, and install Panel to Widget
    ///// </summary>
    ///// <param name="widget">Widget.</param>
    public void AddWidget(AnchorWidget widget)
    {
        //    if (widget != null && !mChildWidgetList.Contains(widget))
        //    {
        //        mChildWidgetList.Add(widget);
        //    }
    }
 ///// <summary>
 ///// Adds the focus widget.
 ///// </summary>
 ///// <param name="widget">Widget.</param>
 public void AddFocusWidget(AnchorWidget widget)
 {
     //    //Widget is not empty, and is not in the focus list. Moreover, it must be Widget of Panel
     //    if (widget != null && !mFocusChildList.Contains(widget) && mChildWidgetList.Contains(widget))
     //    {
     //        widget.RunOnHover(true);
     //        mFocusChildList.Add(widget);
     //    }
 }
 ///// <summary>
 ///// Removes the focus widget.
 ///// </summary>
 ///// <param name="widget">Widget.</param>
 public void RemoveFocusWidget(AnchorWidget widget)
 {
     //    //Widget is not empty, and it is in the list of focus
     //    if (widget != null && mFocusChildList.Contains(widget))
     //    {
     //        widget.RunOnHover(false);
     //        mFocusChildList.Remove(widget);
     //    }
 }
    /// <summary>
    /// Get the specified control.
    /// </summary>
    /// <param name="go">The anchor control</param>
    public static AnchorWidget Get(GameObject go)
    {
        AnchorWidget listener = go.GetComponent <AnchorWidget>();

        if (listener == null)
        {
            listener = go.AddComponent <VREventListener>();
        }
        return(listener);
    }
 ///// <summary>
 ///// Removes the widget.
 ///// </summary>
 ///// <param name="widget">Widget.</param>
 public void RemoveWidget(AnchorWidget widget)
 {
     //    if (widget != null && mChildWidgetList.Contains(widget))
     //    {
     //        mChildWidgetList.Remove(widget);
     //        if (mFocusChildList.Contains(widget))
     //        {
     //            widget.RunOnHover(false);
     //            mFocusChildList.Remove(widget);
     //        }
     //    }
 }
Пример #6
0
    void Start()
    {
        AnchorWidget aw = VREventListener.Get(gameObject);

        aw.onHover = (GameObject go, bool isHover) => {
            if (isHover)
            {
                StartCoroutine("Rotation");
            }
            else
            {
                StopCoroutine("Rotation");
            }
        };

        aw.OnClickEvent = (GameObject go) =>
        {
            rot = new Vector3(rot.z, rot.x, rot.y);
        };
    }
 public void RemoveFocusWidget(AnchorWidget widget)
 {
     //if (mFocusWidgetList.Contains(widget)) mFocusWidgetList.Remove(widget);
 }
 public void AddFocusWidget(AnchorWidget widget)
 {
     //mFocusWidgetList.Add(widget);
 }
 public bool isFocused(AnchorWidget widget)
 {
     return(false);
     //return mFocusWidgetList.Contains(widget);
 }