浏览代码

minor bug fixes

/siyaoH-1.17-PlatformMessage
xingweizhu 4 年前
当前提交
0cac1c89
共有 11 个文件被更改,包括 54 次插入87 次删除
  1. 3
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorWindowSample/UIWidgetsEditorWindowSample.asmdef
  2. 2
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/cupertino/cupertino_switch_demo.cs
  3. 3
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsSample.asmdef
  4. 3
      com.unity.uiwidgets/Editor/UIWidgetsEditorPanel.cs
  5. 4
      com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanel.cs
  6. 13
      engine/src/shell/platform/unity/windows/uiwidgets_system.cc
  7. 3
      engine/src/shell/platform/unity/windows/uiwidgets_system.h
  8. 21
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorWindowSample/GalleryMain.cs
  9. 14
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/UIWidgetsGallery.asmdef
  10. 75
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorWindowSample/CountDemo.cs
  11. 0
      /Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorWindowSample/GalleryMain.cs.meta

3
Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorWindowSample/UIWidgetsEditorWindowSample.asmdef


"name": "UIWidgetsEditorWindowSample",
"references": [
"Unity.UIWidgets",
"Unity.UIWidgets.Editor"
"Unity.UIWidgets.Editor",
"UIWidgetsGallery"
],
"optionalUnityReferences": [],
"includePlatforms": [],

2
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/demo/cupertino/cupertino_switch_demo.cs


using Unity.UIWidgets.widgets;
namespace UIWidgetsGallery.gallery {
class CupertinoSwitchDemo : StatefulWidget {
public class CupertinoSwitchDemo : StatefulWidget {
public static string routeName = "/cupertino/switch";
public override State createState() => new _CupertinoSwitchDemoState();

3
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsSample.asmdef


{
"name": "UIWidgetsSample",
"references": [
"Unity.UIWidgets"
"Unity.UIWidgets",
"UIWidgetsGallery"
],
"optionalUnityReferences": [],
"includePlatforms": [],

3
com.unity.uiwidgets/Editor/UIWidgetsEditorPanel.cs


using System.Collections;
using System.Collections.Generic;
using uiwidgets;
using Unity.UIWidgets.widgets;
using UnityEditor;
using UnityEngine;
using Rect = UnityEngine.Rect;

}
GUI.DrawTexture(new Rect(0.0f, 0.0f, position.width, position.height), _wrapper.renderTexture);
Input_OnGUIEvent(Event.current);
}
}

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


void Input_OnDisable() {
}
public void Input_Update() {
void Input_Update() {
if (Input.touchCount == 0 && Input.mousePresent) {
if (_isEntered) {
if (!Input.GetMouseButton(0) && !Input.GetMouseButton(1) && !Input.GetMouseButton(2)) {

}
}
public void Input_OnGUI() {
void Input_OnGUI() {
Event e = Event.current;
if (e.isKey) {
_wrapper.OnKeyDown(e);

13
engine/src/shell/platform/unity/windows/uiwidgets_system.cc


void UIWidgetsSystem::GfxWorkerCallback(int eventId, void* data) {
const fml::closure task(std::move(gfx_worker_tasks_[eventId]));
gfx_worker_tasks_.erase(eventId);
{
std::scoped_lock(task_mutex_);
gfx_worker_tasks_.erase(eventId);
}
last_task_id_++;
gfx_worker_tasks_[last_task_id_] = task;
{
std::scoped_lock(task_mutex_);
last_task_id_++;
gfx_worker_tasks_[last_task_id_] = task;
}
unity_uiwidgets_->IssuePluginEventAndData(&_GfxWorkerCallback, last_task_id_,
nullptr);
}

3
engine/src/shell/platform/unity/windows/uiwidgets_system.h


#include <cstdarg>
#include <set>
#include <unordered_map>
#include <mutex>
#include "Unity/IUnityInterface.h"
#include "Unity/IUnityUIWidgets.h"

TimePoint next_uiwidgets_event_time_ = TimePoint::clock::now();
std::set<UIWidgetsPanel*> uiwidgets_panels_;
std::mutex task_mutex_;
};
} // namespace uiwidgets

21
Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorWindowSample/GalleryMain.cs


using UIWidgetsGallery.gallery;
using Unity.UIWidgets.Editor;
using UnityEditor;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsEditorWindowSample
{
public class EditorWindowGallery : UIWidgetsEditorPanel
{
[MenuItem("UIWidgets/EditorSample")]
public static void CountDemo()
{
CreateWindow<EditorWindowGallery>();
}
protected override void main()
{
ui_.runApp(new GalleryApp());
}
}
}

14
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsGallery/UIWidgetsGallery.asmdef


{
"name": "UIWidgetsGallery",
"references": [
"Unity.UIWidgets"
],
"optionalUnityReferences": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
}

75
Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorWindowSample/CountDemo.cs


using System.Collections.Generic;
using Unity.UIWidgets.cupertino;
using Unity.UIWidgets.Editor;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEditor;
using Text = Unity.UIWidgets.widgets.Text;
using ui_ = Unity.UIWidgets.widgets.ui_;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
namespace UIWidgetsEditorWindowSample
{
public class EditorWindowCountDemo : UIWidgetsEditorPanel
{
[MenuItem("UIWidgets/CountDemo")]
public static void CountDemo()
{
CreateWindow<EditorWindowCountDemo>();
}
protected override void main()
{
ui_.runApp(new MyApp());
}
class MyApp : StatelessWidget
{
public override Widget build(BuildContext context)
{
return new CupertinoApp(
home: new EditorWindowCounterApp()
);
}
}
}
internal class EditorWindowCounterApp : StatefulWidget
{
public override State createState()
{
return new EditorWindowCounterState();
}
}
internal class EditorWindowCounterState : State<EditorWindowCounterApp>
{
private int count = 0;
public override Widget build(BuildContext context)
{
return new Container(
color: Color.fromARGB(255, 255, 0, 0),
child: new Column(children: new List<Widget>()
{
new Text($"count: {count}", style: new TextStyle(color: Color.fromARGB(255, 0 ,0 ,255))),
new CupertinoButton(
onPressed: () =>
{
setState(() =>
{
count++;
});
},
child: new Container(
color: Color.fromARGB(255,0 , 255, 0),
width: 100,
height: 40
)
),
}
)
);
}
}
}

/Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorWindowSample/CountDemo.cs.meta → /Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorWindowSample/GalleryMain.cs.meta

正在加载...
取消
保存