Пример #1
0
        private void CycleSession(CycleDirection direction)
        {
            int numSessions = _sessionMgr.Sessions.Count;

            if (numSessions > 1)
            {
                int sessionIndex = _sessionMgr.Sessions.IndexOf(_currentSession);
                if (sessionIndex != -1)
                {
                    if (direction == CycleDirection.Previous)
                    {
                        sessionIndex--;
                        if (sessionIndex < 0)
                        {
                            sessionIndex = numSessions - 1;
                        }
                    }
                    else
                    {
                        sessionIndex++;
                        if (sessionIndex >= numSessions)
                        {
                            sessionIndex = 0;
                        }
                    }

                    var newSession = _sessionMgr.Sessions[sessionIndex];
                    var newTab     = _leftTabs[sessionIndex];
                    ChangeSession(newSession, newTab);
                }
            }
        }
Пример #2
0
        internal void CyclePlacemat(Placemat placemat, CycleDirection direction)
        {
            var node = m_Placemats.Find(placemat);

            if (node == null)
            {
                return;
            }

            var next = direction == CycleDirection.Up ? node.Next : node.Previous;

            if (next != null)
            {
                m_Placemats.Remove(placemat);
                if (direction == CycleDirection.Down)
                {
                    m_Placemats.AddBefore(next, node);
                }
                else
                {
                    m_Placemats.AddAfter(next, node);
                }
            }

            UpdateElementsOrder();
        }
Пример #3
0
        public static void SortInCycle(Vector3[] vectors, CycleDirection direction)
        {
            Vector3 center = GetAverageVector(vectors);

            //clockwise
            Array.Sort(vectors, (v1, v2) =>
            {
                v1 -= center;
                v2 -= center;
                return(Mathf.Atan2(v1.x, v1.y).CompareTo(Mathf.Atan2(v2.x, v2.y)));
            });
        }
Пример #4
0
        public SpriteComponent(Entity entity)
            : base(entity)
        {
            _spriteID = -1;
            _colour   = Color4.White;

            _xFrames       = 1;
            _yFrames       = 1;
            _currentXFrame = 0;
            _currentYFrame = 0;

            _timer          = 0;
            _frameTime      = 0.3;
            _animating      = true;
            _cycleDirection = CycleDirection.Horizontal;
        }
Пример #5
0
 public void SetCycleDirection(CycleDirection cycleDirection)
 {
     _cycleDirection = cycleDirection;
 }
Пример #6
0
 /// <summary>
 /// Cycles the given property or option. The second argument can be up or down to set the cycle direction. On overflow, set the property back to the minimum, on underflow set it to the maximum.
 /// </summary>
 /// <param name="direction">The cycling direction. By default, Up.</param>
 public virtual Task CycleAsync(CycleDirection direction = CycleDirection.Up, ApiOptions?options = null) => Api.CycleAsync(PropertyName, direction, options);