private void Target_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Point mousePos = e.GetPosition(target); FletchedGraphic arrow = new FletchedGraphic(mousePos); lArrows.Add(arrow); tempScore.Add(GetScore(mousePos)); UpdateTargetChildren(); }
private void Target_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Point mousePos = e.GetPosition(target); if (Keyboard.Modifiers == ModifierKeys.Control) //bareshaft { BareshaftGraphic bareshaft = new BareshaftGraphic(mousePos); lBareshaft.Add(bareshaft); } else { FletchedGraphic fletched = new FletchedGraphic(mousePos); lFletched.Add(fletched); } UpdateTargetChildren(); }
//Target graphics private void UpdateTargetChildren() { target.Children.Clear(); AddTargetGraphic(); if (lArrows.GetNumElements() > 0) { int head = lArrows.GetHead(); lArrows.ResetHead(); for (int i = 0; i < lArrows.GetSize(); i++) { FletchedGraphic arrow = (FletchedGraphic)lArrows[i]; if (arrow != null) { target.Children.Add(arrow); //ienumerator will go through the whole array even if elements are null } lArrows.MoveNext(); } lArrows.SetHead(head); } }
//Target graphics private void UpdateTargetChildren() { target.Children.Clear(); AddTargetGraphic(); if (lBareshaft.GetNumElements() > 0) { int head = lBareshaft.GetHead(); lBareshaft.SetHead(0); for (int i = 0; i < lBareshaft.GetSize(); i++) { BareshaftGraphic bareshaft = (BareshaftGraphic)lBareshaft[i]; if (bareshaft != null) { target.Children.Add(bareshaft); //ienumerator will go through the whole array even if elements are null } lBareshaft.MoveNext(); } lBareshaft.SetHead(head); } if (lFletched.GetNumElements() > 0) { int head = lFletched.GetHead(); lFletched.SetHead(0); for (int i = 0; i < lFletched.GetSize(); i++) { FletchedGraphic fletched = (FletchedGraphic)lFletched[i]; if (fletched != null) { target.Children.Add(fletched); } lFletched.MoveNext(); } lFletched.SetHead(head); } }