Пример #1
0
 public void StopInstant(int waitCount = 0)
 {
     if (isReady || state == ReelState.Stopping)
     {
         return;
     }
     state       = ReelState.Stopping;
     stopRequest = waitCount;
 }
Пример #2
0
 public void Spin()
 {
     if (!isReady)
     {
         return;
     }
     UpdateRenderAll();
     state       = ReelState.Moving;
     stopRequest = -1;
     OnSpinStarted?.Invoke();
 }
Пример #3
0
        private void Update()
        {
            if (!isInit)
            {
                return;
            }
            long preSpinCount = spinCount;

            if (isMoving)
            {
                moveValue += speed * 0.1f;
            }
            while (moveValue >= 1f)
            {
                moveValue -= 1f;
                CursorUp();
            }
            while (moveValue <= -1f)
            {
                moveValue += 1f;
                CursorDown();
            }
            if (preSpinCount != spinCount) //커서가 변경되었을 때
            //다음 커서값 설정하기
            {
                if (cursorRequest != null)
                {
                    if (dir == RotateDirection.Down)
                    {
                        cursors[cursors.Count - 1] = cursorRequest.settingCursor - cursorRequest.waitCount;
                    }
                    else
                    {
                        cursors[0] = cursorRequest.settingCursor + cursorRequest.waitCount;
                    }
                    cursorRequest.waitCount -= 1;
                    cursorRequest            = null;
                }
                if (stopRequest > 0)
                {
                    stopRequest--;
                }
                if (stopRequest == 0)
                {
                    moveValue = 0f;
                    ApplyMoveValue();
                    state = ReelState.Idle;
                    OnStoped?.Invoke();
                }

                UpdateRenderAll();
                OnCursorChanged?.Invoke(cursor);
            }
        }
Пример #4
0
        public void Switch()
        {
            var table = new[]
            {
                new { pre = ReelState.Stop, post = ReelState.Cycle },
                new { pre = ReelState.Cycle, post = ReelState.Stop },
            };

            State = table.Where(t => t.pre == State)
                         .First()
                         .post;
        }