您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
52 行
1.5 KiB
52 行
1.5 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UIWidgets.foundation;
|
|
using UIWidgets.rendering;
|
|
using UIWidgets.ui;
|
|
using UnityEngine.Assertions;
|
|
|
|
namespace UIWidgets.widgets {
|
|
abstract class WidgetsBinding : RendererBinding {
|
|
protected WidgetsBinding(Window window) : base(window) {
|
|
this.buildOwner.onBuildScheduled = this._handleBuildScheduled;
|
|
window.onLocaleChanged += this.handleLocaleChanged;
|
|
window.onAccessibilityFeaturesChanged += handleAccessibilityFeaturesChanged;
|
|
}
|
|
|
|
public BuildOwner buildOwner {
|
|
get { return this._buildOwner; }
|
|
}
|
|
|
|
readonly BuildOwner _buildOwner;
|
|
|
|
public Element renderViewElement {
|
|
get { return this._renderViewElement; }
|
|
}
|
|
|
|
Element _renderViewElement;
|
|
|
|
void _handleBuildScheduled() {
|
|
ensureVisualUpdate();
|
|
}
|
|
|
|
void handleLocaleChanged() {
|
|
// todo
|
|
// dispatchLocaleChanged(window.locale);
|
|
}
|
|
|
|
void handleAccessibilityFeaturesChanged() {
|
|
// for (WidgetsBindingObserver observer in _observers) {
|
|
// observer.didChangeAccessibilityFeatures();
|
|
// }
|
|
}
|
|
|
|
protected override void drawFrame() {
|
|
if (renderViewElement != null) {
|
|
buildOwner.buildScope(renderViewElement);
|
|
}
|
|
base.drawFrame();
|
|
buildOwner.finalizeTree();
|
|
}
|
|
}
|
|
}
|