浏览代码

fix

/siyaoH-1.17-PlatformMessage
siyao 4 年前
当前提交
2cf92294
共有 2 个文件被更改,包括 16 次插入16 次删除
  1. 24
      com.unity.uiwidgets/Runtime/engine/UIWidgetsMessageManager.cs
  2. 8
      com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanel.cs

24
com.unity.uiwidgets/Runtime/engine/UIWidgetsMessageManager.cs


}
void OnUIWidgetsMethodMessage(string message) {
using (Isolate.getScope(UIWidgetsPanel.anyIsolate)) {
JSONObject jsonObject = (JSONObject) JSON.Parse(message);
string channel = jsonObject["channel"].Value;
string method = jsonObject["method"].Value;
var args = new List<JSONNode>(jsonObject["args"].AsArray.Children);
if (string.IsNullOrEmpty(channel) || string.IsNullOrEmpty(method)) {
Debug.LogError("invalid uiwidgets method message");
}
else {
MethodChannelMessageDelegate exists;
_methodChannelMessageDelegates.TryGetValue(channel, out exists);
exists?.Invoke(method, args);
}
JSONObject jsonObject = (JSONObject) JSON.Parse(message);
string channel = jsonObject["channel"].Value;
string method = jsonObject["method"].Value;
var args = new List<JSONNode>(jsonObject["args"].AsArray.Children);
if (string.IsNullOrEmpty(channel) || string.IsNullOrEmpty(method)) {
Debug.LogError("invalid uiwidgets method message");
}
else {
MethodChannelMessageDelegate exists;
_methodChannelMessageDelegates.TryGetValue(channel, out exists);
exists?.Invoke(method, args);
}
}

8
com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanel.cs


bool _viewMetricsCallbackRegistered;
void _handleViewMetricsChanged(string method, List<JSONNode> args) {
_wrapper.displayMetrics.onViewMetricsChanged();
Window.instance.updateSafeArea();
Window.instance.onMetricsChanged?.Invoke();
using (Isolate.getScope(anyIsolate)) {
_wrapper.displayMetrics.onViewMetricsChanged();
Window.instance.updateSafeArea();
Window.instance.onMetricsChanged?.Invoke();
}
}
protected virtual void Update() {

正在加载...
取消
保存