浏览代码

Merge branch 'master' into gallery

/main
Yuncong Zhang 5 年前
当前提交
c2840c02
共有 3 个文件被更改,包括 32 次插入0 次删除
  1. 6
      Runtime/Plugins/platform/ios/UIWidgetsViewController.mm
  2. 8
      Runtime/engine/UIWidgetsPanel.cs
  3. 18
      Runtime/widgets/binding.cs

6
Runtime/Plugins/platform/ios/UIWidgetsViewController.mm


CGFloat bottom = CGRectGetHeight([[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue]);
CGFloat scale = [UIScreen mainScreen].scale;
// scale == 3 => screen is 1242 * 2208 => we have to perform down-sampling to obtain the real length
// 0.8696 = 1920 / 2208, the vertical down-sampling ratio
if (scale == 3) {
bottom = bottom * 0.8696;
}
viewInsets.bottom = bottom * scale;
padding.bottom = 0;

8
Runtime/engine/UIWidgetsPanel.cs


protected virtual void Update() {
this._displayMetrics.Update();
UIWidgetsMessageManager.ensureUIWidgetsMessageManagerIfNeeded();
#if UNITY_ANDROID
if (Input.GetKeyDown(KeyCode.Escape)) {
this._windowAdapter.withBinding(() => {
WidgetsBinding.instance.handlePopRoute();
});
}
#endif
if (!this._viewMetricsCallbackRegistered) {
this._viewMetricsCallbackRegistered = true;

18
Runtime/widgets/binding.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using UnityEngine;
namespace Unity.UIWidgets.widgets {
public interface WidgetsBindingObserver {

public bool removeObserver(WidgetsBindingObserver observer) {
return this._observers.Remove(observer);
}
public void handlePopRoute() {
var idx = -1;
void _handlePopRouteSub(bool result) {
if (!result) {
idx++;
if (idx >= this._observers.Count) {
Application.Quit();
return;
}
this._observers[idx].didPopRoute().Then(_handlePopRouteSub);
}
}
_handlePopRouteSub(false);
}
public readonly WidgetInspectorService widgetInspectorService;

正在加载...
取消
保存