Beispiel #1
0
 void checkForButtonClicks()
 {
     if ((!isInScene && !journal.GetInWindow()))
     {
         for (int i = 0; i < buttons.Count; i++)
         {
             if (MyGame.CheckMouseInRectClick(buttons[i]) && !MyGame.CheckMouseInRect(journal.GetJournalButton()))
             {
                 if (i < 3)
                 {
                     scenes[i].visible  = true;
                     scenes[i].isActive = true;
                     isInScene          = true;
                     if (_options.isSoundPlaying)
                     {
                         clicks.Play();
                     }
                     if (tutorial.GetCount() == 1 && i == 0)
                     {
                         tutorial.SetCount(2);
                     }
                 }
             }
         }
         home.alpha = 1f;
     }
 }
Beispiel #2
0
 void makeCategoryButtons()
 {
     for (int i = 0; i < categories.Count; i++)
     {
         Button button = categories[i];
         if (MyGame.CheckMouseInRect(button))
         {
             button.SetScaleXY(1.1f);
             if (Input.GetMouseButtonDown(0))
             {
                 button.SetScaleXY(1.1f);
                 foreach (Button catButton in buttonsToShow)
                 {
                     RemoveChild(catButton);
                 }
                 descriptionCanvas.graphics.Clear(Color.Transparent);
                 foreach (Sprite spr in spritesToShow)
                 {
                     spr.alpha = 0f;
                 }
                 category = i;
             }
         }
         else
         {
             button.SetScaleXY(1f);
         }
     }
 }
 //------------------------------------------------------------------------
 //                          checkIfItemIsOverlapped
 //------------------------------------------------------------------------
 public bool checkIfItemIsOverlapped()
 {
     foreach (Item item in listOfItemsInInventory)
     {
         if (MyGame.CheckMouseInRect(item))
         {
             return(true);
         }
     }
     return(false);
 }
Beispiel #4
0
 void mouseOverCheck()
 {
     foreach (Button button in buttonsToShow)
     {
         if (MyGame.CheckMouseInRect(button))
         {
             button.SetScaleXY(1.1f);
         }
         else
         {
             button.SetScaleXY(1f);
         }
     }
 }
Beispiel #5
0
 void Update()
 {
     canvas.graphics.Clear(Color.Transparent);
     canvas.graphics.DrawString(currencySystem.getMoney().ToString(), font, Brushes.Yellow, 0, 0);
     if ((!isInScene && !journal.inWindow))
     {
         for (int i = 0; i < buttons.Count; i++)
         {
             if (MyGame.CheckMouseInRectClick(buttons[i]) && !MyGame.CheckMouseInRect(journal.journalButton))
             {
                 if (i < 3)
                 {
                     scenes[i].visible  = true;
                     scenes[i].isActive = true;
                     isInScene          = true;
                     if (_options.isSoundPlaying)
                     {
                         clicks.Play();
                     }
                     if (tutorial.count == 1 && i == 0)
                     {
                         tutorial.count = 2;
                     }
                 }
             }
         }
         home.alpha = 1f;
     }
     if (isInScene)
     {
         home.alpha = 0f;
     }
     if (HasChild(tutorial))
     {
         inTutorial = true;
     }
     if (!HasChild(tutorial))
     {
         inTutorial = false;
     }
     if (MyGame.CheckMouseInRectClick(home) && home.alpha == 1f)
     {
         parent.RemoveChild(this);
         myGame.isPlaying = false;
     }
 }
    void Update()
    {
        canvas.SetXY(journal.x, journal.y);
        descriptionCanvas.SetXY(journal.x + 660, journal.y + 450);
        if (!inWindow)
        {
            if (MyGame.CheckMouseInRectClick(journalButton))
            {
                journal.alpha = 1f;
                close.alpha   = 1f;
                window.alpha  = 1f;
                inWindow      = true;
                if (level._options.isSoundPlaying)
                {
                    channel = open.Play();
                }
                foreach (Button button in categories)
                {
                    AddChild(button);
                }
            }
        }

        if (inWindow)
        {
            for (int i = 0; i < categories.Count; i++)
            {
                Button button = categories[i];
                if (MyGame.CheckMouseInRect(button))
                {
                    button.SetScaleXY(1.1f);
                    if (Input.GetMouseButtonDown(0))
                    {
                        button.SetScaleXY(1.1f);
                        foreach (Button catButton in buttonsToShow)
                        {
                            RemoveChild(catButton);
                        }
                        descriptionCanvas.graphics.Clear(Color.Transparent);
                        foreach (Sprite spr in spritesToShow)
                        {
                            spr.alpha = 0f;
                        }
                        category = i;
                    }
                }
                else
                {
                    button.SetScaleXY(1f);
                }
            }

            switch (category)
            {
            case 0:
                buttonsToShow = freshButtons;
                listToShow    = freshFish;
                spritesToShow = freshSprites;
                break;

            case 1:
                buttonsToShow = seaButtons;
                listToShow    = seaFish;
                spritesToShow = seaSprites;
                break;

            case 2:
                buttonsToShow = deepButtons;
                listToShow    = deepFish;
                spritesToShow = deepSprites;
                break;
            }

            foreach (Button button in buttonsToShow)
            {
                if (MyGame.CheckMouseInRect(button))
                {
                    button.SetScaleXY(1.1f);
                }
                else
                {
                    button.SetScaleXY(1f);
                }
            }

            for (int i = 0; i < listToShow.Count; i++)
            {
                Button button = buttonsToShow[i];
                button.SetXY(journal.x + 100, journal.y + 200 + 50 * i);
                AddChild(button);
                if (MyGame.CheckMouseInRectClick(button))
                {
                    descriptionCanvas.graphics.Clear(Color.Transparent);
                    descriptionCanvas.graphics.DrawString(listToShow[i].GetFishDescription(), textFont, Brushes.Black, 0, 0);
                    spritesToShow[i].alpha = 1f;
                    foreach (Sprite spr in spritesToShow)
                    {
                        if (spritesToShow.IndexOf(spr) != i)
                        {
                            spr.alpha = 0f;
                        }
                    }
                }
            }

            if (MyGame.CheckMouseInRectClick(close))
            {
                canvas.graphics.Clear(Color.Transparent);
                close.alpha   = 0f;
                journal.alpha = 0f;
                window.alpha  = 0f;
                inWindow      = false;
                descriptionCanvas.graphics.Clear(Color.Transparent);
                foreach (Sprite spr in fishSprites)
                {
                    spr.alpha = 0f;
                }
                foreach (Button button in categories)
                {
                    RemoveChild(button);
                }
                foreach (Button button in buttons)
                {
                    RemoveChild(button);
                }
            }
        }
    }