Example #1
0
        public RichLabelTest(ControlBase parent) : base(parent)
        {
            f1 = new Font(Skin.Renderer, "Arial", 15);

            f2      = new Font(Skin.Renderer, "Times New Roman", 20);
            f2.Bold = true;

            f3        = new Font(Skin.Renderer, "Courier New", 15);
            f3.Italic = true;

            f4           = new Font(Skin.Renderer, "Times New Roman", 20);
            f4.Bold      = true;
            f4.Underline = true;

            f5 = new Font(Skin.Renderer, "Courier New", 10);

            RichLabel label = CreateLabel(this);

            Button button = new Button(this);

            button.Dock     = Dock.Bottom;
            button.Width    = 150;
            button.Text     = "Open a Window";
            button.Clicked += OpenWindow;
        }
Example #2
0
        //Init
        public QuestsWindow(Canvas gameCanvas)
        {
            mQuestsWindow = new WindowControl(gameCanvas, Strings.QuestLog.title, false, "QuestsWindow");
            mQuestsWindow.DisableResizing();

            mQuestList = new ListBox(mQuestsWindow, "QuestList");
            mQuestList.EnableScroll(false, true);

            mQuestTitle = new Label(mQuestsWindow, "QuestTitle");
            mQuestTitle.SetText("");

            mQuestStatus = new Label(mQuestsWindow, "QuestStatus");
            mQuestStatus.SetText("");

            mQuestDescArea = new ScrollControl(mQuestsWindow, "QuestDescription");

            mQuestDescTemplateLabel = new Label(mQuestsWindow, "QuestDescriptionTemplate");

            mQuestDescLabel = new RichLabel(mQuestDescArea);

            mBackButton          = new Button(mQuestsWindow, "BackButton");
            mBackButton.Text     = Strings.QuestLog.back;
            mBackButton.Clicked += _backButton_Clicked;

            mQuitButton = new Button(mQuestsWindow, "AbandonQuestButton");
            mQuitButton.SetText(Strings.QuestLog.abandon);
            mQuitButton.Clicked += _quitButton_Clicked;

            mQuestsWindow.LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString());
        }
Example #3
0
        public NotificationTest(ControlBase parent) : base(parent)
        {
            Panel notificationpane = new Panel(parent);

            notificationpane.Width = 200;
            notificationpane.Dock  = Dock.Right;
            Button b = new Button(parent);

            b.Dock = Dock.Top;
            b.Text = "Show notify";
            RichLabel label = new RichLabel(parent)
            {
                Dock = Dock.Top
            };

            label.AddText("?", System.Drawing.Color.Black);
            b.Clicked += (o, e) =>
            {
                // Notification n = new Notification(notificationpane);
                // n.Text = ("I'm supposed to be multilined, and automatically word wrap.\nThis is on a new line");
                // n.Show(250);
                label.AddText("\nFuck you.", System.Drawing.Color.Red);
                // label.Text = "*error\nFuck you";
                // label.Layout();
            };
        }
        public QuestOfferWindow(Canvas gameCanvas)
        {
            mQuestOfferWindow = new WindowControl(gameCanvas, Strings.QuestOffer.title, false, "QuestOfferWindow");
            mQuestOfferWindow.DisableResizing();
            mQuestOfferWindow.IsClosable = false;

            //Menu Header
            mQuestTitle = new Label(mQuestOfferWindow, "QuestTitle");

            mQuestPromptArea = new ScrollControl(mQuestOfferWindow, "QuestOfferArea");

            mQuestPromptTemplate = new Label(mQuestPromptArea, "QuestOfferTemplate");

            mQuestPromptLabel = new RichLabel(mQuestPromptArea);

            //Accept Button
            mAcceptButton = new Button(mQuestOfferWindow, "AcceptButton");
            mAcceptButton.SetText(Strings.QuestOffer.accept);
            mAcceptButton.Clicked += _acceptButton_Clicked;

            //Decline Button
            mDeclineButton = new Button(mQuestOfferWindow, "DeclineButton");
            mDeclineButton.SetText(Strings.QuestOffer.decline);
            mDeclineButton.Clicked += _declineButton_Clicked;

            mQuestOfferWindow.LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString());
            Interface.InputBlockingElements.Add(mQuestOfferWindow);
        }
 public ExportWindow(GameCanvas parent, Editor editor, MainWindow window) : base(parent, editor)
 {
     _game             = window;
     Title             = "Export Video";
     _descriptionlabel = new RichLabel(this)
     {
         AutoSizeToContents = true
     };
     if (!SafeFrameBuffer.CanRecord)
     {
         _descriptionlabel.AddText(
             "Video export is not supported on this machine.\n\nSorry.",
             Skin.Colors.Text.Foreground);
     }
     else
     {
         _descriptionlabel.AddText(howto, Skin.Colors.Text.Foreground);
     }
     _descriptionlabel.Dock = Dock.Top;
     _error = new Label(this)
     {
         Dock      = Dock.Top,
         TextColor = Color.Red,
         IsHidden  = true,
         Margin    = new Margin(0, 0, 0, 10)
     };
     AutoSizeToContents = true;
     MinimumSize        = new Size(400, 300);
     MakeModal(true);
     Setup();
 }
Example #6
0
        internal static RichLabel TextBold(this RichLabel label, String text, SystemDrawing.Color color = default(SystemDrawing.Color))
        {
            color = color == SystemDrawing.Color.Empty ? SystemDrawing.Color.Black : color;
            if (Globals.Style.BoldFont == null)
            {
                Globals.Style.BoldFont = new Font(label.Skin.Renderer, Configs.RegularBoldFontName, 16);
            }
            var measure = label.Skin.Renderer.MeasureText(Globals.Style.BoldFont, text);
            int?width = null, height = null;

            if (measure.X > label.Width)
            {
                width = label.Width + measure.X;
            }
            if (measure.Y > label.Height)
            {
                height = label.Height + measure.Y;
            }
            if (width.HasValue || height.HasValue)
            {
                label.SetSize(width.HasValue ? width.Value : label.Width, height.HasValue ? height.Value : label.Height);
            }
            label.Text(text, color, Globals.Style.BoldFont);
            return(label);
        }
        //Init
        public EventWindow(Canvas gameCanvas)
        {
            //Event Dialog Window
            mEventDialogWindow = new ImagePanel(gameCanvas, "EventDialogueWindow");
            mEventDialogWindow.Hide();
            Interface.InputBlockingElements.Add(mEventDialogWindow);

            mEventFace = new ImagePanel(mEventDialogWindow, "EventFacePanel");

            mEventDialogArea          = new ScrollControl(mEventDialogWindow, "EventDialogArea");
            mEventDialogLabelTemplate = new Label(mEventDialogArea, "EventDialogLabel");
            mEventDialogLabel         = new RichLabel(mEventDialogArea);

            mEventDialogAreaNoFace          = new ScrollControl(mEventDialogWindow, "EventDialogAreaNoFace");
            mEventDialogLabelNoFaceTemplate = new Label(mEventDialogAreaNoFace, "EventDialogLabel");
            mEventDialogLabelNoFace         = new RichLabel(mEventDialogAreaNoFace);

            mEventResponse1          = new Button(mEventDialogWindow, "EventResponse1");
            mEventResponse1.Clicked += EventResponse1_Clicked;

            mEventResponse2          = new Button(mEventDialogWindow, "EventResponse2");
            mEventResponse2.Clicked += EventResponse2_Clicked;

            mEventResponse3          = new Button(mEventDialogWindow, "EventResponse3");
            mEventResponse3.Clicked += EventResponse3_Clicked;

            mEventResponse4          = new Button(mEventDialogWindow, "EventResponse4");
            mEventResponse4.Clicked += EventResponse4_Clicked;
        }
Example #8
0
        public static WindowControl Error(ControlBase parent, GLWindow game, string text, string title)
        {
            var wc = new WindowControl(parent, title, false);

            wc.MakeModal(true);
            wc.Width = 200;
            RichLabel l = new RichLabel(wc);

            //  Align.StretchHorizontally(l);
            l.Dock  = Pos.Top;
            l.Width = wc.Width;
            l.AddText(text, parent.Skin.Colors.Label.Default, parent.Skin.DefaultFont);
            wc.Layout();
            l.SizeToChildren(false, true);
            wc.Height = 65 + l.Height;
            Align.CenterHorizontally(l);
            Button btn = new Button(wc);

            btn.Name     = "Okay";
            btn.Text     = "Okay";
            btn.Height   = 20;
            btn.Y        = l.Y + l.Height + 10;
            btn.Width    = 100;
            btn.Clicked += (o, e) => { ((WindowControl)o.Parent).Close(); };
            Align.AlignLeft(l);
            wc.Show();
            wc.SetPosition((game.RenderSize.Width / 2) - (wc.Width / 2), (game.RenderSize.Height / 2) - (wc.Height / 2));
            wc.DisableResizing();
            return(wc);
        }
Example #9
0
        protected override void OnCreated()
        {
            m_Window    = View as Window;
            m_AboutText = GetControl <RichLabel>("AboutText");

            string  versionStr = String.Empty;
            Version version    = Assembly.GetExecutingAssembly().GetName().Version;

            if (version != null)
            {
                versionStr = String.Format("v{0}", version.ToString(2));
            }

            Document document = new Document();

            document.Paragraph(new Margin(15, 15, 15, 5)).Text("XML Designer for GWEN.Net Extended Layout ").Text(versionStr);
            document.Paragraph(new Margin(15, 5, 15, 10)).Text("Copyright © 2016 Kimmo Palosaari");
            document.Paragraph(new Margin(15, 35, 15, 5)).Text("GWEN.Net Extended Layout");
            document.Paragraph(new Margin(15, 5, 15, 10)).Text("Copyleft © 2016 Kimmo Palosaari");
            document.Paragraph(new Margin(15, 10, 15, 5)).Text("GWEN.Net");
            document.Paragraph(new Margin(15, 5, 15, 10)).Text("Copyleft © 2011 Omega Red");
            document.Paragraph(new Margin(15, 10, 15, 5)).Text("GWEN");
            document.Paragraph(new Margin(15, 5, 15, 10)).Text("Copyright © 2012 Garry Newman");
            document.Paragraph(new Margin(15, 10, 15, 5)).Text("MIT License");
            document.Paragraph(new Margin(15, 5, 15, 10)).Text("Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:");
            document.Paragraph(new Margin(15, 5, 15, 10)).Text("The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.");
            document.Paragraph(new Margin(15, 5, 15, 10)).Text("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.");

            m_AboutText.Document = document;
        }
Example #10
0
 internal static void ClearText(this RichLabel label)
 {
     if (label == null)
     {
         return;
     }
     label.DeleteAllChildren();
 }
        public ArrestReportDetails(Base parent) : base(parent)
        {
            //Top
            this.TopDock.Height = 75;
            Base instructionsContainer = new Base(this.TopDock);

            instructionsContainer.Dock = Pos.Fill;
            RichLabel instructions = new RichLabel(instructionsContainer);

            instructions.AddText("Please enter in the details for the arrest report below.", System.Drawing.Color.Black);
            instructions.AddLineBreak();
            instructions.AddText("Toggle the Party button. Double click a party in the right pane to quickly insert their name into the report", System.Drawing.Color.Black);
            instructions.SetSize(600, this.TopDock.Height);
            instructions.Position(Pos.Top, 25, 15);
            //this.TopDock.FitChildrenToSize();

            //Center/Fill

            reportDetailsTextBox               = new StateControlledMultilineTextbox(this);
            reportDetailsTextBox.Dock          = Pos.Fill;
            reportDetailsTextBox.TextChanged  += ReportDetailsTextChanged;
            reportDetailsTextBox.ForceWordWrap = false;

            //Bottom
            this.BottomDock.Height = 60;
            Base actionButtonContainer = new Base(this.BottomDock);

            actionButtonContainer.Dock = Pos.Fill;

            transferTextFromSimpleNotepad = new Button(actionButtonContainer);
            transferTextFromSimpleNotepad.SetToolTipText("Transfer from SimpleNotepad");
            transferTextFromSimpleNotepad.CopyContentIcon();
            transferTextFromSimpleNotepad.Position(Pos.Top, 25, 15);
            transferTextFromSimpleNotepad.Clicked += ActionButtonClicked;

            //Right
            this.RightDock.Width       = 200;
            lb_allParties              = new ListBox(this);
            lb_allParties.IsTabable    = true;
            lb_allParties.RowSelected += PartyListItemClicked;

            AllButton              = this.RightDock.TabControl.AddPage("All", lb_allParties);
            AllButton.UserData     = ArrestReportAdditionalParty.PartyTypes.UNKNOWN;
            WitnessButton          = this.RightDock.TabControl.AddPage("Witnesses", lb_allParties);
            WitnessButton.UserData = ArrestReportAdditionalParty.PartyTypes.WITNESS;
            VictimButton           = this.RightDock.TabControl.AddPage("Victims", lb_allParties);
            VictimButton.UserData  = ArrestReportAdditionalParty.PartyTypes.VICTIM;


            //var accomplices = this.RightDock.TabControl.AddPage("Accomplices", lb_allParties);
            //accomplices.UserData = ArrestReportAdditionalParty.PartyTypes.ACCOMPLICE;
            //all.Press(); //Must trigger before we add the rest of the pressed handlers
            AllButton.Pressed     += FilteredPartiesButtonPressed;
            WitnessButton.Pressed += FilteredPartiesButtonPressed;
            VictimButton.Pressed  += FilteredPartiesButtonPressed;
            //accomplices.Pressed += FilteredPartiesButtonPressed;
        }
Example #12
0
 internal static void Warn(this RichLabel label, String message)
 {
     if (label == null || String.IsNullOrEmpty(message))
     {
         return;
     }
     label.AddText(message, System.Drawing.Color.Yellow);
     label.AddLineBreak();
 }
Example #13
0
 internal static RichLabel Text(this RichLabel label, String text, SystemDrawing.Color color = default(SystemDrawing.Color))
 {
     color = color == SystemDrawing.Color.Empty ? SystemDrawing.Color.Black : color;
     if (Globals.Style.RegularFont == null)
     {
         Globals.Style.RegularFont = new Font(label.Skin.Renderer, Configs.FontName, 16);
     }
     label.Text(text, color, Globals.Style.RegularFont);
     return(label);
 }
Example #14
0
        private RichLabel CreateLabel(ControlBase parent)
        {
            RichLabel label = new RichLabel(parent);

            label.Dock         = Dock.Fill;
            label.LinkClicked += OnLinkClicked;

            Document document = new Document();

            document.Paragraph().
            Font(f1).
            Text("This test uses Arial 15, Red. Padding. ", Color.Red).
            Font(f2).
            Text("This text uses Times New Roman Bold 20, Green. Padding. ", Color.Green).
            Font(f3).
            Text("This text uses Courier New Italic 15, Blue. Padding. ", Color.Blue).
            Font().
            Text("Test link (").
            Link("Test Link 1", "Test Link 1", Color.Blue, new Color(0xFFADD8E6)).
            Text("). ").
            Font(f2).
            Text("Test link custom font (", new Color(0xFFFF00FF)).
            Link("Test Link 2", "Test Link 2", Color.Blue, new Color(0xFFADD8E6), f4).
            Text(").", new Color(0xFFFF00FF));

            document.Paragraph().
            Font(f5).
            Text("\n").
            Text("document.Paragraph().").LineBreak().LineBreak().
            Text("\tFont(f1).").LineBreak().
            Text("\t\tText(\"This test uses Arial 15, Red. Padding. \", Color.Red).").LineBreak().
            Text("\tFont(f2).").LineBreak().
            Text("\t\tText(\"This text uses Times New Roman Bold 20, Green. Padding. \", Color.Green).").LineBreak().
            Text("\tFont(f3).").LineBreak().
            Text("\t\tText(\"This text uses Courier New Italic 15, Blue. Padding. \", Color.Blue).\n\n").
            Text("\tFont().\n").
            Text("\t\tText(\"Test link (\").\n").
            Text("\t\tLink(\"Test Link 1\", \"Test Link 1\", Color.Blue, new Color(0xFFADD8E6)).\n").
            Text("\t\tText(\"). \").\n\n\n").
            Text("\tFont(f2).\n").
            Text("\t\tText(\"Test link custom font (\", new Color(0xFFFF00FF)).\n").
            Text("\t\tLink(\"Test Link 2\", \"Test Link 2\", Color.Blue, new Color(0xFFADD8E6), f4).\n").
            Text("\t\tText(\").\", new Color(0xFFFF00FF));");

            document.Image("gwen.png", new Size(100, 100));

            label.Document = document;

            return(label);
        }
Example #15
0
        //Init
        public ForgotPasswordWindow(Canvas parent, MainMenu mainMenu, ImagePanel parentPanel)
        {
            //Assign References
            mMainMenu = mainMenu;

            //Main Menu Window
            mResetWindow          = new ImagePanel(parent, "ForgotPasswordWindow");
            mResetWindow.IsHidden = true;

            //Menu Header
            mWindowHeader = new Label(mResetWindow, "Header");
            mWindowHeader.SetText(Strings.ForgotPass.title);

            mInputBackground = new ImagePanel(mResetWindow, "InputPanel");

            //Login Username Label
            mInputLabel = new Label(mInputBackground, "InputLabel");
            mInputLabel.SetText(Strings.ForgotPass.label);

            //Login Username Textbox
            mInputTextbox = new TextBox(mInputBackground, "InputField");
            mInputTextbox.SubmitPressed += Textbox_SubmitPressed;
            mInputTextbox.Clicked       += Textbox_Clicked;

            mHintLabelTemplate          = new Label(mResetWindow, "HintLabel");
            mHintLabelTemplate.IsHidden = true;

            //Login - Send Login Button
            mSubmitBtn = new Button(mResetWindow, "SubmitButton");
            mSubmitBtn.SetText(Strings.ForgotPass.submit);
            mSubmitBtn.Clicked += SubmitBtn_Clicked;

            //Login - Back Button
            mBackBtn = new Button(mResetWindow, "BackButton");
            mBackBtn.SetText(Strings.ForgotPass.back);
            mBackBtn.Clicked += BackBtn_Clicked;

            mResetWindow.LoadJsonUi(GameContentManager.UI.Menu, Graphics.Renderer.GetResolutionString());

            mHintLabel = new RichLabel(mResetWindow);
            mHintLabel.SetBounds(mHintLabelTemplate.Bounds);
            mHintLabelTemplate.IsHidden = false;
            mHintLabel.AddText(
                Strings.ForgotPass.hint, mHintLabelTemplate.TextColor,
                mHintLabelTemplate.CurAlignments.Count > 0 ? mHintLabelTemplate.CurAlignments[0] : Alignments.Left,
                mHintLabelTemplate.Font
                );
        }
Example #16
0
        public RichLabeledComponent(Base parent, String label, T component, Font labelFont, SystemDrawing.Color labelColor, RelationalPosition labelPosition = RelationalPosition.LEFT, RelationalSize labelScale = RelationalSize.NONE, int?Spacing = null) : base(parent)
        {
            if (component == null)
            {
                throw new ArgumentNullException("LabelComponent cannot recieve a null component");
            }
            mLabelText        = label;
            Component         = component;
            mLabelFontScaling = labelScale;
            mLabelPosition    = labelPosition;
            mSpaceBetweenLabelAndComponent = Spacing;

            mLabel          = new RichLabel(this);
            LabelFont       = labelFont;
            LabelColor      = labelColor;
            mLayoutRequired = true;
        }
Example #17
0
        internal static void Errors(this RichLabel label, List <String> messages, bool newLines = true)
        {
            if (label == null)
            {
                return;
            }
            StringBuilder sb = new StringBuilder();

            foreach (var message in messages)
            {
                if (!String.IsNullOrEmpty(message))
                {
                    var formatted = newLines ? String.Format("{0}{1}", message, Environment.NewLine) : message;
                    sb.Append(formatted);
                }
            }
            label.AddText(sb.ToString(), label.Skin.Colors.Label.Default);
        }
Example #18
0
        public static WindowControl Create(ControlBase parent, GLWindow game, string text, string title, bool ok, bool cancel)
        {
            var wc = new WindowControl(parent, title, false);

            wc.MakeModal(true);
            wc.Width = 200;
            RichLabel l = new RichLabel(wc);

            //  Align.StretchHorizontally(l);
            l.Dock  = Pos.Top;
            l.Width = wc.Width;
            l.AddText(text, parent.Skin.Colors.Label.Default, parent.Skin.DefaultFont);
            wc.Layout();
            l.SizeToChildren(false, true);
            wc.Height = 65 + l.Height;
            Align.CenterHorizontally(l);
            if (ok)
            {
                Button btn = new Button(wc);
                btn.Name   = "Okay";
                btn.Text   = "Okay";
                btn.Height = 20;
                btn.Y      = l.Y + l.Height + 10;
                btn.Width  = 100;
                Align.AlignLeft(l);
            }
            if (cancel)
            {
                Button btn = new Button(wc);
                btn.Name = "Cancel";
                btn.Text = "Cancel";
                btn.SizeToContents();
                btn.Height = 20;
                btn.Width  = 70;
                btn.Y      = l.Y + l.Height + 10;
                btn.X      = (wc.Width - 12) - btn.Width;
            }
            wc.Show();
            wc.SetPosition((game.RenderSize.Width / 2) - (wc.Width / 2), (game.RenderSize.Height / 2) - (wc.Height / 2));
            wc.DisableResizing();
            return(wc);
        }
Example #19
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            RichLabel label = new RichLabel(this);

            label.SetBounds(10, 10, 400, 200);

            f1 = new Font("Arial", 15);
            label.AddText("This test uses Arial 15, White. Padding. ", Color.White, f1);

            f2 = new Font("Times New Roman Bold", 20);
            label.AddText("This text uses Times New Roman Bold 20, Pink. Padding. ", Color.Pink, f2);

            f3 = new Font("Courier New Italic", 15);
            label.AddText("This text uses Courier New Italic 15, Yellow. Padding. ", Color.Yellow, f3);

            label.AddLineBreak();

            label.AddText("This test uses Arial 15, Cyan. Padding. ", Color.Cyan * 1.2, f1);
        }
Example #20
0
        private void OpenWindow(ControlBase control, EventArgs args)
        {
            Window window = new Window(GetCanvas());

            window.Padding       = Padding.Three;
            window.Title         = String.Format("RichLabel Window");
            window.DeleteOnClose = true;
            window.Size          = new Size(500, 300);
            window.Left          = 200; window.Top = 100;

            ScrollControl scroll = new ScrollControl(window);

            scroll.Dock = Dock.Fill;
            scroll.EnableScroll(false, true);
            scroll.AutoHideBars = false;

            RichLabel label = new RichLabel(scroll);

            label.Dock     = Dock.Fill;
            label.Document = LongDocument();
        }
        //Init
        public CreditsWindow(Canvas parent, MainMenu mainMenu)
        {
            //Assign References
            mMainMenu = mainMenu;

            //Main Menu Window
            mCreditsWindow = new ImagePanel(parent, "CreditsWindow");

            //Menu Header
            mCreditsHeader = new Label(mCreditsWindow, "CreditsHeader");
            mCreditsHeader.SetText(Strings.Credits.title);

            mCreditsContent = new ScrollControl(mCreditsWindow, "CreditsScrollview");
            mCreditsContent.EnableScroll(false, true);

            mRichLabel = new RichLabel(mCreditsContent, "CreditsLabel");

            //Back Button
            mBackBtn = new Button(mCreditsWindow, "BackButton");
            mBackBtn.SetText(Strings.Credits.back);
            mBackBtn.Clicked += BackBtn_Clicked;

            mCreditsWindow.LoadJsonUi(GameContentManager.UI.Menu, Graphics.Renderer.GetResolutionString());
        }
Example #22
0
        public SpellDescWindow(Guid spellId, int x, int y, bool centerHorizontally = false)
        {
            var spell = SpellBase.Get(spellId);

            if (spell == null)
            {
                return;
            }

            mDescWindow = new ImagePanel(Interface.GameUi.GameCanvas, "SpellDescWindowExpanded");

            var icon = new ImagePanel(mDescWindow, "SpellIcon");

            var spellName = new Label(mDescWindow, "SpellName");

            spellName.Text = spell.Name;

            var spellType = new Label(mDescWindow, "SpellType");

            spellType.Text = Strings.SpellDesc.spelltypes[(int)spell.SpellType];

            var spellDesc     = new RichLabel(mDescWindow, "SpellDesc");
            var spellStats    = new RichLabel(mDescWindow, "SpellStats");
            var spellDescText = new Label(mDescWindow, "SpellDescText");

            spellDescText.Font = spellDescText.Parent.Skin.DefaultFont;
            var spellStatsText = new Label(mDescWindow, "SpellStatsText");

            spellStatsText.Font     = spellStatsText.Parent.Skin.DefaultFont;
            spellDescText.IsHidden  = true;
            spellStatsText.IsHidden = true;

            //Load this up now so we know what color to make the text when filling out the desc
            mDescWindow.LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString());
            if (spell.Description.Length > 0)
            {
                spellDesc.AddText(
                    Strings.SpellDesc.desc.ToString(spell.Description), spellDesc.RenderColor,
                    spellDescText.CurAlignments.Count > 0 ? spellDescText.CurAlignments[0] : Alignments.Left,
                    spellDescText.Font
                    );

                spellDesc.AddLineBreak();
                spellDesc.AddLineBreak();
            }

            if (spell.SpellType == (int)SpellTypes.CombatSpell)
            {
                if (spell.Combat.TargetType == SpellTargetTypes.Projectile)
                {
                    var proj = ProjectileBase.Get(spell.Combat.ProjectileId);
                    spellType.Text = Strings.SpellDesc.targettypes[(int)spell.Combat.TargetType]
                                     .ToString(proj?.Range ?? 0, spell.Combat.HitRadius);
                }
                else
                {
                    spellType.Text = Strings.SpellDesc.targettypes[(int)spell.Combat.TargetType]
                                     .ToString(spell.Combat.CastRange, spell.Combat.HitRadius);
                }
            }

            if (spell.SpellType == (int)SpellTypes.CombatSpell &&
                (spell.Combat.TargetType == SpellTargetTypes.AoE ||
                 spell.Combat.TargetType == SpellTargetTypes.Single) &&
                spell.Combat.HitRadius > 0)
            {
                spellStats.AddText(
                    Strings.SpellDesc.radius.ToString(spell.Combat.HitRadius), spellStats.RenderColor,
                    spellStatsText.CurAlignments.Count > 0 ? spellStatsText.CurAlignments[0] : Alignments.Left,
                    spellStatsText.Font
                    );

                spellStats.AddLineBreak();
                spellStats.AddLineBreak();
            }

            if (spell.CastDuration > 0)
            {
                var castDuration = (float)spell.CastDuration / 1000f;
                spellStats.AddText(
                    Strings.SpellDesc.casttime.ToString(castDuration), spellStats.RenderColor,
                    spellStatsText.CurAlignments.Count > 0 ? spellStatsText.CurAlignments[0] : Alignments.Left,
                    spellStatsText.Font
                    );

                spellStats.AddLineBreak();
                if (spell.CooldownDuration <= 0)
                {
                    spellStats.AddLineBreak();
                }
            }

            if (spell.CooldownDuration > 0)
            {
                var cdr = 1 - Globals.Me.GetCooldownReduction() / 100;
                var cd  = (float)(spell.CooldownDuration * cdr) / 1000f;
                spellStats.AddText(
                    Strings.SpellDesc.cooldowntime.ToString(cd), spellStats.RenderColor,
                    spellStatsText.CurAlignments.Count > 0 ? spellStatsText.CurAlignments[0] : Alignments.Left,
                    spellStatsText.Font
                    );

                spellStats.AddLineBreak();
                spellStats.AddLineBreak();
            }

            var requirements = spell.VitalCost[(int)Vitals.Health] > 0 || spell.VitalCost[(int)Vitals.Mana] > 0;

            if (requirements == true)
            {
                spellStats.AddText(
                    Strings.SpellDesc.prereqs, spellStats.RenderColor,
                    spellStatsText.CurAlignments.Count > 0 ? spellStatsText.CurAlignments[0] : Alignments.Left,
                    spellStatsText.Font
                    );

                spellStats.AddLineBreak();
                if (spell.VitalCost[(int)Vitals.Health] > 0)
                {
                    spellStats.AddText(
                        Strings.SpellDesc.vitalcosts[(int)Vitals.Health]
                        .ToString(spell.VitalCost[(int)Vitals.Health]), spellStats.RenderColor,
                        spellStatsText.CurAlignments.Count > 0 ? spellStatsText.CurAlignments[0] : Alignments.Left,
                        spellStatsText.Font
                        );

                    spellStats.AddLineBreak();
                }

                if (spell.VitalCost[(int)Vitals.Mana] > 0)
                {
                    spellStats.AddText(
                        Strings.SpellDesc.vitalcosts[(int)Vitals.Mana].ToString(spell.VitalCost[(int)Vitals.Mana]),
                        spellStats.RenderColor,
                        spellStatsText.CurAlignments.Count > 0 ? spellStatsText.CurAlignments[0] : Alignments.Left,
                        spellStatsText.Font
                        );

                    spellStats.AddLineBreak();
                }

                spellStats.AddLineBreak();
            }

            var stats = "";

            if (spell.SpellType == (int)SpellTypes.CombatSpell)
            {
                stats = Strings.SpellDesc.effects;
                spellStats.AddText(
                    stats, spellStats.RenderColor,
                    spellStatsText.CurAlignments.Count > 0 ? spellStatsText.CurAlignments[0] : Alignments.Left,
                    spellStatsText.Font
                    );

                spellStats.AddLineBreak();

                if (spell.Combat.Effect > 0)
                {
                    spellStats.AddText(
                        Strings.SpellDesc.effectlist[(int)spell.Combat.Effect], spellStats.RenderColor,
                        spellStatsText.CurAlignments.Count > 0 ? spellStatsText.CurAlignments[0] : Alignments.Left,
                        spellStatsText.Font
                        );

                    spellStats.AddLineBreak();
                }

                for (var i = 0; i < (int)Vitals.VitalCount; i++)
                {
                    var vitalDiff = spell.Combat.VitalDiff?[i] ?? 0;
                    if (vitalDiff == 0)
                    {
                        continue;
                    }

                    var vitalSymbol = vitalDiff < 0 ? Strings.SpellDesc.addsymbol : Strings.SpellDesc.removesymbol;
                    if (spell.Combat.Effect == StatusTypes.Shield)
                    {
                        stats = Strings.SpellDesc.shield.ToString(Math.Abs(vitalDiff));
                    }
                    else
                    {
                        stats = Strings.SpellDesc.vitals[i].ToString(vitalSymbol, Math.Abs(vitalDiff));
                    }

                    spellStats.AddText(
                        stats, spellStats.RenderColor,
                        spellStatsText.CurAlignments.Count > 0 ? spellStatsText.CurAlignments[0] : Alignments.Left,
                        spellStatsText.Font
                        );

                    spellStats.AddLineBreak();
                }

                if (spell.Combat.Duration > 0)
                {
                    for (var i = 0; i < (int)Stats.StatCount; i++)
                    {
                        if (spell.Combat.StatDiff[i] != 0)
                        {
                            spellStats.AddText(
                                Strings.SpellDesc.stats[i]
                                .ToString(
                                    (spell.Combat.StatDiff[i] > 0
                                            ? Strings.SpellDesc.addsymbol.ToString()
                                            : Strings.SpellDesc.removesymbol.ToString()) +
                                    Math.Abs(spell.Combat.StatDiff[i])
                                    ), spellStats.RenderColor,
                                spellStatsText.CurAlignments.Count > 0
                                    ? spellStatsText.CurAlignments[0]
                                    : Alignments.Left, spellStatsText.Font
                                );

                            spellStats.AddLineBreak();
                        }
                    }

                    var duration = (float)spell.Combat.Duration / 1000f;
                    spellStats.AddText(
                        Strings.SpellDesc.duration.ToString(duration), spellStats.RenderColor,
                        spellStatsText.CurAlignments.Count > 0 ? spellStatsText.CurAlignments[0] : Alignments.Left,
                        spellStatsText.Font
                        );

                    spellStats.AddLineBreak();
                }
            }

            spellStats.SizeToChildren(false, true);
            if (spellStats.Children.Count == 0)
            {
                mDescWindow.Name    = "SpellDescWindow";
                spellStats.Name     = "";
                spellStatsText.Name = "";
            }

            //Load Again for positioning purposes.
            mDescWindow.LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString());
            spellDescText.IsHidden  = true;
            spellStatsText.IsHidden = true;
            icon.Texture            = Globals.ContentManager.GetTexture(GameContentManager.TextureType.Spell, spell.Icon);
            spellStats.SizeToChildren(false, true);
            if (centerHorizontally)
            {
                mDescWindow.MoveTo(x - mDescWindow.Width / 2, y + mDescWindow.Padding.Top);
            }
            else
            {
                mDescWindow.MoveTo(x - mDescWindow.Width - mDescWindow.Padding.Right, y + mDescWindow.Padding.Top);
            }
        }
Example #23
0
        public String Note; // additional text to display in status bar

        public UnitTest(ZGE.Components.ZComponent parent) : base(parent)
        {
            Dock = Pos.Fill;
            SetSize(1024, 768);
            m_List = new Control.CollapsibleList(this);

            LeftDock.TabControl.AddPage("Unit tests", m_List);
            LeftDock.Width = 150;

            m_TextOutput = new Control.ListBox(BottomDock);
            m_Button = BottomDock.TabControl.AddPage("Output", m_TextOutput);
            BottomDock.Height = 200;

            m_DebugCheck = new Control.LabeledCheckBox(m_List);
            m_DebugCheck.Text = "Debug outlines";
            m_DebugCheck.CheckChanged += DebugCheckChanged;

            m_StatusBar = new Control.StatusBar(this);
            m_StatusBar.Dock = Pos.Bottom;
            m_StatusBar.AddControl(m_DebugCheck, true);

            //m_Center = new Center(this);
            //m_Center.Dock = Pos.Fill;
            GUnit test;

            {
                CollapsibleCategory cat = m_List.Add("Non-Interactive");
                {
                    test = new Label(this);
                    RegisterUnitTest("Label", cat, test);
                    test = new RichLabel(this);
                    RegisterUnitTest("RichLabel", cat, test);
                    test = new GroupBox(this);
                    RegisterUnitTest("GroupBox", cat, test);
                    test = new ProgressBar(this);
                    RegisterUnitTest("ProgressBar", cat, test);
                    test = new ImagePanel(this);
                    RegisterUnitTest("ImagePanel", cat, test);
                    test = new StatusBar(this);
                    RegisterUnitTest("StatusBar", cat, test);
                }
            }

            {
                CollapsibleCategory cat = m_List.Add("Standard");
                {
                    test = new Button(this);
                    RegisterUnitTest("Button", cat, test);
                    test = new TextBox(this);
                    RegisterUnitTest("TextBox", cat, test);
                    test = new CheckBox(this);
                    RegisterUnitTest("CheckBox", cat, test);
                    test = new RadioButton(this);
                    RegisterUnitTest("RadioButton", cat, test);
                    test = new ComboBox(this);
                    RegisterUnitTest("ComboBox", cat, test);
                    test = new ListBox(this);
                    RegisterUnitTest("ListBox", cat, test);
                    test = new NumericUpDown(this);
                    RegisterUnitTest("NumericUpDown", cat, test);
                    test = new Slider(this);
                    RegisterUnitTest("Slider", cat, test);
                    test = new MenuStrip(this);
                    RegisterUnitTest("MenuStrip", cat, test);
                    test = new CrossSplitter(this);
                    RegisterUnitTest("CrossSplitter", cat, test);
                }
            }
            
            {
                CollapsibleCategory cat = m_List.Add("Containers");
                {
                    test = new Window(this);
                    RegisterUnitTest("Window", cat, test);
                    test = new TreeControl(this);
                    RegisterUnitTest("TreeControl", cat, test);
                    test = new Properties(this);
                    RegisterUnitTest("Properties", cat, test);
                    test = new TabControl(this);
                    RegisterUnitTest("TabControl", cat, test);
                    test = new ScrollControl(this);
                    RegisterUnitTest("ScrollControl", cat, test);
                    test = new Docking(this);
                    RegisterUnitTest("Docking", cat, test);
                }
            }
            
            {
                CollapsibleCategory cat = m_List.Add("Non-standard");
                {
                    test = new CollapsibleList(this);
                    RegisterUnitTest("CollapsibleList", cat, test);
                    test = new ColorPickers(this);
                    RegisterUnitTest("Color pickers", cat, test);
                }
            }

            m_StatusBar.SendToBack();
            PrintText("Unit Test started!");
        }
Example #24
0
        public SaveWindow(GameCanvas parent, Editor editor) : base(parent, editor)
        {
            Title = "Save Track As...";
            RichLabel l = new RichLabel(this);

            l.Dock = Dock.Top;
            l.AutoSizeToContents = true;
            l.AddText("Files are saved to Documents/LRA/Tracks", Skin.Colors.Text.Foreground);
            _errorbox = new Label(this)
            {
                Dock      = Dock.Top,
                TextColor = Color.Red,
                Text      = "",
                Margin    = new Margin(0, 0, 0, 5)
            };
            ControlBase bottomcontainer = new ControlBase(this)
            {
                Margin             = new Margin(0, 0, 0, 0),
                Dock               = Dock.Bottom,
                AutoSizeToContents = true
            };

            _savelist = new ComboBox(bottomcontainer)
            {
                Dock   = Dock.Top,
                Margin = new Margin(0, 0, 0, 5)
            };
            _namebox = new TextBox(bottomcontainer)
            {
                Dock = Dock.Fill,
            };
            _savebutton = new DropDownButton(bottomcontainer)
            {
                Dock     = Dock.Right,
                Text     = "Save (" + Settings.DefaultSaveFormat + ")",
                UserData = Settings.DefaultSaveFormat,
                Margin   = new Margin(2, 0, 0, 0),
            };
            _savebutton.DropDownClicked += (o, e) =>
            {
                Menu pop = new Menu(_canvas);
                pop.AddItem(".trk (recommended)").Clicked += (o2, e2) =>
                {
                    _savebutton.Text     = "Save (.trk)";
                    _savebutton.UserData = ".trk";
                };
                pop.AddItem(".track.json (for .com / regular LRA / other LRA mod support)").Clicked += (o2, e2) =>
                {
                    _savebutton.Text     = "Save (.json)";
                    _savebutton.UserData = ".json";
                };
                pop.AddItem(".sol (outdated)").Clicked += (o2, e2) =>
                {
                    _savebutton.Text     = "Save (.sol)";
                    _savebutton.UserData = ".sol";
                };
                pop.Open(Pos.Center);
            };
            _savebutton.Clicked += (o, e) =>
            {
                Save();
            };
            Padding            = new Padding(0, 0, 0, 0);
            AutoSizeToContents = true;
            MakeModal(true);
            Setup();
            MinimumSize = new Size(250, MinimumSize.Height);
        }
Example #25
0
        public override void InitializeLayout()
        {
            base.InitializeLayout();
            this.Window.IsClosable = false;
            this.Position          = this.GetLaunchPosition();
            try
            {
                DialogLabel             = new RichLabel(this);
                PositiveButton          = new Button(this);
                NegativeButton          = new Button(this);
                PositiveButton.Clicked += ActionButtonClicked;
                NegativeButton.Clicked += ActionButtonClicked;

                if (!String.IsNullOrEmpty(PositiveButtonText))
                {
                    PositiveButton.Text = PositiveButtonText;
                }
                else
                {
                    PositiveButton.Hide();
                    PositiveButton.Disable();
                }

                if (!String.IsNullOrEmpty(NegativeButtonText))
                {
                    NegativeButton.Text = NegativeButtonText;
                }
                else
                {
                    NegativeButton.Hide();
                    NegativeButton.Disable();
                }

                if (!String.IsNullOrEmpty(DialogMessage))
                {
                    var font = DialogLabel.Skin.DefaultFont.Copy();
                    font.Size = 16;
                    DialogLabel.AddText(DialogMessage, System.Drawing.Color.Black, font);
                    DialogLabel.Margin = new Gwen.Margin(20, 75, 20, 75);
                }


                DialogLabel.Dock = Gwen.Pos.Fill;
                if (NegativeButton.IsVisible && PositiveButton.IsVisible)
                {
                    NegativeButton.SetPosition(((this.Window.Width / 2 - NegativeButton.Width / 2) - NegativeButton.Width - 10f), (this.Window.Height - NegativeButton.Height / 2) - 50f);
                    PositiveButton.SetPosition(((this.Window.Width / 2 - PositiveButton.Width / 2) + PositiveButton.Width + 10f), (this.Window.Height - PositiveButton.Height / 2) - 50f);
                }
                else if (NegativeButton.IsVisible)
                {
                    NegativeButton.SetPosition(((this.Window.Width / 2 - NegativeButton.Width / 2)), (this.Window.Height - NegativeButton.Height / 2) - 50f);
                }
                else
                {
                    PositiveButton.SetPosition(((this.Window.Width / 2 - PositiveButton.Width / 2)), (this.Window.Height - PositiveButton.Height / 2) - 50f);
                }
            }
            catch (Exception e)
            {
                Function.Log(e.ToString());
            }
        }
        public ChangelogWindow(GameCanvas parent, Editor editor) : base(parent, editor)
        {
            Title = "Changelog for " + Program.Version;
            AutoSizeToContents = false;
            SetSize(1100, 380);

            var changelogText = "" +
                                "6/15/20 - Build 1\n" +
                                "* Crashes due to invalid settings files are now resolved (again because I did it wrong last update).\n" +
                                "* Default save format settings are now available for crash backups `Settings -> Other`.\n" +
                                "* Crash Backups now save in the format `## Crash Backup month.day.year_hours.minutes.filetype`.\n" +
                                "* Fixed a issue where autosaves and quicksaves were saved as `## XXXXsave_day.month.year_hours.minutes.filetype`, not `## XXXXsave_month.day.year_hours.minutes.filetype`.\n" +
                                "* Updated the changelog to use it's own window.\n" +
                                "* Fixed a bug where recordings end 1 frame too early (added a extra frame to every new recording).\n" +
                                "* Fixed editing Color Triggers, they now show the correct color after editing.\n*" +
                                " You can now drag and drop / open with `.trk`, `.json` and `.sol` files with `linerider.exe` to automatically open them!\n" +
                                "* Added a hotkeys to Draw the Debug Grid and Debug Camera (`,` and `.`).\n" +
                                "* Custom X and Y Gravity, custom Gravity Well sizes and starting colors are now editable in `Track Properties`.\n" +
                                "--* This modifies the save format so **the `.trk` files LRT saves will not be compatible with LRA or other LRA mods past this update if you use the new features**.\n" +
                                "--* **However `.json` files saved in LRT will continue to work in LRA or LRA mods regardless** even with the extra features added to the file.\n" +
                                "--* Also custom Gravity Well sizes will modify the box Bosh uses to check for collisions, use the Debug Grid to see this change. \n" +
                                "----* The grid is not accurate on the first frame, this is a bug.\n" +
                                "\n" +
                                "================================================================================================================================\n" +
                                "\n" +
                                "6/16/20 - Build 1\n" +
                                "* Fixed a issue where the Gravity Well size was not being set when loading a new track.\n" +
                                "\n" +
                                "NOTE: Discord is *still* auto disabled on startup for now until I reimplement it in a more stable way.";

            ControlBase bottomcontainer = new ControlBase(this)
            {
                Margin             = new Margin(0, 0, 0, 0),
                Dock               = Dock.Bottom,
                AutoSizeToContents = true
            };

            Button btncontinue = new Button(null)
            {
                Text               = "Continue",
                Name               = "btncontinue",
                Dock               = Dock.Right,
                Margin             = new Margin(10, 0, 0, 0),
                AutoSizeToContents = true,
            };

            btncontinue.Clicked += (o, e) =>
            {
                Close();
            };

            Button btndontshow = new Button(null)
            {
                Text               = "Continue and don\'t show again",
                Name               = "btndontshow",
                Dock               = Dock.Right,
                Margin             = new Margin(10, 0, 0, 0),
                AutoSizeToContents = true,
            };

            btndontshow.Clicked += (o, e) =>
            {
                Settings.showChangelog = false;
                Settings.Save();
                Close();
            };

            Button btngithub = new Button(null)
            {
                Text               = "Previous Changelogs (Github)",
                Name               = "btngithub",
                Dock               = Dock.Right,
                Margin             = new Margin(10, 0, 0, 0),
                AutoSizeToContents = true,
            };

            btngithub.Clicked += (o, e) =>
            {
                try
                {
                    GameCanvas.OpenUrl(@"https://github.com/RatherBeLunar/LRA-Community-Edition/tree/master/Changelogs");
                }
                catch
                {
                    MessageBox.Show(parent, "Unable to open your browser.", "Error!");
                }
                Close();
            };

            ControlBase buttoncontainer = new ControlBase(bottomcontainer)
            {
                Margin             = new Margin(0, 0, 0, 0),
                Dock               = Dock.Bottom,
                AutoSizeToContents = true,
                Children           =
                {
                    btncontinue,
                    btndontshow,
                    btngithub,
                }
            };

            RichLabel l = new RichLabel(this);

            l.Dock = Dock.Top;
            l.AutoSizeToContents = true;
            l.AddText(changelogText, Skin.Colors.Text.Foreground);
            MakeModal(true);
            DisableResizing();
        }
Example #27
0
 internal static RichLabel Text(this RichLabel label, String text, SystemDrawing.Color color = default(SystemDrawing.Color), Font textFont = default(Font))
 {
     color = color == SystemDrawing.Color.Empty ? SystemDrawing.Color.Black : color;
     label.AddText(text, color, textFont);
     return(label);
 }
Example #28
0
        //Init
        public EntityBox(Canvas gameCanvas, EntityTypes entityType, Entity myEntity, bool playerBox = false)
        {
            MyEntity     = myEntity;
            EntityType   = entityType;
            PlayerBox    = playerBox;
            EntityWindow =
                playerBox ? new ImagePanel(gameCanvas, "PlayerBox") : new ImagePanel(gameCanvas, "TargetBox");

            EntityWindow.ShouldCacheToTexture = true;

            EntityInfoPanel = new ImagePanel(EntityWindow, "EntityInfoPanel");

            EntityName = new Framework.Gwen.Control.Label(EntityInfoPanel, "EntityNameLabel")
            {
                Text = myEntity?.Name
            };
            EntityLevel        = new Framework.Gwen.Control.Label(EntityInfoPanel, "EntityLevelLabel");
            EntityNameAndLevel = new Framework.Gwen.Control.Label(EntityInfoPanel, "NameAndLevelLabel")
            {
                IsHidden = true
            };

            EntityMap = new Framework.Gwen.Control.Label(EntityInfoPanel, "EntityMapLabel");

            PaperdollPanels   = new ImagePanel[Options.EquipmentSlots.Count];
            PaperdollTextures = new string[Options.EquipmentSlots.Count];
            var i = 0;

            for (var z = 0; z < Options.PaperdollOrder[1].Count; z++)
            {
                if (Options.PaperdollOrder[1][z] == "Player")
                {
                    EntityFaceContainer = new ImagePanel(EntityInfoPanel, "EntityGraphicContainer");

                    EntityFace = new ImagePanel(EntityFaceContainer);
                    EntityFace.SetSize(64, 64);
                    EntityFace.AddAlignment(Alignments.Center);
                }
                else
                {
                    PaperdollPanels[i]   = new ImagePanel(EntityFaceContainer);
                    PaperdollTextures[i] = "";
                    PaperdollPanels[i].Hide();
                    i++;
                }
            }

            EventDesc = new RichLabel(EntityInfoPanel, "EventDescLabel");

            HpBackground = new ImagePanel(EntityInfoPanel, "HPBarBackground");
            HpBar        = new ImagePanel(EntityInfoPanel, "HPBar");
            ShieldBar    = new ImagePanel(EntityInfoPanel, "ShieldBar");
            HpTitle      = new Framework.Gwen.Control.Label(EntityInfoPanel, "HPTitle");
            HpTitle.SetText(Strings.EntityBox.vital0);
            HpLbl = new Framework.Gwen.Control.Label(EntityInfoPanel, "HPLabel");

            MpBackground = new ImagePanel(EntityInfoPanel, "MPBackground");
            MpBar        = new ImagePanel(EntityInfoPanel, "MPBar");
            MpTitle      = new Framework.Gwen.Control.Label(EntityInfoPanel, "MPTitle");
            MpTitle.SetText(Strings.EntityBox.vital1);
            MpLbl = new Framework.Gwen.Control.Label(EntityInfoPanel, "MPLabel");

            ExpBackground = new ImagePanel(EntityInfoPanel, "EXPBackground");
            ExpBar        = new ImagePanel(EntityInfoPanel, "EXPBar");
            ExpTitle      = new Framework.Gwen.Control.Label(EntityInfoPanel, "EXPTitle");
            ExpTitle.SetText(Strings.EntityBox.exp);
            ExpLbl = new Framework.Gwen.Control.Label(EntityInfoPanel, "EXPLabel");

            TradeLabel = new Button(EntityInfoPanel, "TradeButton");
            TradeLabel.SetText(Strings.EntityBox.trade);
            TradeLabel.SetToolTipText(Strings.EntityBox.tradetip.ToString(MyEntity.Name));
            TradeLabel.Clicked += tradeRequest_Clicked;

            PartyLabel = new Button(EntityInfoPanel, "PartyButton");
            PartyLabel.SetText(Strings.EntityBox.party);
            PartyLabel.SetToolTipText(Strings.EntityBox.partytip.ToString(MyEntity.Name));
            PartyLabel.Clicked += invite_Clicked;

            FriendLabel = new Button(EntityInfoPanel, "FriendButton");
            FriendLabel.SetText(Strings.EntityBox.friend);
            FriendLabel.SetToolTipText(Strings.EntityBox.friendtip.ToString(MyEntity.Name));
            FriendLabel.Clicked += friendRequest_Clicked;
            FriendLabel.IsHidden = true;

            EntityStatusPanel = new ImagePanel(EntityWindow, "StatusArea");

            SetEntity(myEntity);

            EntityWindow.LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString());

            UpdateSpellStatus();

            i = 0;
            for (var z = 0; z < Options.PaperdollOrder[1].Count; z++)
            {
                if (Options.PaperdollOrder[1][z] == "Player")
                {
                    EntityFace.RenderColor = EntityFaceContainer.RenderColor;
                }
                else
                {
                    PaperdollPanels[i].RenderColor = EntityFaceContainer.RenderColor;
                    i++;
                }
            }

            EntityWindow.Hide();

            mLastUpdateTime = Globals.System.GetTimeMs();
        }
Example #29
0
        public ExportVideoWindow(Gwen.Controls.ControlBase parent, GLWindow game) : base(parent, "Export Video")
        {
            game.Track.Stop();
            var openwindows = game.Canvas.GetOpenWindows();

            foreach (var v in openwindows)
            {
                if (v is WindowControl)
                {
                    ((WindowControl)v).Close();
                }
            }
            MakeModal(true);
            Width  = 400;
            Height = 280;
            ControlBase bottom = new ControlBase(this);

            bottom.Height = 150;
            bottom.Width  = 400 - 13;
            Align.AlignBottom(bottom);

            var buttonok = new Button(bottom);

            buttonok.Name   = "Okay";
            buttonok.Text   = "Record";
            buttonok.Height = 20;
            buttonok.Y      = 80;
            buttonok.Width  = 100;
            if (!Drawing.SafeFrameBuffer.CanRecord)
            {
                buttonok.IsHidden = true;
            }
            buttonok.Clicked += (o, e) =>
            {
                var wnd = ((WindowControl)o.Parent.Parent);
                wnd.Close();
                if (game.Track.GetFlag() == null)
                {
                    var pop = PopupWindow.Create(parent, game,
                                                 "No flag detected, place one at the end of the track so the recorder knows where to stop.",
                                                 "Error", true, false);
                    pop.FindChildByName("Okay", true).Clicked +=
                        (o1, e1) => { pop.Close(); };
                }
                else
                {
                    var  radiogrp = (RadioButtonGroup)this.FindChildByName("qualityselector", true);
                    bool is1080p  = radiogrp.Selected.Text == "1080p";
                    TrackFiles.TrackRecorder.RecordTrack(game, is1080p);
                }
            };
            Align.AlignLeft(buttonok);
            var buttoncancel = new Button(bottom);

            buttoncancel.Name     = "Cancel";
            buttoncancel.Text     = "Cancel";
            buttoncancel.Height   = 20;
            buttoncancel.Y        = 80;
            buttoncancel.Width    = 100;
            buttoncancel.Clicked += (o, e) => { this.Close(); };
            Align.AlignRight(buttoncancel);
            var label = new RichLabel(this);

            label.Dock  = Pos.Top;
            label.Width = this.Width;
            if (Drawing.SafeFrameBuffer.CanRecord)
            {
                label.AddText("You are about to export your track as a video file. Make sure the end of the track is marked by a flag. It will be located in the same folder as linerider.exe. Please allow some minutes depending on your computer speed. The window will become unresponsive during this time." + Environment.NewLine + Environment.NewLine + "After recording, a console window will open to encode the video. Closing it will cancel the process and all progress will be lost.", parent.Skin.Colors.Label.Default, parent.Skin.DefaultFont);
            }
            else
            {
                label.AddText("Video export is not supported on this machine." + Environment.NewLine + "Sorry.", parent.Skin.Colors.Label.Default, parent.Skin.DefaultFont);
            }
            label.SizeToChildren(false, true);
            var radio = new RadioButtonGroup(bottom);

            radio.Name = "qualityselector";
            radio.AddOption("720p").Select();
            radio.AddOption("1080p");
            Align.AlignLeft(radio);
            radio.Y += 20;
            if (!Drawing.SafeFrameBuffer.CanRecord)
            {
                radio.IsHidden = true;
            }
            DisableResizing();
        }
        public ItemDescWindow(
            ItemBase item,
            int amount,
            int x,
            int y,
            int[] statBuffs,
            string titleOverride    = "",
            string valueLabel       = "",
            bool centerHorizontally = false
            )
        {
            var title = titleOverride;

            if (string.IsNullOrWhiteSpace(title))
            {
                title = item.Name;
            }

            mDescWindow = new ImagePanel(Interface.GameUi.GameCanvas, "ItemDescWindow");
            if (item != null && item.ItemType == ItemTypes.Equipment)
            {
                mDescWindow.Name = "ItemDescWindowExpanded";
            }

            if (item != null)
            {
                var icon = new ImagePanel(mDescWindow, "ItemIcon");

                var itemName = new Label(mDescWindow, "ItemNameLabel");
                itemName.Text = title;

                var itemQuantity = new Label(mDescWindow, "ItemQuantityLabel");

                if (amount > 1)
                {
                    itemQuantity.Text += amount.ToString("N0").Replace(",", Strings.Numbers.comma);
                }

                itemName.AddAlignment(Alignments.CenterH);

                var itemType  = new Label(mDescWindow, "ItemTypeLabel");
                var itemValue = new Label(mDescWindow, "ItemValueLabel");

                itemType.Text = Strings.ItemDesc.itemtypes[(int)item.ItemType];
                itemValue.SetText(valueLabel);

                if (item.ItemType == ItemTypes.Equipment &&
                    item.EquipmentSlot >= 0 &&
                    item.EquipmentSlot < Options.EquipmentSlots.Count)
                {
                    itemType.Text = Options.EquipmentSlots[item.EquipmentSlot];
                    if (item.EquipmentSlot == Options.WeaponIndex && item.TwoHanded)
                    {
                        itemType.Text += " - " + Strings.ItemDesc.twohand;
                    }
                }

                if (item.Rarity > 0)
                {
                    itemType.Text += " - " + Strings.ItemDesc.rarity[item.Rarity];
                    var rarity = CustomColors.Items.Rarities.ContainsKey(item.Rarity)
                        ? CustomColors.Items.Rarities[item.Rarity]
                        : Color.White;

                    itemType.TextColorOverride.R = rarity.R;
                    itemType.TextColorOverride.G = rarity.G;
                    itemType.TextColorOverride.B = rarity.B;
                    itemType.TextColorOverride.A = rarity.A;
                }

                var itemDesc     = new RichLabel(mDescWindow, "ItemDescription");
                var itemDescText = new Label(mDescWindow, "ItemDescText");
                itemDescText.Font = itemDescText.Parent.Skin.DefaultFont;
                var itemStatsText = new Label(mDescWindow, item.ItemType == ItemTypes.Equipment ? "ItemStatsText" : "");
                itemStatsText.Font = itemStatsText.Parent.Skin.DefaultFont;
                var itemStats = new RichLabel(mDescWindow, item.ItemType == ItemTypes.Equipment ? "ItemStats" : "");
                itemDescText.IsHidden  = true;
                itemStatsText.IsHidden = true;

                //Load this up now so we know what color to make the text when filling out the desc
                mDescWindow.LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString());
                if (item.Description.Length > 0)
                {
                    itemDesc.AddText(
                        Strings.ItemDesc.desc.ToString(item.Description), itemDesc.RenderColor,
                        itemDescText.CurAlignments.Count > 0 ? itemDescText.CurAlignments[0] : Alignments.Left,
                        itemDescText.Font
                        );

                    itemDesc.AddLineBreak();
                    itemDesc.AddLineBreak();
                }

                var stats = "";
                if (item.ItemType == ItemTypes.Equipment)
                {
                    stats = Strings.ItemDesc.bonuses;
                    itemStats.AddText(
                        stats, itemStats.RenderColor,
                        itemStatsText.CurAlignments.Count > 0 ? itemStatsText.CurAlignments[0] : Alignments.Left,
                        itemDescText.Font
                        );

                    itemStats.AddLineBreak();
                    if (item.ItemType == ItemTypes.Equipment && item.EquipmentSlot == Options.WeaponIndex)
                    {
                        stats = Strings.ItemDesc.damage.ToString(item.Damage);
                        itemStats.AddText(
                            stats, itemStats.RenderColor,
                            itemStatsText.CurAlignments.Count > 0 ? itemStatsText.CurAlignments[0] : Alignments.Left,
                            itemDescText.Font
                            );

                        itemStats.AddLineBreak();
                    }

                    for (var i = 0; i < (int)Vitals.VitalCount; i++)
                    {
                        var bonus = item.VitalsGiven[i].ToString();
                        if (item.PercentageVitalsGiven[i] > 0)
                        {
                            if (item.VitalsGiven[i] > 0)
                            {
                                bonus += " + ";
                            }
                            else
                            {
                                bonus = "";
                            }

                            bonus += item.PercentageVitalsGiven[i] + "%";
                        }

                        var vitals = Strings.ItemDesc.vitals[i].ToString(bonus);
                        itemStats.AddText(
                            vitals, itemStats.RenderColor,
                            itemStatsText.CurAlignments.Count > 0 ? itemStatsText.CurAlignments[0] : Alignments.Left,
                            itemDescText.Font
                            );

                        itemStats.AddLineBreak();
                    }

                    if (statBuffs != null)
                    {
                        for (var i = 0; i < (int)Stats.StatCount; i++)
                        {
                            var flatStat = item.StatsGiven[i] + statBuffs[i];
                            var bonus    = flatStat.ToString();

                            if (item.PercentageStatsGiven[i] > 0)
                            {
                                if (flatStat > 0)
                                {
                                    bonus += " + ";
                                }
                                else
                                {
                                    bonus = "";
                                }

                                bonus += item.PercentageStatsGiven[i] + "%";
                            }

                            stats = Strings.ItemDesc.stats[i].ToString(bonus);
                            itemStats.AddText(
                                stats, itemStats.RenderColor,
                                itemStatsText.CurAlignments.Count > 0
                                    ? itemStatsText.CurAlignments[0]
                                    : Alignments.Left, itemDescText.Font
                                );

                            itemStats.AddLineBreak();
                        }
                    }
                }

                if (item.ItemType == ItemTypes.Equipment &&
                    item.Effect.Type != EffectType.None &&
                    item.Effect.Percentage > 0)
                {
                    itemStats.AddText(
                        Strings.ItemDesc.effect.ToString(
                            item.Effect.Percentage, Strings.ItemDesc.effects[(int)item.Effect.Type - 1]
                            ), itemStats.RenderColor,
                        itemStatsText.CurAlignments.Count > 0 ? itemStatsText.CurAlignments[0] : Alignments.Left,
                        itemDescText.Font
                        );
                }

                //Load Again for positioning purposes.
                mDescWindow.LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString());
                var itemTex = Globals.ContentManager.GetTexture(GameContentManager.TextureType.Item, item.Icon);
                if (itemTex != null)
                {
                    icon.Texture     = itemTex;
                    icon.RenderColor = item.Color;
                }

                itemDesc.SizeToChildren(false, true);
                itemStats.SizeToChildren(false, true);
                itemDescText.IsHidden  = true;
                itemStatsText.IsHidden = true;
                if (centerHorizontally)
                {
                    mDescWindow.MoveTo(x - mDescWindow.Width / 2, y + mDescWindow.Padding.Top);
                }
                else
                {
                    mDescWindow.MoveTo(x - mDescWindow.Width - mDescWindow.Padding.Right, y + mDescWindow.Padding.Top);
                }
            }
        }