Exemple #1
0
        public static void SetVisible(VRDevice device, Location location, bool visible)
        {
            Transform tooltip = GlobalState.GetTooltipTransform(device, location);

            if (null == tooltip)
            {
                return;
            }

            tooltip.gameObject.SetActive(visible);
        }
Exemple #2
0
        private static void SetOpacity(VRDevice device, float angle)
        {
            Transform tooltip = GlobalState.GetTooltipTransform(device, Location.Grip);

            SetOpacity(tooltip, angle);
            tooltip = GlobalState.GetTooltipTransform(device, Location.Trigger);
            SetOpacity(tooltip, angle);
            tooltip = GlobalState.GetTooltipTransform(device, Location.Primary);
            SetOpacity(tooltip, angle);
            tooltip = GlobalState.GetTooltipTransform(device, Location.Secondary);
            SetOpacity(tooltip, angle);
            tooltip = GlobalState.GetTooltipTransform(device, Location.Joystick);
            SetOpacity(tooltip, angle);
        }
Exemple #3
0
        public static void SetText(VRDevice device, Location location, Action action, string text, bool visible = true)
        {
            Transform tooltip = GlobalState.GetTooltipTransform(device, location);

            if (null == tooltip)
            {
                return;
            }

            Transform textTransform = tooltip.Find("Canvas/Panel/Text");

            if (null != textTransform)
            {
                TextMeshProUGUI tmpro = textTransform.GetComponent <TextMeshProUGUI>();
                tmpro.text = text;
            }

            string icon = "";

            switch (action)
            {
            case Action.Push: icon = "action-push"; break;

            case Action.HoldPush: icon = "action-hold-push"; break;

            case Action.Horizontal: icon = "action-joystick-horizontal"; break;

            case Action.HoldHorizontal: icon = "action-hold-joystick-horizontal"; break;

            case Action.Vertical: icon = "action-joystick-vertical"; break;

            case Action.HoldVertical: icon = "action-hold-joystick-vertical"; break;

            case Action.Joystick: icon = "action-joystick"; break;
            }
            Transform imageTransform = tooltip.Find("Canvas/Panel/Image");

            if (null != imageTransform)
            {
                Image image = imageTransform.GetComponent <Image>();
                icon         = "empty"; // don't use icon value yet, we don't have any image
                image.sprite = UIUtils.LoadIcon(icon);
            }

            tooltip.gameObject.SetActive(visible);
        }