Ejemplo n.º 1
0
        /// <summary>
        /// Renders fuel bar
        /// </summary>
        /// <param name="currentFuelLevel"></param>
        /// <param name="maxFuelLevel"></param>
        public void RenderBar(float currentFuelLevel, float maxFuelLevel)
        {
            float  fuelLevelPercentage = (100f / maxFuelLevel) * currentFuelLevel;
            PointF safeZone            = GetSafezoneBounds();

            if (IsBigmapActive())
            {
                Position = new PointF(basePosition.X + safeZone.X, basePosition.Y - safeZone.Y - 180f);
            }
            else
            {
                Position = new PointF(basePosition.X + safeZone.X, basePosition.Y - safeZone.Y);
            }

            fuelBarBackdropSize = new SizeF(fuelBarWidth(), 12f);
            fuelBarSize         = new SizeF((fuelBarWidth() / 100f) * fuelLevelPercentage, fuelBarHeight);
            fuelBarBackSize     = fuelBarSize;

            fuelBar.Size         = fuelBarSize;
            fuelBarBackdrop.Size = fuelBarBackdropSize;
            fuelBarBack.Size     = fuelBarBackSize;



            if (maxFuelLevel > 0 && currentFuelLevel < 9f)
            {
                if (fuelBarColorTween.State == TweenState.Stopped)
                {
                    fuelBarAnimationDir = !fuelBarAnimationDir;

                    fuelBarColorTween.Start(
                        fuelBarAnimationDir ? 100f : 255f,
                        fuelBarAnimationDir ? 255f : 100f,
                        .5f, // seconds
                        ScaleFuncs.QuarticEaseOut
                        );
                }

                fuelBarColorTween.Update(Game.LastFrameTime);

                fuelBar.Color = Color.FromArgb((int)Math.Floor(fuelBarColorTween.CurrentValue), fuelBarColourWarning);
            }
            else
            {
                fuelBar.Color = fuelBarColourNormal;

                if (fuelBarColorTween.State != TweenState.Stopped)
                {
                    fuelBarColorTween.Stop(StopBehavior.ForceComplete);
                }
            }

            fuelBarBackdrop.Draw();
            fuelBarBack.Draw();
            fuelBar.Draw();
        }
Ejemplo n.º 2
0
        private async Task drawingAsync()
        {
            while (true)
            {
                await Delay(0);

                if (MasterInterfaceToggle && (CameraTech.FixedANPRAlertsToggle || VehicleANPR.Active))
                {
                    //API.DrawRect(0.508f, 0.94f, 0.196f, 0.116f, 0, 0, 0, 150);
                    Rectangle rect = new Rectangle(new PointF(Screen.Width * 0.001f, Screen.Height * 0.5f), new SizeF(Screen.Width * 0.16f, Screen.Height * 0.126f), Color.FromArgb(150, 0, 0, 0));
                    Text      vehicleANPRHeader      = new Text("Vehicle ANPR - " + VehicleANPRHeaderString, new PointF(Screen.Width * 0.08f, Screen.Height * 0.501f), scale, Color.FromArgb(255, 0, 191, 255), Font.ChaletComprimeCologne, Alignment.Center);
                    Text      vehicleANPRInfoText    = new Text(VehicleANPRInfo, new PointF(Screen.Width * 0.08f, Screen.Height * 0.519f), scale, Color.FromArgb(255, 255, 255, 255), Font.ChaletComprimeCologne, Alignment.Center);
                    Text      vehicleANPRMarkersText = new Text(VehicleANPRMarkers, new PointF(Screen.Width * 0.08f, Screen.Height * 0.537f), scale, Color.FromArgb(255, 255, 255, 255), Font.ChaletComprimeCologne, Alignment.Center);
                    if (!VehicleANPR.Active)
                    {
                        vehicleANPRInfoText.Caption    = "~r~DISABLED";
                        vehicleANPRMarkersText.Caption = "";
                    }

                    string focussedString = "Fixed";
                    if (CameraTech.FocussedPlate != null)
                    {
                        focussedString = "Focussed";
                    }
                    Text fixedANPRHeader      = new Text(focussedString + " ANPR - " + FixedANPRHeaderString, new PointF(Screen.Width * 0.08f, Screen.Height * 0.555f), scale, Color.FromArgb(255, 0, 191, 255), Font.ChaletComprimeCologne, Alignment.Center);
                    Text fixedANPRInfoText    = new Text(FixedANPRInfo, new PointF(Screen.Width * 0.08f, Screen.Height * 0.573f), scale, Color.FromArgb(255, 255, 255, 255), Font.ChaletComprimeCologne, Alignment.Center);
                    Text fixedANPRMarkersText = new Text(FixedANPRMarkers, new PointF(Screen.Width * 0.08f, Screen.Height * 0.591f), scale, Color.FromArgb(255, 255, 255, 255), Font.ChaletComprimeCologne, Alignment.Center);
                    if (!CameraTech.FixedANPRAlertsToggle)
                    {
                        fixedANPRInfoText.Caption    = "~r~DISABLED";
                        fixedANPRMarkersText.Caption = "";
                    }

                    if (Game.Player != null && Game.Player.Character != null && Game.Player.Character.Exists() && Game.Player.Character.IsInVehicle() && Game.Player.Character.CurrentVehicle.Exists() &&
                        CameraTech.ANPRModels.Contains(Game.Player.Character.CurrentVehicle.Model))
                    {
                        rect.Draw();
                        vehicleANPRHeader.Draw();
                        vehicleANPRInfoText.Draw();
                        vehicleANPRMarkersText.Draw();
                        fixedANPRHeader.Draw();
                        fixedANPRInfoText.Draw();
                        fixedANPRMarkersText.Draw();
                    }
                }
            }
        }