// Use this for initialization protected virtual void Start() { GameObject gameCtrObj = GameObject.Find ("GameController"); gameCtr = gameCtrObj.GetComponent<GameController>(); GameObject songCtrObj = GameObject.Find ("SongObject"); songObj = songCtrObj.GetComponent<SongObject>(); // note = songCtrObj.GetComponent<Note>(); notes = songObj.notes; bps = gameCtr.bps; delay = 1f/bps * 10f * 2f + 0.1f; activeNotes = new Queue<GameObject>(); // activeChildren = new int[notes.Count]; }
static SongObject ParseOSU(TextAsset textAsset, string fileName) { SongObject songObj = new SongObject(); CollectType _collectType = CollectType.General; string[] contents = textAsset.text.Split('\n'); Dictionary <string, string> result = new Dictionary <string, string> (); result.Add("Title:", fileName); List <HitObject> tmpHitObject = new List <HitObject> (); int k = 0; bool nextSentenceAheadIn = false; bool streamSentenceEdit = false; for (int i = 0; i < contents.Length; i++) { string oneLine = contents[i].Trim(); //空行和注释行 不解析 if (string.IsNullOrEmpty(oneLine) || oneLine.StartsWith("//", StringComparison.Ordinal)) { continue; } if (oneLine.Contains("[HitObjects]")) { _collectType = CollectType.HitObject; continue; } if (oneLine.Contains("[SentenceInfo]")) { _collectType = CollectType.SentenceInfo; continue; } switch (_collectType) { case CollectType.General: for (int j = 0; j < m_Fields.Length; j++) { if (oneLine.Contains(m_Fields[j])) { result.Add(m_Fields[j], oneLine.Replace(m_Fields[j], "")); } } break; case CollectType.SentenceInfo: if (!streamSentenceEdit) { // #region 普通句子 SentenceObj sentenceobjs = new SentenceObj(); if (oneLine.Contains("@@VoiceStart")) { sentenceobjs.Type = SentenceType.KeyVoiceStart; string[] stringArray = oneLine.Split(','); int sentenceStart = int.Parse(stringArray[1]); InOutTime inOut = new InOutTime(sentenceStart, sentenceStart); sentenceobjs.m_InOutTime = inOut; songObj.SentenceObjs.Add(sentenceobjs); _collectType = CollectType.KeyAndVoice; // LogManager.Log(oneLine , " /// _collectType = CollectType.KeyAndVoice"); continue; } if (oneLine.Contains("@@")) { sentenceobjs.Type = SentenceType.BossStart; string[] stringArray = oneLine.Replace("@@", "").Split(','); if (stringArray.Length != 2) { LogManager.LogError("boss战起始时间和延迟播放音乐配置错误"); } int sentenceStart = int.Parse(stringArray[0]); int musicDelay = int.Parse(stringArray[1]); InOutTime inOut = new InOutTime(sentenceStart, sentenceStart); sentenceobjs.m_InOutTime = inOut; songObj.BossWarMusicDelay = musicDelay; streamSentenceEdit = true; songObj.SentenceObjs.Add(sentenceobjs); continue; } string[] parse = oneLine.Split(','); int startTime = int.Parse(parse[0]); int endTime = int.Parse(parse[1]); if (parse[2].Contains("#")) { sentenceobjs.Type = SentenceType.Voice; parse[2] = parse[2].Replace("#", ""); } else { sentenceobjs.Type = SentenceType.Common; } string[] param = parse[2].Split('$'); string[] wordShow = parse[3].Split('$'); string[] wordSoundFile = null; if (parse.Length >= 5) { wordSoundFile = parse[4].Split('$'); } for (int j = 0; j < param.Length; j++) { if (k >= tmpHitObject.Count) { LogManager.LogError("OSU文件中hitObject数目 与 txt文件中的单词数量不匹配"); return(null); } try { ClickObj click = new ClickObj(param[j], tmpHitObject[k].Position, wordShow[j]); click.m_ClickTimes = 1; sentenceobjs.ClickAndHOList.ClickObjs.Add(click); tmpHitObject[k].Word = param[j]; if (wordSoundFile != null && wordSoundFile.Length > 0) { if (wordSoundFile.Length == param.Length) { tmpHitObject[k].SonudFile = wordSoundFile[j]; } else { LogManager.LogError(string.Format("行 {0} 有错误:句子单词个数 与 单词语音文件数量不匹配", (i + 1))); return(null); } } sentenceobjs.ClickAndHOList.HitObjects.Add(tmpHitObject[k]); k++; } catch (Exception e) { LogManager.LogError("the wrong line is:", (i + 1).ToString()); LogManager.LogError(e); LogManager.LogError(e.StackTrace); } } InOutTime inOutTime = new InOutTime(startTime, endTime); sentenceobjs.m_InOutTime = inOutTime; //判断这一句是否应该延迟删除,下一句是否应该提前出现 if (endTime - sentenceobjs.ClickAndHOList.HitObjects[sentenceobjs.ClickAndHOList.HitObjects.Count - 1].StartMilliSecond < CorePlaySettings.Instance.m_MinIntervalBeforeSentenceEnd) { //这一句延迟删除,下一句提前出现 if (nextSentenceAheadIn) { sentenceobjs.m_InOutTime.InOut = EffectInOutTiming.Both; } else { sentenceobjs.m_InOutTime.InOut = EffectInOutTiming.DelayOut; nextSentenceAheadIn = true; } } else { if (nextSentenceAheadIn) { sentenceobjs.m_InOutTime.InOut = EffectInOutTiming.AheadIn; nextSentenceAheadIn = false; } } songObj.SentenceObjs.Add(sentenceobjs); #endregion } else { #region boss句子 string[] parse = oneLine.Split(','); StreamSentenceGroup group = new StreamSentenceGroup(); if (parse.Length == 5 && parse[4].Equals("BB")) { group.CalckSentence = true; } else { group.CalckSentence = false; } group.SetTimeLength(int.Parse(parse[0])); if (parse[1].Contains("#")) { group.SetSentenceType(SentenceType.Voice); parse[1] = parse[1].Replace("#", ""); } else { group.SetSentenceType(SentenceType.Common); } string[] matchSentences = parse[1].Replace("@@", "").Split('|'); string[] showSentences = parse[2].Split('|'); string[] fileNames = parse[3].Split('|'); if (matchSentences.Length != showSentences.Length || showSentences.Length != fileNames.Length) { LogManager.LogError("TXT文件 第 ", (i + 1).ToString(), "行报错:断句数量不匹配"); return(null); } else { int sentenceNumber = matchSentences.Length; for (int line = 0; line < sentenceNumber; line++) { StreamSentence bossSentence = new StreamSentence(); bossSentence.SetAudioFileName(fileNames[line].ToLower()); string[] words = matchSentences[line].Split('$'); string[] showWords = showSentences[line].Split('$'); if (words.Length != showWords.Length) { LogManager.LogError("TXT文件 第 ", (i + 1).ToString(), "行报错:单词数量不匹配 ", words.Length.ToString(), "/" + showWords.Length.ToString()); return(null); } else { for (int index = 0; index < words.Length; index++) { KeyValuePair <string, string> kv = new KeyValuePair <string, string> (words[index], showWords[index]); bossSentence.AddToSentence(kv); } } group.AddSentence(bossSentence); } } songObj.StreamSentences.Add(group); #endregion } break; case CollectType.HitObject: if (oneLine.Contains("C") || oneLine.Contains("P") || oneLine.Contains("L") || oneLine.Contains("B")) { //2017年10月28日版本先不做这些功能 continue; } else { string[] param = oneLine.Split(','); if (param.Length != 6) { LogManager.LogError("data parse error: the data file is --", fileName); } else { Vector2 pos = new Vector2(int.Parse(param[0]), int.Parse(param[1])); int startTime = int.Parse(param[2]); int type = int.Parse(param[3]); int soundType = int.Parse(param[4]); HitObject ho = new HitObject(pos, startTime, type, soundType); tmpHitObject.Add(ho); } } break; case CollectType.KeyAndVoice: //LogManager.Log(oneLine , " ||||| case CollectType.KeyAndVoice:"); string[] parses = oneLine.Split(','); if (parses.Length < 3) { LogManager.LogError("TXT文件 第 ", (i + 1).ToString(), "行报错:分段不够"); return(null); } StreamSentence ss = new StreamSentence(); ss.SetDuration(int.Parse(parses[0]) * 0.001f); if (parses[1].StartsWith("#", StringComparison.Ordinal)) { //parses[1] = parses[1].Substring(1); parses[1] = parses[1].Replace("#", ""); //LogManager.Log (" 需要录音 = " , parses[1]); ss.needRecord = true; ss.SetType(SentenceType.NonRhythmVoice); //if (parses[1].StartsWith ("#", StringComparison.Ordinal)) //{ // parses[1] = parses[1].Substring (1); // ss.needRecord = true; //} } else { ss.SetType(SentenceType.NonRhythmCommon); } if (parses.Length == 4) { string[] tempAudios = parses[3].Split('|'); if (string.IsNullOrEmpty(tempAudios[0]) == false) { ss.SetAudioFileName(tempAudios[0].ToLower()); } if (tempAudios.Length == 2 && string.IsNullOrEmpty(tempAudios[1]) == false) { ss.Speaker = tempAudios[1]; } //ss.SetAudioFileName(parses[3]); } string[] firstWords = parses[1].Split('$'); string[] clickWords = parses[2].Split('$'); if (firstWords.Length != clickWords.Length) { LogManager.LogError("TXT文件 第 ", (i + 1).ToString(), "行报错:单词数量不匹配"); return(null); } else { for (int index = 0; index < firstWords.Length; index++) { KeyValuePair <string, string> kv = new KeyValuePair <string, string> (firstWords[index], clickWords[index]); ss.AddToSentence(kv); //ClickObj click = new ClickObj(kv.Key, tmpHitObject[k].Position, kv.Value); //ClickObj click = new ClickObj(kv.Key, Vector2.zero, kv.Value); //click.m_ClickTimes = 1; //ss.ClickAndHOList.ClickObjs.Add(click); //tmpHitObject[k].Word = kv.Key; //ss.ClickAndHOList.HitObjects.Add(tmpHitObject[k]); //k++; } } songObj.NonRhythmSenteces.Add(ss); break; } } songObj.SetContents(result); return(songObj); }
public void AddToSelectedObjects(SongObject songObjects) { AddToSelectedObjects(new SongObject[] { songObjects }); }
public void RemoveFromSelectedObjects(SongObject songObjects) { RemoveFromSelectedObjects(new SongObject[] { songObjects }); }
public SongEditAdd(SongObject songObject) : base(songObject) { Debug.Assert(songObject.song == null, "Must add a new song object!"); }
// Start is called before the first frame update public static SongObject ParseFile(string data) { //objeto que crearemos var songData = new SongObject(); //limpiamos comentarios Regex regex = new Regex("(\\s+//-([^;]+)\\s)|(//[\\s+]measure\\s[0-9]+\\s)"); data = regex.Replace(data, ""); // string text = "One car red car blue car"; string pat = "#([^;]+);"; // Instantiate the regular expression object. Regex r = new Regex(pat, RegexOptions.IgnoreCase); Match m = r.Match(data); int currentLevel = -1; while (m.Success) { //set key value var rawValue = m.Groups[1].Value.Split(':'); string key = rawValue[0].ToString(); string value = rawValue[1].ToString(); //se avanza en el contador de niveles if (key.Equals("NOTEDATA")) { currentLevel++; songData.Levels[currentLevel] = new LevelObject(); } if (currentLevel > -1)//pa cuando es del nivel { switch (key) { case "NOTES": songData.Levels[currentLevel].Notes = ProcessNotes(value); break; case "BPMS": case "STOPS": case "DELAYS": case "WARPS": case "TIMESIGNATURES": case "TICKCOUNTS": case "COMBOS": case "SPEEDS": case "SCROLLS": songData.Levels[currentLevel].LevelModifiers[key] = GetModifiers(key, value); break; default: songData.Levels[currentLevel].LevelTags[key] = value; break; } } else// globales { switch (key) { case "BPMS": case "STOPS": case "DELAYS": case "WARPS": case "TIMESIGNATURES": case "TICKCOUNTS": case "COMBOS": case "SPEEDS": case "SCROLLS": songData.SongModifiers[key] = GetModifiers(key, value); break; default: songData.SongTags[key] = value; break; } } m = m.NextMatch(); } return(songData); }
protected SongEditCommand(SongObject songObject) { AddClone(songObject); }
public void StartMoveAction(SongObject songObject) { StartMoveAction(new SongObject[] { songObject }, 0); }
protected BaseAction(SongObject so, TypeTag tag) { songObject = so.Clone(); // Clone to preserve the state it was added in typeTag = tag; }
protected BaseAction(SongObject so) { songObject = so.Clone(); // Clone to preserve the state it was added in typeTag = TypeTag.None; }
void OnDisable() { currentEventToCustomise = null; originalEvent = null; eventStr = string.Empty; }
// Use this for initialization void Start() { GameObject songCtrObj = GameObject.Find("SongObject"); songObCtr = songCtrObj.GetComponent<SongObject>(); }
void Awake() { current = this; //pointer to this whole object GameObject songObj = GameObject.Find("SongObject"); song = songObj.GetComponent<SongObject>(); }
public static SongObject FindObjectToModify(SongObject so) { ChartEditor editor = ChartEditor.Instance; Song song = editor.currentSong; Chart chart = editor.currentChart; int index; switch ((SongObject.ID)so.classID) { case SongObject.ID.Note: index = SongObjectHelper.FindObjectPosition(so as Note, chart.notes); if (index == SongObjectHelper.NOTFOUND) { return(null); } return(chart.notes[index]); case SongObject.ID.Starpower: index = SongObjectHelper.FindObjectPosition(so as Starpower, chart.starPower); if (index == SongObjectHelper.NOTFOUND) { return(null); } return(chart.starPower[index]); case SongObject.ID.ChartEvent: index = SongObjectHelper.FindObjectPosition(so as ChartEvent, chart.events); if (index == SongObjectHelper.NOTFOUND) { return(null); } return(chart.events[index]); case SongObject.ID.BPM: index = SongObjectHelper.FindObjectPosition(so as BPM, song.bpms); if (index == SongObjectHelper.NOTFOUND) { return(null); } return(song.bpms[index]); case SongObject.ID.TimeSignature: index = SongObjectHelper.FindObjectPosition(so as TimeSignature, song.timeSignatures); if (index == SongObjectHelper.NOTFOUND) { return(null); } return(song.timeSignatures[index]); case SongObject.ID.Section: index = SongObjectHelper.FindObjectPosition(so as Section, song.sections); if (index == SongObjectHelper.NOTFOUND) { return(null); } return(song.sections[index]); case SongObject.ID.Event: index = SongObjectHelper.FindObjectPosition(so as Event, song.events); if (index == SongObjectHelper.NOTFOUND) { return(null); } return(song.events[index]); default: Debug.LogError("Object to modify not implemented for object. Object will not be modified."); break; } return(so); }
public DeleteAction(SongObject so) : base(so) { }
public static float WorldYPosition(SongObject songObject) { return(songObject.song.TickToWorldYPosition(songObject.tick)); }
public AddAction(SongObject so) : base(so) { }
void AddClone(SongObject songObject) { songObjects.Add(songObject.Clone()); }
public AddAction(SongObject so, TypeTag tag) : base(so, tag) { }
public SongEditAdd(SongObject songObject) : base(songObject) { }
public void Copy() { const float DEFAULT_LEFT = -2; const float DEFAULT_RIGHT = 2; var songObjectsCopy = new SongObject[selectedObjectsManager.currentSelectedObjects.Count]; float?left = null, right = null; float position = 0; bool containsNotes = false; // Scan through all the current objects to determine width of scanned area for (int i = 0; i < selectedObjectsManager.currentSelectedObjects.Count; ++i) { if (!containsNotes && selectedObjectsManager.currentSelectedObjects[i].GetType() == typeof(Note)) { containsNotes = true; } songObjectsCopy[i] = selectedObjectsManager.currentSelectedObjects[i].Clone(); position = SongObjectController.GetXPos(selectedObjectsManager.currentSelectedObjects[i]); if (left == null || position < left) { left = position; } if (right == null || position > right) { right = position; } } // Default collision size if (containsNotes) { if (left > DEFAULT_LEFT) { left = DEFAULT_LEFT; } if (right < DEFAULT_RIGHT) { right = DEFAULT_RIGHT; } } if (left == null) { left = DEFAULT_LEFT; } if (right == null) { right = DEFAULT_RIGHT; } Vector2 bottomLeft = Vector2.zero; Vector2 upperRight = Vector2.zero; var area = new Clipboard.SelectionArea(); if (selectedObjectsManager.currentSelectedObjects.Count > 0) { bottomLeft = new Vector2((float)left, currentSong.TickToWorldYPosition(songObjectsCopy[0].tick)); upperRight = new Vector2((float)right, currentSong.TickToWorldYPosition(songObjectsCopy[songObjectsCopy.Length - 1].tick)); area = new Clipboard.SelectionArea(bottomLeft, upperRight, songObjectsCopy[0].tick, songObjectsCopy[songObjectsCopy.Length - 1].tick); } ClipboardObjectController.SetData(songObjectsCopy, area, currentSong); }
public static void ApplyPostValidatedAction(SongObject songObject) { switch (songObject.classID) { case ((int)SongObject.ID.Note): { Note note = songObject as Note; ChartEditor editor = ChartEditor.Instance; Chart chart = editor.currentChart; chart.Add(note); foreach (Note chordNote in note.chord) { if (chordNote.controller) { chordNote.controller.SetDirty(); } } Note next = note.nextSeperateNote; if (next != null) { foreach (Note chordNote in next.chord) { if (chordNote.controller) { chordNote.controller.SetDirty(); } } } } break; case ((int)SongObject.ID.Starpower): case ((int)SongObject.ID.ChartEvent): { ChartEditor editor = ChartEditor.Instance; Chart chart = editor.currentChart; chart.Add(songObject as ChartObject); } break; case ((int)SongObject.ID.BPM): case ((int)SongObject.ID.TimeSignature): { ChartEditor editor = ChartEditor.Instance; Song song = editor.currentSong; song.Add(songObject as SyncTrack); } break; case ((int)SongObject.ID.Section): case ((int)SongObject.ID.Event): { ChartEditor editor = ChartEditor.Instance; Song song = editor.currentSong; song.Add(songObject as Event); } break; default: Debug.LogError("Unhandled songobject!"); break; } }
private void LateUpdate() { prevSongObject = currentSongObject.Clone(); prevSongObjectRef = currentSongObject; }
protected virtual bool Equals(SongObject b) { return(tick == b.tick && classID == b.classID); }
protected abstract void Assign(SongObjectController sCon, SongObject songObject);
public bool IsSelected(SongObject songObject) { return(SongObjectHelper.FindObjectPosition(songObject, currentSelectedObjects) != SongObjectHelper.NOTFOUND); }
SongObject[] ScanArea(Vector2 cornerA, Vector2 cornerB, uint minLimitInclusive, uint maxLimitNonInclusive) { Clipboard.SelectionArea area = new Clipboard.SelectionArea(cornerA, cornerB, minLimitInclusive, maxLimitNonInclusive); Rect areaRect = area.GetRect(editor.currentSong); List <SongObject> chartObjectsList = new List <SongObject>(); if (Globals.viewMode == Globals.ViewMode.Chart) { int index, length; SongObjectHelper.GetRange(editor.currentChart.chartObjects, minLimitInclusive, maxLimitNonInclusive, out index, out length); for (int i = index; i < index + length; ++i) { ChartObject chartObject = editor.currentChart.chartObjects[i]; float offset = 0; if ((SongObject.ID)chartObject.classID == SongObject.ID.ChartEvent) { offset = ChartEventController.GetOffset(editor, (ChartEvent)chartObject); } if (chartObject.tick < maxLimitNonInclusive && PrefabGlobals.HorizontalCollisionCheck(PrefabGlobals.GetCollisionRect(chartObject, 0, offset), areaRect)) { chartObjectsList.Add(chartObject); } } } else { // Gather synctrack, sections and events int index, length; SongObjectHelper.GetRange(editor.currentSong.syncTrack, minLimitInclusive, maxLimitNonInclusive, out index, out length); // Synctrack for (int i = index; i < index + length; ++i) { SongObject chartObject = editor.currentSong.syncTrack[i]; if (chartObject.tick < maxLimitNonInclusive && PrefabGlobals.HorizontalCollisionCheck(PrefabGlobals.GetCollisionRect(chartObject), areaRect)) { chartObjectsList.Add(chartObject); } } SongObjectHelper.GetRange(editor.currentSong.eventsAndSections, minLimitInclusive, maxLimitNonInclusive, out index, out length); // Events and sections for (int i = index; i < index + length; ++i) { SongObject chartObject = editor.currentSong.eventsAndSections[i]; float offset = 0; if ((SongObject.ID)chartObject.classID == SongObject.ID.Event) { offset = EventController.GetOffset(editor, (Event)chartObject); } if (chartObject.tick < maxLimitNonInclusive && PrefabGlobals.HorizontalCollisionCheck(PrefabGlobals.GetCollisionRect(chartObject, 0, offset), areaRect)) { chartObjectsList.Add(chartObject); } } } return(chartObjectsList.ToArray()); }
string GetSaveString <T>(Song song, T[] list, ExportOptions exportOptions, ref string out_errorList, Song.Instrument instrument = Song.Instrument.Guitar) where T : SongObject { System.Text.StringBuilder saveString = new System.Text.StringBuilder(); float resolutionScaleRatio = song.ResolutionScaleRatio(exportOptions.targetResolution); for (int i = 0; i < list.Length; ++i) { SongObject songObject = list[i]; try { uint tick = (uint)Mathf.Round(songObject.tick * resolutionScaleRatio) + exportOptions.tickOffset; saveString.Append(Globals.TABSPACE + tick); switch ((SongObject.ID)songObject.classID) { case (SongObject.ID.BPM): BPM bpm = songObject as BPM; if (bpm.anchor != null) { uint anchorValue = (uint)((double)bpm.anchor * 1000000); saveString.AppendFormat(s_anchorFormat, anchorValue, tick); } saveString.AppendFormat(s_bpmFormat, bpm.value); break; case (SongObject.ID.TimeSignature): TimeSignature ts = songObject as TimeSignature; if (ts.denominator == 4) { saveString.AppendFormat(s_tsFormat, ts.numerator); } else { uint denominatorSaveVal = (uint)Mathf.Log(ts.denominator, 2); saveString.AppendFormat(s_tsDenomFormat, ts.numerator, denominatorSaveVal); } break; case (SongObject.ID.Section): Section section = songObject as Section; saveString.AppendFormat(s_sectionFormat, section.title); break; case (SongObject.ID.Event): Event songEvent = songObject as Event; saveString.AppendFormat(s_eventFormat, songEvent.title); break; case (SongObject.ID.ChartEvent): ChartEvent chartEvent = songObject as ChartEvent; saveString.AppendFormat(s_chartEventFormat, chartEvent.eventName); break; case (SongObject.ID.Starpower): Starpower sp = songObject as Starpower; saveString.AppendFormat(s_starpowerFormat, (uint)Mathf.Round(sp.length * resolutionScaleRatio)); break; case (SongObject.ID.Note): Note note = songObject as Note; int fretNumber; if (instrument != Song.Instrument.Unrecognised) { if (instrument == Song.Instrument.Drums) { fretNumber = GetDrumsSaveNoteNumber(note); } else if (instrument == Song.Instrument.GHLiveGuitar || instrument == Song.Instrument.GHLiveBass) { fretNumber = GetGHLSaveNoteNumber(note); } else { fretNumber = GetStandardSaveNoteNumber(note); } } else { fretNumber = note.rawNote; } saveString.AppendFormat(s_noteFormat, fretNumber, (uint)Mathf.Round(note.length * resolutionScaleRatio)); // Only need to get the flags of one note of a chord if (exportOptions.forced && (note.next == null || (note.next != null && note.next.tick != note.tick))) { if ((note.flags & Note.Flags.Forced) == Note.Flags.Forced) { saveString.AppendFormat(s_forcedNoteFormat, tick); } // Save taps line if not an open note, as open note taps cause weird artifacts under sp if (!note.IsOpenNote() && (note.flags & Note.Flags.Tap) == Note.Flags.Tap) { saveString.AppendFormat(s_tapNoteFormat, tick); } } continue; default: continue; } saveString.Append(Globals.LINE_ENDING); //throw new System.Exception("Test error count: " + i); } catch (System.Exception e) { string error = Logger.LogException(e, "Error with saving object #" + i + " as " + songObject); out_errorList += error + Globals.LINE_ENDING; } } return(saveString.ToString()); }
public Add(SongObject songObjects) : base(new SongObject[] { songObjects }) { }
public static SongMaxScoreInfo GetSongObjectMaxScore(SongObject so) { SongMaxScoreInfo info = new SongMaxScoreInfo(); info.MaxScore = 0; info.MaxCombo = 0; int voiceSorce = 0; int clickTime = 0; int voiceTime = 0; info.ClickFrequency = 0; //点击和语音 for (int i = 0; i < so.SentenceObjs.Count; i++) { if (so.SentenceObjs[i].Type == SentenceType.Common) { for (int j = 0; j < so.SentenceObjs[i].ClickAndHOList.HitObjects.Count; j++) { clickTime += so.SentenceObjs[i].m_InOutTime.EndTime - so.SentenceObjs[i].m_InOutTime.StartTime; info.MaxScore += (int)(CorePlaySettings.Instance.m_ComboPoint + info.MaxCombo * RuntimeConst.ScoreParam); info.MaxCombo++; info.ClickFrequency++; } } else if (so.SentenceObjs[i].Type == SentenceType.Voice) { voiceTime += so.SentenceObjs[i].m_InOutTime.EndTime - so.SentenceObjs[i].m_InOutTime.StartTime; voiceSorce += CorePlaySettings.Instance.m_VoiceRightPoint; info.MaxScore += CorePlaySettings.Instance.m_VoiceRightPoint; info.MaxCombo++; } } //boss战 for (int i = 0; i < so.StreamSentences.Count; i++) { if (so.StreamSentences[i].Type == SentenceType.Common) { for (int j = 0; j < so.StreamSentences[i].Group[0].Sentence.Count; j++) { clickTime += so.StreamSentences[i].TimeLength; info.MaxScore += (int)(CorePlaySettings.Instance.m_ComboPoint + info.MaxCombo * RuntimeConst.ScoreParam); info.MaxCombo++; info.ClickFrequency++; } } else if (so.StreamSentences[i].Type == SentenceType.Voice) { voiceTime += so.StreamSentences[i].TimeLength; voiceSorce += CorePlaySettings.Instance.m_VoiceRightPoint; info.MaxScore += CorePlaySettings.Instance.m_VoiceRightPoint; info.MaxCombo++; } } //普通关语音回放部分 for (int i = 0; i < so.NonRhythmSenteces.Count; i++) { if (so.NonRhythmSenteces[i].Type == SentenceType.NonRhythmCommon) { for (int j = 0; j < so.NonRhythmSenteces[i].Sentence.Count; j++) { clickTime += (int)(so.NonRhythmSenteces[i].Duration * 1000); info.MaxScore += (int)(CorePlaySettings.Instance.m_ComboPoint + info.MaxCombo * RuntimeConst.ScoreParam); info.MaxCombo++; info.ClickFrequency++; } } else if (so.NonRhythmSenteces[i].Type == SentenceType.NonRhythmVoice) { voiceTime += (int)(so.NonRhythmSenteces[i].Duration * 1000); voiceSorce += CorePlaySettings.Instance.m_VoiceRightPoint; info.MaxScore += CorePlaySettings.Instance.m_VoiceRightPoint; info.MaxCombo++; } } info.VoiceScorePercent = (float)voiceSorce / info.MaxScore; info.ClickScorePercent = 1 - info.VoiceScorePercent; info.ClickTimePercent = (float)(clickTime) / (clickTime + voiceTime); info.VoiceTimePercent = 1 - info.ClickTimePercent; return(info); }
public Delete(SongObject songObjects) : base(new SongObject[] { songObjects }) { }
public DeleteAction(SongObject so, TypeTag tag) : base(so, tag) { }
public Modify(SongObject before, SongObject after) : base(new SongObject[] { before, after }) { }