예제 #1
0
 /// <summary>
 /// 리더보드 열기
 /// </summary>
 public void OnLeaderboardClicked()
 {
     if (EGSocial._IsAuthenticated)
     {
         Define.OpenSongLeaderboard(_beatInfo);
     }
 }
예제 #2
0
        public Panel()
        {
            InitializeComponent();
            this.Text = Define.GetTitle();

            Logger.LoggerSend += (e) => AppendTextRichTextBox(e.log, e.color);
            gameCore           = new GameCore();
        }
예제 #3
0
        private const float _topBoxMinHeightScreenRate = 0.05f;  // 상단 박스의 화면 내 최소 세로 비중

        /// <summary>
        ///  씬 진입 시 한번 실행
        /// </summary>
        protected override void OnAwake()
        {
            _instance = this;
            Define.SetFPS();
            Define.InitCommonSystems();
            //_shapePoolManager.RecordMaxCreatedCount();
            //_moverPoolManager.RecordMaxCreatedCount();
            _Players = new List <Player>();
            _Shots   = new List <Shot>();
            _Enemys  = new List <Enemy>();
            _Bullets = new List <Bullet>();
            _Effects = new List <Effect>();

            StartLoading();
        }
예제 #4
0
        /// <summary>
        /// 결과 정산 및 보여주기
        /// </summary>
        private void DoResult()
        {
            // 상태 변경
            SetState(StateType.Result);

            // 유지할 필요 없는 구성요소 무효화
            _srcSong.Stop();
            _srcEffect.Stop();
            RemoveAllMover();

            // 하이스코어 갱신
            bool newHighScore = false;
            int  highScore    = Define.GetSongHighScore(_beatInfo);

            if (_score > highScore)
            {
                newHighScore = true;
                highScore    = _score;
                Define.SetSongHighScore(_beatInfo, _score);
            }
            // 클리어 여부 갱신
            bool cleared = !_isGameOvered;

            if (cleared)
            {
                if (!Define.IsSongCleared(_beatInfo))
                {
                    Define.SetSongCleared(_beatInfo, true);
                }

                // 업적 달성 여부는 로컬로 불러오지 않으므로 매번 시도
                if (EGSocial._IsAuthenticated)
                {
                    Define.ReportAchievementProgress(_beatInfo._clearAchievementKey, 100.0);
                }
            }

            // 리더보드 갱신 시도
            if (EGSocial._IsAuthenticated)
            {
                Define.ReportScoreToSongLeaderboard(_beatInfo, _score);
            }

            // 결과 UI
            _UIResult.SetData(_beatInfo, cleared, _score, highScore, newHighScore);
            _UIResult.Open();
        }
예제 #5
0
        // 엔진에서 호출하는 플레이 갱신
        public void UpdatePlay()
        {
            // 키입력 처리
            if (_HasKeyInputFocus)
            {
                if (Input.GetButtonDown(ButtonName._start) || Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.Menu))
                {
                    StartPause();
                }
                else if (Input.GetButtonDown(ButtonName._screenshot))
                {
                    Define.CaptureScreenshot();
                }
            }
            if (_isPaused)
            {
                return;
            }


            // 프레임 갱신 하지 않을 것인가?
            bool skipUpdateFrame = false;

            // 노래 끝나면 isPlaying = false, time = 0, timeSamples = 0
            // time 은 timeSamples / clip.frequency 와 소수점 정밀도 제외하고는 동일함
            // 노래가 재생중일 때는 보정 발생할 수 있음
            if (_srcSong.isPlaying)
            {
                // 현재 노래 재생 시점을 프레임 단위로 변경
                int songFrame = (int)(_srcSong.time * (float)Define._fps);
                // 이번에 갱신할 게임 프레임
                int gameFrame = _Frame + 1;
                //Debug.Log("songFrame:" + songFrame.ToString() + " gameFrame:" + gameFrame.ToString());

                if (songFrame > gameFrame + _songFrameOverToMuch)
                {
                    // 한꺼번에 다 따라잡아야 할 정도로 노래가 앞서감
                    // 기본 갱신 1회가 있으므로 노래 -1 까지 따라잡음
                    int targetFrame = (songFrame - 1);
                    while (_Frame < targetFrame)
                    {
                        UpdatePlayFrame(true);
                    }
                }
                else if (songFrame > gameFrame + _songFrameOverTolerance)
                {
                    // 조금씩 따라잡을 정도로 노래가 앞서감
                    //Debug.Log("[GameSystem] Song frame over occurred. Song:" + songFrame.ToString() + " Game:" + gameFrame.ToString());
                    int targetFrame = Mathf.Min(songFrame - 1, _Frame + _additionalBySongFrameOver);
                    while (_Frame < targetFrame)
                    {
                        //Debug.Log("over occured!");
                        UpdatePlayFrame(true);
                    }
                }
                else if (songFrame + _gameFrameOverGap < gameFrame)
                {
                    //Debug.Log("[GameSystem] Game frame skip occurred. Song:" + songFrame.ToString() + " Game:" + gameFrame.ToString());
                    // 게임이 노래를 앞서나가면 갱신하지 않음
                    skipUpdateFrame = true;
                }
//                 else
//                 {
//                     Debug.Log("[GameSystem] Song:" + songFrame.ToString() + " Game:" + gameFrame.ToString() + " gap:" + (songFrame - gameFrame).ToString());
//                 }
            }

            if (!skipUpdateFrame)
            {
                UpdatePlayFrame(false);
            }

            // 결과 보여줘야 하는가?
            if ((_isGameOvered && _Frame >= (_gameOveredFrame + _gameOverResultDelay)) || // 게임오버되었고 딜레이 지남
                !_srcSong.isPlaying     // 노래가 종료됨
                )
            {
                DoResult();
            }

            if (_TestInfo != null && _TestInfo._ForScreenshot)
            {
                StartPause();
            }
        }