Пример #1
0
        public static IMenu UpdateMenu(MouseHandler mouse, IMenu current, KeyboardHandler kB)
        {
            List <Buttons> currentMenuList = lesMenus[lesMenus.IndexOf(current)].buttonsList;

            if (kB.pressedKeysList.Contains(Keys.Escape))
            {
                current.EscapePressed();
                return(lesMenus.Find(bk => bk.gameState == current.Escape));
            }
            foreach (var item in currentMenuList)
            {
                if (item.spacePos.Contains(mouse.position))
                {
                    item.Transparency = 0.5f;
                    if (mouse.LeftClickState == ClickState.Clicked)
                    {
                        item.Clicked();
                        return(lesMenus.Find(bk => bk.gameState == item.returnState));
                    }
                }
                else
                {
                    item.Transparency = 1.0f;
                }
            }
            return(current);
        }
Пример #2
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()
 {
     // TODO: Add your initialization logic here
     base.Initialize();
     mouse    = new MouseHandler();
     keyboard = new KeyboardHandler();
 }
Пример #3
0
 public void Update(MouseHandler mouse, KeyboardHandler kB)
 {
     foreach (var item in buttonList)
     {
         if ((item.spacePos.Contains(mouse.position) && mouse.LeftClickState == ClickState.Clicked) || kB.pressedKeysList.Contains(item.Hotkey))
         {
             item.Clicked();
             Game1.inGameState = item.returnState;
         }
         else if (mouse.LeftClickState == ClickState.Releasing || kB.releasedKeysList.Contains(item.Hotkey))
         {
             item.Released();
         }
     }
     SetUIText();
 }
Пример #4
0
        public static IMenu UpdateMenu(MouseHandler mouse, IMenu current, KeyboardHandler kB)
        {
            List<Drawable> currentMenuList = lesMenus[lesMenus.IndexOf(current)].drawableList;

            if (kB.pressedKeysList.Contains(Keys.Escape))
            {
                current.EscapePressed();
                return lesMenus.Find(bk => bk.gameState == current.Escape);
            }

            foreach (var item in currentMenuList)
            {
                if (item.Update(mouse, current))
                    return lesMenus.Find(bk => bk.gameState == item.returnState);
            }
            return current;
        }
Пример #5
0
        public static IMenu UpdateMenu(MouseHandler mouse, IMenu current, KeyboardHandler kB)
        {
            List <Drawable> currentMenuList = lesMenus[lesMenus.IndexOf(current)].drawableList;

            if (kB.pressedKeysList.Contains(Keys.Escape))
            {
                current.EscapePressed();
                return(lesMenus.Find(bk => bk.gameState == current.Escape));
            }

            foreach (var item in currentMenuList)
            {
                if (item.Update(mouse, current))
                {
                    return(lesMenus.Find(bk => bk.gameState == item.returnState));
                }
            }
            return(current);
        }
Пример #6
0
 public static IMenu UpdateMenu(MouseHandler mouse, IMenu current, KeyboardHandler kB)
 {
     List<Buttons> currentMenuList = lesMenus[lesMenus.IndexOf(current)].buttonsList;
     if (kB.pressedKeysList.Contains(Keys.Escape))
     {
         current.EscapePressed();
         return lesMenus.Find(bk => bk.gameState == current.Escape);
     }
     foreach (var item in currentMenuList)
     {
         if (item.spacePos.Contains(mouse.position))
         {
             item.Transparency = 0.5f;
             if (mouse.LeftClickState == ClickState.Clicked)
             {
                 item.Clicked();
                 return lesMenus.Find(bk => bk.gameState == item.returnState);
             }
         }
         else
             item.Transparency = 1.0f;
     }
     return current;
 }
Пример #7
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()
 {
     // TODO: Add your initialization logic here
     base.Initialize();
     mouse = new MouseHandler();
     keyboard = new KeyboardHandler();
 }
Пример #8
0
 public void Update(MouseHandler mouse, KeyboardHandler kB)
 {
     foreach (var item in buttonList)
     {
         if ((item.spacePos.Contains(mouse.position) && mouse.LeftClickState == ClickState.Clicked) || kB.pressedKeysList.Contains(item.Hotkey))
         {
             item.Clicked();
             Game1.inGameState = item.returnState;
         }
         else if (mouse.LeftClickState == ClickState.Releasing || kB.releasedKeysList.Contains(item.Hotkey))
         {
             item.Released();
         }
     }
     SetUIText();
 }