Esempio n. 1
0
    private void Update()
    {
        foreach (IWidget child in childs.Values)
        {
            child.Update(null);
        }

        PointerEventData pointerData = new PointerEventData(EventSystem.current);

        pointerData.position = Input.mousePosition;
        List <RaycastResult> results = new List <RaycastResult>();

        EventSystem.current.RaycastAll(pointerData, results);
        if (results.Count > 0)
        {
            //foreach(RaycastResult r in results) {
            for (int i = 0; i < results.Count; ++i)
            {
                WidgetComponent wic = results[i].gameObject.GetComponent <WidgetComponent>();
                if (wic != null)
                {
                    if (wic.widget is Widget)
                    {
                        (wic.widget as Widget).Emit("OnHover", new object[] { childs, Verse.Instance, wic.widget });
                    }
                    if (HoverObject is Widget && wic.widget != HoverObject)
                    {
                        (HoverObject as Widget).Emit("OnHoverExit", new object[] { childs, Verse.Instance, HoverObject });
                    }
                    HoverObject = wic.widget;
                    break;
                }
            }
            //Debug.Log(results[0].gameObject.name);
            //}
        }
        else
        {
            HoverObject = null;
        }
        //EventSystem.current.RaycastAll(Input.mousePosition, Camera.main);
        if (HoverObject != null)
        {
            string ttt = HoverObject.GetToolTipText();
            if (ttt == null)
            {
                Tooltip.SetActive(false);
            }
            else
            {
                Tooltip.transform.position = Input.mousePosition + new Vector3(17f, -17f, -1f);
                Tooltip.SetActive(true);
                Tooltip.GetComponentInChildren <UnityEngine.UI.Text>().text = ttt;
            }
        }
        else
        {
            Tooltip.SetActive(false);
        }
    }
Esempio n. 2
0
 public void Load()
 {
     if (WidgetType == WidgetType.Generated)
     {
         if (string.IsNullOrEmpty(Name))
         {
             WidgetComponent.Load(Path);
         }
         else
         {
             WidgetComponent.Load(Path, Name, Environment.TickCount * Row * Column);
         }
     }
     else
     {
         WidgetComponent.Load();
     }
     IsLoaded = true;
 }
Esempio n. 3
0
 public void Unload()
 {
     WidgetComponent.Unload();
     IsLoaded = false;
 }