using UnityEngine; using System.Collections; using System.Collections.Generic; publicclassGameControllerScript:MonoBehaviour { //指定輸出文本框 publicUnityEngine.UI.Text messageText; //存儲臨時字符串 System.Text.StringBuilder info =newSystem.Text.StringBuilder(); // Use this for initialization voidStart() { //將輸出文本框置空 messageText.text =""; info.AppendLine("設備與系統信息:"); //設備的模型 GetMessage("設備模型",SystemInfo.deviceModel); //設備的名稱 GetMessage("設備名稱",SystemInfo.deviceName); //設備的類型 GetMessage("設備類型(PC電腦,掌上型)",SystemInfo.deviceType.ToString()); //系統內存大小 GetMessage("系統內存大小MB",SystemInfo.systemMemorySize.ToString()); //操作系統 GetMessage("操作系統",SystemInfo.operatingSystem); //設備的唯一標識符 GetMessage("設備唯一標識符",SystemInfo.deviceUniqueIdentifier); //顯卡設備標識ID GetMessage("顯卡ID",SystemInfo.graphicsDeviceID.ToString()); //顯卡名稱 GetMessage("顯卡名稱",SystemInfo.graphicsDeviceName); //顯卡類型 GetMessage("顯卡類型",SystemInfo.graphicsDeviceType.ToString()); //顯卡供應商 GetMessage("顯卡供應商",SystemInfo.graphicsDeviceVendor); //顯卡供應唯一ID GetMessage("顯卡供應唯一ID",SystemInfo.graphicsDeviceVendorID.ToString()); //顯卡版本號 GetMessage("顯卡版本號",SystemInfo.graphicsDeviceVersion); //顯卡內存大小 GetMessage("顯存大小MB",SystemInfo.graphicsMemorySize.ToString()); //顯卡是否支持多線程渲染 GetMessage("顯卡是否支持多線程渲染",SystemInfo.graphicsMultiThreaded.ToString()); //支持的渲染目標數量 GetMessage("支持的渲染目標數量",SystemInfo.supportedRenderTargetCount.ToString()); //輸出 messageText.text = info.ToString(); } // Update is called once per frame voidUpdate() { //退出 if(Input.GetKeyUp("escape")) { if(Input.GetKeyUp("escape")) { Application.Quit(); } } } voidGetMessage(paramsstring[] str) { if(str.Length==2) { info.AppendLine(str[0]+":"+ str[1]); } } }
