Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alianblank/blankbatterystate
BlankBatteryState
https://github.com/alianblank/blankbatterystate
battery battery-info battery-status batterystate ios unity unity-3d unity-asset unity-scripts unity2d unity3d unity3d-plugin unityplugins
Last synced: 20 days ago
JSON representation
BlankBatteryState
- Host: GitHub
- URL: https://github.com/alianblank/blankbatterystate
- Owner: AlianBlank
- License: mit
- Created: 2019-08-28T02:43:53.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-01-19T02:04:35.000Z (almost 3 years ago)
- Last Synced: 2024-11-03T15:42:43.478Z (2 months ago)
- Topics: battery, battery-info, battery-status, batterystate, ios, unity, unity-3d, unity-asset, unity-scripts, unity2d, unity3d, unity3d-plugin, unityplugins
- Language: Objective-C++
- Size: 10.8 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BlankBatteryState
用于在 Unity3D 中获取Android 和 iOS 平台上电池状态和电量值的插件
# Example
> Return Result Fromat 返回值格式
> {"status":1,"value":100}
> status => 1 状态未知 2 电池充电中 3 放电中 4 未充电 5 满电量
> value => BatteryValue 电量值
>
```csharpusing System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class BlankBatteryStateExample : MonoBehaviour
{
private string result = "";
// Update is called once per frame
void OnGUI()
{
if (GUILayout.Button("BlankBatteryState", GUILayout.Width(300), GUILayout.Height(200)))
{
try
{
result = BlankBatteryState.GetBatteryState();
}
catch (Exception e)
{
result = e.Message;
}}
GUILayout.Label(result);
}
}```