public ReportHandler()
 {
     Background = new ResRectangle(new Point(350, 45), new Size(Game.Resolution.Width - 475, Game.Resolution.Height - 120), Color.FromArgb(200, 10, 10, 10));
     Title      = new ResText("CAD: Murder Call Report", new Point(360, 50), 0.975f, Color.White, RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Left);
     Text       = new ResText("", new Point(355, 80), 0.4225f, Color.White, RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Left);
     AddTextToReport("[" + DateTime.UtcNow.ToShortDateString() + "  " + DateTime.UtcNow.ToLongTimeString() + "]" + "~n~>Call received." + "~n~>Officer " + Settings.General.Name + " en route.");
 }
Пример #2
0
        internal static void Main()
        {
            var resolutionRatio = UIMenu.GetScreenResolutionMantainRatio();

            //Checks if the option for the on screen text is set to true
            if (Globals.Config.AvailableForCalloutsText)
            {
                if (Globals.Config.PLDCompatibility == true)
                {
                    _availableRect = new ResRectangle(new Point(320, (int)(resolutionRatio.Height - 130)), new Size(200, 50), Color.FromArgb(Globals.Config.RectangleAlpha, Color.Black));
                }
                else
                {
                    _availableRect = new ResRectangle(new Point(320, (int)(resolutionRatio.Height - 67)), new Size(200, 50), Color.FromArgb(Globals.Config.RectangleAlpha, Color.Black));
                }
            }

            if (Globals.Config.PLDCompatibility == true)
            {
                _availableText = new ResText("Available for calls: ",
                                             new Point(420, (int)(resolutionRatio.Height - 120)), 0.3f, Color.FromArgb(255, Color.White),
                                             RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Centered);
            }
            else
            {
                _availableText = new ResText("Available for calls: ",
                                             new Point(420, (int)(resolutionRatio.Height - 57)), 0.3f, Color.FromArgb(255, Color.White),
                                             RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Centered);
            }


            Game.FrameRender += GameOnFrameRender;
        }
Пример #3
0
        /// <summary>
        /// Draws this instance.
        /// </summary>
        public override void Draw()
        {
            if (!Visible)
            {
                return;
            }
            base.Draw();

            var res = UIMenu.GetScreenResolutionMantainRatio();

            var blackAlpha = Focused ? 200 : 100;
            var fullAlpha  = Focused ? 255 : 150;

            var activeWidth  = res.Width - SafeSize.X * 2;
            var submenuWidth = (int)(activeWidth * 0.6818f);
            var itemSize     = new Size((int)activeWidth - (submenuWidth + 3), 40);

            for (int i = 0; i < Items.Count; i++)
            {
                //bool hovering = UIMenu.IsMouseInBounds(SafeSize.AddPoints(new Point(0, (itemSize.Height + 3) * i)), itemSize);

                ResRectangle.Draw(SafeSize.AddPoints(new Point(0, (itemSize.Height + 3) * i)), itemSize, (Index == i && Focused) ? Color.FromArgb(fullAlpha, Color.White) : Color.FromArgb(blackAlpha, Color.Black));
                ResText.Draw(Items[i].Title, SafeSize.AddPoints(new Point(6, 5 + (itemSize.Height + 3) * i)), 0.35f, Color.FromArgb(fullAlpha, (Index == i && Focused) ? Color.Black : Color.White), Common.EFont.ChaletLondon, false);

                //if (Focused && hovering && Common.IsDisabledControlJustPressed(0, GameControl.CursorAccept))
                //{
                //    Items[Index].Focused = false;
                //    Common.PlaySound("NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET");
                //    bool open = Index == i;
                //    Index = (1000 - (1000 % Items.Count) + i) % Items.Count;
                //    if (open)
                //    {
                //        if (Items[Index].CanBeFocused && !Items[Index].Focused)
                //        {
                //            Parent.FocusLevel = 2;
                //            Items[Index].JustOpened = true;
                //            Items[Index].Focused = true;
                //        }
                //        else
                //        {
                //            Items[Index].OnActivated();
                //        }
                //    }
                //    else
                //    {
                //        Parent.FocusLevel = 1;
                //    }
                //}
            }

            Items[Index].Visible           = true;
            Items[Index].FadeInWhenFocused = true;
            //if (Items[Index].CanBeFocused)
            //    Items[Index].Focused = true;
            Items[Index].UseDynamicPositionment = false;
            Items[Index].SafeSize    = SafeSize.AddPoints(new Point((int)activeWidth - submenuWidth, 0));
            Items[Index].TopLeft     = SafeSize.AddPoints(new Point((int)activeWidth - submenuWidth, 0));
            Items[Index].BottomRight = new Point((int)res.Width - SafeSize.X, (int)res.Height - SafeSize.Y);
            Items[Index].Draw();
        }
Пример #4
0
 public Input(DialogWindows d)
 {
     InitializeComponent();
     Return = d;
     ResText.Focus();
     OKBtn.Click += Ok_Clkick;
     ResText.Focus();
     KeyDown   += Enter_Click;
     KeyPreview = true;
 }
        internal void Process()
        {
            if (Menu.Visible)
            {
                if (Game.IsKeyDown(Keys.C))
                {
                    copiedSequence = getSelectedSequence()?.ItemValue;
                    Common.PlaySound(Menu.AUDIO_SELECT, Menu.AUDIO_LIBRARY);
                }
                else if (Game.IsKeyDown(Keys.V) && copiedSequence != null)
                {
                    var s = getSelectedSequence();
                    if (s != null)
                    {
                        s.ItemValue = copiedSequence;
                        Common.PlaySound(Menu.AUDIO_SELECT, Menu.AUDIO_LIBRARY);
                    }
                }
                else if (Game.IsControlJustPressed(13, GameControl.FrontendLeft))
                {
                    shiftSelectedSequence(-1);
                }
                else if (Game.IsControlJustPressed(13, GameControl.FrontendRight))
                {
                    shiftSelectedSequence(1);
                }
                else if (Game.IsKeyDown(Keys.PageDown))
                {
                    shiftSelectedItem(1);
                }
                else if (Game.IsKeyDown(Keys.PageUp))
                {
                    shiftSelectedItem(-1);
                }
                else if (Game.IsKeyDown(Keys.R))
                {
                    invertSelectedSequence();
                }
                else if (Game.IsKeyDown(Keys.E))
                {
                    extendSelectedSequence();
                }

                if (!string.IsNullOrEmpty(copiedSequence))
                {
                    string seqDisp = "Copied sequence " + UIMenuSequenceItemSelector.FormatSequence(copiedSequence);
                    Point  p       = new Point(Menu.WidthOffset + 500, 30);
                    ResText.Draw(seqDisp, p, 0.4f, Color.White, Common.EFont.Monospace, false);
                    int rectW = (int)ResText.MeasureStringWidth(seqDisp, Common.EFont.Monospace, 0.4f);
                    ResRectangle.Draw(new Point(p.X - 10, p.Y - 1), new Size(rectW + 20, 31), Color.FromArgb(180, Color.Black));
                }
            }
        }
Пример #6
0
 public void LoadText(DatabinTable <ResText, ushort> textDataBin)
 {
     if (textDataBin != null)
     {
         this.m_textMap = new Dictionary <string, string>();
         Dictionary <long, object> .Enumerator enumerator = textDataBin.GetEnumerator();
         while (enumerator.MoveNext())
         {
             KeyValuePair <long, object> current = enumerator.Current;
             ResText text = (ResText)current.Value;
             this.m_textMap.Add(StringHelper.UTF8BytesToString(ref text.szKey), StringHelper.UTF8BytesToString(ref text.szValue));
         }
     }
 }
 public void LoadText(DatabinTable <ResText, ushort> textDataBin)
 {
     if (textDataBin == null)
     {
         return;
     }
     this.m_textMap = new Dictionary <int, string>();
     Dictionary <long, object> .Enumerator enumerator = textDataBin.GetEnumerator();
     while (enumerator.MoveNext())
     {
         KeyValuePair <long, object> current = enumerator.get_Current();
         ResText resText = (ResText)current.get_Value();
         this.m_textMap.Add(StringHelper.UTF8BytesToString(ref resText.szKey).JavaHashCode(), StringHelper.UTF8BytesToString(ref resText.szValue));
     }
 }
Пример #8
0
        public override void Draw()
        {
            base.Draw();

            var alpha = (Focused || !CanBeFocused) ? 255 : 200;

            if (!string.IsNullOrEmpty(TextTitle))
            {
                ResText.Draw(TextTitle, SafeSize.AddPoints(new Point(40, 20)), 1.5f, Color.FromArgb(alpha, Color.White), Common.EFont.ChaletLondon, false);
            }

            if (!string.IsNullOrEmpty(Text))
            {
                var ww = WordWrap == 0 ? BottomRight.X - TopLeft.X - 40 : WordWrap;

                ResText.Draw(Text, SafeSize.AddPoints(new Point(40, 150)), 0.4f, Color.FromArgb(alpha, Color.White), Common.EFont.ChaletLondon, ResText.Alignment.Left, false, false, new Size((int)ww, 0));
            }
        }
Пример #9
0
        public override void Draw()
        {
            base.Draw();

            var alpha      = (Focused || !CanBeFocused) ? 180 : 60;
            var blackAlpha = (Focused || !CanBeFocused) ? 200 : 90;
            var fullAlpha  = (Focused || !CanBeFocused) ? 255 : 150;

            var rectSize = (int)(BottomRight.X - TopLeft.X);

            for (int i = 0; i < Dictionary.Count; i++)
            {
                ResRectangle.Draw(new Point(TopLeft.X, TopLeft.Y + (40 * i)), new Size(rectSize, 40), i % 2 == 0 ? Color.FromArgb(alpha, 0, 0, 0) : Color.FromArgb(blackAlpha, 0, 0, 0));

                var item = Dictionary.ElementAt(i);

                ResText.Draw(item.Key, new Point(TopLeft.X + 6, TopLeft.Y + 5 + (40 * i)), 0.35f, Color.FromArgb(fullAlpha, Color.White), Common.EFont.ChaletLondon, false);
                ResText.Draw(item.Value, new Point(BottomRight.X - 6, TopLeft.Y + 5 + (40 * i)), 0.35f, Color.FromArgb(fullAlpha, Color.White), Common.EFont.ChaletLondon, ResText.Alignment.Right, false, false, Size.Empty);
            }
        }
Пример #10
0
        private void FindText(ResText txt)
        {
            var lines = txt.GetText(false);

            string[] tr = null;
            if (_package.HasTranslate)
            {
                tr = txt.GetText(true);
            }
            for (int i = 0; i < lines.Length; i++)
            {
                if (IsPass(lines[i]))
                {
                    AddResult(txt, i, lines[i]);
                }
                else if (tr != null && IsPass(tr[i]))
                {
                    AddResult(txt, i, tr[i]);
                }
            }
        }
Пример #11
0
        private void FindText(ResText txt)
        {
            var lines = txt.GetStrings();

            string[] tr = null;
            if (_translate != null)
            {
                tr = _translate.Get(txt).GetStrings();
            }
            for (int i = 0; i < lines.Length; i++)
            {
                if (IsPass(lines[i]))
                {
                    AddResult(txt, i, lines[i]);
                }
                else if (tr != null && IsPass(tr[i]))
                {
                    AddResult(txt, i, tr[i]);
                }
            }
        }
Пример #12
0
        protected override void ShowResource(Resource res, bool translated)
        {
            dgvText.Rows.Clear();

            ResText txt = (ResText)res;
            var     en  = txt.GetText(false);

            if (res.Package.HasTranslate)
            {
                var ru = txt.GetText(true);
                for (int i = 0; i < en.Length; i++)
                {
                    dgvText.Rows.Add(i, en[i], ru[i]);
                }
            }
            else
            {
                for (int i = 0; i < en.Length; i++)
                {
                    dgvText.Rows.Add(i, en[i], "");
                }
            }
        }
Пример #13
0
        protected override void Reload()
        {
            dgvText.Rows.Clear();

            ResText txt = (ResText)_res;
            var     en  = txt.GetStrings();

            if (_tres != null)
            {
                var tr = _tres.GetStrings();
                for (int i = 0; i < en.Length; i++)
                {
                    dgvText.Rows.Add(i, en[i], tr[i]);
                }
            }
            else
            {
                for (int i = 0; i < en.Length; i++)
                {
                    dgvText.Rows.Add(i, en[i], "");
                }
            }
        }
Пример #14
0
        public void DrawPedInfo(Ped ped, ulong ticksToDraw)
        {
            ulong        tickCount  = Game.TickCount;
            SizeF        res        = RAGENativeUI.UIMenu.GetScreenResolutionMantainRatio();
            ResRectangle background = new ResRectangle(new Point((int)res.Width - 350, (int)res.Height - 600), new Size((int)res.Width, (int)res.Height - 571), Color.FromArgb(170, Color.Black));

            Persona persona       = Functions.GetPersonaForPed(ped);
            ResText nameText      = new ResText("NAME:  ~b~" + persona.FullName.ToUpper(), new Point((int)res.Width - 320, (int)res.Height - 550), 0.3225f, Color.White, RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Left);
            ResText genderText    = new ResText("GENDER:  ~b~" + persona.Gender, new Point((int)res.Width - 320, (int)res.Height - 500), 0.3225f, Color.White, RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Left);
            ResText birthdayText  = new ResText("BIRTHDAY:  ~b~" + persona.BirthDay.ToShortDateString(), new Point((int)res.Width - 320, (int)res.Height - 450), 0.3225f, Color.White, RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Left);
            ResText citationsText = new ResText("CITATIONS:  ~b~" + persona.Citations, new Point((int)res.Width - 320, (int)res.Height - 400), 0.3225f, Color.White, RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Left);
            ResText wantedText    = new ResText("EXTRA INFO:  ~b~" + (persona.Wanted ? "~r~WANTED" : "NONE"), new Point((int)res.Width - 320, (int)res.Height - 350), 0.3225f, Color.White, RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Left);

            _canOverrideDrawInfo = false;
            while (true)
            {
                if ((Game.TickCount - tickCount) > ticksToDraw)
                {
                    break;
                }
                if (Camera == null || !Camera.Exists())
                {
                    break;
                }
                if (_canOverrideDrawInfo)
                {
                    break;
                }
                background.Draw();
                nameText.Draw();
                genderText.Draw();
                birthdayText.Draw();
                citationsText.Draw();
                wantedText.Draw();
                GameFiber.Yield();
            }
        }
Пример #15
0
        public void DrawVehicleInfo(Vehicle vehicle, ulong ticksToDraw)
        {
            ulong        tickCount  = Game.TickCount;
            SizeF        res        = RAGENativeUI.UIMenu.GetScreenResolutionMantainRatio();
            ResRectangle background = new ResRectangle(new Point((int)res.Width - 350, (int)res.Height - 600), new Size((int)res.Width, (int)res.Height - 571), Color.FromArgb(170, Color.Black));

            ResText plateText          = new ResText("PLATE:  ~b~" + vehicle.LicensePlate.ToUpper(), new Point((int)res.Width - 320, (int)res.Height - 550), 0.3225f, Color.White, RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Left);
            ResText ownerText          = new ResText("OWNER:  ~b~" + Functions.GetVehicleOwnerName(vehicle), new Point((int)res.Width - 320, (int)res.Height - 500), 0.3225f, Color.White, RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Left);
            ResText modelText          = new ResText("MODEL:  ~b~" + vehicle.Model.Name.ToUpper(), new Point((int)res.Width - 320, (int)res.Height - 450), 0.3225f, Color.White, RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Left);
            ResText primaryColorText   = new ResText("PRIMARY COLOR:  ~b~" + vehicle.GetPrimaryColor().ToFriendlyName().ToUpper(), new Point((int)res.Width - 320, (int)res.Height - 400), 0.3225f, Color.White, RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Left);
            ResText secondaryColorText = new ResText("SECONDARY COLOR:  ~b~" + vehicle.GetSecondaryColor().ToFriendlyName().ToUpper(), new Point((int)res.Width - 320, (int)res.Height - 350), 0.3225f, Color.White, RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Left);

            _canOverrideDrawInfo = false;
            while (true)
            {
                if ((Game.TickCount - tickCount) > ticksToDraw)
                {
                    break;
                }
                if (Camera == null || !Camera.Exists())
                {
                    break;
                }
                if (_canOverrideDrawInfo)
                {
                    break;
                }
                background.Draw();
                plateText.Draw();
                ownerText.Draw();
                modelText.Draw();
                primaryColorText.Draw();
                secondaryColorText.Draw();
                GameFiber.Yield();
            }
        }
Пример #16
0
        public override void Draw()
        {
            base.Draw();
            if (Heists.Count == 0)
            {
                return;
            }

            res = UIMenu.GetScreenResolutionMantainRatio();

            var activeWidth = res.Width - SafeSize.X * 2;
            var itemSize    = new Size((int)activeWidth - 515, 40);

            var alpha      = Focused ? 120 : 30;
            var blackAlpha = Focused ? 200 : 100;
            var fullAlpha  = Focused ? 255 : 150;

            var counter = 0;

            for (int i = _minItem; i < Math.Min(Heists.Count, _maxItem); i++)
            {
                ResRectangle.Draw(SafeSize.AddPoints(new Point(0, (itemSize.Height + 3) * counter)), itemSize, (Index == i && Focused) ? Color.FromArgb(fullAlpha, Color.White) : Color.FromArgb(blackAlpha, Color.Black));
                ResText.Draw(Heists[i].Name, SafeSize.AddPoints(new Point(6, 5 + (itemSize.Height + 3) * counter)), 0.35f, Color.FromArgb(fullAlpha, (Index == i && Focused) ? Color.Black : Color.White), Common.EFont.ChaletLondon, false);
                counter++;
            }

            if (Heists[Index].Logo == null || (Heists[Index].Logo.Sprite == null && Heists[Index].Logo.Texture == null))
            {
                drawTexture      = false;
                _noLogo.Position = new Point((int)res.Width - SafeSize.X - 512, SafeSize.Y);
                _noLogo.Color    = Color.FromArgb(blackAlpha, 0, 0, 0);
                _noLogo.Draw();
            }
            else if (Heists[Index].Logo != null && Heists[Index].Logo.Texture != null && !Heists[Index].Logo.IsGameSprite)
            {
                drawTexture = true;
            }
            else if (Heists[Index].Logo != null && Heists[Index].Logo.Sprite != null && Heists[Index].Logo.IsGameSprite)
            {
                drawTexture = false;
                Sprite sprite = Heists[Index].Logo.Sprite;
                sprite.Position = new Point((int)res.Width - SafeSize.X - 512, SafeSize.Y);
                sprite.Color    = Color.FromArgb(blackAlpha, 0, 0, 0);
                sprite.Draw();
            }
            else
            {
                drawTexture = false;
            }

            ResRectangle.Draw(new Point((int)res.Width - SafeSize.X - 512, SafeSize.Y + 256), new Size(512, 40), Color.FromArgb(fullAlpha, Color.Black));
            ResText.Draw(Heists[Index].Name, new Point((int)res.Width - SafeSize.X - 4, SafeSize.Y + 260), 0.5f, Color.FromArgb(fullAlpha, Color.White), Common.EFont.HouseScript, ResText.Alignment.Right, false, false, Size.Empty);

            for (int i = 0; i < Heists[Index].ValueList.Count; i++)
            {
                ResRectangle.Draw(new Point((int)res.Width - SafeSize.X - 512, SafeSize.Y + 256 + 40 + (40 * i)), new Size(512, 40), i % 2 == 0 ? Color.FromArgb(alpha, 0, 0, 0) : Color.FromArgb(blackAlpha, 0, 0, 0));
                var text  = Heists[Index].ValueList[i].Item1;
                var label = Heists[Index].ValueList[i].Item2;


                ResText.Draw(text, new Point((int)res.Width - SafeSize.X - 506, SafeSize.Y + 260 + 42 + (40 * i)), 0.35f, Color.FromArgb(fullAlpha, Color.White), Common.EFont.ChaletLondon, false);
                ResText.Draw(label, new Point((int)res.Width - SafeSize.X - 6, SafeSize.Y + 260 + 42 + (40 * i)), 0.35f, Color.FromArgb(fullAlpha, Color.White), Common.EFont.ChaletLondon, ResText.Alignment.Right, false, false, Size.Empty);
            }

            if (!string.IsNullOrEmpty(Heists[Index].Description))
            {
                var propLen = Heists[Index].ValueList.Count;
                ResRectangle.Draw(new Point((int)res.Width - SafeSize.X - 512, SafeSize.Y + 256 + 42 + 40 * propLen), new Size(512, 2), Color.FromArgb(fullAlpha, Color.White));
                ResText.Draw(Heists[Index].Description, new Point((int)res.Width - SafeSize.X - 508, SafeSize.Y + 256 + 45 + 40 * propLen + 4), 0.35f, Color.FromArgb(fullAlpha, Color.White), Common.EFont.ChaletLondon, ResText.Alignment.Left, false, false, new Size(508, 0));

                ResRectangle.Draw(new Point((int)res.Width - SafeSize.X - 512, SafeSize.Y + 256 + 44 + 40 * propLen), new Size(512, 45 * (StringMeasurer.MeasureString(Heists[Index].Description) / 500)), Color.FromArgb(blackAlpha, 0, 0, 0));
            }
        }
Пример #17
0
        public override void Draw()
        {
            if (!Visible)
            {
                return;
            }

            base.Draw();

            int blackAlpha = Focused ? 200 : 100;
            int fullAlpha  = Focused ? 255 : 150;

            int  subMenuWidth = (BottomRight.X - TopLeft.X);
            Size itemSize     = new Size(subMenuWidth, 40);

            int i = 0;

            for (int c = minItem; c < Math.Min(Items.Count, maxItem); c++)
            {
                //bool hovering = UIMenu.IsMouseInBounds(SafeSize.AddPoints(new Point(0, (itemSize.Height + 3) * i)), itemSize);

                bool hasLeftBadge  = Items[c].LeftBadgeInfo != null;
                bool hasRightBadge = Items[c].RightBadgeInfo != null;

                bool hasBothBadges = hasRightBadge && hasLeftBadge;
                bool hasAnyBadge   = hasRightBadge || hasLeftBadge;

                ResRectangle.Draw(SafeSize.AddPoints(new Point(0, (itemSize.Height + 3) * i)), itemSize, (Index == c && Focused) ? Color.FromArgb(fullAlpha, Color.White) : /*Focused && hovering ? Color.FromArgb(100, 50, 50, 50) :*/ Color.FromArgb(blackAlpha, Color.Black));
                ResText.Draw(Items[c].Text, SafeSize.AddPoints(new Point((hasBothBadges ? 60 : hasAnyBadge ? 30 : 6), 5 + (itemSize.Height + 3) * i)), 0.35f, Color.FromArgb(fullAlpha, (Index == c && Focused) ? Color.Black : Color.White), Common.EFont.ChaletLondon, false);

                bool selected = (Index == c && Focused);
                if (hasLeftBadge && !hasRightBadge && !Items[c].LeftBadgeInfo.IsBlank &&
                    BadgeToSprite(Items[c].LeftBadgeInfo, selected, out string badgeTxd, out string badgeTex))
                {
                    Sprite.Draw(badgeTxd, badgeTex,
                                SafeSize.AddPoints(new Point(-2, 1 + (itemSize.Height + 3) * i)), new Size(40, 40), 0f,
                                BadgeToColor(Items[c].LeftBadgeInfo, selected));
                }

                if (!hasLeftBadge && hasRightBadge && !Items[c].RightBadgeInfo.IsBlank &&
                    BadgeToSprite(Items[c].RightBadgeInfo, selected, out badgeTxd, out badgeTex))
                {
                    Sprite.Draw(badgeTxd, badgeTex,
                                SafeSize.AddPoints(new Point(-2, 1 + (itemSize.Height + 3) * i)), new Size(40, 40), 0f,
                                BadgeToColor(Items[c].RightBadgeInfo, selected));
                }

                if (hasLeftBadge && hasRightBadge)
                {
                    if (!Items[c].LeftBadgeInfo.IsBlank && BadgeToSprite(Items[c].LeftBadgeInfo, selected, out badgeTxd, out badgeTex))
                    {
                        Sprite.Draw(badgeTxd, badgeTex,
                                    SafeSize.AddPoints(new Point(-2, 1 + (itemSize.Height + 3) * i)), new Size(40, 40), 0f,
                                    BadgeToColor(Items[c].LeftBadgeInfo, selected));
                    }

                    if (!Items[c].RightBadgeInfo.IsBlank && BadgeToSprite(Items[c].RightBadgeInfo, selected, out badgeTxd, out badgeTex))
                    {
                        Sprite.Draw(badgeTxd, badgeTex,
                                    SafeSize.AddPoints(new Point(25, 1 + (itemSize.Height + 3) * i)), new Size(40, 40), 0f,
                                    BadgeToColor(Items[c].RightBadgeInfo, selected));
                    }
                }

                if (!String.IsNullOrEmpty(Items[c].RightLabel))
                {
                    ResText.Draw(Items[c].RightLabel,
                                 SafeSize.AddPoints(new Point(BottomRight.X - SafeSize.X - 5, 5 + (itemSize.Height + 3) * i)),
                                 0.35f, Color.FromArgb(fullAlpha, (Index == c && Focused) ? Color.Black : Color.White),
                                 Common.EFont.ChaletLondon, ResText.Alignment.Right, false, false, Size.Empty);
                }

                if (Items[c] is UIMenuCheckboxItem)
                {
                    string textureName;
                    if (c == Index && Focused)
                    {
                        textureName = ((UIMenuCheckboxItem)Items[c]).Checked ? "shop_box_tickb" : "shop_box_blankb";
                    }
                    else
                    {
                        textureName = ((UIMenuCheckboxItem)Items[c]).Checked ? "shop_box_tick" : "shop_box_blank";
                    }
                    Sprite.Draw("commonmenu", textureName, SafeSize.AddPoints(new Point(BottomRight.X - SafeSize.X - 60, -5 + (itemSize.Height + 3) * i)), new Size(50, 50), 0f, Color.White);
                }
                else if (Items[c] is UIMenuListItem)
                {
                    var convItem = (UIMenuListItem)Items[c];

                    var yoffset = 5;
                    var basePos =
                        SafeSize.AddPoints(new Point(BottomRight.X - SafeSize.X - 30, yoffset + (itemSize.Height + 3) * i));

                    var arrowLeft  = new Sprite("commonmenu", "arrowleft", basePos, new Size(30, 30));
                    var arrowRight = new Sprite("commonmenu", "arrowright", basePos, new Size(30, 30));
                    var itemText   = new ResText("", basePos, 0.35f, Color.White, Common.EFont.ChaletLondon, ResText.Alignment.Right);

                    string caption = (convItem.Collection == null ? convItem.IndexToItem(convItem.Index) : convItem.Collection[convItem.Index]).ToString();
                    {
                        // prepare text style for TextCommands.GetWidth
                        int         screenw = Game.Resolution.Width;
                        int         screenh = Game.Resolution.Height;
                        const float height  = 1080f;
                        float       ratio   = (float)screenw / screenh;
                        var         width   = height * ratio;
                        float       x       = (itemText.Position.X) / width;
                        N.SetTextFont((int)itemText.FontEnum);
                        N.SetTextScale(0.0f, itemText.Scale);
                        N.SetTextRightJustify(true);
                        N.SetTextWrap(0.0f, x);
                    }
                    int offset = (int)(TextCommands.GetWidth(caption) * Game.Resolution.Width);

                    itemText.Color = convItem.Enabled ? selected ? Color.Black : Color.WhiteSmoke : Color.FromArgb(163, 159, 148);

                    itemText.Caption = caption;

                    arrowLeft.Color  = convItem.Enabled ? selected ? Color.Black : Color.WhiteSmoke : Color.FromArgb(163, 159, 148);
                    arrowRight.Color = convItem.Enabled ? selected ? Color.Black : Color.WhiteSmoke : Color.FromArgb(163, 159, 148);

                    arrowLeft.Position = SafeSize.AddPoints(new Point(BottomRight.X - SafeSize.X - 60 - offset, yoffset + (itemSize.Height + 3) * i));
                    if (selected)
                    {
                        arrowLeft.Draw();
                        arrowRight.Draw();
                        itemText.Position = SafeSize.AddPoints(new Point(BottomRight.X - SafeSize.X - 30, yoffset + (itemSize.Height + 3) * i));
                    }
                    else
                    {
                        itemText.Position = SafeSize.AddPoints(new Point(BottomRight.X - SafeSize.X - 5, yoffset + (itemSize.Height + 3) * i));
                    }

                    itemText.Draw();
                }

                //if (Focused && hovering && (Common.IsDisabledControlJustPressed(0, GameControl.CursorAccept) || Game.IsControlJustPressed(0, GameControl.CursorAccept)))
                //{
                //    bool open = Index == c;
                //    Index = (1000 - (1000 % Items.Count) + c) % Items.Count;
                //    if (!open)
                //        Common.PlaySound("NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET");
                //    else
                //    {
                //        if (Items[Index] is UIMenuCheckboxItem)
                //        {
                //            Common.PlaySound("SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET");
                //            UIMenuCheckboxItem cb = (UIMenuCheckboxItem)Items[Index];
                //            cb.Checked = !cb.Checked;
                //            cb.CheckboxEventTrigger();
                //        }
                //        else
                //        {
                //            Common.PlaySound("SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET");
                //            Items[Index].ItemActivate(null);
                //        }
                //    }
                //}

                i++;
            }
        }
Пример #18
0
        public void Update()
        {
            if (!Visible || TemporarilyHidden)
            {
                return;
            }

            ShowInstructionalButtons();
            NativeFunction.Natives.HideHudAndRadarThisFrame();
            //NativeFunction.CallByHash<uint>(0xaae7ce1d63167423); // _SHOW_CURSOR_THIS_FRAME

            ProcessControls();

            var res  = UIMenu.GetScreenResolutionMantainRatio();
            var safe = new Point(300, 180);

            if (!HideTabs)
            {
                ResText.Draw(Title, new Point(safe.X, safe.Y - 80), 1f, Color.White, Common.EFont.ChaletComprimeCologne, ResText.Alignment.Left, true, false, Size.Empty);

                if (Photo == null)
                {
                    Sprite.Draw("char_multiplayer", "char_multiplayer", new Point((int)res.Width - safe.X - 64, safe.Y - 80), new Size(64, 64), 0f, Color.White);
                }
                else
                {
                    Photo.Position = new Point((int)res.Width - safe.X - 100, safe.Y - 80);
                    Photo.Size     = new Size(64, 64);
                    Photo.Draw();
                }

                ResText.Draw(Name, new Point((int)res.Width - safe.X - 70, safe.Y - 95), 0.7f, Color.White, Common.EFont.ChaletComprimeCologne, ResText.Alignment.Right, true, false, Size.Empty);

                string subt = Money;
                if (string.IsNullOrEmpty(Money))
                {
                    subt = DateTime.Now.ToString();
                }


                ResText.Draw(subt, new Point((int)res.Width - safe.X - 70, safe.Y - 60), 0.4f, Color.White, Common.EFont.ChaletComprimeCologne, ResText.Alignment.Right, true, false, Size.Empty);

                ResText.Draw(MoneySubtitle, new Point((int)res.Width - safe.X - 70, safe.Y - 40), 0.4f, Color.White, Common.EFont.ChaletComprimeCologne, ResText.Alignment.Right, true, false, Size.Empty);

                for (int i = 0; i < Tabs.Count; i++)
                {
                    var activeSize = res.Width - 2 * safe.X;
                    activeSize -= 4 * 5;
                    int tabWidth = (int)activeSize / Tabs.Count;

                    //Game.DisableControlAction(0, GameControl.CursorX, false);
                    //Game.DisableControlAction(0, GameControl.CursorY, false);

                    //bool hovering = UIMenu.IsMouseInBounds(safe.AddPoints(new Point((tabWidth + 5) * i, 0)), new Size(tabWidth, 40));

                    var tabColor = Tabs[i].Active ? Color.White : /*hovering ? Color.FromArgb(100, 50, 50, 50) :*/ Color.Black;
                    ResRectangle.Draw(safe.AddPoints(new Point((tabWidth + 5) * i, 0)), new Size(tabWidth, 40), Color.FromArgb(Tabs[i].Active ? 255 : 200, tabColor));

                    ResText.Draw(Tabs[i].Title.ToUpper(), safe.AddPoints(new Point((tabWidth / 2) + (tabWidth + 5) * i, 5)), 0.35f, Tabs[i].Active ? Color.Black : Color.White, Common.EFont.ChaletLondon, ResText.Alignment.Centered, false, false, Size.Empty);

                    if (Tabs[i].Active)
                    {
                        ResRectangle.Draw(safe.SubtractPoints(new Point(-((tabWidth + 5) * i), 10)), new Size(tabWidth, 10), Color.DodgerBlue);
                    }

                    //if (hovering && Common.IsDisabledControlJustPressed(0, GameControl.CursorAccept) && !Tabs[i].Active)
                    //{
                    //    Tabs[Index].Active = false;
                    //    Tabs[Index].Focused = false;
                    //    Tabs[Index].Visible = false;
                    //    Index = (1000 - (1000 % Tabs.Count) + i) % Tabs.Count;
                    //    Tabs[Index].Active = true;
                    //    Tabs[Index].Focused = true;
                    //    Tabs[Index].Visible = true;
                    //    Tabs[Index].JustOpened = true;

                    //    FocusLevel = Tabs[Index].CanBeFocused ? 1 : 0;

                    //    Common.PlaySound("NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET");
                    //}
                }
            }

            Tabs[Index].Draw();

            _sc.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1);

            _sc.Render2D();
        }
Пример #19
0
        public void Load(MissionData mission)
        {
            CurrentStage      = -1;
            CurrentObjectives = new List <SerializableObjective>();
            CurrentMission    = mission;
            IsMissionPlaying  = true;

            if (mission.Objectives.Count == 0)
            {
                Game.DisplayNotification("No spawnpoint found for stage 0.");
                AbortMission();
                return;
            }

            _oldModel = Game.LocalPlayer.Model;
            _oldPos   = Game.LocalPlayer.Character.Position;

            GameFiber.StartNew(delegate
            {
                Game.FadeScreenOut(1000, true);
                LoadInteriors();

                World.Weather   = CurrentMission.Weather;
                World.TimeOfDay = new TimeSpan(CurrentMission.Time, 0, 0);

                var res = UIMenu.GetScreenResolutionMantainRatio();

                var name     = new ResText(CurrentMission.Name, new Point((int)res.Width - 100, (int)res.Height - 100), 0.7f, Color.WhiteSmoke, Common.EFont.HouseScript, ResText.Alignment.Right);
                name.Outline = true;

                GameFiber.StartNew(delegate
                {
                    DateTime start = DateTime.Now;
                    while (DateTime.Now.Subtract(start).TotalMilliseconds < 10000)
                    {
                        name.Draw();
                        GameFiber.Yield();
                    }
                });

                var startTime = Game.GameTime;

                while (IsMissionPlaying)
                {
                    Game.MaxWantedLevel = CurrentMission.MaxWanted;
                    if (Game.LocalPlayer.WantedLevel < CurrentMission.MinWanted)
                    {
                        Game.LocalPlayer.WantedLevel = CurrentMission.MinWanted;
                    }

                    if (Game.LocalPlayer.Character.IsDead)
                    {
                        FailMission(true);
                        break;
                    }

                    if (CurrentMission.TimeLimit.HasValue)
                    {
                        var elapsed = TimeSpan.FromMilliseconds(Convert.ToDouble((CurrentMission.TimeLimit.Value * 1000) - (Game.GameTime - startTime)));
                        if (TimerBars != null)
                        {
                            TimerBars.UpdateValue("GLOBAL_TIME", "TIME", false, string.Format("{0:D2}:{1:D2}.{2:D3}", elapsed.Minutes, elapsed.Seconds, elapsed.Milliseconds));
                        }
                    }

                    if (CurrentMission.TimeLimit.HasValue && (Game.GameTime - startTime) > CurrentMission.TimeLimit * 1000)
                    {
                        FailMission(reason: "You have run out of time.");
                        break;
                    }

                    if (CurrentObjectives.Count == 0)
                    {
                        AdvanceStage();
                        if (!CurrentMission.Objectives.Any(o => o.ActivateAfter >= CurrentStage))
                        {
                            SucceedMission();
                        }
                    }

                    TimerBars?.Draw();
                    GameFiber.Yield();
                }

                UnloadInteriors();
            });
        }
Пример #20
0
        private async Task ApplyTranslate(ResText r)
        {
            try
            {
                var part = Book.GetVolume(r.ToString());
                if (part == null) // Ресурс без перевода
                {
                    return;
                }

                if (String.IsNullOrEmpty(part.DateChange)) // Пропускаем части без перевода
                {
                    return;
                }

                if (_cache != null && _cache.TryGetValue(r.ToString(), out string changed) && changed.Equals(part.DateChange)) // Пропускаем неизмененные части
                {
                    return;
                }

                var enLines = r.GetText(false); // Оригинальный текст
                var ruLines = r.GetText(true);  // Уже переведенный текст

                if (enLines.Length != ruLines.Length)
                {
                    Console.WriteLine($"{r} Lines count error");
                    return;
                }

                var translates = await Book.GetTranslates(part.URL);

                bool hasTranslate = false;

                var notaEn = translates.Keys.ToHashSet();

                for (int i = 0; i < enLines.Length; i++)
                {
                    var en = enLines[i];
                    if (String.IsNullOrEmpty(en))
                    {
                        continue;
                    }

                    if (!translates.TryGetValue(en, out var tr))
                    {
                        en = en.Replace("\n", "\r\n");
                        if (!translates.TryGetValue(en, out tr))
                        {
                            //Console.WriteLine($"Missing tex {r} - {en}");
                            continue;
                        }
                    }

                    if (tr == null)
                    {
                        continue;
                    }

                    notaEn.Remove(en);

                    var ru = ruLines[i];
                    if (tr.Equals(ru)) // Пропускаем старый перевод
                    {
                        continue;
                    }

                    Console.WriteLine(ru);
                    Console.WriteLine(tr);
                    Console.WriteLine();

                    hasTranslate = true;

                    ruLines[i] = tr;
                }

                if (notaEn.Count > 0)
                {
                    Console.WriteLine($"Not found nota in {r.FileName}");
                    foreach (var nota in notaEn)
                    {
                        Console.WriteLine(nota);
                    }
                }

                if (hasTranslate)
                {
                    Console.WriteLine(r);
                    r.SetTranslate(ruLines);
                    _hasChanges = true;
                }
            }
            finally
            {
                _progress++;
                ReportProgress?.Invoke(_progress * 100 / _total);
            }
        }