public void CreateTail() { foreach (var prev in previousNotes) { if (Type.IsEither(NoteType.HoldStart, NoteType.HoldEnd) && prev.Type == NoteType.HoldStart) // Hold tail { if (prev.nextTail != null) { TSystemStatic.Log($"Note {prev.ID} seems to have multiple hold or slide bodys. Ignoring tail connection with note {ID}."); data.type = NoteType.Tap; continue; } var newObj = Instantiate(Game.tailTemplate); newObj.transform.SetParent(Game.meshParent); newObj.transform.localScale = Vector3.one; newObj.name = "Tail " + prev.ID.ToString(); var newTail = newObj.GetComponent <Tail>(); newTail.Set(prev, this, false); prev.nextTail = newTail; previousTails.Add(newTail); data.type = NoteType.HoldEnd; } else if (Type.IsEither(NoteType.SlideStart, NoteType.SlideMiddle, NoteType.SlideEnd) && prev.Type.IsEither(NoteType.SlideStart, NoteType.SlideMiddle)) // Slide tail { if (prev.nextTail != null) { TSystemStatic.Log($"Note {prev.ID} seems to have multiple hold or slide bodys. Ignoring tail connection with note {ID}."); if (nextNote != null && nextNote.Type.IsEither(NoteType.SlideStart, NoteType.SlideMiddle, NoteType.SlideEnd)) { data.type = NoteType.SlideStart; } else { data.type = NoteType.Tap; } continue; } var newObj = Instantiate(Game.tailTemplate); newObj.transform.SetParent(Game.meshParent); newObj.transform.localScale = Vector3.one; newObj.name = "Tail " + prev.ID.ToString(); var newTail = newObj.GetComponent <Tail>(); newTail.Set(prev, this, true); prev.nextTail = newTail; previousTails.Add(newTail); if (nextNote != null && nextNote.Type.IsEither(NoteType.SlideStart, NoteType.SlideMiddle, NoteType.SlideEnd)) { data.type = NoteType.SlideMiddle; } else { data.type = NoteType.SlideEnd; } } } }
// Update is called once per frame void Update() { if (Game.IsStarted) { foreach (var l in lines) { var line = l.Value; line.UpdateCooltime(); // Note garbage collection while (line.notes.Count > 0 && (Game.notes[line.notes[0]].isHit || Game.notes[line.notes[0]].isDead)) { TSystemStatic.Log($"Undeleted dead/hit note ({line.notes[0]}, {Game.notes[line.notes[0]].Type}) detected in line {l.Key}! Removing it."); RemoveNote(l.Key, line.notes[0]); } } } }
public void CreateConnector() { foreach (var prev in previousNotes) { if (Flick != FlickType.NotFlick && prev.Flick != FlickType.NotFlick) { if (prev.nextConnector != null) { TSystemStatic.Log($"Note {prev.ID} seems to have multiple next-flick connection. Ignoring flick connection with note {ID}."); continue; } var newObj = Instantiate(Game.connectorTemplate); newObj.transform.SetParent(Game.meshParent); newObj.transform.localScale = Vector3.one; newObj.name = "Connector " + prev.ID.ToString(); var newConn = newObj.GetComponent <Connector>(); newConn.Set(prev, this); prev.nextConnector = newConn; previousConnectors.Add(newConn); } } }
public virtual void AddScore(NoteData data, JudgeType result) { TSystemStatic.Log("AddScore not implemented in this basis."); }
public virtual void CreateNote(NoteData data) { TSystemStatic.Log("CreateNote not implemented in this basis."); }
public virtual Sprite GetNoteImage(NoteData data) { TSystemStatic.Log("GetNoteImage not implemented in this basis."); return(null); }
public virtual GameObject GetNoteTemplate(NoteData data) { TSystemStatic.Log("GetNoteObject not implemented in this basis."); return(null); }
protected virtual IEnumerator SpecialLeaveAnimRoutine() { TSystemStatic.Log("Special leave Animation per line object is not implemented in this basis."); yield return(null); }
public void ParseDeleste(string path, out bool succeed) { FileStream file = null; StreamReader scanner = null; try { file = new FileStream(path, FileMode.Open, FileAccess.Read); scanner = new StreamReader(file, System.Text.Encoding.UTF8); } catch (Exception e) { TSystemStatic.LogWithException("Beatmap file does not exists.", e); succeed = false; return; } int d, MaxBlockNum = -1, ID = 1; char[] div = { ' ', ',', ':' }; DelesteGlobalData StaticData = new DelesteGlobalData(); Dictionary <int, DelesteBlockData> Blocks = new Dictionary <int, DelesteBlockData>(); double Time = 0, Speed = 1.0; byte[] Color = new byte[] { 255, 255, 255, 255 }; var SongTime = TSystemConfig.Now.gameSync; // Steadily, stacks the data. while (scanner.Peek() != -1) { try { string dataLine = scanner.ReadLine(); string[] data = dataLine.Split(div, StringSplitOptions.RemoveEmptyEntries); if (data.Length > 1 && data[0].StartsWith("#") && (data[0].Substring(1).ToUpper().Equals("BPM") || data[0].Substring(1).ToUpper().Equals("TEMPO"))) { StaticData.CurrentBPM = double.Parse(data[1]); } else if (data.Length > 1 && data[0].StartsWith("#") && data[0].Substring(1).ToUpper().Equals("OFFSET")) { Time += (int.Parse(data[1]) / 1000d); } else if (data.Length > 1 && data[0].StartsWith("#") && (data[0].Substring(1).ToUpper().Equals("SONGOFFSET") || data[0].Substring(1).ToUpper().Equals("MUSICOFFSET") || data[0].Substring(1).ToUpper().Equals("BGMOFFSET"))) { Time -= (int.Parse(data[1]) / 1000d); } else if (data.Length > 1 && data[0].StartsWith("#") && data[0].Substring(1).ToUpper().Equals("ATTRIBUTE")) { if (data[1].ToUpper().Equals("CUTE") || data[1].ToUpper().Equals("CU") || data[1].Equals("1")) { Color = new byte[] { 255, 100, 200, 255 }; } else if (data[1].ToUpper().Equals("COOL") || data[1].ToUpper().Equals("CO") || data[1].Equals("2")) { Color = new byte[] { 85, 135, 255, 255 }; } else if (data[1].ToUpper().Equals("PASSION") || data[1].ToUpper().Equals("PA") || data[1].Equals("3")) { Color = new byte[] { 255, 220, 50, 255 }; } else if (data[1].ToUpper().Equals("ALL") || data[1].Equals("4")) { Color = new byte[] { 230, 255, 255, 255 }; } } else if (data.Length > 2 && data[0].StartsWith("#") && (data[0].Substring(1).ToUpper().Equals("MEASURE") || data[0].Substring(1).ToUpper().Equals("MEAS") || data[0].Substring(1).ToUpper().Equals("MEA"))) { if (data[2].Contains("/")) { string[] numbers = data[2].Split(new char[] { '/' }); StaticData.Measure.Add(double.Parse(numbers[0]) / double.Parse(numbers[1])); } else { StaticData.Measure.Add(double.Parse(data[2])); } StaticData.MeasurePos.Add(double.Parse(data[1])); } else if (data.Length > 2 && (data[0].StartsWith("#") && (data[0].Substring(1).ToUpper().Equals("CHANGEBPM") || data[0].Substring(1).ToUpper().Equals("CHANGETEMPO")))) { StaticData.ChangeBPM.Add(double.Parse(data[2])); StaticData.ChangeBPMPos.Add(double.Parse(data[1])); } else if (data.Length > 1 && data[0].StartsWith("#") && data[0].Substring(1).ToUpper().Equals("CHANGEATTRIBUTE")) { if (data[1].ToUpper().Equals("CUTE") || data[1].ToUpper().Equals("CU") || data[1].Equals("1")) { Color = new byte[] { 255, 100, 200, 255 }; } else if (data[1].ToUpper().Equals("COOL") || data[1].ToUpper().Equals("CO") || data[1].Equals("2")) { Color = new byte[] { 85, 135, 255, 255 }; } else if (data[1].ToUpper().Equals("PASSION") || data[1].ToUpper().Equals("PA") || data[1].Equals("3")) { Color = new byte[] { 255, 220, 50, 255 }; } else if (data[1].ToUpper().Equals("ALL") || data[1].Equals("4")) { Color = new byte[] { 230, 255, 255, 255 }; } } else if (data.Length > 1 && data[0].StartsWith("#") && (data[0].Substring(1).ToUpper().Equals("HISPEED") || data[0].Substring(1).ToUpper().Equals("HS"))) { Speed = double.Parse(data[1]); if (Speed <= 0) { throw new Exception("TSystem does not support HiSpeed zero and below."); } } else if (data.Length > 2 && data[0].StartsWith("#") && data[0].Substring(1).ToUpper().Equals("HS2")) { //if (double.Parse(data[2]) <= 0) // throw new Exception("TSystem does not support HiSpeed zero and below.")); //StaticData.HS2.Add(double.Parse(data[2])); //StaticData.HS2Pos.Add(double.Parse(data[1])); TSystemStatic.Log("While parsing Deleste file: TSystem does not support HS2."); } else if (data.Length > 2 && data[0].StartsWith("#") && data[0].Substring(1).ToUpper().Equals("DELAY")) { StaticData.Delay.Add(double.Parse(data[2])); StaticData.DelayPos.Add(double.Parse(data[1])); } else if (data.Length > 3 && data[0].StartsWith("#") && data[0].Substring(1).ToUpper().Equals("SCROLL")) { StaticData.Scroll.Add(new double[2] { double.Parse(data[2]) / 1000d, double.Parse(data[3]) / 1000d }); StaticData.ScrollPos.Add(double.Parse(data[1])); } else if (data.Length > 0 && data[0].StartsWith("#") && int.TryParse(data[0].Substring(1, 1), out d)) { int CurBlock = int.Parse(data[1]); if (!Blocks.ContainsKey(CurBlock)) { Blocks.Add(CurBlock, new DelesteBlockData(CurBlock)); } Blocks[CurBlock].DataLines.Add(dataLine); Blocks[CurBlock].Channel.Add(int.Parse(data[0].Substring(1))); Blocks[CurBlock].Color.Add(Color); Blocks[CurBlock].Speed.Add(Speed); if (MaxBlockNum < CurBlock) { MaxBlockNum = CurBlock; } } } catch (Exception e) { TSystemStatic.LogWithException("Failed to parse Deleste type beatmap.", e); scanner.Close(); file.Close(); succeed = false; return; } } scanner.Close(); file.Close(); // Creates note at here. Game.CreateNote(new NoteData(0, 0, SongTime, (float)Speed, 0, 0, NoteType.Starter, FlickType.NotFlick, new Color32(255, 255, 255, 255), new List <int>())); for (int i = 0; i <= MaxBlockNum; i++) { if (Blocks.ContainsKey(i)) { Blocks[i].ParseBlock(Game, ref ID, ref Time, ref StaticData); } else { Time += ((240 / StaticData.CurrentBPM) * StaticData.BeatMultiplier); } } succeed = true; }