예제 #1
0
 private void CanvasPaint(object Sender, PaintEventArgs Event)
 {
     foreach (Shape SelectedShape in ShapesDrawn)
     {
         SelectedShape.SetGraphics(Event.Graphics);
         SelectedShape.Draw();
     }
 }
예제 #2
0
        /// Drawing
        public static void DrawShapes(SpriteBatch spriteBatch)
        {
            // sort shapes with comparer for drawing (comparer sorts on isSnapped then timeIdle)
            List <Shape> shapes = new List <Shape>(CurrentPuzzleSet.ShapesDict.Values);

            shapes.Sort(new ShapeSnapAgeComparer());

            if (CurrentPuzzle.IsCleared)
            {
                for (int i = 0; i < shapes.Count; i++)
                {
                    if (shapes[i].State == Shape.ShapeState.Dropped ||
                        shapes[i].State == Shape.ShapeState.TransitionOut)
                    {
                        shapes[i].Draw(spriteBatch, Color.White, false);
                    }
                }
            }
            else if (IsAShapeSelected)
            {
                // draw dropped shapes and shapes transitioning off
                for (int i = 0; i < shapes.Count; i++)
                {
                    if (shapes[i].State == Shape.ShapeState.Dropped ||
                        shapes[i].State == Shape.ShapeState.TransitionOut || shapes[i].State == Shape.ShapeState.TransitionInAfterHint || shapes[i].State == Shape.ShapeState.TransitionOutForHint || shapes[i].State == Shape.ShapeState.WaitOnHint)
                    {
                        shapes[i].Draw(spriteBatch, Color.White, false);
                    }
                }

                // apply an effect to selected texture here
                SelectedShape.Draw(spriteBatch, Color.White, true);
            }
            else
            {
                // draw dropped shapes and shapes transitioning off

                int selectedCogShapeKey = MainScreen.PuzzlePanel.SelectedShapeKey;

                for (int i = 0; i < shapes.Count; i++)
                {
                    if (shapes[i].State == Shape.ShapeState.Dropped ||
                        shapes[i].State == Shape.ShapeState.TransitionOut ||
                        shapes[i].State == Shape.ShapeState.TransitionInAfterHint ||
                        shapes[i].State == Shape.ShapeState.TransitionOutForHint ||
                        shapes[i].State == Shape.ShapeState.WaitOnHint)
                    {
                        if (shapes[i].Key == selectedCogShapeKey &&
                            (shapes[i].State != Shape.ShapeState.TransitionInAfterHint &&
                             shapes[i].State != Shape.ShapeState.TransitionOutForHint &&
                             shapes[i].State != Shape.ShapeState.WaitOnHint))
                        {
                            shapes[i].Draw(spriteBatch, Color.White, true);
                        }
                        else // if (shapes[i].State == Shape.ShapeState.TransitionOut)
                        {
                            shapes[i].Draw(spriteBatch, Color.White, false);
                            //                            shapes[i].Draw(spriteBatch, Color.White, 1f, 1f);
                        }
                    }
                }
            }

            if (MainScreen.PuzzlePanel.PanelState == PuzzlePanel.PuzzlePanelState.Hint)
            {
                hintManager.Draw(spriteBatch);
            }
        }