minor bug fixes
This commit is contained in:
Родитель
57512785d1
Коммит
59f8799d55
|
@ -1,75 +0,0 @@
|
|||
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
|
||||
)
|
||||
),
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
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());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,7 +2,8 @@
|
|||
"name": "UIWidgetsEditorWindowSample",
|
||||
"references": [
|
||||
"Unity.UIWidgets",
|
||||
"Unity.UIWidgets.Editor"
|
||||
"Unity.UIWidgets.Editor",
|
||||
"UIWidgetsGallery"
|
||||
],
|
||||
"optionalUnityReferences": [],
|
||||
"includePlatforms": [],
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "UIWidgetsGallery",
|
||||
"references": [
|
||||
"Unity.UIWidgets"
|
||||
],
|
||||
"optionalUnityReferences": [],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": []
|
||||
}
|
|
@ -4,7 +4,7 @@ using Unity.UIWidgets.rendering;
|
|||
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();
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"name": "UIWidgetsSample",
|
||||
"references": [
|
||||
"Unity.UIWidgets"
|
||||
"Unity.UIWidgets",
|
||||
"UIWidgetsGallery"
|
||||
],
|
||||
"optionalUnityReferences": [],
|
||||
"includePlatforms": [],
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using uiwidgets;
|
||||
using Unity.UIWidgets.editor2;
|
||||
using Unity.UIWidgets.engine2;
|
||||
using Unity.UIWidgets.foundation;
|
||||
using Unity.UIWidgets.ui;
|
||||
using Unity.UIWidgets.widgets;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using Rect = UnityEngine.Rect;
|
||||
|
@ -74,7 +72,6 @@ namespace Unity.UIWidgets.Editor {
|
|||
}
|
||||
|
||||
GUI.DrawTexture(new Rect(0.0f, 0.0f, position.width, position.height), _wrapper.renderTexture);
|
||||
|
||||
Input_OnGUIEvent(Event.current);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ namespace Unity.UIWidgets.engine2 {
|
|||
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)) {
|
||||
|
@ -244,7 +244,7 @@ namespace Unity.UIWidgets.engine2 {
|
|||
}
|
||||
}
|
||||
|
||||
public void Input_OnGUI() {
|
||||
void Input_OnGUI() {
|
||||
Event e = Event.current;
|
||||
if (e.isKey) {
|
||||
_wrapper.OnKeyDown(e);
|
||||
|
|
|
@ -63,15 +63,20 @@ void UIWidgetsSystem::WakeUp() {}
|
|||
|
||||
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);
|
||||
}
|
||||
task();
|
||||
}
|
||||
|
||||
void UIWidgetsSystem::PostTaskToGfxWorker(const fml::closure& task) {
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <cstdarg>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
#include <mutex>
|
||||
|
||||
#include "Unity/IUnityInterface.h"
|
||||
#include "Unity/IUnityUIWidgets.h"
|
||||
|
@ -71,6 +72,8 @@ class UIWidgetsSystem {
|
|||
|
||||
TimePoint next_uiwidgets_event_time_ = TimePoint::clock::now();
|
||||
std::set<UIWidgetsPanel*> uiwidgets_panels_;
|
||||
|
||||
std::mutex task_mutex_;
|
||||
};
|
||||
|
||||
} // namespace uiwidgets
|
||||
|
|
Загрузка…
Ссылка в новой задаче