浏览代码

fix typo and style

/main
kg 6 年前
当前提交
206625fa
共有 2 个文件被更改,包括 34 次插入34 次删除
  1. 62
      Editor/editor/EditorUtils.cs
  2. 6
      Runtime/engine/DisplayMetrics.cs

62
Editor/editor/EditorUtils.cs


namespace Unity.UIWidgets.Editor {
[InitializeOnLoad]
public class EitorUtils {
static EitorUtils() {
public class EditorUtils {
static EditorUtils() {
DisplayMetricsProvider.provider = () => new EditorPlayerDisplayMetrics();
}
}

float _lastDevicePixelRatio = 0;
public void OnGUI() {
}
public void OnGUI() {
}
public void Update() {
this._lastDevicePixelRatio = GameViewUtil.getGameViewDevicePixelRatio();
public void Update() {
this._lastDevicePixelRatio = GameViewUtil.getGameViewDevicePixelRatio();
}
public float DevicePixelRatio {

internal static class GameViewUtil {
static class GameViewUtil {
public static float getGameViewDevicePixelRatio(float fallback = 1) {
public static float getGameViewDevicePixelRatio(float fallback = 1) {
loadTypeIfNeed();
EditorWindow gameview = getMainGameView();

}
return fallback;
}
}
static EditorWindow getMainGameView() {
IEnumerable enumerable = null;
if (!getFieldValue(null, "s_GameViews", ref enumerable)) {
return null;
}
IEnumerator enumerator = enumerable != null ? enumerable.GetEnumerator() : null;
if (enumerator != null && enumerator.MoveNext()) {
return enumerator.Current as EditorWindow;
}
return null;
}
static EditorWindow getMainGameView() {
IEnumerable enumerable = null;
if (!getFieldValue(null, "s_GameViews", ref enumerable)) {
return null;
}
IEnumerator enumerator = enumerable != null ? enumerable.GetEnumerator() : null;
if (enumerator != null && enumerator.MoveNext()) {
return enumerator.Current as EditorWindow;
}
return null;
}
| BindingFlags.NonPublic
| BindingFlags.Static | BindingFlags.Instance);
| BindingFlags.NonPublic
| BindingFlags.Static | BindingFlags.Instance);
result = (T)fieldInfo.GetValue(ins);
result = (T) fieldInfo.GetValue(ins);
return true;
}

}
}
}
var property = _gameViewType.GetProperty(name, BindingFlags.Public
| BindingFlags.NonPublic |
BindingFlags.Static | BindingFlags.Instance);
var property = _gameViewType.GetProperty(name,
BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.Static | BindingFlags.Instance);
if (property == null) {
return false;
}

6
Runtime/engine/DisplayMetrics.cs


}
#if UNITY_ANDROID
_devicePixelRatio = AndroidDevicePixelRatio();
this._devicePixelRatio = AndroidDevicePixelRatio();
_devicePixelRatio = UIWidgetsWebGLDevicePixelRatio();
this._devicePixelRatio = UIWidgetsWebGLDevicePixelRatio();
_devicePixelRatio = IOSDeviceScaleFactor();
this._devicePixelRatio = IOSDeviceScaleFactor();
#endif
if (this._devicePixelRatio <= 0) {

正在加载...
取消
保存