Exemple #1
0
        public override void Update()
        {
            base.Update();

            if (isSelected)
            {
                m_background.x      = m_originRec.X - SELECTED_ADD;
                m_background.y      = m_originRec.Y - SELECTED_ADD;
                m_background.width  = m_originRec.Width + SELECTED_ADD * 2;
                m_background.height = m_originRec.Height + SELECTED_ADD * 2;
                m_background.Color  = EDColors.getColor(isActive ? EDColors.ORANGE : Color.Gray, 0.6f);
                if (isActive)
                {
                    m_BottomText.Color = EDColors.YELLOW;
                    m_TopText.Color    = EDColors.YELLOW;
                }
            }
            else
            {
                m_background.x      = m_originRec.X;
                m_background.y      = m_originRec.Y;
                m_background.width  = m_originRec.Width;
                m_background.height = m_originRec.Height;
                m_background.Color  = EDColors.getColor(isActive ? EDColors.ORANGE : Color.Gray, 0.2f);
                m_BottomText.Color  = EDColors.ORANGE;
                m_TopText.Color     = EDColors.ORANGE;
            }
        }
Exemple #2
0
        /// <summary>
        /// The button is centered on the position;
        /// </summary>
        /// <param name="_parent"></param>
        public UiMainMenuButton(int _x, int _y, MenuButtonType _type, NxOverlay _parent) : base(_parent)
        {
            x      = _x;
            y      = _y;
            m_Type = _type;

            //background
            Color        = EDColors.getColor(EDColors.ORANGE, 0.2f);
            m_originRec  = new Rectangle(x - (WIDTH / 2), y - (HEIGHT / 2), WIDTH, HEIGHT);
            m_background = new NxRectangle(m_originRec.X, m_originRec.Y, m_originRec.Width, m_originRec.Height, Color);
            Add(m_background);

            //Title
            m_TopText = new NxSimpleText(x, m_background.y + 5, getMenuTitle(), EDColors.ORANGE, 34, NxFonts.EuroCapital);
            m_TopText.centerHorizontal = true;
            Add(m_TopText);

            //Icon
            m_Icon = new NxImage(m_background.x + (WIDTH - ICON_SIZE) / 2, m_background.y + 50, ResHelper.GetResourceImage(Assembly.GetExecutingAssembly(), getIconPath()));
            Add(m_Icon);

            //Bottom Text
            int _botHeight = 80;
            int _padding   = 5;

            m_BottomText             = new NxTextbox(m_background.x + _padding, m_background.y + (HEIGHT - _botHeight) - _padding, WIDTH - _padding * 2, _botHeight, getBottomText(), EDColors.ORANGE, 19);
            m_BottomText.showBounds  = true;
            m_BottomText.boundColors = EDColors.getColor(EDColors.ORANGE, .5f);
            Add(m_BottomText);
        }
Exemple #3
0
        public UiSearchResultLine(UiSearchResult _parent) : base(_parent.Parent)
        {
            Color            = EDColors.getColor(EDColors.ORANGE, 0.1f);
            RelativeChildPos = true;

            m_background = new NxRectangle(0, 0, width, height, Color);
            Add(m_background);

            Widths       = new int[PropertiesCount];
            m_props      = new NxSimpleText[PropertiesCount];
            m_separators = new NxRectangle[PropertiesCount];

            for (int i = 0; i < m_separators.Length; i++)
            {
                m_separators[i] = new NxRectangle(i * 50, 0, 1, height, Color.Black);
                Add(m_separators[i]);
            }

            for (int i = 0; i < m_props.Length; i++)
            {
                m_props[i] = new NxSimpleText(i * 50, 5, "Property " + i.ToString(), Color.Orange, 18)
                {
                    AutoSize = false
                };
                Add(m_props[i]);
            }
        }
Exemple #4
0
        public override void Update()
        {
            base.Update();

            bool select = NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.select));
            bool left   = NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.left));
            bool right  = NexHudEngine.isShortcutPressed(Shortcuts.get(ShortcutId.right));

            if (select)
            {
                if (Radio.Selected)
                {
                    if (RadioPlayer.Instance.isPlaying)
                    {
                        RadioPlayer.Instance.Pause();
                    }
                    else
                    {
                        RadioPlayer.Instance.Play();
                    }
                }
                else if (PreviousRadio.Selected)
                {
                    RadioPlayer.Instance.Prev();
                }
                else if (NextRadio.Selected)
                {
                    RadioPlayer.Instance.Next();
                }
            }

            Radio.Label = string.Format("{0} {1}", RadioPlayer.Instance.isPlaying ? "[>]" : "[ ]", RadioPlayer.Instance.getRadioInfos().name);
            // Volume.width = (int)(RadioPlayer.Instance.Volume * totalWidth);

            if (VolumeSelected)
            {
                if (right)
                {
                    RadioPlayer.Instance.VolumeUp();
                }
                else if (left)
                {
                    RadioPlayer.Instance.VolumeDown();
                }
            }
            Volume.Color = VolumeSelected ? EDColors.YELLOW : EDColors.getColor(EDColors.ORANGE, 0.6f);
            Volume.Value = (int)(RadioPlayer.Instance.Volume * 100.0f);
        }
Exemple #5
0
 public override void Update()
 {
     base.Update();
     if (searchName.text != "empty")
     {
         if (Selected)
         {
             searchName.Color = EDColors.WHITE;
         }
         else
         {
             searchName.Color = EDColors.YELLOW;
         }
     }
     m_background.Color = Selected ? EDColors.getColor(EDColors.ORANGE, 0.8f) : EDColors.getColor(EDColors.ORANGE, 0.1f);
 }
Exemple #6
0
        public NxMainPanelSearchButton(int _x, int _y, int _width, NxMenu _menu) : base(_menu.frame.NxOverlay)
        {
            m_width = _width;
            x       = _x;
            y       = _y;

            m_background = new NxRectangle(x, y, m_width, Height, EDColors.getColor(EDColors.ORANGE, 0.1f));
            Add(m_background);
            Add(new NxRectangle(x, y, m_width, 1, EDColors.YELLOW));
            Add(new NxRectangle(x, y + Height - 1, m_width, 1, EDColors.getColor(EDColors.YELLOW, 0.5f)));

            searchName = new NxSimpleText(x + (m_width / 2), y + (Height / 2), "empty", EDColors.getColor(EDColors.WHITE, 0.2f));
            searchName.centerHorizontal = true;
            searchName.centerVertical   = true;
            Add(searchName);
        }
Exemple #7
0
        public override void Render(Graphics _g)
        {
            base.Render(_g);

            m_background.Color = EDColors.getColor(m_background.Color, Selected ? 0.3f : 0.1f);
            m_props[1].Color   = Selected ? EDColors.WHITE : EDColors.ORANGE;

            if (m_registerWidth)
            {
                for (int i = 0; i < m_props.Length; i++)
                {
                    Widths[i] = (int)m_props[i].sizeF.Width;
                }
                m_registerWidth      = false;
                WidthMustBeRefreshed = true;
            }
        }
Exemple #8
0
        void Start()
        {
            inPortalEdgeColors = new EDColors {
                edgeColorMode            = inPortal.edgeColorMode,
                edgeColor                = inPortal.edgeColor,
                edgeColorGradient        = inPortal.edgeColorGradient,
                edgeColorGradientTexture = inPortal.edgeColorGradientTexture
            };
            outPortalEdgeColors = new EDColors {
                edgeColorMode            = outPortal.edgeColorMode,
                edgeColor                = outPortal.edgeColor,
                edgeColorGradient        = outPortal.edgeColorGradient,
                edgeColorGradientTexture = outPortal.edgeColorGradientTexture
            };

            trigger.OnMagicTriggerStayOneTime         += ResetInPortalEdgeDetection;
            trigger.OnNegativeMagicTriggerStayOneTime += ResetOutPortalEdgeDetection;
        }
Exemple #9
0
 public override void Render(Graphics _g)
 {
     if (Selected)
     {
         _g.FillRectangle(new SolidBrush(EDColors.getColor(EDColors.ORANGE, 0.2f)), Rectangle);
         _g.DrawRectangle(new Pen(EDColors.ORANGE, 1), Rectangle);
     }
     else
     {
         _g.FillRectangle(new SolidBrush(EDColors.getColor(EDColors.WHITE, 0.05f)), Rectangle);
     }
     foreach (NxSimpleText text in m_content)
     {
         if (text.isVisible)
         {
             _g.FillRectangle(new SolidBrush(EDColors.getColor(EDColors.BLUE, 0.4f)), text.Rectangle);
         }
     }
     base.Render(_g);
 }
Exemple #10
0
        public override void Update()
        {
            base.Update();

            m_Balance.text = string.Format("{0:#,0}", NexHudMain.EliteApi.Commander.Credits) + " cr";

            m_Rebuy.text = "Rebuy: " + string.Format("{0:#,0}", m_lastRebuy);

            if (m_lastRebuy > NexHudMain.EliteApi.Commander.Credits / 5)
            {
                m_Rebuy.Color = EDColors.YELLOW;
            }
            else if (m_lastRebuy > NexHudMain.EliteApi.Commander.Credits)
            {
                m_Rebuy.Color = EDColors.RED;
            }
            else
            {
                m_Rebuy.Color = EDColors.getColor(EDColors.WHITE, 0.5f);
            }
        }
Exemple #11
0
        public UiSearchCreate(UiSearch2 _search) : base(_search.Menu.frame.NxOverlay)
        {
            m_UiSearch = _search;

            //10 params max

            /*Allegiance
             * Economy
             * Government
             * Needs Permit
             * Population
             * 100000000000
             * Power
             * Power State
             * Security
             * State
             * Secondary Economy*/
            // InitGrid(8, 20);
            x                = 5;
            y                = 70;
            width            = NxMenu.Width - 10;
            height           = NxMenu.Height - 90 - 5;
            RelativeChildPos = true;


            int _cx = 0;
            int _cy = 0;

            int boxsize        = 15;
            int boxPlusPadding = boxsize + 4;

            int spaceBetweenCheckbox = 8;

            int spaceBetweenCategories = 35;

            Color breakLineColor = EDColors.getColor(EDColors.GREEN, 0.5f);


            //Allegiance
            Add(new NxSimpleText(0, 0, "Allegiance", EDColors.BLUE, 18, NxFonts.EuroCapital));
            Add(new NxRectangle(5, _cy + 20, m_UiSearch.Menu.frame.WindowWidth - 10, 1, breakLineColor));
            _cy += 24;
            foreach (string s in SpanshDatas.allegiance)
            {
                int _width = (int)m_UiSearch.Menu.frame.NxGraphics.MeasureString(s, NxCheckbox.DefaultFont).Width + boxPlusPadding;
                _cx += spaceBetweenCheckbox;
                NxCheckbox b = new NxCheckbox(_cx, _cy, _width, 30, s, m_UiSearch.Menu)
                {
                    BoxSize = boxsize
                };
                b.Obj = nameof(SpanshDatas.allegiance);
                Add(b);
                _cx += _width;
            }

            //Permit
            _cx += 25;
            int permitCatPositionX = _cx;

            Add(new NxSimpleText(_cx, 0, "Need a permit", EDColors.BLUE, 18, NxFonts.EuroCapital));
            for (int i = 0; i < 3; i++)
            {
                string _cbText = "???";
                switch (i)
                {
                case 0: _cbText = "Yes"; break;

                case 1: _cbText = "No"; break;

                case 2: _cbText = "Mine only"; break;
                }
                int _width = (int)m_UiSearch.Menu.frame.NxGraphics.MeasureString(_cbText, NxCheckbox.DefaultFont).Width + boxPlusPadding;

                NxCheckbox b = new NxCheckbox(_cx, _cy, _width, 30, _cbText, m_UiSearch.Menu)
                {
                    BoxSize = boxsize, CircleBox = true
                };
                m_CbPermits[i] = b;
                b.onClick     += onPermitChanged;
                b.Obj          = "permitOptions";
                if (i == 2)
                {
                    b.Checked = true;
                }
                Add(b);
                _cx += _width;
                _cx += 15;
            }


            _cx  = 0;
            _cy += spaceBetweenCategories;
            //Economy
            Add(new NxSimpleText(_cx, _cy, "Economy", EDColors.BLUE, 18, NxFonts.EuroCapital));
            Add(new NxRectangle(5, _cy + 20, m_UiSearch.Menu.frame.WindowWidth - 10, 1, breakLineColor));
            _cy += 24;
            foreach (string s in SpanshDatas.economy)
            {
                int _width = (int)m_UiSearch.Menu.frame.NxGraphics.MeasureString(s, NxCheckbox.DefaultFont).Width + boxPlusPadding;
                if (_cx + _width + 5 > m_UiSearch.Menu.frame.WindowWidth)
                {
                    _cx  = 0;
                    _cy += 32;
                }
                _cx += spaceBetweenCheckbox;
                NxCheckbox b = new NxCheckbox(_cx, _cy, _width, 30, s, m_UiSearch.Menu)
                {
                    BoxSize = boxsize
                };
                b.Obj = nameof(SpanshDatas.economy);
                Add(b);
                _cx += _width;
            }

            _cx  = 0;
            _cy += spaceBetweenCategories;
            //Governement
            Add(new NxSimpleText(_cx, _cy, "Government", EDColors.BLUE, 18, NxFonts.EuroCapital));
            Add(new NxRectangle(5, _cy + 20, m_UiSearch.Menu.frame.WindowWidth - 10, 1, breakLineColor));
            _cy += 24;
            foreach (string s in SpanshDatas.government)
            {
                int _width = (int)m_UiSearch.Menu.frame.NxGraphics.MeasureString(s, NxCheckbox.DefaultFont).Width + boxPlusPadding;
                if (_cx + _width + 5 > m_UiSearch.Menu.frame.WindowWidth)
                {
                    _cx  = 0;
                    _cy += 32;
                }
                _cx += spaceBetweenCheckbox;
                NxCheckbox b = new NxCheckbox(_cx, _cy, _width, 30, s, m_UiSearch.Menu)
                {
                    BoxSize = boxsize
                };
                b.Obj = nameof(SpanshDatas.government);
                Add(b);
                _cx += _width;
            }


            _cx  = 0;
            _cy += spaceBetweenCategories;
            //State
            Add(new NxSimpleText(_cx, _cy, "State", EDColors.BLUE, 18, NxFonts.EuroCapital));
            Add(new NxRectangle(5, _cy + 20, m_UiSearch.Menu.frame.WindowWidth - 10, 1, breakLineColor));
            _cy += 24;
            foreach (string s in SpanshDatas.state)
            {
                int _width = (int)m_UiSearch.Menu.frame.NxGraphics.MeasureString(s, NxCheckbox.DefaultFont).Width + boxPlusPadding;
                if (_cx + _width + 5 > m_UiSearch.Menu.frame.WindowWidth)
                {
                    _cx  = 0;
                    _cy += 32;
                }
                _cx += spaceBetweenCheckbox;
                NxCheckbox b = new NxCheckbox(_cx, _cy, _width, 30, s, m_UiSearch.Menu)
                {
                    BoxSize = boxsize
                };
                b.Obj = nameof(SpanshDatas.state);
                Add(b);
                _cx += _width;
            }

            _cx  = 0;
            _cy += spaceBetweenCategories;
            int powerPositionY = _cy;

            //Power
            Add(new NxSimpleText(_cx, _cy, "Power", EDColors.BLUE, 18, NxFonts.EuroCapital));
            Add(new NxRectangle(5, _cy + 20, m_UiSearch.Menu.frame.WindowWidth - 10, 1, breakLineColor));
            _cy += 24;
            foreach (string s in SpanshDatas.power)
            {
                int _width = (int)m_UiSearch.Menu.frame.NxGraphics.MeasureString(s, NxCheckbox.DefaultFont).Width + boxPlusPadding;
                if (_cx + _width + 5 > permitCatPositionX)
                {
                    _cx  = 0;
                    _cy += 32;
                }
                _cx += spaceBetweenCheckbox;
                NxCheckbox b = new NxCheckbox(_cx, _cy, _width, 30, s, m_UiSearch.Menu)
                {
                    BoxSize = boxsize
                };
                b.Obj = nameof(SpanshDatas.power);
                Add(b);
                _cx += _width;
            }

            _cx = permitCatPositionX;
            _cy = powerPositionY;
            //State
            Add(new NxSimpleText(_cx, _cy, "Power state", EDColors.BLUE, 18, NxFonts.EuroCapital));
            // Add(new NxRectangle(5, _cy + 20, m_menu.frame.WindowWidth - 10, 1, breakLineColor));
            _cy += 24;
            foreach (string s in SpanshDatas.power_state)
            {
                int _width = (int)m_UiSearch.Menu.frame.NxGraphics.MeasureString(s, NxCheckbox.DefaultFont).Width + boxPlusPadding;
                if (_cx + _width + 5 > m_UiSearch.Menu.frame.WindowWidth)
                {
                    _cx  = permitCatPositionX;
                    _cy += 32;
                }
                _cx += spaceBetweenCheckbox;
                NxCheckbox b = new NxCheckbox(_cx, _cy, _width, 30, s, m_UiSearch.Menu)
                {
                    BoxSize = boxsize
                };
                b.Obj = nameof(SpanshDatas.power_state);
                Add(b);
                _cx += _width;
            }

            _cx            = 0;
            _cy           += spaceBetweenCategories;
            powerPositionY = _cy;
            //Security
            Add(new NxSimpleText(_cx, _cy, "Security", EDColors.BLUE, 18, NxFonts.EuroCapital));
            Add(new NxRectangle(5, _cy + 20, m_UiSearch.Menu.frame.WindowWidth - 10, 1, breakLineColor));
            _cy += 24;
            foreach (string s in SpanshDatas.security)
            {
                int _width = (int)m_UiSearch.Menu.frame.NxGraphics.MeasureString(s, NxCheckbox.DefaultFont).Width + boxPlusPadding;
                if (_cx + _width + 5 > permitCatPositionX)
                {
                    _cx  = 0;
                    _cy += 32;
                }
                _cx += spaceBetweenCheckbox;
                NxCheckbox b = new NxCheckbox(_cx, _cy, _width, 30, s, m_UiSearch.Menu)
                {
                    BoxSize = boxsize
                };
                b.Obj = nameof(SpanshDatas.security);
                Add(b);
                _cx += _width;
            }

            _cx = permitCatPositionX;
            _cy = powerPositionY;
            //Population
            Add(new NxSimpleText(_cx, _cy, "Population", EDColors.BLUE, 18, NxFonts.EuroCapital));
            // Add(new NxRectangle(5, _cy + 20, m_menu.frame.WindowWidth - 10, 1, breakLineColor));
            _cy += 24;
            for (int i = 0; i < 3; i++)
            {
                string s = "Unpopulated";
                if (i == 1)
                {
                    s = "Populated";
                }
                else if (i == 2)
                {
                    s = "Both";
                }
                int _width = (int)m_UiSearch.Menu.frame.NxGraphics.MeasureString(s, NxCheckbox.DefaultFont).Width + boxPlusPadding;
                if (_cx + _width + 5 > m_UiSearch.Menu.frame.WindowWidth)
                {
                    _cx  = permitCatPositionX;
                    _cy += 32;
                }
                _cx += spaceBetweenCheckbox;
                NxCheckbox b = new NxCheckbox(_cx, _cy, _width, 30, s, m_UiSearch.Menu)
                {
                    BoxSize = boxsize, CircleBox = true
                };
                b.Checked         = i == 2;
                m_CbPopulation[i] = b;
                b.onClick        += onPopulationChanged;
                b.Obj             = "populationOptions";
                Add(b);
                _cx += _width;
            }


            _cx = 0;

            _cy = m_UiSearch.Menu.frame.WindowHeight - 110;


            NxButton btnCreate = new NxButton(5, _cy, m_UiSearch.Menu.frame.WindowWidth / 2 - 15, 30, "Save search", m_UiSearch.Menu);

            btnCreate.onClick          += onSave;
            btnCreate.ColorBack         = EDColors.getColor(EDColors.GREEN, 0.1f);
            btnCreate.ColorBackSelected = EDColors.getColor(EDColors.GREEN, 0.9f);
            Add(btnCreate);

            NxButton btnSearch = new NxButton(m_UiSearch.Menu.frame.WindowWidth / 2 + 10, _cy, m_UiSearch.Menu.frame.WindowWidth / 2 - 15, 30, "Search now", m_UiSearch.Menu);

            btnSearch.onClick += onSearch;
            Add(btnSearch);


            MoveCursorToFirst();
            Reset();
        }
Exemple #12
0
        public UiMainTopInfos(NxMenu _menu) : base(_menu.frame.NxOverlay)
        {
            m_menu = _menu;
            //Loading & Content;
            m_Content = new NxGroup(Parent);
            Add(m_Content);
            m_Content.isVisible = false;
            m_Loading           = new NxLoading(NxMenu.Width / 2, 30);
            Add(m_Loading);

            //Decoration
            Add(new NxImage(0, 0, NxMenu.Width, HEIGHT * 2, ResHelper.GetResourceImage(Assembly.GetExecutingAssembly(), "Resources.GradientOrange15p.png")));
            Add(new NxRectangle(0, HEIGHT, NxMenu.Width, 1, EDColors.YELLOW));

            //* Faction icon *//
            m_AllegianceLogo = new NxImage(0, 0, ResHelper.GetResourceImage(Assembly.GetExecutingAssembly(), "Resources.factions.inde64.png"));
            m_Content.Add(m_AllegianceLogo);
            //* -- Titles **//
            //System Name
            m_SystemName = new NxSimpleText(decal_x, 0, string.Empty, EDColors.ORANGE, 40, NxFonts.EuroCapital);
            m_Content.Add(m_SystemName);
            //Controlling Factions
            m_ControllingFaction = new NxSimpleText(decal_x + 5, 35, string.Empty, EDColors.YELLOW, 20, NxFonts.EuroCapital);
            m_Content.Add(m_ControllingFaction);

            //* -- Descriptions **//
            //Government & Population
            Column1 = 0;

            int infoSize = 18;

            m_GovAndPop = new NxSimpleText(Column1, 2, string.Empty, EDColors.getColor(EDColors.WHITE, 0.5f), infoSize, NxFonts.EuroStile);
            m_Content.Add(m_GovAndPop);
            //Economy
            m_Economy = new NxSimpleText(Column1, 20, string.Empty, EDColors.BLUE, infoSize, NxFonts.EuroStile);
            m_Content.Add(m_Economy);
            //Security
            m_SecurityLabel = new NxSimpleText(Column1, 40, "Security:", EDColors.getColor(EDColors.WHITE, 0.5f), infoSize, NxFonts.EuroStile);
            m_Content.Add(m_SecurityLabel);
            m_Security = new NxSimpleText(Column1, 40, string.Empty, EDColors.BLUE, infoSize, NxFonts.EuroStile);
            m_Content.Add(m_Security);
            //Threat
            m_ThreatLabel = new NxSimpleText(Column1, 40, "Threat:", EDColors.getColor(EDColors.WHITE, 0.5f), infoSize, NxFonts.EuroStile);
            m_Content.Add(m_ThreatLabel);
            m_Threat = new NxSimpleText(Column1, 40, string.Empty, EDColors.BLUE, infoSize, NxFonts.EuroStile);
            m_Content.Add(m_Threat);
            //Traffic
            m_traffic = new NxSimpleText(0, 40, string.Empty, EDColors.getColor(EDColors.WHITE, 0.5f), infoSize, NxFonts.EuroStile);
            m_Content.Add(m_traffic);

            //* -- Column 2 -- *//
            //reserve
            m_Reserve = new NxSimpleText(0, 2, string.Empty, EDColors.getColor(EDColors.WHITE, 0.5f), infoSize, NxFonts.EuroStile);
            m_Content.Add(m_Reserve);
            //System Value
            m_SystemValue = new NxSimpleText(0, 20, string.Empty, EDColors.LIGHTBLUE, infoSize, NxFonts.EuroStile);
            m_Content.Add(m_SystemValue);
            //System Value Mapped
            m_SystemValueMapped = new NxSimpleText(0, 40, string.Empty, EDColors.BLUE, infoSize, NxFonts.EuroStile);
            m_Content.Add(m_SystemValueMapped);
        }
Exemple #13
0
        private void refresh()
        {
            int _startX = 5;
            int _startY = 100;
            int _btnId  = 0;
            int _y      = _startY;
            int _x      = _startX;
            int _vSpace = 5;
            int _hSpace = 5;

            Point _cCoords = new Point();

            m_CursorMaxX = 0;
            m_CursorMaxY.Initialize();

            for (int i = 0; i <= (int)BlueprintCategorie.Armour; i++)
            {
                if (_y > _startY)
                {
                    _y += _vSpace;
                }
                BlueprintCategorie _categorie = (BlueprintCategorie)i;
                m_Buttons[_btnId].Coords = _cCoords;
                m_Buttons[_btnId].resetColors();
                m_Buttons[_btnId].Label        = EDEnumHelper.ToStringFormated(_categorie).ToUpper();
                m_Buttons[_btnId].isSelectable = false;
                m_Buttons[_btnId].x            = _x;
                m_Buttons[_btnId].y            = _y;
                m_Buttons[_btnId].height       = HEIGHT_CAT;
                _y += m_Buttons[_btnId].height + _vSpace;
                _btnId++;
                _cCoords.Y++;


                List <string> _typeAdded = new List <string>();
                List <string> _nameAdded = new List <string>();
                foreach (BlueprintDatas _data in EngineerHelper.blueprints.Where(x => x.Categorie == _categorie))
                {
                    if (_typeAdded.Contains(_data.Type))
                    {
                        continue;
                    }
                    m_CursorMaxX             = Math.Max(m_CursorMaxX, _cCoords.X);
                    m_CursorMaxY[_cCoords.X] = Math.Max(m_CursorMaxY[_cCoords.X], _cCoords.Y);

                    m_Buttons[_btnId].Obj    = _data.Type;
                    m_Buttons[_btnId].Coords = _cCoords;
                    m_Buttons[_btnId].resetColors();
                    m_Buttons[_btnId].ColorLabel   = EDColors.getColor(EDColors.YELLOW, .8f);
                    m_Buttons[_btnId].Label        = _data.Type;
                    m_Buttons[_btnId].isSelectable = true;
                    m_Buttons[_btnId].Selected     = false;
                    m_Buttons[_btnId].x            = _x;
                    m_Buttons[_btnId].y            = _y;
                    m_Buttons[_btnId].height       = HEIGHT_TYPE;
                    _y += m_Buttons[_btnId].height + _vSpace;



                    _btnId++;
                    _cCoords.Y++;

                    _typeAdded.Add(_data.Type);

                    if (_cCoords.Y > 12)
                    {
                        _y         = _startY;
                        _x        += BUTTON_WIDTH + _hSpace;
                        _cCoords.Y = 0;
                        _cCoords.X++;
                    }


                    if (!string.IsNullOrEmpty(m_TypeSelected) && m_TypeSelected == _data.Type)
                    {
                        m_CursorCoords = m_Buttons[_btnId - 1].Coords;
                        m_Buttons[_btnId - 1].ColorBack  = EDColors.getColor(EDColors.ORANGE, 0.3f);
                        m_Buttons[_btnId - 1].ColorLabel = EDColors.YELLOW;

                        foreach (BlueprintDatas _data2 in EngineerHelper.blueprints.Where(x => x.Type == m_TypeSelected && !x.IsExperimental && !x.IsSynthesis))
                        {
                            if (_nameAdded.Contains(_data2.Name))
                            {
                                continue;
                            }
                            m_CursorMaxX             = Math.Max(m_CursorMaxX, _cCoords.X);
                            m_CursorMaxY[_cCoords.X] = Math.Max(m_CursorMaxY[_cCoords.X], _cCoords.Y);

                            m_Buttons[_btnId].Obj    = _data2;
                            m_Buttons[_btnId].Coords = _cCoords;
                            m_Buttons[_btnId].resetColors();
                            m_Buttons[_btnId].ColorBack         = EDColors.getColor(EDColors.GREEN, 0.4f);
                            m_Buttons[_btnId].ColorBackSelected = EDColors.getColor(EDColors.GREEN, 0.8f);
                            m_Buttons[_btnId].Label             = _data2.Name;
                            m_Buttons[_btnId].isSelectable      = true;
                            m_Buttons[_btnId].Selected          = false;
                            m_Buttons[_btnId].x      = _x;
                            m_Buttons[_btnId].y      = _y;
                            m_Buttons[_btnId].height = HEIGHT_TYPE;
                            _y += m_Buttons[_btnId].height + _vSpace;
                            _btnId++;
                            _cCoords.Y++;

                            _nameAdded.Add(_data2.Name);

                            if (_cCoords.Y > 12)
                            {
                                _y         = _startY;
                                _x        += BUTTON_WIDTH + _hSpace;
                                _cCoords.Y = 0;
                                _cCoords.X++;
                            }
                        }
                    }
                }
            }

            for (int i = 0; i < m_Buttons.Count; i++)
            {
                m_Buttons[i].isVisible = i < _btnId;
                m_Buttons[i].makeItDirty();
            }
        }
Exemple #14
0
        public UiSearchResult(UiSearch2 _search, UiImprove _uiImprove = null) : base(_search != null ? _search.Menu.frame.NxOverlay : _uiImprove.Menu.frame.NxOverlay)
        {
            m_UiSearch       = _search;
            m_UiImprove      = _uiImprove;
            RelativeChildPos = true;
            //Title
            m_title = new NxSimpleText(0, 0, "Search result...", EDColors.ORANGE, 24, NxFonts.EuroCapital);
            Add(m_title);

            int _by = 0;

            width  = NxMenu.Width;
            height = NxMenu.Height - y;
            //Bookmark buttons

            //Tips for materials

            //Title
            _by += 40;

            //Loading

            m_loading = new NxLoading(NxMenu.Width / 2, 500);
            Add(m_loading);

            //Message

            m_messageInfo = new NxSimpleText(10, height - 160, "", Color.CadetBlue, 20);

            Add(m_messageInfo);

            //results

            m_results = new UiSearchResultLine[MAX_LINE_RESULT];
            for (int i = 0; i < m_results.Length; i++)
            {
                m_results[i] = new UiSearchResultLine(this)
                {
                    x      = 0,
                    y      = _by,
                    width  = NxMenu.Width,
                    height = 30
                };
                _by += m_results[i].height + 2;

                m_results[i].onClick += OnClickResult;
                Add(m_results[i]);
            }

            MoveCursorToFirst();

            m_BtnSave                   = new NxButton(width / 2 + 5, height - 135, width / 2 - 10, 35, "Save search", Menu);
            m_BtnSave.ColorBack         = EDColors.getColor(EDColors.GREEN, 0.1f);
            m_BtnSave.ColorBackSelected = EDColors.getColor(EDColors.GREEN, 0.8f);
            m_BtnSave.onClick          += onSaveClicked;
            Add(m_BtnSave);

            m_BtnDelete                   = new NxButton(5, height - 135, width / 2 - 10, 35, "Delete search", Menu);
            m_BtnDelete.ColorBack         = EDColors.getColor(EDColors.RED, 0.1f);
            m_BtnDelete.ColorBackSelected = EDColors.getColor(EDColors.RED, 0.8f);
            m_BtnDelete.onClick          += onDeleteClicked;
            Add(m_BtnDelete);
        }
Exemple #15
0
        public override void Update()
        {
            base.Update();
            if (!isVisible)
            {
                _skipUpdate = true;
                return;
            }
            else if (_skipUpdate)
            {
                _skipUpdate = false;
                return;
            }

            if (m_messageLifeTime < 10)
            {
                m_messageLifeTime += NexHudEngine.deltaTime;
            }

            //Message display
            if (m_messageLifeTime < 5)
            {
                m_messageInfo.isVisible = true;
                if (m_messageLifeTime > 4)
                {
                    m_messageInfo.Color = EDColors.getColor(m_messageInfo.Color, 5 - m_messageLifeTime);
                }
            }
            else
            {
                m_messageInfo.isVisible = false;
            }


            if (Shortcuts.BackPressed)
            {
                if (m_UiSearch != null)
                {
                    m_UiSearch.changeState(m_PreviousState);
                }
                else if (m_UiImprove != null)
                {
                    m_UiImprove.changeState(UiImprove.UiImproveState.BlueprintDetail);
                }
                return;
            }

            if (Shortcuts.UpPressed)
            {
                moveUp();
            }
            if (Shortcuts.DownPressed)
            {
                moveDown();
            }
            if (Shortcuts.LeftPressed)
            {
                moveLeft();
            }
            if (Shortcuts.RightPressed)
            {
                moveRight();
            }

            bool refreshAllWidth = m_results.Length > 0;

            foreach (UiSearchResultLine line in m_results)
            {
                if (!line.WidthMustBeRefreshed)
                {
                    refreshAllWidth = false;
                    break;
                }
            }
            if (refreshAllWidth)
            {
                int[] MaxWidths = new int[m_results.First().Widths.Length];
                foreach (UiSearchResultLine line in m_results)
                {
                    for (int i = 0; i < MaxWidths.Length; i++)
                    {
                        MaxWidths[i] = Math.Max(MaxWidths[i], line.Widths[i]);
                    }
                }
                foreach (UiSearchResultLine line in m_results)
                {
                    line.setPositions(MaxWidths);
                }
            }
        }