Files
Main/Assets/Code/Logic/_Required/Profiler/Asset/PFAssetPhoneInfoForm.cs
2025-01-25 04:38:09 +08:00

90 lines
3.6 KiB
C#

using Thousandto.Core.Base;
using Thousandto.Core.Framework;
using System.Collections.Generic;
using UnityEngine;
namespace Thousandto.Code.Logic
{
/// <summary>
/// 游戏资源生命周期和使用情况监视面板
/// </summary>
public class PFAssetPhoneInfoForm : MonoBehaviour
{
public IDeviceInfo phoneInfo = null;
public Rect backrect;
Texture2D BlackBlank;
Texture2D WhiteBlank;
void Awake()
{
phoneInfo = HardwareManager.DeviceInfo;
backrect = new Rect(0, 0, 400, UnityEngine.Screen.height);
BlackBlank = PFAssetDefines.CreateColorTex(new Color(0, 0, 0, 1f), 10, 10);
WhiteBlank = PFAssetDefines.CreateColorTex(new Color(1, 1, 1, 0.5f), 10, 10);
}
public float Duration = 0f;
void OnGUI()
{
var oldTextAnchor = GUI.skin.label.alignment;
GUI.skin.label.alignment = TextAnchor.MiddleCenter;
var x = UnityEngine.Screen.width / 2 - backrect.width / 2;
GUI.DrawTexture(new Rect(x, 0, backrect.width, backrect.height), BlackBlank, ScaleMode.StretchToFill);
//设备机型
Color color = GUI.color;
int index = 0;
GUI.DrawTexture(new Rect(x+50, index * 50, 300, 40), WhiteBlank, ScaleMode.StretchToFill);
GUI.color = Color.red;
GUI.Label(new Rect(x+10, index * 50, 400, 50), "手机型号:" + phoneInfo.GetPhoneBrand());
GUI.color = color;
index++;
//设备IMEI
GUI.DrawTexture(new Rect(x + 50, index * 50, 300, 40), WhiteBlank, ScaleMode.StretchToFill);
GUI.color = Color.red;
GUI.Label(new Rect(x + 10, index * 50, 400, 50), "IMEI:" + phoneInfo.GetPhoneImei());
GUI.color = color;
index++;
//设备IMSI
GUI.DrawTexture(new Rect(x + 50, index * 50, 300, 40), WhiteBlank, ScaleMode.StretchToFill);
GUI.color = Color.red;
GUI.Label(new Rect(x + 10, index * 50, 400, 50), "IMSI:" + phoneInfo.GetPhoneImsi());
GUI.color = color;
index++;
//设备CPU型号
GUI.DrawTexture(new Rect(x + 50, index * 50, 300, 40), WhiteBlank, ScaleMode.StretchToFill);
GUI.color = Color.red;
GUI.Label(new Rect(x + 10, index * 50, 400, 50), "CPU型号:" + phoneInfo.GetPhoneCPUName());
GUI.color = color;
index++;
//设备CPU频率
GUI.DrawTexture(new Rect(x + 50, index * 50, 300, 40), WhiteBlank, ScaleMode.StretchToFill);
GUI.color = Color.red;
GUI.Label(new Rect(x + 10, index * 50, 400, 50), "CPU频率:" + phoneInfo.GetPhoneCPUFrequency());
GUI.color = color;
index++;
//设备CPU数量
GUI.DrawTexture(new Rect(x + 50, index * 50, 300, 40), WhiteBlank, ScaleMode.StretchToFill);
GUI.color = Color.red;
GUI.Label(new Rect(x + 10, index * 50, 400, 50), "CPU数量:" + phoneInfo.GetPhoneCores());
GUI.color = color;
index++;
//设备mac地址
GUI.DrawTexture(new Rect(x + 50, index * 50, 300, 40), WhiteBlank, ScaleMode.StretchToFill);
GUI.color = Color.red;
GUI.Label(new Rect(x + 10, index * 50, 400, 50), "mac地址:" + phoneInfo.GetMacAddress());
GUI.color = color;
index++;
GUI.skin.label.alignment = oldTextAnchor;
//关闭
if (GUI.Button(new Rect(x+ backrect.width, 30, 50, 50), "Close"))
{
Destroy(this);
}
}
}
}