public void Draw() { if (!initialized) { return; } foreach (Mark mk in marks) { mk.Draw(); } foreach (Mark mk in marks) { ExMark exmk = mk as ExMark; if (exmk != null) { exmk.gageDraw(); } } if (gameutility.Connect || gameutility.Profile.Connect) { foreach (MarkConnection mc in connections) { mc.DrawConnection(DrawConnect); } } foreach (Mark mk in marks) { mk.colorDraw(); } }
private Mark CreateMark(IPPDData ipdata) { ExMarkData emd = ipdata as ExMarkData; if (emd != null) { ExMark ret = new ExMark(device, resourceManager, imagepathes, emd, (ButtonType)keychange[(int)emd.ButtonType], evals, adjustgaptime, circlepoints, em.GetCorrectDisplaystate(ipdata.Time), em.GetACMode(ipdata.Time)); marks.Add(ret); return(ret); } else { MarkData md = ipdata as MarkData; Mark ret = new Mark(device, resourceManager, imagepathes, md, (ButtonType)keychange[(int)md.ButtonType], evals, adjustgaptime, em.GetCorrectDisplaystate(ipdata.Time), em.GetACMode(ipdata.Time)); marks.Add(ret); return(ret); } }
public void Update(float time, bool[] b, bool[] released, bool fadeout) { if (!initialized) { return; } cd.Update(); readppddata(time); foreach (Mark mk in marks) { if (removemarks.Contains(mk)) { continue; } ExMark exmk = mk as ExMark; EffectType result = 0; int soundtype = -1; bool remove = false; if (exmk != null) { remove = exmk.ExUpdate(em.GetCorrectTime(time, mk.Time), gameutility.SpeedScale * em.BPM, ref b, ref released, ref result, gameutility.Auto, ref soundtype, CreateEffect ); if (gameutility.Auto) { if (soundtype >= 0 && soundtype < 10) { int index = Array.IndexOf(keychange, soundtype); if (PlaySound != null) { PlaySound.Invoke(index, true); } } else if (soundtype >= 10) { int index = Array.IndexOf(keychange, soundtype - 10); if (StopSound != null) { StopSound.Invoke(index, false); } if (em.GetReleaseSound(index) && PlaySound != null) { PlaySound.Invoke(index, false); } } } else { //manual int index = Array.IndexOf(keychange, soundtype); if (em.GetReleaseSound(index) && PlaySound != null) { PlaySound.Invoke(index, false); } } } else { remove = mk.Update(em.GetCorrectTime(time, mk.Time), gameutility.SpeedScale * em.BPM, ref b, ref result, gameutility.Auto, ref soundtype, CreateEffect ); if (gameutility.Auto) { if (soundtype != -1) { int index = Array.IndexOf(keychange, soundtype); if (PlaySound != null) { PlaySound.Invoke(index, false); } } } } if (result != EffectType.None) { if (result == EffectType.Cool || result == EffectType.Fine) { if (gameutility.Auto && ACPressing[(int)mk.ButtonType] != null) { if (PressingButton != null) { PressingButton.Invoke(mk.ButtonType, false); } for (int i = 0; i < ACPressing.Length; i++) { if (ACPressing[i] != null) { AddRemove(ACPressing[i]); } } Array.Clear(ACPressing, 0, ACPressing.Length); } if (ChangeCombo != null) { ChangeCombo.Invoke(true, new Vector2(mk.Position.X + 10, mk.Position.Y - 60)); } } else if (result == EffectType.Pressing) { if (PressingButton != null) { if (PressingButton.Invoke(mk.ButtonType, true)) { for (int i = 0; i < ACPressing.Length; i++) { if (ACPressing[i] != null) { AddRemove(ACPressing[i]); } } Array.Clear(ACPressing, 0, ACPressing.Length); } } ACPressing[(int)mk.ButtonType] = exmk; CheckConnection(exmk); } else if (result == EffectType.PressReleased) { PressingButton.Invoke(mk.ButtonType, false); for (int i = 0; i < ACPressing.Length; i++) { if (ACPressing[i] != null) { AddRemove(ACPressing[i]); } } Array.Clear(ACPressing, 0, ACPressing.Length); } else { if (ChangeCombo != null) { ChangeCombo.Invoke(false, new Vector2(mk.Position.X + 10, mk.Position.Y - 60)); } } if (!fadeout && result != EffectType.Pressing && result != EffectType.PressReleased) { if (EvaluateCount != null) { EvaluateCount.Invoke((int)result - 1, false); } } } if (remove) { AddRemove(mk); } } foreach (Mark mk in removemarks) { marks.Remove(mk); } if (marks.Count > 0 && !gameutility.Auto) { int iter = 0; for (int i = 0; i < 10; i++) { if (b[i]) { Mark mk = null; while (iter < marks.Count) { mk = marks[iter] as Mark; ExMark exmk = mk as ExMark; if (exmk != null && exmk.ExMarkState != ExMark.ExState.waitingpress) { iter++; } else { break; } } if (iter >= marks.Count || mk == null) { break; } if (mk.AC) { int eval = mk.Evaluate(time); if (eval > 0) { if (ChangeCombo != null) { ChangeCombo(false, new Vector2(mk.Position.X + 10, mk.Position.Y - 60)); } EvaluateCount.Invoke(eval - 1, true); marks.Remove(mk); CheckConnection(mk); } } } } } removemarks.Clear(); }