当前位置: 首页>>代码示例>>C#>>正文


C# Gestures.Gesture类代码示例

本文整理汇总了C#中TouchScript.Gestures.Gesture的典型用法代码示例。如果您正苦于以下问题:C# Gesture类的具体用法?C# Gesture怎么用?C# Gesture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Gesture类属于TouchScript.Gestures命名空间,在下文中一共展示了Gesture类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnEnable

        protected virtual void OnEnable()
        {
            hideFlags = HideFlags.HideAndDontSave;

            instance = target as Gesture;

            advanced = serializedObject.FindProperty("advancedProps");
            friendlyGestures = serializedObject.FindProperty("friendlyGestures");
            requireGestureToFail = serializedObject.FindProperty("requireGestureToFail");
            combineTouches = serializedObject.FindProperty("combineTouches");
            combineTouchesInterval = serializedObject.FindProperty("combineTouchesInterval");
            useSendMessage = serializedObject.FindProperty("useSendMessage");
            sendMessageTarget = serializedObject.FindProperty("sendMessageTarget");
            sendStateChangeMessages = serializedObject.FindProperty("sendStateChangeMessages");

            friendlyGesturesList = new ReorderableList(serializedObject, friendlyGestures, false, false, false, true);
            friendlyGesturesList.headerHeight = 0;
            friendlyGesturesList.drawElementCallback += (rect, index, active, focused) =>
            {
                rect.height = 16;
                var gesture = friendlyGestures.GetArrayElementAtIndex(index).objectReferenceValue as Gesture;
                if (gesture == null)
                {
                    // Killing null elements.
                    indexToRemove = index;
                    EditorGUI.LabelField(rect, GUIContent.none);
                    return;
                }
                EditorGUI.LabelField(rect, string.Format("{0} @ {1}", gesture.GetType().Name, gesture.name), GUIElements.BoxLabelStyle);
            };
            friendlyGesturesList.onRemoveCallback += list => { indexToRemove = list.index; };
        }
开发者ID:Jashengmato,项目名称:TouchScript,代码行数:32,代码来源:GestureEditor.cs

示例2: OnEnter

        public override void OnEnter()
        {
            gesture = GestureUtils.GetGesture<Gesture>(Fsm, GameObject, Gesture, Component, false);
            if (gesture == null)
            {
                LogError("Gesture is missing");
                return;
            }

            gesture.StateChanged += gestureStateChangedHandler;
        }
开发者ID:Jashengmato,项目名称:TouchScript,代码行数:11,代码来源:GestureStateChanged.cs

示例3: addFriendlyGesture

        private void addFriendlyGesture(SerializedProperty prop, Gesture value)
        {
            if (value == null || value == target) return;

            addGesture(prop, value);

            var so = new SerializedObject(value);
            so.Update();
            SerializedProperty p = so.FindProperty(FRIENDLY_GESTURES_PROP);
            p.arraySize++;
            p.GetArrayElementAtIndex(p.arraySize - 1).objectReferenceValue = target;

            so.ApplyModifiedProperties();
            EditorUtility.SetDirty(value);
        }
开发者ID:ksmylz,项目名称:TouchScript,代码行数:15,代码来源:GestureEditor.cs

示例4: OnEnter

        public override void OnEnter()
        {
            gesture = GestureUtils.GetGesture<Gesture>(Fsm, GameObject, Gesture, Component, false);
            if (gesture == null)
            {
                LogError("Gesture is missing");
                return;
            }

            ITouchHit hit;
            gesture.GetTargetHitResult(out hit);
            var hit3d = hit as ITouchHit3D;
            if (hit3d == null) return;

            if (Collider != null) Collider.Value = hit3d.Collider;
            if (RigidBody != null) RigidBody.Value = hit3d.Rigidbody;
            if (Normal != null) Normal.Value = hit3d.Normal;
            if (Point != null) Point.Value = hit3d.Point;

            Finish();
        }
开发者ID:Jashengmato,项目名称:TouchScript,代码行数:21,代码来源:Get3DHitResult.cs

示例5: shouldBegin

 private bool shouldBegin(Gesture gesture)
 {
     bool result = true;
     if (GlobalGestureDelegate != null) result = GlobalGestureDelegate.ShouldBegin(gesture);
     return result && gesture.ShouldBegin();
 }
开发者ID:oafkad,项目名称:TouchScript,代码行数:6,代码来源:GestureManagerInstance.cs

示例6: failGesture

 private void failGesture(Gesture gesture)
 {
     gesture.INTERNAL_SetState(Gesture.GestureState.Failed);
 }
开发者ID:oafkad,项目名称:TouchScript,代码行数:4,代码来源:GestureManagerInstance.cs

示例7: gestureIsActive

 private bool gestureIsActive(Gesture gesture)
 {
     if (gesture.gameObject.activeInHierarchy == false) return false;
     if (gesture.enabled == false) return false;
     switch (gesture.State)
     {
         case Gesture.GestureState.Failed:
         case Gesture.GestureState.Recognized:
         case Gesture.GestureState.Cancelled:
             return false;
         default:
             return true;
     }
 }
开发者ID:oafkad,项目名称:TouchScript,代码行数:14,代码来源:GestureManagerInstance.cs

示例8: doUpdateEnded

 private void doUpdateEnded(Gesture gesture, TouchPoint touch)
 {
     gesture.INTERNAL_TouchEnded(touch);
 }
开发者ID:oafkad,项目名称:TouchScript,代码行数:4,代码来源:GestureManagerInstance.cs

示例9: INTERNAL_GestureChangeState

        internal Gesture.GestureState INTERNAL_GestureChangeState(Gesture gesture, Gesture.GestureState state)
        {
            bool recognized = false;
            switch (state)
            {
                case Gesture.GestureState.Possible:
                    break;
                case Gesture.GestureState.Began:
                    switch (gesture.State)
                    {
                        case Gesture.GestureState.Possible:
                            break;
                        default:
                            print(String.Format("Gesture {0} erroneously tried to enter state {1} from state {2}",
                                new object[] {gesture, state, gesture.State}));
                            break;
                    }
                    recognized = recognizeGestureIfNotPrevented(gesture);
                    if (!recognized)
                    {
                        if (!gesturesToReset.Contains(gesture)) gesturesToReset.Add(gesture);
                        return Gesture.GestureState.Failed;
                    }
                    break;
                case Gesture.GestureState.Changed:
                    switch (gesture.State)
                    {
                        case Gesture.GestureState.Began:
                        case Gesture.GestureState.Changed:
                            break;
                        default:
                            print(String.Format("Gesture {0} erroneously tried to enter state {1} from state {2}",
                                new object[] {gesture, state, gesture.State}));
                            break;
                    }
                    break;
                case Gesture.GestureState.Failed:
                    if (!gesturesToReset.Contains(gesture)) gesturesToReset.Add(gesture);
                    break;
                case Gesture.GestureState.Recognized: // Ended
                    if (!gesturesToReset.Contains(gesture)) gesturesToReset.Add(gesture);
                    switch (gesture.State)
                    {
                        case Gesture.GestureState.Possible:
                            recognized = recognizeGestureIfNotPrevented(gesture);
                            if (!recognized)
                            {
                                return Gesture.GestureState.Failed;
                            }
                            break;
                        case Gesture.GestureState.Began:
                        case Gesture.GestureState.Changed:
                            break;
                        default:
                            print(string.Format("Gesture {0} erroneously tried to enter state {1} from state {2}",
                                new object[] {gesture, state, gesture.State}));
                            break;
                    }
                    break;
                case Gesture.GestureState.Cancelled:
                    if (!gesturesToReset.Contains(gesture)) gesturesToReset.Add(gesture);
                    break;
            }

            return state;
        }
开发者ID:oafkad,项目名称:TouchScript,代码行数:66,代码来源:GestureManagerInstance.cs

示例10: recognizeGesture

 private void recognizeGesture(Gesture gesture)
 {
     var gestures = getHierarchyContaining(gesture.transform);
     foreach (var otherGesture in gestures)
     {
         if (gesture == otherGesture) continue;
         if (!gestureIsActive(otherGesture)) continue;
         if (!(otherGesture.State == Gesture.GestureState.Began || otherGesture.State == Gesture.GestureState.Changed) &&
             gesture.CanPreventGesture(otherGesture))
         {
             failGesture(otherGesture);
         }
     }
 }
开发者ID:kod3r,项目名称:TouchScript,代码行数:14,代码来源:TouchManager.cs

示例11: gestureCanRecognize

        private bool gestureCanRecognize(Gesture gesture)
        {
            if (!gesture.ShouldBegin()) return false;

            var gestures = getHierarchyContaining(gesture.transform);
            foreach (var otherGesture in gestures)
            {
                if (gesture == otherGesture) continue;
                if (!gestureIsActive(otherGesture)) continue;
                if ((otherGesture.State == Gesture.GestureState.Began || otherGesture.State == Gesture.GestureState.Changed) &&
                    otherGesture.CanPreventGesture(gesture))
                {
                    return false;
                }
            }

            return true;
        }
开发者ID:kod3r,项目名称:TouchScript,代码行数:18,代码来源:TouchManager.cs

示例12: failGesture

 private void failGesture(Gesture gesture)
 {
     gesture.SetState(Gesture.GestureState.Failed);
 }
开发者ID:kod3r,项目名称:TouchScript,代码行数:4,代码来源:TouchManager.cs

示例13: GestureChangeState

        internal Gesture.GestureState GestureChangeState(Gesture gesture, Gesture.GestureState state)
        {
            switch (state)
            {
                case Gesture.GestureState.Possible:
                    break;
                case Gesture.GestureState.Began:
                    switch (gesture.State)
                    {
                        case Gesture.GestureState.Possible:
                            break;
                        default:
                            print(String.Format("Gesture {0} erroneously tried to enter state {1} from state {2}", gesture, state, gesture.State));
                            break;
                    }
                    if (gestureCanRecognize(gesture))
                    {
                        recognizeGesture(gesture);
                    } else
                    {
                        if (!gesturesToReset.Contains(gesture)) gesturesToReset.Add(gesture);
                        return Gesture.GestureState.Failed;
                    }
                    break;
                case Gesture.GestureState.Changed:
                    switch (gesture.State)
                    {
                        case Gesture.GestureState.Began:
                        case Gesture.GestureState.Changed:
                            break;
                        default:
                            print(String.Format("Gesture {0} erroneously tried to enter state {1} from state {2}", gesture, state, gesture.State));
                            break;
                    }
                    break;
                case Gesture.GestureState.Failed:
                    if (!gesturesToReset.Contains(gesture)) gesturesToReset.Add(gesture);
                    break;
                case Gesture.GestureState.Recognized: // Ended
                    if (!gesturesToReset.Contains(gesture)) gesturesToReset.Add(gesture);
                    switch (gesture.State)
                    {
                        case Gesture.GestureState.Possible:
                            if (gestureCanRecognize(gesture))
                            {
                                recognizeGesture(gesture);
                            } else
                            {
                                return Gesture.GestureState.Failed;
                            }
                            break;
                        case Gesture.GestureState.Began:
                        case Gesture.GestureState.Changed:
                            break;
                        default:
                            print(String.Format("Gesture {0} erroneously tried to enter state {1} from state {2}", gesture, state, gesture.State));
                            break;
                    }
                    break;
                case Gesture.GestureState.Cancelled:
                    if (!gesturesToReset.Contains(gesture)) gesturesToReset.Add(gesture);
                    break;
            }

            return state;
        }
开发者ID:kod3r,项目名称:TouchScript,代码行数:66,代码来源:TouchManager.cs

示例14: addFriendlyGesture

        private void addFriendlyGesture(SerializedProperty prop, Gesture value)
        {
            if (value == null || value == target) return;

            // Adding that gesture to this gesture.
            var shouldAdd = true;
            for (int i = 0; i < prop.arraySize; i++)
            {
                if (prop.GetArrayElementAtIndex(i).objectReferenceValue == value)
                {
                    shouldAdd = false;
                    break;
                }
            }

            if (shouldAdd)
            {
                prop.arraySize++;
                prop.GetArrayElementAtIndex(prop.arraySize - 1).objectReferenceValue = value;
                addFriendlyGestureId.Invoke(instance, new object[] {value});
            }

            // Adding this gesture to that gesture.
            shouldAdd = true;
            var so = new SerializedObject(value);
            so.Update();
            SerializedProperty p = so.FindProperty(FRIENDLY_GESTURES_PROP);
            for (int i = 0; i < p.arraySize; i++)
            {
                if (p.GetArrayElementAtIndex(i).objectReferenceValue == target)
                {
                    shouldAdd = false;
                    break;
                }
            }

            if (shouldAdd)
            {
                p.arraySize++;
                p.GetArrayElementAtIndex(p.arraySize - 1).objectReferenceValue = target;
                so.ApplyModifiedProperties();
                EditorUtility.SetDirty(value);
                addFriendlyGestureId.Invoke(value, new object[] {instance});
            }
        }
开发者ID:scbwin,项目名称:TouchScript,代码行数:45,代码来源:GestureEditor.cs

示例15: CanBePreventedByGesture

 /// <summary>
 /// Determines whether this instance can be prevented by specified gesture.
 /// </summary>
 /// <param name="gesture"> The gesture. </param>
 /// <returns> <c>true</c> if this instance can be prevented by specified gesture; <c>false</c> otherwise. </returns>
 public virtual bool CanBePreventedByGesture(Gesture gesture)
 {
     if (Delegate == null) return !IsFriendly(gesture);
     return !Delegate.ShouldRecognizeSimultaneously(this, gesture);
 }
开发者ID:oafkad,项目名称:TouchScript,代码行数:10,代码来源:Gesture.cs


注:本文中的TouchScript.Gestures.Gesture类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。