protected override void SetNoteObject() { if (!Flick.Equals(FlickMode.None)) { Body.sizeDelta = new Vector2(110, 110); } base.SetNoteObject(); SizeInPixelPrev = SizeInPixel; SizeInPixelNext = SizeInPixel; if (Game.Mode.Equals(GameMode.Theater)) { StartPos = new Vector3(-307.22195f + 87.7777f * StartLine, 217, 0); EndPos = new Vector3(-553 + 158 * EndLine, -240, 0); } else if (Game.Mode.Equals(GameMode.Theater4)) { StartPos = new Vector3(-363.889f + 145.5556f * StartLine, 217, 0); EndPos = new Vector3(-655 + 262 * EndLine, -240, 0); } else if (Game.Mode.Equals(GameMode.Theater2L)) { StartPos = new Vector3(-396.6666f + 264.4444f * StartLine, 217, 0); EndPos = new Vector3(-714 + 476 * EndLine, -240, 0); } else if (Game.Mode.Equals(GameMode.Theater2P)) { StartPos = new Vector3(-256.5f + 171 * StartLine, 241, 0); EndPos = new Vector3(-567 + 378 * EndLine, -311, 0); } FlickBorderLeft = EndPos.x - 79; FlickBorderRight = EndPos.x + 79; BorderUp = 0; BorderDown = float.MinValue; if (SizeInPixel > 130) { if (Game.Mode.Equals(GameMode.Theater2P)) { StartPos = new Vector3(0, 241, 0); EndPos = new Vector3(0, -311, 0); } else { StartPos = new Vector3(0, 217, 0); EndPos = new Vector3(0, -240, 0); } FlickBorderLeft = -100; FlickBorderRight = 100; } }
protected virtual void SetNoteObject() { SizeInPixel = Body.sizeDelta.x; gameObject.GetComponent <Image>().sprite = Game.GetNoteTexture(Mode, Flick); if (SizeInPixel > 130) { gameObject.GetComponent <Image>().sprite = Instantiate(Game.IsNoteColored ? Game.WhiteTexture[9] : Game.NoteTexture[9]) as Sprite; } if (Flick.Equals(FlickMode.Left)) { Body.sizeDelta = new Vector2(Body.sizeDelta.y * 1.2f, Body.sizeDelta.y); Body.pivot = new Vector2(7f / 12f, 0.5f); } else if (Flick.Equals(FlickMode.Right)) { Body.sizeDelta = new Vector2(Body.sizeDelta.y * 1.2f, Body.sizeDelta.y); Body.pivot = new Vector2(5f / 12f, 0.5f); } else if (Flick.Equals(FlickMode.Up)) { Body.sizeDelta = new Vector2(Body.sizeDelta.x, Body.sizeDelta.x * 1.2f); Body.pivot = new Vector2(0.5f, 5f / 12f); } else if (Flick.Equals(FlickMode.Down)) { Body.sizeDelta = new Vector2(Body.sizeDelta.x, Body.sizeDelta.x * 1.2f); Body.pivot = new Vector2(0.5f, 7f / 12f); } if (Game.IsNoteColored) { gameObject.GetComponent <Image>().color = ColorKey; } if (gameObject.GetComponent <Image>().sprite == null) { gameObject.GetComponent <Image>().color = Color.clear; } Body.SetAsFirstSibling(); RunningFrames = 100 / Speed; AppearFrame = ReachFrame - RunningFrames; if (Mode.Equals(NoteInfo.SystemNoteStarter)) { Game.Frame -= RunningFrames; } }
public override void CreateTailConnector() { base.CreateTailConnector(); if (TailToNext != null) { if (Game.IsNoteColored) { TailToNext.Color = new Color32(ColorKey.r, ColorKey.g, ColorKey.b, 180); } else { TailToNext.Color = new Color32(255, 255, 255, 180); } if (Mode.Equals(NoteInfo.LongNoteStart)) { TailToNext.SetEndPos(Game.Dispensor.Notes[NextNoteID].StartPos, 0, 0); } else if (Mode.Equals(NoteInfo.SlideNoteStart) || Mode.Equals(NoteInfo.SlideNoteCheckpoint)) { TailToNext.SetStartPos(StartPos, 0f, 0); TailToNext.SetEndPos(Game.Dispensor.Notes[NextNoteID].StartPos, 0f, 0); } } if (!Flick.Equals(FlickMode.None)) { GameObject MyConnector = Instantiate(Game.BaseConnector) as GameObject; MyConnector.name = "c" + ID.ToString(); ConnectorToNext = MyConnector.GetComponent <ImprovedConnector>(); ConnectorToNext.OwnerID = ID; if (Game.IsNoteColored) { ConnectorToNext.MainRenderer.material.color = new Color32(ColorKey.r, ColorKey.g, ColorKey.b, 180); } ConnectorToNext.EndPos = Game.Dispensor.Notes[NextNoteID].StartPos; ConnectorToNext.EndScale = 0; Game.Dispensor.Notes[NextNoteID].ConnectorsFromPrevious.Add(ConnectorToNext); } TailCreated = true; }
public void ParseBlock(IngameBasis Game, ref int ID, ref double Time, ref DelesteGlobalData StaticData) { int MaxBit = 1; List <int> DataIndex = new List <int>(), StartIndex = new List <int>(), EndIndex = new List <int>(); List <string[]> Datas = new List <string[]>(); // DataIndex, StartIndex, EndIndex의 초기화와 MaxBit의 갱신, 그리고 Datas의 값 대입을 수행합니다. for (int i = 0; i < DataLines.Count; i++) { Datas.Add(DataLines[i].Split(new char[] { ':' })); DataIndex.Add(-1); StartIndex.Add(0); EndIndex.Add(0); MaxBit = LCM(MaxBit, Datas[i][1].Length); } // MaxBit를 기반으로, 차례차례 데이터를 해석하고 추가하는 전체 과정입니다. for (int i = 0; i < MaxBit; i++) { // 선제적으로, 각종 큐들을 살펴보면서 조건을 만족한다면 데이터를 그에 맞춥니다. if (StaticData.Measure.Count > 0 && StaticData.MeasurePos[0] <= Measure + (i / (double)MaxBit)) { StaticData.BeatMultiplier = StaticData.Measure[0]; StaticData.Measure.RemoveAt(0); StaticData.MeasurePos.RemoveAt(0); } if (StaticData.ChangeBPM.Count > 0 && StaticData.ChangeBPMPos[0] <= Measure + (i / (double)MaxBit)) { StaticData.CurrentBPM = StaticData.ChangeBPM[0]; StaticData.ChangeBPM.RemoveAt(0); StaticData.ChangeBPMPos.RemoveAt(0); } if (StaticData.HS2.Count > 0 && StaticData.HS2Pos[0] <= Measure + (i / (double)MaxBit)) { StaticData.SpeedMultiplier = StaticData.HS2[0]; StaticData.HS2.RemoveAt(0); StaticData.HS2Pos.RemoveAt(0); } if (StaticData.Delay.Count > 0 && StaticData.DelayPos[0] <= Measure + (i / (double)MaxBit)) { Time += StaticData.Delay[0]; StaticData.Delay.RemoveAt(0); StaticData.DelayPos.RemoveAt(0); } if (StaticData.Scroll.Count > 0 && StaticData.ScrollPos[0] <= Measure + (i / (double)MaxBit)) { Game.CreateNote(new NoteData(ID++, 0, (float)Time, (float)StaticData.Scroll[0][0], 0, 0, NoteType.Scroller, FlickType.NotFlick, new Color32(255, 255, 255, 0), new List <int>())); StaticData.EndScrollTime = Time + StaticData.Scroll[0][1]; StaticData.IsScrollModified = true; StaticData.Scroll.RemoveAt(0); StaticData.ScrollPos.RemoveAt(0); } if (StaticData.EndScrollTime <= Time && StaticData.IsScrollModified) { Game.CreateNote(new NoteData(ID++, 0, (float)Time, 1, 0, 0, NoteType.Scroller, FlickType.NotFlick, new Color32(255, 255, 255, 0), new List <int>())); StaticData.IsScrollModified = false; } // Data를 병렬적으로 처리합니다. for (int j = 0; j < Datas.Count; j++) { // 만약 현재의 i 지점에 해당하는 해당 데이터의 계산된 인덱스가 기존의 인덱스보다 크다면 값을 그에 맞춥니다. if (i / (MaxBit / Datas[j][1].Length) > DataIndex[j]) { DataIndex[j]++; } else { continue; } // 데이터를 가져옵니다. 코드 간략화를 위함입니다. char Command = Datas[j][1][DataIndex[j]]; // 필요한 개별 변수를 설정합니다. (1차) NoteType Mode; FlickType Flick; // 노트의 기본 정보를 해석합니다. if (Command.Equals('1') || char.ToUpper(Command).Equals('L')) { Mode = NoteType.Tap; Flick = FlickType.Left; } else if (Command.Equals('2') || char.ToUpper(Command).Equals('T')) { Mode = NoteType.Tap; Flick = FlickType.NotFlick; } else if (Command.Equals('3') || char.ToUpper(Command).Equals('R')) { Mode = NoteType.Tap; Flick = FlickType.Right; } else if (Command.Equals('4') || char.ToUpper(Command).Equals('H')) { Mode = NoteType.HoldStart; Flick = FlickType.NotFlick; } else if (Command.Equals('5') || char.ToUpper(Command).Equals('S')) { Mode = NoteType.SlideStart; Flick = FlickType.NotFlick; } else { continue; } // 필요한 개별 변수를 설정합니다. (2차) double Start = 3, End = 3; // 시작 지점과 끝 지점을 설정합니다. // 위 코드의 continue 때문에, 유효한 노트 데이터가 해석이 되어야 이 부분부터의 코드에 도달합니다. if (Datas[j].Length >= 3) { int DummyStart; char StartText = Datas[j][2][StartIndex[j]]; if (int.TryParse(StartText.ToString(), out DummyStart)) { Start = DummyStart; } else { if (char.ToUpper(StartText).Equals('A')) { Start = 1.5; } else if (char.ToUpper(StartText).Equals('B')) { Start = 2.5; } else if (char.ToUpper(StartText).Equals('C')) { Start = 3.5; } else if (char.ToUpper(StartText).Equals('D')) { Start = 4.5; } else { throw new Exception("While parsing Deleste file: Error in start point parsing."); } } StartIndex[j]++; if (Datas[j].Length.Equals(3)) { End = Start; } } if (Datas[j].Length >= 4) { int DummyEnd; char EndText = Datas[j][3][EndIndex[j]]; if (int.TryParse(EndText.ToString(), out DummyEnd)) { End = DummyEnd; } else { if (char.ToUpper(EndText).Equals('A')) { End = 1.5; } else if (char.ToUpper(EndText).Equals('B')) { End = 2.5; } else if (char.ToUpper(EndText).Equals('C')) { End = 3.5; } else if (char.ToUpper(EndText).Equals('D')) { End = 4.5; } else { throw new Exception("While parsing Deleste file: Error in end point parsing."); } } EndIndex[j]++; } // 필요한 개별 변수를 설정합니다. (3차) List <int> Prevs = new List <int>(); if (!StaticData.HoldPrev.ContainsKey(End)) { StaticData.HoldPrev.Add(End, 0); } if (!StaticData.TailPrev.ContainsKey(Channel[j])) { StaticData.TailPrev.Add(Channel[j], 0); } if (!StaticData.ConnectorPrev.ContainsKey(Channel[j])) { StaticData.ConnectorPrev.Add(Channel[j], new List <double[]>(3)); } if (!StaticData.BeforeTime.ContainsKey(Channel[j])) { StaticData.BeforeTime.Add(Channel[j], 0); } // 연결할 이전 노트가 있으면 연결합니다. Tail, Connector 순서로 연결합니다. // Tail은 홀드 노트를 우선으로 합니다 (추후 변경 가능). 중복은 허용하지 않습니다. if (Mode.Equals(NoteType.Tap) && StaticData.HoldPrev[End] > 0) { Mode = NoteType.HoldEnd; Prevs.Add(StaticData.HoldPrev[End]); StaticData.HoldPrev[End] = 0; } else if (Mode.Equals(NoteType.Tap) && StaticData.TailPrev[Channel[j]] > 0) { Mode = NoteType.SlideEnd; Prevs.Add(StaticData.TailPrev[Channel[j]]); StaticData.TailPrev[Channel[j]] = 0; } if (Mode.Equals(NoteType.SlideStart) && StaticData.TailPrev[Channel[j]] > 0) { Mode = NoteType.SlideMiddle; Prevs.Add(StaticData.TailPrev[Channel[j]]); } // Connector를 연결합니다. // ConnectorPrev[Channel[j]][x]에서 x=0의 값은 방향(증가 방향이 양수), x=1의 값은 비교 지점, x=2의 값은 노트 ID입니다. if (!Flick.Equals(FlickType.NotFlick) && StaticData.ConnectorPrev[Channel[j]].Count > 0) { for (int k = 0; k < StaticData.ConnectorPrev[Channel[j]].Count; k++) { if (Time - StaticData.BeforeTime[Channel[j]] > 0 && Time - StaticData.BeforeTime[Channel[j]] <= 1) { if (StaticData.ConnectorPrev[Channel[j]][k][0] > 0) { if (End > StaticData.ConnectorPrev[Channel[j]][k][1]) { Prevs.Add((int)StaticData.ConnectorPrev[Channel[j]][k][2]); } } else if (StaticData.ConnectorPrev[Channel[j]][k][0] < 0) { if (End < StaticData.ConnectorPrev[Channel[j]][k][1]) { Prevs.Add((int)StaticData.ConnectorPrev[Channel[j]][k][2]); } } else { Prevs.Add((int)StaticData.ConnectorPrev[Channel[j]][k][2]); } } } if (StaticData.BeforeTime[Channel[j]] != Time) { StaticData.ConnectorPrev[Channel[j]].Clear(); } } else if (Flick.Equals(FlickType.NotFlick) && StaticData.ConnectorPrev[Channel[j]].Count > 0 && StaticData.BeforeTime[Channel[j]] != Time) { StaticData.ConnectorPrev[Channel[j]].Clear(); } // 다음 노트와 연결될 노트에 대한 데이터를 전역 데이터에 입력합니다. if (Mode.Equals(NoteType.HoldStart)) { StaticData.HoldPrev[End] = ID; } else if (Mode.Equals(NoteType.SlideStart) || Mode.Equals(NoteType.SlideMiddle)) { StaticData.TailPrev[Channel[j]] = ID; } if (!Flick.Equals(FlickType.NotFlick)) { if (Channel[j] % 4 == 0 || Channel[j] % 4 == 1) { if (Flick.Equals(FlickType.Left)) { StaticData.ConnectorPrev[Channel[j]].Add(new double[3] { -1, End, ID }); } else if (Flick.Equals(FlickType.Right)) { StaticData.ConnectorPrev[Channel[j]].Add(new double[3] { 1, End, ID }); } } else if (Channel[j] % 4 == 2 || Channel[j] % 4 == 3) { StaticData.ConnectorPrev[Channel[j]].Add(new double[3] { 0, End, ID }); } StaticData.BeforeTime[Channel[j]] = Time; } // 노트를 게임에 추가합니다. Game.CreateNote(new NoteData(ID++, 1, (float)Time, (float)(Speed[j] * StaticData.SpeedMultiplier), (float)Start, (float)End, Mode, Flick, new Color32(Color[j][0], Color[j][1], Color[j][2], Color[j][3]), Prevs)); } Time += (((240 / StaticData.CurrentBPM) * StaticData.BeatMultiplier) / MaxBit); } }
protected void FlickCheck(Vector3 pos, float delta, int finger) { if (!IsFlickBeingHitted && CurrentFrame >= RunningFrames - 13f && Game.Judger.FindFlickHitted(Flick, EndLine).Equals(false)) { if (Flick.Equals(FlickMode.Left)) { if (pos.x <= FlickBorderRight && pos.x - delta > FlickBorderLeft) { IsFlickBeingHitted = true; FlickStartedPos = pos.x - delta; TouchedFinger = finger; } } if (Flick.Equals(FlickMode.Right)) { if (pos.x >= FlickBorderLeft && pos.x - delta < FlickBorderRight) { IsFlickBeingHitted = true; FlickStartedPos = pos.x - delta; TouchedFinger = finger; } } if (Flick.Equals(FlickMode.Up)) { if (pos.x >= FlickBorderLeft && pos.x < FlickBorderRight && pos.y < 0) { IsFlickBeingHitted = true; FlickStartedPos = pos.y - delta; TouchedFinger = finger; } } if (Flick.Equals(FlickMode.Down)) { if (pos.x >= FlickBorderLeft && pos.x < FlickBorderRight && pos.y < 0) { IsFlickBeingHitted = true; FlickStartedPos = pos.y - delta; TouchedFinger = finger; } } } if (IsFlickBeingHitted && CurrentFrame >= RunningFrames - 13f && finger.Equals(TouchedFinger) && Game.Judger.FindFlickHitted(Flick, EndLine).Equals(false)) { if (Flick.Equals(FlickMode.Left)) { if (pos.x - FlickStartedPos < FlickThreshold * -1) { Hit(EndPos, TouchedFinger); } } if (Flick.Equals(FlickMode.Right)) { if (pos.x - FlickStartedPos > FlickThreshold) { Hit(EndPos, TouchedFinger);; } } if (Flick.Equals(FlickMode.Up)) { if (pos.y - FlickStartedPos > FlickThreshold) { Hit(EndPos, TouchedFinger);; } } if (Flick.Equals(FlickMode.Down)) { if (pos.y - FlickStartedPos < FlickThreshold * -1) { Hit(EndPos, TouchedFinger);; } } } }
protected void Hit(Vector3 pos, int finger) { if ((Mode.Equals(NoteInfo.LongNoteEnd) || Mode.Equals(NoteInfo.SlideNoteEnd))) { if (!Game.Dispensor.Notes[PreviousTailID].IsHit) { return; } } if ((Mode.Equals(NoteInfo.SlideNoteCheckpoint) || Mode.Equals(NoteInfo.SlideNoteEnd))) { int Count = 0; for (int i = 0; i < PreviousNoteIDs.Count; i++) { if (Game.Dispensor.Notes[PreviousNoteIDs[i]].Mode.Equals(NoteInfo.SlideNoteStart)) { Count++; } } if (Count.Equals(0)) { return; } } if (pos.y < BorderUp && pos.y >= BorderDown && pos.x >= FlickBorderLeft && pos.x < FlickBorderRight && !IsHit) { if (Game.Judger.HitJudge(Game.Mode, Mode, Flick, CurrentFrame, RunningFrames, true)) { TouchedFinger = finger; if (Flick.Equals(FlickMode.None)) { Game.Judger.TapHitted[EndLine] = true; } else { Game.Judger.SetFlickHitted(Flick, EndLine); } IsHit = true; if (!Mode.Equals(NoteInfo.SlideNoteStart)) { gameObject.GetComponent <Image>().color = Color.clear; } Game.ShortEffectPlay(Mathf.RoundToInt(EndLine), SizeInPixel > 150 ? true : false); if (Mode.Equals(NoteInfo.LongNoteEnd)) { Game.Dispensor.Notes[TailsFromPrevious[0].OwnerID].Erase(); } if (Mode.Equals(NoteInfo.LongNoteStart)) { Body.anchoredPosition3D = EndPos; TailToNext.SetStartPos(Body.anchoredPosition3D, 1, SizeInPixel * (140f / 100) * 1); IsSlideHolding = true; OwnAnimator.Play("HoldEffect"); } else if (Mode.Equals(NoteInfo.SlideNoteStart)) { Game.Judger.NoteQueue[EndLine].Remove(ID); IsSlideHolding = true; OwnAnimator.Play("HoldEffect"); if (Game.Frame < ReachFrame) { Body.anchoredPosition3D = EndPos; SlideFrameCalibrator = RunningFrames - CurrentFrame; LastSlideReachFrame = Game.Frame; } } else { Erase(); } } } }
protected virtual void InputPhase() { if (Game.IsAutoPlay) { if (Game.IsStarted.Equals(true) && (int)Mode < 6 && CurrentFrame >= RunningFrames - 0.5f && !IsHit) { if (Mode.Equals(NoteInfo.SlideNoteCheckpoint)) { TransferTail(); } else { Hit(EndPos, 0); } if (Mode.Equals(NoteInfo.SlideNoteEnd)) { Game.Dispensor.Notes[TailsFromPrevious[0].OwnerID].Erase(); } } } else { if ((int)Mode < 10 && !Mode.Equals(NoteInfo.SlideNoteCheckpoint) && Input.touchCount > 0 && ((Game.Judger.NoteQueue[EndLine].Count < 1 || Game.Judger.NoteQueue[EndLine][0].Equals(ID)) || (Mode.Equals(NoteInfo.LongNoteEnd) && Game.Dispensor.Notes[TailsFromPrevious[0].OwnerID].IsHit))) { if (Flick.Equals(FlickMode.None)) { for (int i = 0; i < Input.touchCount; i++) { Vector3 point = SyncPosition(Input.GetTouch(i).position); if (!(Mode.Equals(NoteInfo.LongNoteEnd) || Mode.Equals(NoteInfo.SlideNoteEnd)) && Input.GetTouch(i).phase.Equals(TouchPhase.Began) && !Game.Judger.TapHitted[EndLine]) { Hit(point, Input.GetTouch(i).fingerId); } } } else { for (int i = 0; i < Input.touchCount; i++) { if (Input.GetTouch(i).phase.Equals(TouchPhase.Moved)) { Vector3 point = SyncPosition(Input.GetTouch(i).position); Vector3 deltaPoint = point - SyncPosition(Input.GetTouch(i).position - Input.GetTouch(i).deltaPosition); if (Flick.Equals(FlickMode.Left)) { if (deltaPoint.x < 0) { FlickCheck(point, deltaPoint.x, Input.GetTouch(i).fingerId); } } else if (Flick.Equals(FlickMode.Right)) { if (deltaPoint.x > 0) { FlickCheck(point, deltaPoint.x, Input.GetTouch(i).fingerId); } } else if (Flick.Equals(FlickMode.Up)) { if (deltaPoint.y > 0) { FlickCheck(point, deltaPoint.y, Input.GetTouch(i).fingerId); } } else if (Flick.Equals(FlickMode.Down)) { if (deltaPoint.y < 0) { FlickCheck(point, deltaPoint.y, Input.GetTouch(i).fingerId); } } } if (Input.GetTouch(i).fingerId.Equals(TouchedFinger) && Input.GetTouch(i).phase.Equals(TouchPhase.Ended)) { IsFlickBeingHitted = false; TouchedFinger = 100; } } } } // 키보드 입력 if ((int)Mode < 6 && !(Mode.Equals(NoteInfo.LongNoteEnd) || Mode.Equals(NoteInfo.SlideNoteStart) || Mode.Equals(NoteInfo.SlideNoteCheckpoint) || Mode.Equals(NoteInfo.SlideNoteEnd)) && (Game.Judger.NoteQueue[EndLine].Count < 1 || Game.Judger.NoteQueue[EndLine][0].Equals(ID))) { if (Input.GetKeyDown(Game.Keys[Mathf.RoundToInt(EndLine - 1)]) && !Game.Judger.TapHitted[EndLine]) { Hit(EndPos, 0); } } if (Mode.Equals(NoteInfo.LongNoteEnd) && Game.Dispensor.Notes[PreviousTailID].IsHit) { if (Input.GetKeyUp(Game.Keys[Mathf.RoundToInt(EndLine - 1)])) { Hit(EndPos, 0); } } } }
protected override void MovePhase() { base.MovePhase(); if (gameObject.activeSelf) { float ProgressBy100 = CurrentFrame * Speed; float ProgressBy1 = ProgressBy100 / 100; if (!IsHit && (!Mode.Equals(NoteInfo.SlideNoteStart) || (Mode.Equals(NoteInfo.SlideNoteStart) && Game.Frame < ReachFrame))) { float cX = NotePath.GetStarlightX(StartPos.x, EndPos.x, ProgressBy1); float cY = NotePath.GetStarlightY(ProgressBy100); CurrentPos = new Vector3(cX, cY, CurrentPos.z); Body.anchoredPosition3D = CurrentPos; Body.localScale = new Vector3(NotePath.GetStarlightScale(ProgressBy1), NotePath.GetStarlightScale(ProgressBy1), 1); BeforePos = CurrentPos; } else if (Mode.Equals(NoteInfo.SlideNoteStart) && !Game.Paused && (IsHit || Game.Frame >= ReachFrame)) { Body.anchoredPosition3D += new Vector3(((Game.Dispensor.Notes[NextNoteID].EndPos.x - EndPos.x) / ((SlideFrameDistance + SlideFrameCalibrator) / 60)) * Time.deltaTime, 0); if (IsHit) { FlickBorderLeft = Body.anchoredPosition3D.x - 98; FlickBorderRight = Body.anchoredPosition3D.x + 98; } } if (!Game.Paused) { if (!Flick.Equals(FlickMode.None) && ConnectorToNext != null && ConnectorToNext.gameObject.activeSelf) { ConnectorToNext.StartPos = Body.anchoredPosition3D; ConnectorToNext.StartScale = Body.localScale.x * 120; } if (!Flick.Equals(FlickMode.None) && ConnectorsFromPrevious.Count > 0) { for (int i = 0; i < ConnectorsFromPrevious.Count; i++) { if (ConnectorsFromPrevious[i] != null && !Game.Dispensor.Notes[ConnectorsFromPrevious[i].OwnerID].IsHit) { ConnectorsFromPrevious[i].EndPos = Body.anchoredPosition3D; ConnectorsFromPrevious[i].EndScale = Body.localScale.x * 120; } if (ConnectorsFromPrevious[i] != null && Game.Dispensor.Notes[ConnectorsFromPrevious[i].OwnerID].IsHit) { ConnectorsFromPrevious[i].gameObject.SetActive(false); } } } if (Mode.Equals(NoteInfo.LongNoteStart) && !IsHit) { TailToNext.SetStartPos(Body.anchoredPosition3D, ProgressBy1, SizeInPixel * (140f / 100)); } if ((Mode.Equals(NoteInfo.SlideNoteStart) || Mode.Equals(NoteInfo.SlideNoteCheckpoint) && TailToNext != null)) { TailToNext.SetStartPos(Body.anchoredPosition3D, (Mode.Equals(NoteInfo.SlideNoteStart) && Game.Frame >= ReachFrame) ? 1 : ProgressBy1, SizeInPixel * (140f / 100), (Game.Frame - LastSlideReachFrame) / (Game.Dispensor.Notes[NextNoteID].ReachFrame - LastSlideReachFrame)); } if (TailsFromPrevious.Count > 0) { for (int i = 0; i < TailsFromPrevious.Count; i++) { if (TailsFromPrevious[i] != null) { TailsFromPrevious[i].SetEndPos(Body.anchoredPosition3D, CurrentFrame * Speed > 100 ? 1 : ProgressBy1, SizeInPixel * (140f / 100)); } } } } } }
protected override void InputPhase() { base.InputPhase(); if (Game.IsAutoPlay) { if (Game.IsStarted.Equals(true) && (int)Mode < 6 && CurrentFrame >= RunningFrames - 0.5f && !IsHit) { if (Mode.Equals(NoteInfo.SlideNoteCheckpoint)) { Hit(EndPos, 0); } } } else { if ((int)Mode < 10 && !Mode.Equals(NoteInfo.SlideNoteCheckpoint) && Input.touchCount > 0 && ((Game.Judger.NoteQueue[EndLine].Count < 1 || Game.Judger.NoteQueue[EndLine][0].Equals(ID)) || (Mode.Equals(NoteInfo.LongNoteEnd) && Game.Dispensor.Notes[TailsFromPrevious[0].OwnerID].IsHit))) { if (Flick.Equals(FlickMode.None)) { for (int i = 0; i < Input.touchCount; i++) { Vector3 point = SyncPosition(Input.GetTouch(i).position); if ((Mode.Equals(NoteInfo.LongNoteEnd) || Mode.Equals(NoteInfo.SlideNoteEnd)) && Input.GetTouch(i).phase.Equals(TouchPhase.Ended)) { if (Input.GetTouch(i).fingerId.Equals(Game.Dispensor.Notes[PreviousNoteIDs[0]].TouchedFinger)) { if (point.x >= FlickBorderLeft && point.x < FlickBorderRight) { Hit(point, Input.GetTouch(i).fingerId); } else { Game.Judger.JudgeAsMiss(); if (Mode.Equals(NoteInfo.LongNoteEnd)) { Game.Dispensor.Notes[TailsFromPrevious[0].OwnerID].Erase(); } Erase(); } } } } } else { for (int i = 0; i < Input.touchCount; i++) { if (Mode.Equals(NoteInfo.LongNoteEnd) && Input.GetTouch(i).fingerId.Equals(Game.Dispensor.Notes[PreviousNoteIDs[0]].TouchedFinger) && Input.GetTouch(i).phase.Equals(TouchPhase.Ended)) { Game.Judger.JudgeAsMiss(); Game.Dispensor.Notes[PreviousTailID].Erase(); Erase(); } } } } if ((Mode.Equals(NoteInfo.LongNoteStart) || Mode.Equals(NoteInfo.SlideNoteStart)) && IsHit) { for (int i = 0; i < Input.touchCount; i++) { if ((Input.GetTouch(i).phase.Equals(TouchPhase.Began) || Input.GetTouch(i).phase.Equals(TouchPhase.Stationary) || Input.GetTouch(i).phase.Equals(TouchPhase.Moved))) { if (!IsSlideHolding) { IsSlideHolding = true; } } if (Input.GetTouch(i).fingerId.Equals(TouchedFinger) && Input.GetTouch(i).phase.Equals(TouchPhase.Ended)) { if (Mode.Equals(NoteInfo.LongNoteStart) && !Game.Dispensor.Notes[NextNoteID].IsAppeared) { Game.Judger.JudgeAsMiss(); Game.Judger.HoldNoteDead[EndLine] = true; Erase(); } else if (Mode.Equals(NoteInfo.SlideNoteStart)) { if (Game.Dispensor.Notes[NextNoteID].Mode.Equals(NoteInfo.SlideNoteCheckpoint) || (Game.Dispensor.Notes[NextNoteID].Mode.Equals(NoteInfo.SlideNoteEnd) && !Game.Dispensor.Notes[NextNoteID].IsAppeared)) { IsSlideGroupDead = true; Game.Judger.JudgeAsFakeMiss(); Erase(); } } } } } if (Mode.Equals(NoteInfo.SlideNoteCheckpoint) && Game.Dispensor.Notes[PreviousTailID].Mode.Equals(NoteInfo.SlideNoteStart) && !IsHit && CurrentFrame >= RunningFrames - 6f) { for (int i = 0; i < Input.touchCount; i++) { if (Input.GetTouch(i).fingerId.Equals(Game.Dispensor.Notes[PreviousTailID].TouchedFinger)) { Vector3 point = SyncPosition(Input.GetTouch(i).position); if (point.x >= FlickBorderLeft && point.x < FlickBorderRight) { IsSlideCheckHitted = true; } } } if (CurrentFrame >= RunningFrames - 0.5f) { if (TailToNext != null) { TransferTail(); } if (IsSlideCheckHitted && TailToNext == null) { Hit(EndPos, Game.Dispensor.Notes[PreviousTailID].TouchedFinger); } } } } }
protected override void InputPhase() { base.InputPhase(); if (Game.IsAutoPlay) { if (Game.IsStarted.Equals(true) && (int)Mode < 6 && CurrentFrame >= RunningFrames - 0.5f && !IsHit) { if (Mode.Equals(NoteInfo.SlideNoteCheckpoint)) { Erase(); } } } else { if ((int)Mode < 10 && !Mode.Equals(NoteInfo.SlideNoteCheckpoint) && Input.touchCount > 0 && ((Game.Judger.NoteQueue[EndLine].Count < 1 || Game.Judger.NoteQueue[EndLine][0].Equals(ID)) || (Mode.Equals(NoteInfo.LongNoteEnd) && Game.Dispensor.Notes[TailsFromPrevious[0].OwnerID].IsHit))) { if (Flick.Equals(FlickMode.None)) { for (int i = 0; i < Input.touchCount; i++) { Vector3 point = SyncPosition(Input.GetTouch(i).position); if ((Mode.Equals(NoteInfo.LongNoteEnd) || Mode.Equals(NoteInfo.SlideNoteEnd)) && Input.GetTouch(i).phase.Equals(TouchPhase.Ended)) { Hit(point, Input.GetTouch(i).fingerId); } } } } if ((Mode.Equals(NoteInfo.LongNoteStart) || Mode.Equals(NoteInfo.SlideNoteStart)) && IsHit) { for (int i = 0; i < Input.touchCount; i++) { Vector3 point = SyncPosition(Input.GetTouch(i).position); if ((Input.GetTouch(i).phase.Equals(TouchPhase.Began) || Input.GetTouch(i).phase.Equals(TouchPhase.Stationary) || Input.GetTouch(i).phase.Equals(TouchPhase.Moved))) { if (point.x >= FlickBorderLeft && point.x < FlickBorderRight && !IsSlideHolding) { IsSlideHolding = true; OwnAnimator.enabled = true; gameObject.transform.GetChild(0).gameObject.SetActive(true); OwnAnimator.Play("HoldEffect"); TouchedFinger = Input.GetTouch(i).fingerId; } else if (Input.GetTouch(i).fingerId.Equals(TouchedFinger) && !(point.x >= FlickBorderLeft && point.x < FlickBorderRight) && IsSlideHolding) { IsSlideHolding = false; OwnAnimator.enabled = false; gameObject.transform.GetChild(0).gameObject.SetActive(false); TouchedFinger = 100; } } if (Input.GetTouch(i).fingerId.Equals(TouchedFinger) && Input.GetTouch(i).phase.Equals(TouchPhase.Ended)) { IsSlideHolding = false; OwnAnimator.enabled = false; gameObject.transform.GetChild(0).gameObject.SetActive(false); TouchedFinger = 100; } } } } }
public void Clean() { if (NextTail != null) { Destroy(NextTail); } if (Type.Equals(1)) { if (NextNote != null && NextNote.Type.Equals(Type)) { NextNote.ParentBlock.DeleteNote(NextNote.gameObject); } if (PreviousNotes.Count > 0) { for (int i = 0; i < PreviousNotes.Count; i++) { if (PreviousNotes[i].Type.Equals(Type)) { CreatorNote refer = PreviousNotes[i]; PreviousNotes.RemoveAt(i--); refer.ParentBlock.DeleteNote(refer.gameObject); } } } } else if (Type.Equals(2)) { if (NextNote != null && NextNote.Type.Equals(Type)) { NextNote.PreviousNotes.Remove(this); if (PreviousNotes.Count > 0) { for (int i = 0; i < PreviousNotes.Count; i++) { if (PreviousNotes[i].Type.Equals(Type)) { PreviousNotes[i].NextNote = NextNote; NextNote.PreviousNotes.Add(PreviousNotes[i]); PreviousNotes[i].NextTail.GetComponent <LineRenderer>().SetPosition(1, NextNote.Body.position); PreviousNotes[i].NextTail.GetComponent <TailPosUpdator>().TailNote = NextNote.gameObject; NextNote.PreviousTails.Add(PreviousNotes[i].NextTail); } } } } else { if (PreviousNotes.Count > 0) { for (int i = 0; i < PreviousNotes.Count; i++) { if (PreviousNotes[i].Type.Equals(Type)) { PreviousNotes[i].NextNote = null; if (ParentBlock.Table.NotePlaceMode.Equals(2) && ParentBlock.Table.LastSlideNote.Equals(this)) { ParentBlock.Table.LastSlideNote = PreviousNotes[i]; } } } } if (ParentBlock.Table.NotePlaceMode.Equals(2) && ParentBlock.Table.LastSlideNote.Equals(this)) { ParentBlock.Table.LastSlideNote = null; ParentBlock.Table.PlaceModeChanged(0); } } } if (!Flick.Equals(0)) { if (NextNote != null) { NextNote.PreviousNotes.Remove(this); if (PreviousNotes.Count > 0) { for (int i = 0; i < PreviousNotes.Count; i++) { if (!PreviousNotes[i].Flick.Equals(0)) { PreviousNotes[i].NextNote = NextNote; NextNote.PreviousNotes.Add(PreviousNotes[i]); PreviousNotes[i].NextTail.GetComponent <LineRenderer>().SetPosition(1, NextNote.Body.position); PreviousNotes[i].NextTail.GetComponent <TailPosUpdator>().TailNote = NextNote.gameObject; NextNote.PreviousTails.Add(PreviousNotes[i].NextTail); } } } } else { if (PreviousNotes.Count > 0) { for (int i = 0; i < PreviousNotes.Count; i++) { if (!PreviousNotes[i].Flick.Equals(0)) { PreviousNotes[i].NextNote = null; if (ParentBlock.Table.NotePlaceMode.Equals(3) && ParentBlock.Table.LastFlickNote.Equals(this)) { ParentBlock.Table.LastFlickNote = PreviousNotes[i]; } } } } if (ParentBlock.Table.NotePlaceMode.Equals(3) && ParentBlock.Table.LastFlickNote.Equals(this)) { ParentBlock.Table.LastFlickNote = null; ParentBlock.Table.PlaceModeChanged(0); } } } }