示例#1
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            Vector2 position = new Vector2(d.X, d.Y);

            if (mainMenu.SelectItemNumber == 0)
            {
                mainMenu.Draw(gameTime, d, position);
            }
            else if (mainMenu.SelectItemNumber == 1)
            {
                if (kanjiMenu.SelectItemNumber == 0)
                {
                    kanjiMenu.Draw(gameTime, d, position);
                }
                else if (kanjiMenu.SelectItemNumber == 1)
                {
                    if (kanjiGame == null)
                    {
                        this.kanjiGame = new KanjiGame(this);
                        Components.Add(this.kanjiGame);
                    }

                    kanjiGame.Draw(gameTime, d, position);
                    kanjiGame.Update(gameTime);
                }
                else if (kanjiMenu.SelectItemNumber == 2)
                {
                    if (compositionGame == null)
                    {
                        this.compositionGame = new CompositionGame(this);
                        Components.Add(this.compositionGame);
                    }

                    compositionGame.Draw(gameTime, d, position);
                    compositionGame.Update(gameTime);
                }
                else if (kanjiMenu.SelectItemNumber == 3)
                {
                    if (kanjiList == null)
                    {
                        this.kanjiList = new KanjiList(this);
                        Components.Add(this.kanjiList);
                    }

                    kanjiList.Draw(gameTime, d, position);
                    kanjiList.Update(gameTime);
                }
                else
                { }

                back(position);
            }
            else if (mainMenu.SelectItemNumber == 2)
            {
                if (vocabularyMenu.SelectItemNumber == 0)
                {
                    vocabularyMenu.Draw(gameTime, d, position);
                }
                else if (vocabularyMenu.SelectItemNumber == 1)
                {
                    if (vocabularyGame == null)
                    {
                        this.vocabularyGame = new VocabularyGame(this);
                        Components.Add(this.vocabularyGame);
                    }

                    vocabularyGame.Draw(gameTime, d, position);
                }
                else if (vocabularyMenu.SelectItemNumber == 2)
                {
                    if (vocabularyGame2 == null)
                    {
                        this.vocabularyGame2 = new VocabularyGame2(this);
                        Components.Add(this.vocabularyGame2);
                    }

                    vocabularyGame2.Draw(gameTime, d, position);
                }
                else if (vocabularyMenu.SelectItemNumber == 3)
                {
                    if (vocabularyList == null)
                    {
                        this.vocabularyList = new VocabularyList(this);
                        Components.Add(this.vocabularyList);
                    }

                    vocabularyList.Draw(gameTime, d, position);
                    vocabularyList.Update(gameTime);
                }
                else
                { }

                back(position);
            }
            else
            {
                back(position);
            }

            spriteBatch.Begin();

            if (d.X > 0 && d.X < GraphicsDevice.Viewport.Width && d.Y > 0 && d.Y < GraphicsDevice.Viewport.Height)
            {
                spriteBatch.Draw(cursor, position, null, Color.White, 0.0f, textureCenter, 1.0f, SpriteEffects.None, 0.0f);
            }

            spriteBatch.End();

            base.Draw(gameTime);
        }
示例#2
0
 private void deleteObject()
 {
     if (mainMenu.SelectItemNumber == 1)
     {
         if (kanjiMenu.SelectItemNumber == 1)
         {
             Components.Remove(this.kanjiGame);
             kanjiGame.Dispose();
             kanjiGame = null;
         }
         else if (kanjiMenu.SelectItemNumber == 2)
         {
             Components.Remove(this.compositionGame);
             compositionGame.Dispose();
             compositionGame = null;
         }
         else if (kanjiMenu.SelectItemNumber == 3)
         {
             Components.Remove(this.kanjiList);
             kanjiList.Dispose();
             kanjiList = null;
         }
         else
         { }
     }
     else if (mainMenu.SelectItemNumber == 2)
     {
         if (vocabularyMenu.SelectItemNumber == 1)
         {
             Components.Remove(this.vocabularyGame);
             vocabularyGame.Dispose();
             vocabularyGame = null;
         }
         else if (vocabularyMenu.SelectItemNumber == 2)
         {
             Components.Remove(this.vocabularyGame2);
             vocabularyGame2.Dispose();
             vocabularyGame2 = null;
         }
         else if (vocabularyMenu.SelectItemNumber == 3)
         {
             Components.Remove(this.vocabularyList);
             vocabularyList.Dispose();
             vocabularyList = null;
         }
         else
         { }
     }
     else { }
 }