mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Refactor PowerStatus (now called BatteryInfo)
This commit is contained in:
24
osu.Game/Utils/BatteryInfo.cs
Normal file
24
osu.Game/Utils/BatteryInfo.cs
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
namespace osu.Game.Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides access to the system's power status.
|
||||
/// </summary>
|
||||
public abstract class BatteryInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The charge level of the battery, from 0 to 1.
|
||||
/// </summary>
|
||||
public abstract double ChargeLevel { get; }
|
||||
|
||||
public abstract bool IsCharging { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the battery is currently low in charge.
|
||||
/// Returns true if not charging and current charge level is lower than or equal to 25%.
|
||||
/// </summary>
|
||||
public bool IsLowBattery => !IsCharging && ChargeLevel <= 0.25;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user