protected override void lazyUpdateImpl() { if (!bIsStart) { return; } if (cCamObj && cCharMgr) { cCamObj.transform.LookAt(cCharMgr.cMainChar.gameObject.transform.position + posOffset); } SceneManager mgr = Singlton.getInstance("SceneManager") as SceneManager; //Debug.Log("lazyUpdateImpl"); fTime += Time.deltaTime; //Debug.Log("ftime" + ftime); nTime = (int)fTime; //测试节奏用 LabTest.text = "Time:" + nTime.ToString() + " Beat:" + fBeatTime /* + " Score:" + nScore*/; fSliderStep = (300 / fBeatTime) * Time.deltaTime; posSliderPos.x += fSliderStep; if (posSliderPos.x >= 150f) { posSliderPos.x = -150f; Debug.LogWarning("fTime" + fTime); } if (posSliderPos.x >= 80 && posSliderPos.x <= 100) { LabTest.color = cC1; } else { LabTest.color = cC2; } SprBeatSlider.transform.localPosition = posSliderPos; if (posSliderPos.x >= 115 && posSliderPos.x <= 115 + fSliderStep) { if ((nCurOpeIdx != nRecordCurOpeCnt && !bIsNullOpe) || bIsCanPressDrum) { NvSoundController soundctr = Singlton.getInstance("NvSoundController") as NvSoundController; soundctr.PlaySe("beatmiss"); } if (nCurOpeDataIdx != 0 && !bIsNullOpe) { if (!bIsLastGoodUp) { Miss(); } bIsCanPressDrum = false; for (int i = 0; i < SprOperator.Length; i++) { SprOperator[i].enabled = false; } BtnDrumBeat.gameObject.active = false; SprDrumBeatHalo.enabled = false; SprDrumBeatHalo.animation.Stop(); //cGesture.SetGestureEnable(false); } } //Debug.LogWarning("cCurSongData.litBeatDataIdx = " + cCurSongData.litBeatDataIdx + " Count = " + mgr.cShareData.lstBeatData[cCurSongData.litBeatDataIdx].litOpeData.Count); if (mgr.cShareData.lstBeatData[cCurSongData.litBeatDataIdx].litOpeData.Count > nCurOpeDataIdx) { //Debug.Log("nCurOpeDataIdx:" + nCurOpeDataIdx); if (posSliderPos.x >= 140 && posSliderPos.x <= 140 + fSliderStep /*Mathf.Abs((float)cCurSongData.litOpeCode[nCurOpeDataIdx].nShowTime / 100f - fTime) < Time.deltaTime*/) { //Debug.LogError("nTime:" + nTime); if (fTime > (float)mgr.cShareData.lstBeatData[cCurSongData.litBeatDataIdx].litOpeData[0].nShowTime / 100f - 1) { int nTempTurns = 0; if (bIsInShowTime) { if (++nShowTimeCnt > ShowTimeTurns) { ShowTimeAccomplish(); cCurOpeData = mgr.cShareData.lstBeatData[cCurSongData.litBeatDataIdx].litOpeData[nCurOpeDataIdx]; nRecordCurOpeCnt = cCurOpeData.mapOpeCode[mgr.cShareData.strDiffLv].litOpeInfo.Count; nTempTurns = 1; } else { cCurOpeData = mgr.cShareData.lstBeatData[cCurSongData.litBeatDataIdx].litOpeData[nCurOpeDataIdx]; cCurOpeData.mapOpeCode[mgr.cShareData.strDiffLv].litOpeInfo.Clear(); cCurOpeData.mapOpeCode[mgr.cShareData.strDiffLv].litOpeInfo.Add((int)UnityEngine.Random.Range(5, 8)); cCurOpeData.mapOpeCode[mgr.cShareData.strDiffLv].litOpeInfo.Add((int)UnityEngine.Random.Range(5, 8)); cCurOpeData.mapOpeCode[mgr.cShareData.strDiffLv].litOpeInfo.Add((int)UnityEngine.Random.Range(5, 8)); if ((int)UnityEngine.Random.Range(0, 10) > 4) { cCurOpeData.mapOpeCode[mgr.cShareData.strDiffLv].litOpeInfo.Add((int)UnityEngine.Random.Range(5, 8)); } if ((int)UnityEngine.Random.Range(0, 10) > 6) { cCurOpeData.mapOpeCode[mgr.cShareData.strDiffLv].litOpeInfo.Add((int)UnityEngine.Random.Range(5, 8)); } nRecordCurOpeCnt = 3; nTempTurns = 2; } } else { cCurOpeData = mgr.cShareData.lstBeatData[cCurSongData.litBeatDataIdx].litOpeData[nCurOpeDataIdx]; nRecordCurOpeCnt = cCurOpeData.mapOpeCode[mgr.cShareData.strDiffLv].litOpeInfo.Count; nTempTurns = 1; } ShowOneGroup(); nCurOpeIdx = 0; nCurOpeDataIdx += nTempTurns; bIsLastGoodUp = false; } } } if (Input.GetKeyDown(KeyCode.Space)) { DrumBeat(); } if (cCurOpeData != null) { if (nCurOpeIdx >= nRecordCurOpeCnt) { BtnDrumBeat.gameObject.active = true; SprDrumBeatHalo.enabled = true; SprDrumBeatHalo.animation.Play(); bIsCanPressDrum = true; cCurOpeData = null; //cGesture.SetGestureEnable(false); } else { cGesture.SetGestureEnable(true); if (Input.GetKeyDown(KeyCode.UpArrow)) { VerdictOperator(1); } if (Input.GetKeyDown(KeyCode.DownArrow)) { VerdictOperator(2); } if (Input.GetKeyDown(KeyCode.LeftArrow)) { VerdictOperator(3); } if (Input.GetKeyDown(KeyCode.RightArrow)) { VerdictOperator(4); } } } }
protected override void lazyUpdateImpl() { if (!bIsStart) return; if(cCamObj && cCharMgr) { cCamObj.transform.LookAt(cCharMgr.cMainChar.gameObject.transform.position + posOffset); } SceneManager mgr = Singlton.getInstance("SceneManager") as SceneManager; //Debug.Log("lazyUpdateImpl"); fTime += Time.deltaTime; //Debug.Log("ftime" + ftime); nTime = (int)fTime; //测试节奏用 LabTest.text = "Time:" + nTime.ToString() + " Beat:" + fBeatTime/* + " Score:" + nScore*/; fSliderStep = (300/fBeatTime)*Time.deltaTime; posSliderPos.x += fSliderStep; if(posSliderPos.x >= 150f) { posSliderPos.x = -150f; Debug.LogWarning("fTime" + fTime); } if(posSliderPos.x >= 80 && posSliderPos.x <= 100) { LabTest.color = cC1; } else { LabTest.color = cC2; } SprBeatSlider.transform.localPosition = posSliderPos; if (posSliderPos.x >= 115 && posSliderPos.x <= 115 + fSliderStep) { if ((nCurOpeIdx != nRecordCurOpeCnt && !bIsNullOpe) || bIsCanPressDrum) { NvSoundController soundctr = Singlton.getInstance("NvSoundController") as NvSoundController; soundctr.PlaySe("beatmiss"); } if (nCurOpeDataIdx != 0 && !bIsNullOpe) { if (!bIsLastGoodUp) { Miss(); } bIsCanPressDrum = false; for (int i = 0; i < SprOperator.Length; i++) { SprOperator[i].enabled = false; } BtnDrumBeat.gameObject.active = false; SprDrumBeatHalo.enabled = false; SprDrumBeatHalo.animation.Stop(); //cGesture.SetGestureEnable(false); } } //Debug.LogWarning("cCurSongData.litBeatDataIdx = " + cCurSongData.litBeatDataIdx + " Count = " + mgr.cShareData.lstBeatData[cCurSongData.litBeatDataIdx].litOpeData.Count); if (mgr.cShareData.lstBeatData[cCurSongData.litBeatDataIdx].litOpeData.Count > nCurOpeDataIdx) { //Debug.Log("nCurOpeDataIdx:" + nCurOpeDataIdx); if (posSliderPos.x >= 140 && posSliderPos.x <= 140 + fSliderStep /*Mathf.Abs((float)cCurSongData.litOpeCode[nCurOpeDataIdx].nShowTime / 100f - fTime) < Time.deltaTime*/) { //Debug.LogError("nTime:" + nTime); if (fTime > (float)mgr.cShareData.lstBeatData[cCurSongData.litBeatDataIdx].litOpeData[0].nShowTime / 100f - 1) { int nTempTurns = 0; if (bIsInShowTime) { if(++nShowTimeCnt > ShowTimeTurns) { ShowTimeAccomplish(); cCurOpeData = mgr.cShareData.lstBeatData[cCurSongData.litBeatDataIdx].litOpeData[nCurOpeDataIdx]; nRecordCurOpeCnt = cCurOpeData.mapOpeCode[mgr.cShareData.strDiffLv].litOpeInfo.Count; nTempTurns = 1; } else { cCurOpeData = mgr.cShareData.lstBeatData[cCurSongData.litBeatDataIdx].litOpeData[nCurOpeDataIdx]; cCurOpeData.mapOpeCode[mgr.cShareData.strDiffLv].litOpeInfo.Clear(); cCurOpeData.mapOpeCode[mgr.cShareData.strDiffLv].litOpeInfo.Add((int)UnityEngine.Random.Range(5,8)); cCurOpeData.mapOpeCode[mgr.cShareData.strDiffLv].litOpeInfo.Add((int)UnityEngine.Random.Range(5,8)); cCurOpeData.mapOpeCode[mgr.cShareData.strDiffLv].litOpeInfo.Add((int)UnityEngine.Random.Range(5,8)); if ((int)UnityEngine.Random.Range(0, 10) > 4) { cCurOpeData.mapOpeCode[mgr.cShareData.strDiffLv].litOpeInfo.Add((int)UnityEngine.Random.Range(5, 8)); } if ((int)UnityEngine.Random.Range(0, 10) > 6) { cCurOpeData.mapOpeCode[mgr.cShareData.strDiffLv].litOpeInfo.Add((int)UnityEngine.Random.Range(5, 8)); } nRecordCurOpeCnt = 3; nTempTurns = 2; } } else { cCurOpeData = mgr.cShareData.lstBeatData[cCurSongData.litBeatDataIdx].litOpeData[nCurOpeDataIdx]; nRecordCurOpeCnt = cCurOpeData.mapOpeCode[mgr.cShareData.strDiffLv].litOpeInfo.Count; nTempTurns = 1; } ShowOneGroup(); nCurOpeIdx = 0; nCurOpeDataIdx += nTempTurns; bIsLastGoodUp = false; } } } if (Input.GetKeyDown(KeyCode.Space)) { DrumBeat(); } if(cCurOpeData != null) { if (nCurOpeIdx >= nRecordCurOpeCnt) { BtnDrumBeat.gameObject.active = true; SprDrumBeatHalo.enabled = true; SprDrumBeatHalo.animation.Play(); bIsCanPressDrum = true; cCurOpeData = null; //cGesture.SetGestureEnable(false); } else { cGesture.SetGestureEnable(true); if (Input.GetKeyDown (KeyCode.UpArrow)) { VerdictOperator(1); } if (Input.GetKeyDown(KeyCode.DownArrow)) { VerdictOperator(2); } if (Input.GetKeyDown(KeyCode.LeftArrow)) { VerdictOperator(3); } if (Input.GetKeyDown(KeyCode.RightArrow)) { VerdictOperator(4); } } } }