Esempio n. 1
0
        public override void Update()
        {
            if (active)
            {
                if (Game1.priorityGui == this)
                {
                    GuiWidgetButtonString widgetButtonString = null;
                    GuiWidgetItemSlot     widgetInvSlot      = null;

                    for (int i = widgets.Count - 1; i >= 0; i--)
                    {
                        if (widgets[i].id.Item1 == WidgetType.ButtonString)
                        {
                            widgetButtonString = (GuiWidgetButtonString)widgets[i];
                            widgetButtonString.Update();
                        }

                        if (widgets[i].id.Item1 == WidgetType.ItemSlot)
                        {
                            widgetInvSlot = (GuiWidgetItemSlot)widgets[i];
                            widgetInvSlot.Update();
                        }

                        if (!widgets[i].active)
                        {
                            widgets.RemoveAt(i--);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        public GuiWidgetButtonString createButtonString(Rectangle position, Tuple <WidgetType, int> id, string text, GuiWidgetButtonString.Alignment align, Color color, SpriteFont font, Color[] colors)
        {
            GuiWidgetButtonString widget;

            widget = new GuiWidgetButtonString(position, id, text, align, color, font, colors);

            widgets.Add(widget);
            return(widget);
        }
Esempio n. 3
0
        public override void Update()
        {
            if (active)
            {
                if (firstOpen)
                {   //Create widgets and such
                    CreateWidgets();
                    firstOpen = false;
                }

                if (Game1.priorityGui == this)
                {
                    GuiWidgetButtonString widgetButtonString = null;

                    for (int i = widgets.Count - 1; i >= 0; i--)
                    {
                        if (widgets[i].id.Item1 == WidgetType.ButtonString)
                        {
                            widgetButtonString = (GuiWidgetButtonString)widgets[i];
                            widgetButtonString.Update();

                            if (widgets[i].id.Item2 == 0)
                            {
                                if (widgets[i].currentState == GuiWidget.State.Done)
                                {
                                    Close();
                                }
                            }
                            if (widgets[i].id.Item2 == 1)
                            {
                                if (widgets[i].currentState == GuiWidget.State.Done)
                                {
                                    reallyExit.Open();
                                }
                            }
                        }

                        if (!widgets[i].active)
                        {
                            widgets.RemoveAt(i--);
                        }
                    }
                }
                reallyExit.Update();
                if (reallyExit.clicked[0])
                {
                    game.Exit();
                }
            }
        }