double lostArrage = 500 * 10; //按错与位置出入太大 /// <summary> /// 通知有按键按下 /// </summary> /// <param name="key"></param> public void NotifyKeyDown(DrumType dt) { if (SignEnd()) { return; } for (int i = indexActual; i < signCount;) { if (null == CadenceSigns) { return; } CadenceSign cs = CadenceSigns[i]; double atime = (lapseTime - arriveEndPointOffset);// / (1 * speed);//当前实际流逝时间 if (CommHelper.Abs(cs.DelayTimeMill - atime) <= normalArrage) { //double lv = Canvas.GetLeft(cs.currentSign); cs.currentSign.Visibility = Visibility.Collapsed; LayoutRoot.Children.Remove(cs.currentSign); indexActual++; cs.state = 2; HitArgs ha = new HitArgs(); ha.DrumType = dt; ha.SignSource = cs; ha.HitType = HitType.Normal; if (cs.drumType != DrumType.FaceAll && cs.drumType != DrumType.SideAll) { cs.DelayTimeMill -= (int)(10 * speed); } if (CommHelper.Abs(cs.DelayTimeMill - atime) <= niceArrage) { ha.HitType = HitType.Nice; } //得分算出来后计算按键是否对应 if (!KnockKeyIsCodex(cs, dt)) { ha.HitType = HitType.Lost; } OnHit(this, ha); return; } else if (CommHelper.Abs(cs.DelayTimeMill - atime) <= lostArrage) { RemoveAndSendMsg(cs, 1, HitType.Lost); return; } else { return;//没有满足的直接跳出 } } }