浏览代码

check graphic api

/main
siyao 3 年前
当前提交
e8d1f872
共有 2 个文件被更改,包括 51 次插入13 次删除
  1. 7
      .gitignore
  2. 57
      com.unity.uiwidgets/Runtime/engine/UIWidgetsPanel.cs

7
.gitignore


# uiwidgets
Samples/Assets/Plugins/**
engine/build/**
engine/third_party/skia
engine/third_party/skia
engine/Scripts/depot_tools/
engine/Scripts/engine/
engine/Scripts/engine2/
engine/build_debug/
engine/icudtl.o

57
com.unity.uiwidgets/Runtime/engine/UIWidgetsPanel.cs


using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Profiling;
using UnityEngine.Rendering;
using UnityEngine.Scripting;
using UnityEngine.UI;
using Path = System.IO.Path;

UIWidgetsWindowType getWindowType();
}
public class Configurations {
private Dictionary<string, TextFont> _textFonts = new Dictionary<string, TextFont>();
public void Clear() {

_textFonts[key: family] = font;
_textFonts[key: family] = font;
}
public object fontsToObject() {
Dictionary<string, TextFont> settings = _textFonts;

for (var j = 0; j < setting.Value.fonts.Length; j++) {
var fontDic = new Dictionary<string, object>();
var fileExist = false;
if (setting.Value.fonts[j].asset.Length > 0) {
var assetPath = setting.Value.fonts[j].asset;
var assetAbsolutePath = Path.Combine(Application.streamingAssetsPath, assetPath);

}
}
[ExecuteInEditMode]
[ExecuteInEditMode]
public partial class UIWidgetsPanel : RawImage, IUIWidgetsWindow {
static List<UIWidgetsPanel> panels = new List<UIWidgetsPanel>();

UIWidgetsMessageManager.instance?.AddChannelMessageDelegate("ViewportMetricsChanged",
_handleViewMetricsChanged);
}
#if !UNITY_EDITOR
CollectGarbageOnDemand();
#endif

return true;
}
#endif
static bool UIWidgetsDisabled;
void DisableUIWidgets() {
Debug.Log("Please change graphic api for UIWidgets.\n" +
"Metal for iOS and MacOS.\n" +
"Direct3D for Windows\n" +
"Vulkan for Android\n");
UIWidgetsDisabled = true;
enabled = false;
}
if (UIWidgetsDisabled) {
enabled = false;
return;
}
var type = SystemInfo.graphicsDeviceType;
if(type != GraphicsDeviceType.OpenGLES2 && type != GraphicsDeviceType.OpenGLES3){
DisableUIWidgets();
return;
}
#endif
#if UNITY_IOS || UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX
if (type != GraphicsDeviceType.Metal) {
DisableUIWidgets();
return;
}
#endif
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
if (type != GraphicsDeviceType.Direct3D11 && type != GraphicsDeviceType.Direct3D12) {
DisableUIWidgets();
return;
}
if(canvas == null){
if (canvas == null) {
enabled = false;
startCoroutine(ReEnableUIWidgetsNextFrame());
return;

Hooks.tryHook();
#endif
#if !UNITY_EDITOR
TryEnableOnDemandGC();
Application.lowMemory += () => {

#endif
base.OnEnable();
D.assert(_wrapper == null);
_configurations = new Configurations();
_wrapper = new UIWidgetsPanelWrapper();

protected virtual void onEnable() {
}
_configurations.AddFont(family,font);
_configurations.AddFont(family, font);
}
protected void AddFont(string family, List<string> assets, List<int> weights) {

textFont.fonts = fonts;
AddFont(family: family, font: textFont);
}
protected virtual void main() {
}
}

}
}
}
#if UNITY_ANDROID && !UNITY_EDITOR
if (Input.GetKeyDown(KeyCode.Escape)) {
using (Isolate.getScope(anyIsolate)) {

正在加载...
取消
保存