示例#1
0
 public override void Reset()
 {
     this.gameObject = null;
     this.fingerId   = new FsmInt
     {
         UseVariable = true
     };
     this.touchBegan        = null;
     this.touchMoved        = null;
     this.touchStationary   = null;
     this.touchEnded        = null;
     this.touchCanceled     = null;
     this.storeFingerId     = null;
     this.storeHitPoint     = null;
     this.normalizeHitPoint = false;
     this.storeOffset       = null;
     this.relativeTo        = TouchGUIEvent.OffsetOptions.Center;
     this.normalizeOffset   = true;
     this.everyFrame        = true;
 }
示例#2
0
        private void DoTouchOffset(Vector3 touchPos)
        {
            if (this.storeOffset.IsNone)
            {
                return;
            }
            Rect    screenRect = this.guiElement.GetScreenRect();
            Vector3 value      = default(Vector3);

            TouchGUIEvent.OffsetOptions offsetOptions = this.relativeTo;
            if (offsetOptions != TouchGUIEvent.OffsetOptions.TopLeft)
            {
                if (offsetOptions != TouchGUIEvent.OffsetOptions.Center)
                {
                    if (offsetOptions == TouchGUIEvent.OffsetOptions.TouchStart)
                    {
                        value = touchPos - this.touchStartPos;
                    }
                }
                else
                {
                    Vector3 b = new Vector3(screenRect.x + screenRect.width * 0.5f, screenRect.y + screenRect.height * 0.5f, 0f);
                    value = touchPos - b;
                }
            }
            else
            {
                value.x = touchPos.x - screenRect.x;
                value.y = touchPos.y - screenRect.y;
            }
            if (this.normalizeOffset.Value)
            {
                value.x /= screenRect.width;
                value.y /= screenRect.height;
            }
            this.storeOffset.Value = value;
        }