浏览代码

add a uiwidgetPanel host to StoreConnector, so that we can binding it to the right window.instance when stateChanged callback is triggered

/dev_k12
xingwei.zhu 4 年前
当前提交
70ecfd32
共有 1 个文件被更改,包括 19 次插入2 次删除
  1. 21
      com.unity.uiwidgets/Runtime/redux/widget_redux.cs

21
com.unity.uiwidgets/Runtime/redux/widget_redux.cs


using System;
using Unity.UIWidgets.editor;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;

public readonly bool pure;
public readonly UIWidgetsEditorWindow host;
UIWidgetsEditorWindow host = null,
ViewModelBuilder<ViewModel> builder = null,
StoreConverter<State, ViewModel> converter = null,
bool pure = false,

D.assert(converter != null);
this.host = host;
this.pure = pure;
this.builder = builder;
this.converter = converter;

builder: this.builder,
converter: this.converter,
pure: this.pure,
shouldRebuild: this.shouldRebuild
shouldRebuild: this.shouldRebuild,
host : this.host
);
}
}

public readonly bool pure;
public readonly UIWidgetsEditorWindow host;
public _StoreListener(
ViewModelBuilder<ViewModel> builder = null,
StoreConverter<State, ViewModel> converter = null,

UIWidgetsEditorWindow host = null,
Key key = null) : base(key) {
D.assert(builder != null);
D.assert(converter != null);

this.converter = converter;
this.pure = pure;
this.shouldRebuild = shouldRebuild;
this.host = host;
}
public override widgets.State createState() {

}
void _handleStateChanged(State state) {
if (Window.hasInstance) {
if (this.widget.host != null) {
var preInstance = Window.instance;
using (WindowProvider.of(this.widget.host).getScope()) {
this._innerStateChanged(state);
}
Window.instance = preInstance;
}
else if (Window.hasInstance) {
this._innerStateChanged(state);
}
else {

正在加载...
取消
保存