先修复一下,错误的场景 删除不必要的钓场资产 修复into场景 update:更新meta文件,修复报错 update:修复资源 修复第一章节建造 修复建造第三章 update:删除多余内容 update:更新README.md update:还原图标 update:更新README update:更新配置
66 lines
1.7 KiB
C#
66 lines
1.7 KiB
C#
using UnityEngine;
|
|
using UnityEngine.AddressableAssets;
|
|
using System.Linq;
|
|
// using tysdk;
|
|
|
|
public class GpuEvaluation
|
|
{
|
|
private class GpuData
|
|
{
|
|
public int tier;
|
|
public string[] keywords;
|
|
}
|
|
|
|
private static GpuData[] _devdatas;
|
|
private static GpuData[] DevDatas
|
|
{
|
|
get{
|
|
if(_devdatas == null)
|
|
{
|
|
var handle = Addressables.LoadAssetAsync<TextAsset>("gpudata");
|
|
handle.WaitForCompletion();
|
|
_devdatas = Newtonsoft.Json.JsonConvert.DeserializeObject<GpuData[]>(handle.Result.text);
|
|
}
|
|
return _devdatas;
|
|
}
|
|
}
|
|
|
|
public static int? GetTier(string deviceName)
|
|
{
|
|
foreach (var device in DevDatas)
|
|
{
|
|
var keywords = device.keywords;
|
|
if (keywords.All(k => deviceName.IndexOf(k) >= 0))
|
|
{
|
|
var info = string.Join(" ", keywords);
|
|
Debug.Log($"[GpuEvaluation] Found Match Gpu {info} Tier {device.tier}");
|
|
#if AGG
|
|
using(var track = GEvent.TackEvent("GpuEvaluation"))
|
|
{
|
|
track.AddContent("record", true);
|
|
track.AddContent("gpu", deviceName);
|
|
track.AddContent("tier", device.tier);
|
|
}
|
|
#endif
|
|
return device.tier;
|
|
}
|
|
}
|
|
|
|
#if AGG
|
|
using(var track = GEvent.TackEvent("GpuEvaluation"))
|
|
{
|
|
track.AddContent("record", false);
|
|
track.AddContent("gpu", deviceName);
|
|
track.AddContent("tier", 1);
|
|
}
|
|
#endif
|
|
return null;
|
|
}
|
|
|
|
#if UNITY_EDITOR
|
|
public static int Tier => 3;
|
|
#else
|
|
public static int Tier => GetTier(SystemInfo.graphicsDeviceName) ?? 2;
|
|
#endif
|
|
}
|