public void OnPick() { if (_is_playing) { foreach (HitObject HO in HitObjects) { if (HO._offset + HO._size > _Time_Since_Start && HO._offset < _Time_Since_Start) { if (HO._is_hittable) { //Hit HO.OnHit(); ++_hit; return; } else { return; } } } ++_player_miss; ++_miss; Fretboard f = GetComponentInParent <Fretboard>(); if (f) { f.OnMiss(); } } }
// EVENTS public void OnEnd() { foreach (HitObject HO in HitObjects) { HO.Reset(); } if (_miss != 0) { Fretboard f = GetComponentInParent <Fretboard>(); if (f) { if (_player_miss != 0) { Assets.Scripts.Token t = new Assets.Scripts.Token(_name, Assets.Scripts.Token.Sequence_State.Fail, _hit, _player_miss); f.AddToken(t); } else { Assets.Scripts.Token t = new Assets.Scripts.Token(_name, Assets.Scripts.Token.Sequence_State.Background, _hit, _miss); f.AddToken(t); } } //output fail pattern; } else { Fretboard f = GetComponentInParent <Fretboard>(); if (f) { Assets.Scripts.Token t = new Assets.Scripts.Token(_name, Assets.Scripts.Token.Sequence_State.Success, _hit, _miss); f.AddToken(t); } // output success pattern } if (_loop) { BeginAt(_Time_Since_Start - _length); } else { Stop(); _Time_Since_Start = 0; } Fretboard f2 = GetComponentInParent <Fretboard>(); if (f2) { f2.OnSequenceEnd(); } }
public void Do() { if (_is_playing) { _Time_Since_Start += Time.deltaTime * 1000; if (_Time_Since_Start > _length) { OnEnd(); } foreach (HitObject HO in HitObjects) { if (HO._is_hittable) { if (HO._offset + HO._size < _Time_Since_Start) { HO.OnKill(); ++_miss; } } } } }
//Takes all of the information in the record and put it into a string with the format that it needs to have to be saved in a file public string ToFile() { string ReturnString = ""; foreach (ContractionIVDrip item in _contractionIVDRIPList) { ReturnString = ReturnString + item.ToString(); } foreach (VaginalExploration item in _vaginalExplorationList) { ReturnString = ReturnString + item.ToString(); } foreach (Micturition item in _micturitionList) { ReturnString = ReturnString + item.ToString(); } foreach (FetusObservation item in FetusObservationList) { ReturnString = ReturnString + item.ToString(); } foreach (BirthInformation item in BirthInformationList) { ReturnString = ReturnString + item.ToString(); } ReturnString = (ReturnString + "_variables|" + ThisRecordID.ToString() + "|" + TimeOfBirth.ToString() + "|" + CircumferenceHead.ToString() + "|" + CircumferenceStomach.ToString() + "|" + BloodSugar.ToString() + "|" + GA + "|" + NavelpHVenous.ToString() + "|" + NavelpHArterial.ToString() + "|" + NavelBaseExcessArterial.ToString() + "|" + NavelBaseExcessVenous.ToString() + "|" + FetusPosition.ToString() + "|" + PlacentaWeight.ToString() + "|" + KVitamin.ToString() + "|" + ApgarOneMinute.ToString() + "|" + ApgarFiveMinutes.ToString() + "|" + ApgarTenMinutes.ToString() + "|" + AO.ToString() + "|" + HO.ToString() + "|" + Weight.ToString() + "|" + Length.ToString() + "|" + NumberOfChildren + "|" + FurtherNotice + "|" + Sucking.ToString() + "|" + Nose.ToString() + "|" + Pharynx.ToString() + "|" + Ventricle.ToString() + "|" + Diagnosis + "|" + Note + "|" + NewNote + "|" + ApgarOneMinuteNote + "|" + ApgarFiveMinuteNote + "|" + ApgarTenMinuteNote + "|" + BreastFeedingNote + "|" + BirthComplications.ToString() + "|" + IsActive.ToString() + "|" + ChildCPR); foreach (string item in Diseases) { ReturnString = ReturnString + "|" + item; } return(ReturnString); }
void LoadFile() { m_CurrentSongName = m_DropDown.options[m_DropDown.value].text; string path = "Songs/" + m_CurrentSongName + "OSU"; TextAsset osu = ResourceLoadUtils.Load <TextAsset>(path); string[] contents = null; if (osu == null) { string filePath = GetPathString(m_CurrentSongName + "OSU.txt"); if (File.Exists(filePath)) { contents = File.ReadAllLines(filePath); } else { PromptManager.Instance.MessageBox(PromptManager.Type.FloatingTip, m_CurrentSongName + ".txt 文件没有找到!!"); return; } } else { contents = osu.text.Split('\n'); } m_HitObjects.Clear(); ClearAllContent(); bool hitObjStart = false; for (int i = 0; i < contents.Length; i++) { string parseContent = contents[i].Trim(); if (string.IsNullOrEmpty(parseContent) || parseContent.StartsWith("//")) {//空行和注释行 不解析 continue; } if (parseContent.Contains("[HitObjects]")) { hitObjStart = true; continue; } if (hitObjStart) { if (parseContent.Contains("C") || parseContent.Contains("P") || parseContent.Contains("L") || parseContent.Contains("B")) {//2017年10月28日版本先不做这些功能 continue; } else { string[] param = parseContent.Split(','); if (param.Length != 6) { LogManager.LogError("data parse error: the data file is --", path); } else { Vector2 pos = new Vector2(int.Parse(param[0]), int.Parse(param[1])); int startTime = int.Parse(param[2]); HO ho = new HO(); ho.m_Index = m_HitObjects.Count + 1; ho.m_StartTime = startTime; ho.m_Position = pos; m_HitObjects.Add(ho); } } } } InitLeftBoxHOList(); CreateLeftBoxScrollViewContent(); }