Example #1
0
        void OnSpinReelComplete()
        {
            if (_isExpecting)
            {
                HideExpect();
            }

            _isTweenLast = false;
            _isSpinning  = false;
            _isStopping  = false;
            _isExpecting = false;

            _spinTween             = null;
            _lastSymbolNames.Value = _receivedSymbolNames.Value;
            ExpectType             = ExpectReelType.Null;

            RemoveSymbolsExceptNecessary();
            AlignSymbols(-_machineConfig.tweenLastBackInfo.distance);

            SlotSoundList.ReelStop();

            if (_machineConfig.tweenLastBackInfo.distance != 0)
            {
                var backOutTween = _symbolContainer.DOLocalMove(Vector3.zero, _machineConfig.tweenLastBackInfo.duration);
                backOutTween.SetEase(Ease.OutBack);
                backOutTween.Play();
            }

            UnLock();

            if (OnStop != null)
            {
                OnStop(this);
            }
        }
Example #2
0
        IEnumerator Spin_Enter()
        {
            _bookedSpin = false;

            if (_paylineDisplayer != null)
            {
                _paylineDisplayer.Clear();
            }

            _betting.Save();

            _ui.Spin();
            _reelContainer.Spin();
            _topboard.Spin();

            SlotSoundList.Spin();

            if (_testSendData != null)
            {
                GameServerCommunicator.Instance.Send(_testSendData);
                _testSendData = null;
            }
            else
            {
                GameServerCommunicator.Instance.Spin(_betting.LineBet);
            }

            yield break;
        }
Example #3
0
        void CheckNextReel()
        {
            if (_nextStopIndex >= _machineConfig.column)
            {
                ReelStopCompleted();
                return;
            }

            var nextOrder = _spinStartOrder[_nextStopIndex];
            var nextReel  = _reels[nextOrder];

            if (nextReel.IsLocked)
            {
                ++_nextStopIndex;
                CheckNextReel();
                return;
            }

            if (nextReel.IsExpectable)
            {
                IsExpecting = true;

                for (var i = _nextStopIndex; i < _machineConfig.column; ++i)
                {
                    var reel = _reels[_spinStartOrder[i]];
                    if (i == _nextStopIndex)
                    {
                        reel.IsLoop = false;
                    }
                    else
                    {
                        reel.IsLoop = true;
                    }
                }

                nextReel.SpinToExpect();
                SlotSoundList.Expect(null);
                return;
            }

            if (IsExpecting)
            {
                IsExpecting = false;

                for (var i = _nextStopIndex; i < _machineConfig.column; ++i)
                {
                    var reel = _reels[_spinStartOrder[i]];
                    reel.IsLoop = false;
                }
            }
        }
Example #4
0
        void CheckScatters()
        {
            if (_machineConfig.ScatterInfos == null)
            {
                return;
            }

            var count = _machineConfig.ScatterInfos.Count;

            Debug.Log("------ CheckScatters: " + count);

            for (var i = 0; i < count; ++i)
            {
                var       info = _machineConfig.ScatterInfos[i];
                AudioClip stopSound;
                if (info.CheckScattered(_lastStoppedReel, out stopSound))
                {
                    SlotSoundList.PlaySFX(stopSound);
                }
                else
                {
                }
            }

            /*
             * var res: Vector.<ASymbol> = mStoppedReel.getSymbolsByType( SymbolType.FREESPIN );
             *          var count: int = res.length;
             *          if( count == 0 ) return;
             *
             *          if( mStoppedReel.column == 2 && getSymbolCount( SymbolType.FREESPIN ) < 1 )
             *          {
             *                  return;
             *          }
             *          else if(  mStoppedReel.column == 4 && getSymbolCount( SymbolType.FREESPIN ) < 2)
             *          {
             *                  return;
             *          }
             *
             *          var symbol: ASymbol;
             *          for( var i: int = 0; i < count; ++i)
             *          {
             *                  symbol = res[i];
             *                  symbol.setState( SymbolState.SCATTER );
             *          }
             *
             *          addSymbolCount( SymbolType.FREESPIN );
             *
             *          SoundPlayer.manager.playScatterStop( SymbolType.FREESPIN );
             */
        }
Example #5
0
        IEnumerator Initialize(ResDTO.Login dto)
        {
            //필요한 리소스 Pool 들의 preload 가 완료 되길 기다린다.
            while (GamePool.IsReady == false)
            {
                Debug.Log("Wait Pool...");
                yield return(new WaitForSeconds(0.2f));
            }

            Debug.Log("Pool readied");

            _model.SetLoginData(dto);

            //-----------------------------------------------------------------
            // essential module
            // ReelContainer & Topboard & SlotMachineUI
            //-----------------------------------------------------------------

            _ui = FindObjectOfType <SlotMachineUI>() as SlotMachineUI;
            _ui.Initialize(this);

            _reelContainer = GetComponentInChildren <ReelContainer>();
            _reelContainer.Initialize(this);
            _reelContainer.OnPlayAllWin       += OnPlayAllWinHandler;
            _reelContainer.OnPlayEachWin      += OnPlayEachWinHandler;
            _reelContainer.OnReelStopComplete += OnReelStopCompleteListener;

            _topboard = GetComponentInChildren <Topboard>();

            _paylineDisplayer = GetComponentInChildren <PaylineDisplayer>();
            if (_paylineDisplayer != null)
            {
                _paylineDisplayer.Initialize(this);
            }

            _freeSpinDirector = GetComponentInChildren <FreeSpinDirector>();
            if (_freeSpinDirector != null)
            {
                _freeSpinDirector.Initialize(this);
            }

            SlotSoundList.Initialize();

            GameManager.Instance.SceneReady();

            SetState(MachineState.Idle);
        }
Example #6
0
        IEnumerator FreeSpinTrigger_Enter()
        {
            SlotSoundList.PlayFreeSpinTrigger();

            _reelContainer.FreeSpinTrigger();
            _topboard.FreeSpinTrigger();
            _ui.FreeSpinTrigger();

            yield return(new WaitForSeconds(MachineConfig.transition.FreeSpinTriggerDuration));

            if (_lastSpinInfo.totalPayout > 0)
            {
                SetState(MachineState.PlayWin);
            }
            else
            {
                SetState(MachineState.CheckNextSpin);
            }
        }
Example #7
0
        IEnumerator BonusSpin_Enter()
        {
            if (_paylineDisplayer != null)
            {
                _paylineDisplayer.Clear();
            }

            _lastSpinInfo = _model.NextSpin();

            yield return(_reelContainer.LockReel(_lastSpinInfo.fixedreel));

            _topboard.BonusSpin();

            yield return(new WaitForSeconds(MachineConfig.transition.LockReelAfterDelay));

            _reelContainer.BonusSpin(_lastSpinInfo);
            SlotSoundList.Spin();

            yield break;
        }
Example #8
0
        IEnumerator FreeSpin_Enter()
        {
            _lastSpinInfo = _model.UseFreeSpin();

            if (_lastSpinInfo == null)
            {
                Debug.LogError("freeSpin info null");
            }

            if (_model.FreeSpinCurrentCount == 1)
            {
                yield return(StartCoroutine(FreeSpinModeStart()));
            }

            _topboard.FreeSpin();
            _ui.FreeSpin();
            _reelContainer.FreeSpin(_lastSpinInfo);

            SlotSoundList.FreeSpin();
        }
Example #9
0
        IEnumerator Idle_Enter()
        {
            SlotSoundList.PlayBGM();

            _ui.Idle();

            if (_model.IsAutoSpin)
            {
                _model.UseAutoSpin();

                yield return(new WaitForSeconds(_model.IsFastSpin ? 0f : MachineConfig.transition.AutoSpinDelay));

                TrySpin();
            }
            else if (_bookedSpin)
            {
                TrySpin();
            }

            yield break;
        }
Example #10
0
        IEnumerator FreeSpinReady_Enter()
        {
            if (_paylineDisplayer != null)
            {
                _paylineDisplayer.Clear();
            }

            SlotSoundList.PlayFreeSpinReady();

            _reelContainer.FreeSpinReady();
            _topboard.FreeSpinReady();

            if (_freeSpinDirector == null)
            {
                yield return(new WaitForSeconds(2f));

                SetState(MachineState.FreeSpin);
            }
            else if (_model.IsFreeSpinReTrigger)
            {
                yield return(StartCoroutine(_freeSpinDirector.Retrigger()));

                SetState(MachineState.FreeSpin);
            }
            else if (MachineConfig.TriggerType == FreeSpinTriggerType.Select)
            {
                yield return(StartCoroutine(_freeSpinDirector.Select()));

                GameServerCommunicator.Instance.FreeSpin(_betting.LineBet, _freeSpinDirector.SelectedKind.Value);
            }
            else
            {
                yield return(StartCoroutine(_freeSpinDirector.Trigger()));

                SetState(MachineState.FreeSpin);
            }
        }
Example #11
0
 IEnumerator FreeSpinReady_Exit()
 {
     SlotSoundList.StopFreeSpinReady();
     _freeSpinDirector.Close();
     yield break;
 }
Example #12
0
 IEnumerator FreeSpinTrigger_Exit()
 {
     SlotSoundList.StopFreeSpinTrigger();
     yield break;
 }
Example #13
0
 void OnReelStopCompleteListener()
 {
     SlotSoundList.StopSpin();
     SetState(MachineState.ReelStopComplete);
 }
Example #14
0
 void OnDestroy()
 {
     _instance = null;
 }
Example #15
0
 void Awake()
 {
     _instance = this;
 }
Example #16
0
 virtual public void SettingByScript()
 {
     _slotConfig  = GetComponent <SlotConfig>();
     _soundPlayer = GetComponent <SlotSoundList>();
 }