Exemple #1
0
    void UpdateStatusIndicators()
    {
        var currentBatteryLevel = BatteryLevelPlugin.GetBatteryLevel() * 100f;

        batteryLevelText.text = String.Format("{0}%", currentBatteryLevel);

        if (currentBatteryLevel >= 88)
        {
            batteryLevelIcon.text = BATTERY_LEVEL_100;
        }
        else if (currentBatteryLevel >= 63)
        {
            batteryLevelIcon.text = BATTERY_LEVEL_75;
        }
        else if (currentBatteryLevel >= 38)
        {
            batteryLevelIcon.text = BATTERY_LEVEL_50;
        }
        else if (currentBatteryLevel >= 13)
        {
            batteryLevelIcon.text = BATTERY_LEVEL_25;
        }
        else
        {
            batteryLevelIcon.text = BATTERY_LEVEL_0;
        }
    }
Exemple #2
0
    /// <summary>
    /// Find the current device battery level and update indicators in the
    /// UI accordingly.
    /// </summary>
    void UpdateStatusIndicators()
    {
        var currentBatteryLevel = BatteryLevelPlugin.GetBatteryLevel() * 100f;

        batteryLevelText.text = "Battery:" + String.Format("{0}%", currentBatteryLevel);

        // Show the icon that matches the current level most closely.
        if (currentBatteryLevel >= 88)
        {
            batteryLevelIcon.text = BATTERY_LEVEL_100;
        }
        else if (currentBatteryLevel >= 63)
        {
            batteryLevelIcon.text = BATTERY_LEVEL_75;
        }
        else if (currentBatteryLevel >= 38)
        {
            batteryLevelIcon.text = BATTERY_LEVEL_50;
        }
        else if (currentBatteryLevel >= 13)
        {
            batteryLevelIcon.text = BATTERY_LEVEL_25;
        }
        else
        {
            batteryLevelIcon.text = BATTERY_LEVEL_0;
        }
    }
Exemple #3
0
 void Update()
 {
     UpdateStatusIndicators();
     sysTime.text = BatteryLevelPlugin.GetSysTime();
 }