Exemplo n.º 1
0
        void ShowCredits(ASCreditsState credits)
        {
            tabState = credits;

            scrollPanel.RemoveChildren();

            IEnumerable <string> lines;

            if (credits == ASCreditsState.Engine)
            {
                lines = engineLines;
            }
            else if (credits == ASCreditsState.AS)
            {
                lines = asEngineLines;
            }
            else
            {
                lines = modLines;
            }

            foreach (var line in lines)
            {
                var label = template.Clone() as LabelWidget;
                label.GetText = () => line;
                scrollPanel.AddChild(label);
            }
        }
Exemplo n.º 2
0
        void ShowList(string title, string message, IEnumerable <string> items)
        {
            visible         = Mode.List;
            titleLabel.Text = title;
            listLabel.Text  = message;

            listPanel.RemoveChildren();
            foreach (var i in items)
            {
                var item        = i;
                var labelWidget = (LabelWidget)listTemplate.Clone();
                labelWidget.GetText = () => item;
                listPanel.AddChild(labelWidget);
            }

            primaryButton.Bounds.Y   += listContainer.Bounds.Height - panel.Bounds.Height;
            secondaryButton.Bounds.Y += listContainer.Bounds.Height - panel.Bounds.Height;
            panel.Bounds.Y           -= (listContainer.Bounds.Height - panel.Bounds.Height) / 2;
            panel.Bounds.Height       = listContainer.Bounds.Height;
        }
Exemplo n.º 3
0
        Widget MakeLabelWidget(LabelWidget template, object item)
        {
            var itemString = item.ToString();
            var widget     = (LabelWidget)template.Clone();
            var font       = Game.Renderer.Fonts[widget.Font];

            itemString           = WidgetUtils.WrapText(itemString, widget.Bounds.Width, font);
            widget.Bounds.Height = font.Measure(itemString).Y;
            widget.GetText       = () => itemString;
            return(widget);
        }
Exemplo n.º 4
0
        void ShowCredits(bool modCredits)
        {
            isShowingModTab = modCredits;

            scrollPanel.RemoveChildren();
            foreach (var line in modCredits ? modLines : engineLines)
            {
                var label = template.Clone() as LabelWidget;
                label.GetText = () => line;
                scrollPanel.AddChild(label);
            }
        }
Exemplo n.º 5
0
        Widget MakeHistoryWidget(object o)
        {
            var message = (ChatMessage)o;
            var widget  = (LabelWidget)historyTemplate.Clone();
            var font    = Game.Renderer.Fonts[widget.Font];

            var color = message.Type == ChatMessageType.Notification ?
                        ChromeMetrics.Get <Color>("GlobalChatNotificationColor") :
                        ChromeMetrics.Get <Color>("GlobalChatTextColor");

            var display = WidgetUtils.WrapText(message.ToString(), widget.Bounds.Width, font);

            widget.Bounds.Height = font.Measure(display).Y;
            widget.GetText       = () => display;
            widget.GetColor      = () => color;
            widget.Id            = message.UID;
            return(widget);
        }