Esempio n. 1
0
        private async void Functions()
        {
            if (ScreenTools.IsMouseInBounds(new PointF(BackgroundBar.Position.X + safezoneOffset.X, BackgroundBar.Position.Y - 4f + safezoneOffset.Y), new SizeF(BackgroundBar.Size.Width, BackgroundBar.Size.Height + 8f)))
            {
                if (API.IsDisabledControlPressed(0, 24))
                {
                    if (!Pressed)
                    {
                        Pressed  = true;
                        Audio.Id = API.GetSoundId();
                        API.PlaySoundFrontend(Audio.Id, Audio.Slider, Audio.Library, true);
                    }
                    await BaseScript.Delay(0);

                    float Progress = API.GetDisabledControlNormal(0, 239) * Resolution.Width;
                    Progress      -= ActiveBar.Position.X + safezoneOffset.X;
                    ActiveBar.Size = new SizeF(Progress >= 0 && Progress <= 413 ? Progress : (Progress < 0 ? 0 : 413), ActiveBar.Size.Height);
                    UpdateParent((float)Math.Round(Progress >= 0 && Progress <= 413 ? Progress : (Progress < 0 ? 0 : 413) / BackgroundBar.Size.Width, 2));
                }
                else
                {
                    API.StopSound(Audio.Id);
                    API.ReleaseSoundId(Audio.Id);
                    Pressed = false;
                }
            }
            else
            {
                API.StopSound(Audio.Id);
                API.ReleaseSoundId(Audio.Id);
                Pressed = false;
            }
        }
Esempio n. 2
0
        internal async void Functions()
        {
            Point safezoneOffset = ScreenTools.SafezoneBounds;

            if (ScreenTools.IsMouseInBounds(new PointF(Grid.Position.X + 20f + safezoneOffset.X, Grid.Position.Y + 20f + safezoneOffset.Y), new SizeF(Grid.Size.Width - 40f, Grid.Size.Height - 40f)))
            {
                if (API.IsDisabledControlPressed(0, 24))
                {
                    if (!Pressed)
                    {
                        Pressed  = true;
                        Audio.Id = API.GetSoundId();
                        API.PlaySoundFrontend(Audio.Id, Audio.Slider, Audio.Library, true);
                        while (API.IsDisabledControlPressed(0, 24) && ScreenTools.IsMouseInBounds(new PointF(Grid.Position.X + 20f + safezoneOffset.X, Grid.Position.Y + 20f + safezoneOffset.Y), new SizeF(Grid.Size.Width - 40f, Grid.Size.Height - 40f)))
                        {
                            await BaseScript.Delay(0);

                            var   res    = ScreenTools.ResolutionMaintainRatio;
                            float mouseX = API.GetDisabledControlNormal(0, 239) * res.Width;
                            float mouseY = API.GetDisabledControlNormal(0, 240) * res.Height;
                            mouseX -= (Circle.Size.Width / 2) + safezoneOffset.X;
                            mouseY -= (Circle.Size.Height / 2) + safezoneOffset.Y;
                            PointF Position = new PointF(mouseX > (Grid.Position.X + 10 + Grid.Size.Width - 40) ? (Grid.Position.X + 10 + Grid.Size.Width - 40) : ((mouseX < (Grid.Position.X + 20 - (Circle.Size.Width / 2))) ? (Grid.Position.X + 20 - (Circle.Size.Width / 2)) : mouseX), mouseY > (Grid.Position.Y + 10 + Grid.Size.Height - 40) ? (Grid.Position.Y + 10 + Grid.Size.Height - 40) : ((mouseY < (Grid.Position.Y + 20 - (Circle.Size.Height / 2))) ? (Grid.Position.Y + 20 - (Circle.Size.Height / 2)) : mouseY));
                            Circle.Position = Position;
                            var resultX = (float)Math.Round((Circle.Position.X - (Grid.Position.X + 20) + (Circle.Size.Width + 20)) / (Grid.Size.Width - 40), 2) + safezoneOffset.X;
                            var resultY = (float)Math.Round((Circle.Position.Y - (Grid.Position.Y + 20) + (Circle.Size.Height + 20)) / (Grid.Size.Height - 40), 2) + safezoneOffset.Y;
                            UpdateParent(((resultX >= 0.0f && resultX <= 1.0f) ? resultX : ((resultX <= 0f) ? 0.0f : 1.0f) * 2f) - 1f, ((resultY >= 0.0f && resultY <= 1.0f) ? resultY : ((resultY <= 0f) ? 0.0f : 1.0f) * 2f) - 1f);
                        }
                        API.StopSound(Audio.Id);
                        API.ReleaseSoundId(Audio.Id);
                        Pressed = false;
                    }
                }
            }
        }
Esempio n. 3
0
 private async void Functions()
 {
     if (ScreenTools.IsMouseInBounds(new PointF(Grid.Position.X + 20f + safezoneOffset.X, Grid.Position.Y + 20f + safezoneOffset.Y), new SizeF(Grid.Size.Width - 40f, Grid.Size.Height - 40f)))
     {
         if (API.IsDisabledControlPressed(0, 24))
         {
             if (!Pressed)
             {
                 Pressed  = true;
                 Audio.Id = API.GetSoundId();
                 API.PlaySoundFrontend(Audio.Id, Audio.Slider, Audio.Library, true);
             }
             float mouseX = API.GetDisabledControlNormal(0, 239) * Resolution.Width;
             mouseX         -= (Circle.Size.Width / 2) + safezoneOffset.X;
             Circle.Position = new PointF(mouseX > (Grid.Position.X + 10 + Grid.Size.Width - 40) ? (Grid.Position.X + 10 + Grid.Size.Width - 40) : ((mouseX < (Grid.Position.X + 20 - (Circle.Size.Width / 2))) ? (Grid.Position.X + 20 - (Circle.Size.Width / 2)) : mouseX), Circle.Position.Y);
             var resultX = (float)Math.Round((Circle.Position.X - (Grid.Position.X + 20) + (Circle.Size.Width + 20)) / (Grid.Size.Width - 40), 2) + safezoneOffset.X;
             UpdateParent(((resultX >= 0.0f && resultX <= 1.0f) ? resultX : ((resultX <= 0f) ? 0.0f : 1.0f) * 2f) - 1f);
         }
         if (API.IsDisabledControlJustReleased(0, 24))
         {
             API.StopSound(Audio.Id);
             API.ReleaseSoundId(Audio.Id);
             Pressed = false;
         }
     }
     else
     {
         API.StopSound(Audio.Id);
         API.ReleaseSoundId(Audio.Id);
         Pressed = false;
     }
 }
Esempio n. 4
0
        private void Functions()
        {
            Point safezoneOffset = ScreenTools.SafezoneBounds;

            if (ScreenTools.IsMouseInBounds(new PointF(LeftArrow.Position.X + safezoneOffset.X, LeftArrow.Position.Y + safezoneOffset.Y), LeftArrow.Size))
            {
                if (API.IsDisabledControlJustPressed(0, 24) || API.IsControlJustPressed(0, 24))
                {
                    GoLeft();
                }
            }
            if (ScreenTools.IsMouseInBounds(new PointF(RightArrow.Position.X + safezoneOffset.X, RightArrow.Position.Y + safezoneOffset.Y), RightArrow.Size))
            {
                if (API.IsDisabledControlJustPressed(0, 24) || API.IsControlJustPressed(0, 24))
                {
                    GoRight();
                }
            }
            for (int Index = 0; Index < Bar.Count; Index++)
            {
                if (ScreenTools.IsMouseInBounds(new PointF(Bar[Index].Position.X + safezoneOffset.X, Bar[Index].Position.Y + safezoneOffset.Y), Bar[Index].Size))
                {
                    if (API.IsDisabledControlJustPressed(0, 24) || API.IsControlJustPressed(0, 24))
                    {
                        CurrentSelection = Data.Pagination.Min + Index;
                        UpdateSelection(true);
                    }
                }
            }
        }
        private async void Functions()
        {
            if (ScreenTools.IsMouseInBounds(new PointF(Grid.Position.X + 20f + safezoneOffset.X, Grid.Position.Y + 20f + safezoneOffset.Y), new SizeF(Grid.Size.Width - 40f, Grid.Size.Height - 40f)))
            {
                if (API.IsDisabledControlPressed(0, 24))
                {
                    if (!Pressed)
                    {
                        Pressed  = true;
                        Audio.Id = API.GetSoundId();
                        API.PlaySoundFrontend(Audio.Id, Audio.Slider, Audio.Library, true);
                    }
                    await BaseScript.Delay(0);

                    float mouseY = API.GetDisabledControlNormal(0, 240) * Resolution.Height;
                    mouseY         -= (Circle.Size.Height / 2) + safezoneOffset.Y;
                    Circle.Position = new PointF(Circle.Position.X, mouseY > (Grid.Position.Y + 10 + Grid.Size.Height - 40) ? (Grid.Position.Y + 10 + Grid.Size.Height - 40) : ((mouseY < (Grid.Position.Y + 20 - (Circle.Size.Height / 2))) ? (Grid.Position.Y + 20 - (Circle.Size.Height / 2)) : mouseY));
                    var resultY = (float)Math.Round((Circle.Position.Y - (Grid.Position.Y + 20) + (Circle.Size.Height + 20)) / (Grid.Size.Height - 40), 2);
                    UpdateParent(((resultY >= 0.0f && resultY <= 1.0f) ? resultY : ((resultY <= 0f) ? 0.0f : 1.0f) * 2f) - 1f);
                }
                else
                {
                    API.StopSound(Audio.Id);
                    API.ReleaseSoundId(Audio.Id);
                    Pressed = false;
                }
            }
            else
            {
                API.StopSound(Audio.Id);
                API.ReleaseSoundId(Audio.Id);
                Pressed = false;
            }
        }
Esempio n. 6
0
        public async void Functions()
        {
            if (ScreenTools.IsMouseInBounds(new PointF(_bar.Position.X, _bar.Position.Y - 7.5f), new SizeF(_max, _bar.Size.Height + 19)))
            {
                if (API.IsDisabledControlPressed(0, 24))
                {
                    if (!Pressed)
                    {
                        Pressed  = true;
                        Audio.Id = API.GetSoundId();
                        API.PlaySoundFrontend(Audio.Id, Audio.Slider, Audio.Library, true);
                        while (API.IsDisabledControlPressed(0, 24) && ScreenTools.IsMouseInBounds(new PointF(_bar.Position.X, _bar.Position.Y - 7.5f), new SizeF(_max, _bar.Size.Height + 19)))
                        {
                            await BaseScript.Delay(0);

                            float CursorX = API.GetDisabledControlNormal(0, 239) * Resolution.Width;
                            CalculateProgress(CursorX);
                            Parent.ProgressChange(this, _index);
                            ProgressChanged(Parent, this, _index);
                        }
                        API.StopSound(Audio.Id);
                        API.ReleaseSoundId(Audio.Id);
                        Pressed = false;
                    }
                }
            }
        }
Esempio n. 7
0
        public async void Functions()
        {
            if (ScreenTools.IsMouseInBounds(new PointF((int)Math.Round(Bar.Position.X), (int)Math.Round(Bar.Position.Y - 12)), new Size((int)Max, (int)Math.Round(Bar.Size.Height + 24)), Offset))
            {
                if (API.IsDisabledControlPressed(0, 24))
                {
                    var   ress    = ScreenTools.ResolutionMaintainRatio;
                    float CursorX = (float)Math.Round(API.GetDisabledControlNormal(0, 239) * ress.Width);
                    CalculateProgress(CursorX);
                    Parent.ProgressChange(this, Index);
                    ProgressChanged(Parent, this, Index);
                    if (!Pressed)
                    {
                        Pressed  = true;
                        Audio.Id = API.GetSoundId();
                        API.PlaySoundFrontend(Audio.Id, Audio.Slider, Audio.Library, true);
                        await BaseScript.Delay(100);

                        API.StopSound(Audio.Id);
                        API.ReleaseSoundId(Audio.Id);
                        Pressed = false;
                    }
                }
            }
        }
Esempio n. 8
0
 private void Functions()
 {
     if (ScreenTools.IsMouseInBounds(LeftArrow.Position, LeftArrow.Size))
     {
         if (API.IsDisabledControlJustPressed(0, 24) || API.IsControlJustPressed(0, 24))
         {
             GoLeft();
         }
     }
     if (ScreenTools.IsMouseInBounds(RightArrow.Position, RightArrow.Size))
     {
         if (API.IsDisabledControlJustPressed(0, 24) || API.IsControlJustPressed(0, 24))
         {
             GoRight();
         }
     }
     for (int Index = 0; Index < Bar.Count; Index++)
     {
         if (ScreenTools.IsMouseInBounds(Bar[Index].Position, Bar[Index].Size))
         {
             if (API.IsDisabledControlJustPressed(0, 24) || API.IsControlJustPressed(0, 24))
             {
                 CurrentSelection = Data.Pagination.Min + Index;
                 UpdateSelection(true);
             }
         }
     }
 }
Esempio n. 9
0
        /// <summary>
        /// Draw item.
        /// </summary>
        public override async Task Draw()
        {
            base.Draw();

            string caption = CurrentListItem;
            float  offset  = ScreenTools.GetTextWidth(caption, _itemText.Font, _itemText.Scale);

            _itemText.Color = Enabled ? Selected ? Colors.Black : Colors.WhiteSmoke : Color.FromArgb(163, 159, 148);

            _itemText.Caption = caption;

            _arrowLeft.Color  = Enabled ? Selected ? Colors.Black : Colors.WhiteSmoke : Color.FromArgb(163, 159, 148);
            _arrowRight.Color = Enabled ? Selected ? Colors.Black : Colors.WhiteSmoke : Color.FromArgb(163, 159, 148);

            _arrowLeft.Position = new PointF(375 - (int)offset + Offset.X + Parent.WidthOffset, _arrowLeft.Position.Y);
            if (Selected)
            {
                _arrowLeft.Draw();
                _arrowRight.Draw();
                _itemText.Position = new PointF(403 + Offset.X + Parent.WidthOffset, _itemText.Position.Y);
            }
            else
            {
                _itemText.Position = new PointF(418 + Offset.X + Parent.WidthOffset, _itemText.Position.Y);
            }
            _itemText.Draw();
        }
Esempio n. 10
0
 public static float MeasureString(string input, Font font, float scale) => ScreenTools.GetTextWidth(input, font, scale);
Esempio n. 11
0
 public static int MeasureString(string input) => (int)ScreenTools.GetTextWidth(input, Font.ChaletLondon, 1f);
Esempio n. 12
0
 public static float MeasureStringWidthNoConvert(string str, Font font, float scale) => ScreenTools.GetTextWidth(str, font, scale);