浏览代码

Merge pull request #143 from UnityTech/textselection

handle navigation back button events (within-unity solution)
/main
GitHub 6 年前
当前提交
7a84b502
共有 2 个文件被更改,包括 26 次插入0 次删除
  1. 8
      Runtime/engine/UIWidgetsPanel.cs
  2. 18
      Runtime/widgets/binding.cs

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;

正在加载...
取消
保存