public Slider(PercentChanged onChanged, float current = 1, float min = 0, float max = 1) { _onChanged = onChanged; _valueToCurrent = new Interpolation(min, max, 0, 1);; _currentToValue = new Interpolation(0, 1, min, max); Current = _valueToCurrent.From(current); Size = new Size(150, 15f); }
void Check() { int oldPercent = 0; while (true) { IntPtr ptr = IntPtr.Add(Game.Read <IntPtr>(Module, new int[] { 0x003222D0, 0x164, 0x124, 0xB4, 0x3C0 }), 0x12C); string readed = Game.ReadString((int)ptr, 4); if (!readed.Contains("%")) { oldPercent = -1; Thread.Sleep(150); continue; } int curPercent = int.Parse(readed.Split('%')[0]); if (curPercent != oldPercent) { PercentChanged?.Invoke(curPercent); oldPercent = curPercent; } Thread.Sleep(RefreshDelay); } }