Beispiel #1
0
        private void Start()
        {
            var deviceAgnosticChildCount = _deviceAgnosticRootTransform.childCount;

            for (var i = deviceAgnosticChildCount - 1; i >= 0; i--)
            {
                var childGameObject = _deviceAgnosticRootTransform.GetChild(i);
                Destroy(childGameObject.gameObject);
            }

            var deviceSpecificChildCount = _deviceSpecificRootTransform.childCount;

            for (var i = deviceSpecificChildCount - 1; i >= 0; i--)
            {
                var childGameObject = _deviceSpecificRootTransform.GetChild(i);
                Destroy(childGameObject.gameObject);
            }

            _wearableControl = WearableControl.Instance;

            for (var i = 0; i < WearableConstants.GESTURE_IDS.Length; i++)
            {
                GestureId gestureId = WearableConstants.GESTURE_IDS[i];

                if (gestureId == GestureId.None)
                {
                    continue;
                }

                if (_wearableControl.GetWearableGestureById(gestureId).IsAvailable == false)
                {
                    continue;
                }

                Sprite sprite;
                if (!_gestureIconFactory.TryGetGestureIcon(gestureId, out sprite))
                {
                    Debug.LogWarningFormat(this, GESTURE_ICON_NOT_FOUND_FORMAT, gestureId);
                    continue;
                }

                Sprite glowSprite;
                if (!_gestureGlowIconFactory.TryGetGestureIcon(gestureId, out glowSprite))
                {
                    Debug.LogWarningFormat(this, GESTURE_ICON_NOT_FOUND_FORMAT, gestureId);
                    continue;
                }

                Transform displayRoot = (gestureId.IsGestureDeviceAgnostic())?
                                        _deviceAgnosticRootTransform : _deviceSpecificRootTransform;
                var gestureDisplay = Instantiate(_gestureDisplay, displayRoot, false);
                gestureDisplay.Set(gestureId, sprite, glowSprite);
                gestureDisplay.gameObject.SetActive(true);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Each product has its own mapping from physical gestures to abstract ones.  If we do not know
        /// about this product or this gesture we return GestureId.None.
        /// </summary>
        public static GestureId GetDeviceSpecificGestureForProduct(GestureId deviceAgnosticGestureId, ProductType product)
        {
            GestureId abstractGesture = GestureId.None;

            if (deviceAgnosticGestureId.IsGestureDeviceAgnostic())
            {
                Debug.LogWarningFormat(WearableConstants.GESTURE_NOT_DEVICE_AGNOSTIC_WARNING, deviceAgnosticGestureId);
            }
            else
            {
                Dictionary <GestureId, GestureId> mappingForProduct = null;
                if (_agnosticToSpecificGesture.TryGetValue(product, out mappingForProduct))
                {
                    mappingForProduct.TryGetValue(deviceAgnosticGestureId, out abstractGesture);
                }
            }

            return(abstractGesture);
        }