Exemplo n.º 1
0
        /// <summary>
        /// Handles the left click on the UI elements
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="playSound"></param>
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            // clicked next page
            if (NextPageButton.containsPoint(x, y))
            {
                if (Reminders.Count > (PageIndex + 1) * 5)
                {
                    PageIndex += 1;
                    SetUpUI();
                }
            }
            // clicked previous page
            else if (PrevPageButton.containsPoint(x, y))
            {
                if (PageIndex != 0)
                {
                    PageIndex -= 1;
                    SetUpUI();
                }
            }

            // clicked new reminder
            if (NewReminderButton.containsPoint(x, y))
            {
                Game1.activeClickableMenu = new NewReminder_Page1(Page1OnChangeBehaviour);
            }

            // clicked delete button
            int reminderindex = 0;

            foreach (ClickableTextureComponent deleteButton in DeleteButtons)
            {
                reminderindex++;
                if (deleteButton.containsPoint(x, y))
                {
                    int reminderIndex = (PageIndex * 5) + reminderindex;
                    Utilities.Files.DeleteReminder(reminderIndex);
                    SetUpUI();
                    break;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>The draw calls for the UI elements</summary>
        public override void draw(SpriteBatch b)
        {
            CursorPosition = Utilities.Data.Helper.Input.GetCursorPosition();

            // suppress the Menu button
            Utilities.Data.Helper.Input.Suppress(Utilities.Data.MenuButton);

            // draw screen fade
            b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.75f);

            // draw menu box
            Game1.drawDialogueBox(xPositionOnScreen, yPositionOnScreen, width, height - 12, false, true);

            // draw title scroll
            SpriteText.drawStringWithScrollCenteredAt(b, "Display Recurring Reminders", Game1.viewport.Width / 2, yPositionOnScreen, "Display Recurring Reminders");

            // draw boxes
            foreach (ClickableTextureComponent box in Boxes)
            {
                box.draw(b);
            }

            // draw labels
            foreach (ClickableComponent label in ReminderMessages)
            {
                string text  = "";
                Color  color = Game1.textColor;
                Utility.drawTextWithShadow(b, label.name, Game1.smallFont, new Vector2(label.bounds.X, label.bounds.Y), color);
                if (text.Length > 0)
                {
                    Utility.drawTextWithShadow(b, text, Game1.smallFont, new Vector2((label.bounds.X + Game1.tileSize / 3) - Game1.smallFont.MeasureString(text).X / 2f, (label.bounds.Y + Game1.tileSize / 2)), color);
                }
            }
            if (Reminders.Count > (PageIndex + 1) * 5)
            {
                NextPageButton.draw(b);
            }
            if (PageIndex != 0)
            {
                PrevPageButton.draw(b);
            }

            // draw the delete buttons
            foreach (ClickableTextureComponent button in DeleteButtons)
            {
                button.draw(b);
            }

            // draw the warning for no reminder
            if (Reminders.Count <= 0)
            {
                Utility.drawTextWithShadow(b, NoRemindersWarning.name, Game1.smallFont, new Vector2(NoRemindersWarning.bounds.X, NoRemindersWarning.bounds.Y), Game1.textColor);
            }

            // draw new reminders button
            NewReminderButton.draw(b);

            // draw the boxes hover text
            foreach (ClickableTextureComponent box in Boxes)
            {
                if (box.containsPoint((int)CursorPosition.ScreenPixels.X, (int)CursorPosition.ScreenPixels.Y))
                {
                    if (box.hoverText != null)
                    {
                        int x = Game1.getMouseX() + 32;
                        int y = Game1.getMouseY() + 32 + 16;
                        IClickableMenu.drawTextureBox(b, Game1.menuTexture, new Rectangle(0, 256, 60, 60), x, y - 16, Utilities.Extras.EstimateStringDimension(box.hoverText) + 8, Game1.tileSize + 16, Color.White, 1f, true);
                        SpriteText.drawString(b, box.hoverText, x + 32, y, 999, -1, 99, 1f, 0.88f, false, -1, "", 8, SpriteText.ScrollTextAlignment.Left);
                    }
                }
            }

            // draw cursor
            drawMouse(b);
        }
Exemplo n.º 3
0
        void ReleaseDesignerOutlets()
        {
            if (BackButton != null)
            {
                BackButton.Dispose();
                BackButton = null;
            }

            if (CurrentItemName != null)
            {
                CurrentItemName.Dispose();
                CurrentItemName = null;
            }

            if (DisplayButton != null)
            {
                DisplayButton.Dispose();
                DisplayButton = null;
            }

            if (ExitButton != null)
            {
                ExitButton.Dispose();
                ExitButton = null;
            }

            if (HiddenNameButton != null)
            {
                HiddenNameButton.Dispose();
                HiddenNameButton = null;
            }

            if (HomeButton != null)
            {
                HomeButton.Dispose();
                HomeButton = null;
            }

            if (NextButton != null)
            {
                NextButton.Dispose();
                NextButton = null;
            }

            if (NextPageButton != null)
            {
                NextPageButton.Dispose();
                NextPageButton = null;
            }

            if (PlayButton != null)
            {
                PlayButton.Dispose();
                PlayButton = null;
            }

            if (PrevButton != null)
            {
                PrevButton.Dispose();
                PrevButton = null;
            }

            if (PrevPageButton != null)
            {
                PrevPageButton.Dispose();
                PrevPageButton = null;
            }

            if (SelectButton != null)
            {
                SelectButton.Dispose();
                SelectButton = null;
            }

            if (ShutdownButton != null)
            {
                ShutdownButton.Dispose();
                ShutdownButton = null;
            }

            if (WheeImage != null)
            {
                WheeImage.Dispose();
                WheeImage = null;
            }
        }