Пример #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            MediaManager.Setup(Services, graphics);
            prevMouseState = Mouse.GetState();

            TAGame.TAGame tagame = new TAGame.TAGame(this);

            Restart();
            ActiveGame = "SPLASHSCREEN";
        }
Пример #2
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            MediaManager.DrawArt(spriteBatch, "Content/table_clear", 0, 0);
            MediaManager.DrawArt(spriteBatch, "Content/books_pen", 0, 0);
            MediaManager.DrawArt(spriteBatch, "Content/implied_partay", 0, 0);
            MediaManager.DrawArt(spriteBatch, "Content/math", 0, 0);
            MediaManager.DrawArt(spriteBatch, "Content/lamp", 525, -150);
            MediaManager.DrawArt(spriteBatch, "Content/splash_screen_paper", 750, 600);

            foreach (ClickableObject o in menuItems)
            {
                o.Draw(spriteBatch);
            }
            base.Draw(spriteBatch);
            MediaManager.DrawArt(spriteBatch, "Content/lamp_light", 0, 0);
        }
Пример #3
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            MediaManager.DrawArt(spriteBatch, "Content/bookstore_background", (int)bgXOffset, 0);
            MediaManager.DrawArt(spriteBatch, "Content/bookstore_background", (int)bgXOffset + 2000, 0);

            // player & objects drawn by this!
            base.Draw(spriteBatch);

            /* if (direction < 0)
             *   MediaManager.DrawArt(spriteBatch, "Content/shopping_cart_200", (int)600, 425);
             * else
             *   MediaManager.DrawArt(spriteBatch, "Content/shopping_cart_200_h", (int)400, 425);
             */
            if (grr)
            {
                MediaManager.DrawArt(spriteBatch, "Content/BLAH", 200, 40);
            }
        }
Пример #4
0
 public WorldMap(MainGame game)
     : base(game)
 {
     menuItems    = new ClickableObject[2];
     menuItems[0] = new ClickableObject(new TextureObject(MediaManager.textures["BLAH"], new Vector2(100, 100)),
                                        delegate()
     {
         game.ActiveGame = "TAGAME";
         MediaManager.StopSound();
         MediaManager.PlaySound("Content/dark_beat");
     });
     menuItems[1] = new ClickableObject(new TextureObject(MediaManager.textures["BLAH"], new Vector2(700, 100)),
                                        delegate()
     {
         game.ActiveGame = "BOOKSTOREGAME";
         MediaManager.StopSound();
         MediaManager.PlaySound("Content/Emilia");
     });
 }
Пример #5
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.End();
            spriteBatch.Begin();

            Vector2 mousePos = Vector2.Transform(MediaManager.GetCurMousePos(), MediaManager.cam.get_transformation(game.GraphicsDevice));

            /*
             * if (game.ActiveGame == "TAGAME" || game.ActiveGame == "BOOKSTOREGAME")
             * {
             *
             *  Color UI_Color = Color.White;
             *
             *  int UI_Top_Height = 253;
             *  int UI_Bot_Height = 253;
             *  int UI_Pad_Height = 10;
             *  int UI_Mid_Height = -11;
             *
             *  int UI_width = 150;
             *  int line_height = 25;
             *  int window_width = 1200;
             *
             *  int UI_DIST_BW_AS_AND_HID = 20;
             *  int UI_X = window_width - UI_width;
             *  int UI_Y_AS = 5;
             *  int UI_Y_HID = 0;
             *
             *  int UI_Font_Padding = 10;
             *  int UI_Font_X = UI_Font_Padding + UI_X;
             *
             *  int DEFAULT_NUM_ITEMS_AS = 2;
             *  int BS_GAME_NUM_ITEMS_AS = 2 + DEFAULT_NUM_ITEMS_AS;
             *  int TA_GAME_NUM_ITEMS_AS = 2 + DEFAULT_NUM_ITEMS_AS;
             *
             *  int DEFAULT_NUM_ITEMS_NS = 3;
             *  int BS_GAME_NUM_ITEMS_NS = 2 + DEFAULT_NUM_ITEMS_NS;
             *  int TA_GAME_NUM_ITEMS_NS = 2 + DEFAULT_NUM_ITEMS_NS;
             *
             *  int TA_GAME_HEIGHT_AS = TA_GAME_NUM_ITEMS_AS * line_height + UI_Pad_Height;
             *  int TA_GAME_HEIGHT_NS = TA_GAME_NUM_ITEMS_NS * line_height + 2 * UI_Pad_Height;
             *  int BS_GAME_HEIGHT_AS = BS_GAME_NUM_ITEMS_AS * line_height + UI_Pad_Height;
             *  int BS_GAME_HEIGHT_NS = BS_GAME_NUM_ITEMS_NS * line_height + 2 * UI_Pad_Height;
             *
             *  if (UI_button_state == 1)
             *  {
             *      foreach (ClickableObject o in menuItems)
             *      {
             *          o.Draw(spriteBatch);
             *      }
             *  }
             *
             *
             *  switch (game.ActiveGame)
             *  {
             *      case "TAGAME":
             *          UI_MAX_Y = TA_GAME_HEIGHT_AS;
             *          if (UI_display_state == 1)
             *          {
             *              MediaManager.DrawArt(spriteBatch, "Content/UI_Bottom_150p", UI_X - 50, TA_GAME_HEIGHT_AS + TA_GAME_HEIGHT_NS - UI_Bot_Height);
             *              UI_MAX_Y = TA_GAME_HEIGHT_AS + TA_GAME_HEIGHT_NS;
             *          }
             *          MediaManager.DrawArt(spriteBatch, "Content/UI_Top_150p", UI_X - 50, TA_GAME_HEIGHT_AS - UI_Top_Height);
             *          break;
             *      case "BOOKSTOREGAME":
             *          UI_MAX_Y = BS_GAME_HEIGHT_AS;
             *          if (UI_display_state == 1)
             *          {
             *              MediaManager.DrawArt(spriteBatch, "Content/UI_Bottom_150p", UI_X - 50, BS_GAME_HEIGHT_AS + BS_GAME_HEIGHT_NS - UI_Bot_Height);
             *              UI_MAX_Y = BS_GAME_HEIGHT_AS + BS_GAME_HEIGHT_NS;
             *          }
             *          MediaManager.DrawArt(spriteBatch, "Content/UI_Top_150p", UI_X - 50, BS_GAME_HEIGHT_AS - UI_Top_Height);
             *          break;
             *      default:
             *          break;
             *  }
             *
             *  MediaManager.DrawText(spriteBatch, "TIME: " + game.time, UI_Font_X, UI_Y_AS, UI_Color);
             *  UI_Y_AS += line_height;
             *  MediaManager.DrawText(spriteBatch, "BSL: " + game.bloodSugarLevel.ToString(), UI_Font_X, UI_Y_AS, UI_Color);
             *  UI_Y_AS += line_height;
             *
             *  switch (game.ActiveGame)
             *  {
             *      case "TAGAME":
             *          MediaManager.DrawText(spriteBatch, "PAPERS LEFT: ", UI_Font_X, UI_Y_AS, UI_Color);
             *          UI_Y_AS += line_height;
             *          MediaManager.DrawText(spriteBatch, "CLASS PERCENTAGE: ", UI_Font_X, UI_Y_AS, UI_Color);
             *          UI_Y_AS += line_height;
             *          break;
             *      case "BOOKSTOREGAME":
             *          MediaManager.DrawText(spriteBatch, "CUSTOMERS: ", UI_Font_X, UI_Y_AS, UI_Color);
             *          UI_Y_AS += line_height;
             *          MediaManager.DrawText(spriteBatch, "TIME TIL CLOSING: ", UI_Font_X, UI_Y_AS, UI_Color);
             *          UI_Y_AS += line_height;
             *          break;
             *      default:
             *          break;
             *  }
             *
             *  UI_Y_HID = UI_Y_AS + UI_DIST_BW_AS_AND_HID;
             *
             *  if (UI_display_state == 1)
             *  {
             *      MediaManager.DrawText(spriteBatch, "SCORE: " + game.score, UI_Font_X, UI_Y_HID, UI_Color);
             *      UI_Y_HID += line_height;
             *      MediaManager.DrawText(spriteBatch, "TIME: " + game.time, UI_Font_X, UI_Y_HID, UI_Color);
             *      UI_Y_HID += line_height;
             *      MediaManager.DrawText(spriteBatch, "GRADE: ", UI_Font_X, UI_Y_HID, UI_Color);
             *      UI_Y_HID += line_height;
             *
             *      switch (game.ActiveGame)
             *      {
             *          case "TAGAME":
             *              MediaManager.DrawText(spriteBatch, "PAPERS LEFT: ", UI_Font_X, UI_Y_HID, UI_Color);
             *              UI_Y_HID += line_height;
             *              MediaManager.DrawText(spriteBatch, "CLASS PERCENTAGE: ", UI_Font_X, UI_Y_HID, UI_Color);
             *              UI_Y_HID += line_height;
             *              break;
             *          case "BOOKSTOREGAME":
             *              MediaManager.DrawText(spriteBatch, "CUSTOMERS: ", UI_Font_X, UI_Y_HID, UI_Color);
             *              UI_Y_HID += line_height;
             *              MediaManager.DrawText(spriteBatch, "TIME TIL CLOSING: ", UI_Font_X, UI_Y_HID, UI_Color);
             *              UI_Y_HID += line_height;
             *              break;
             *          default:
             *              break;
             *      }
             *  }
             *
             *  switch (game.ActiveGame)
             *  {
             *      case "TAGAME":
             *          if (UI_display_state == 0)
             *          {
             *              Vector2 newButtonPos = new Vector2(UI_X, TA_GAME_HEIGHT_AS + UI_Mid_Height);
             *              menuItems[0].Position = newButtonPos;
             *              if (UI_button_state == 1)
             *              {
             *                  MediaManager.DrawText(spriteBatch, "Click to Expand", UI_X + 22, TA_GAME_HEIGHT_AS + UI_Mid_Height + 14, UI_Color);
             *              }
             *              UI_BUTTON_Y = TA_GAME_HEIGHT_AS + UI_Mid_Height;
             *          }
             *          else if (UI_display_state == 1)
             *          {
             *              Vector2 newButtonPos = new Vector2(UI_X, TA_GAME_HEIGHT_AS + TA_GAME_HEIGHT_NS + UI_Mid_Height);
             *              menuItems[0].Position = newButtonPos;
             *              if (UI_button_state == 1)
             *              {
             *                  MediaManager.DrawText(spriteBatch, "Click to Hide", UI_X + 37, TA_GAME_HEIGHT_AS + TA_GAME_HEIGHT_NS + UI_Mid_Height + 14, UI_Color);
             *              }
             *              UI_BUTTON_Y = TA_GAME_HEIGHT_AS + TA_GAME_HEIGHT_NS + UI_Mid_Height;
             *          }
             *          break;
             *      case "BOOKSTOREGAME":
             *          if (UI_display_state == 0)
             *          {
             *              Vector2 newButtonPos = new Vector2(UI_X, BS_GAME_HEIGHT_AS + UI_Mid_Height);
             *              menuItems[0].Position = newButtonPos;
             *              if (UI_button_state == 1)
             *              {
             *                  MediaManager.DrawText(spriteBatch, "Click to Expand", UI_X + 22, BS_GAME_HEIGHT_AS + UI_Mid_Height + 14, UI_Color);
             *              }
             *              UI_BUTTON_Y = BS_GAME_HEIGHT_AS + UI_Mid_Height;
             *          }
             *          else if (UI_display_state == 1)
             *          {
             *              Vector2 newButtonPos = new Vector2(UI_X, BS_GAME_HEIGHT_AS + BS_GAME_HEIGHT_NS + UI_Mid_Height);
             *              menuItems[0].Position = newButtonPos;
             *              if (UI_button_state == 1)
             *              {
             *                  MediaManager.DrawText(spriteBatch, "Click to Hide", UI_X + 37, BS_GAME_HEIGHT_AS + BS_GAME_HEIGHT_NS + UI_Mid_Height + 14, UI_Color);
             *              }
             *              UI_BUTTON_Y = BS_GAME_HEIGHT_AS + BS_GAME_HEIGHT_NS + UI_Mid_Height;
             *          }
             *          break;
             *      default:
             *          break;
             *  }
             *  UI_BUTTON_X = UI_X;
             *
             * }
             */
            MediaManager.DrawArt(spriteBatch, "Content/cursorSmall30", (int)mousePos.X - 30 / 2, (int)mousePos.Y - 30 / 2);
            spriteBatch.End();
            spriteBatch.Begin(SpriteSortMode.Deferred,
                              null,
                              null,
                              null,
                              null,
                              null,
                              MediaManager.cam.get_transformation(spriteBatch.GraphicsDevice));
        }
Пример #6
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (Keyboard.GetState().IsKeyDown(Keys.Q))
            {
                this.Exit();
            }
            // Allows the game to exit
            if (Keyboard.GetState().IsKeyDown(Keys.R))
            {
                Restart();
                ActiveGame = "SPLASHSCREEN";
                return;
            }

            MouseState curMouseState = Mouse.GetState();

            Vector2 curPos  = MediaManager.GetMousePos(curMouseState);
            Vector2 prevPos = MediaManager.GetMousePos(prevMouseState);

            games["UI"].MouseOver(curPos);
            activeGame.MouseOver(curPos);

            if ((prevMouseState.LeftButton == ButtonState.Released) && (curMouseState.LeftButton == ButtonState.Pressed))
            {
                if (games["UI"].ClickDown(curPos))
                {
                    activeGame.ClickDown(curPos);
                    System.Diagnostics.Debug.Write("going\n");
                }
                startClickState = curMouseState;
            }

            //double distance = Math.Sqrt(Math.Pow(startClickState.X - curMouseState.X, 2)
            //    + Math.Pow(startClickState.Y - curMouseState.Y, 2));

            if ((prevMouseState.LeftButton == ButtonState.Pressed) && (curMouseState.LeftButton == ButtonState.Pressed) &&
                prevPos != curPos)
            {
                activeGame.Drag(prevPos, curPos);
            }

            if ((prevMouseState.LeftButton == ButtonState.Pressed) && (curMouseState.LeftButton == ButtonState.Released))
            {
                if (games["UI"].ClickUp(curPos))
                {
                    activeGame.ClickUp(curPos);
                }
            }

            prevMouseState = curMouseState;

            activeGame.Update(gameTime);

            if (gameTime.TotalGameTime.Seconds % 13 == 0)
            {
                money++;
                bloodSugarLevel = MediaManager.GetRandomInt(40, 250);
            }

            base.Update(gameTime);
        }