guanghuispark
3 年前
当前提交
c1db5330
共有 25 个文件被更改,包括 1208 次插入 和 126 次删除
-
50com.unity.uiwidgets.devtools/Editor/v2/dependencies/provider/deferred_inherited_provider.cs
-
26com.unity.uiwidgets.devtools/Editor/v2/dependencies/provider/inherited_provider.cs
-
1com.unity.uiwidgets.devtools/Editor/v2/main.cs
-
52com.unity.uiwidgets.devtools/Editor/v2/src/app.cs
-
54com.unity.uiwidgets.devtools/Editor/v2/src/banner_messages.cs
-
3com.unity.uiwidgets.devtools/Editor/v2/src/config_specific/framework_initialize/framework_initialize.cs
-
7com.unity.uiwidgets.devtools/Editor/v2/src/globals.cs
-
1com.unity.uiwidgets.devtools/Editor/v2/src/initializer.cs
-
186com.unity.uiwidgets.devtools/Editor/v2/src/inspector/diagnostics_node.cs
-
52com.unity.uiwidgets.devtools/Editor/v2/src/inspector/inspector_controller.cs
-
83com.unity.uiwidgets.devtools/Editor/v2/src/inspector/inspector_screen.cs
-
163com.unity.uiwidgets.devtools/Editor/v2/src/inspector/inspector_tree.cs
-
23com.unity.uiwidgets.devtools/Editor/v2/src/inspector/inspector_tree_flutter.cs
-
10com.unity.uiwidgets.devtools/Editor/v2/src/notifications.cs
-
169com.unity.uiwidgets.devtools/Editor/v2/src/scaffold.cs
-
248com.unity.uiwidgets.devtools/Editor/v2/src/split.cs
-
2com.unity.uiwidgets.devtools/Editor/v2/src/theme.cs
-
24com.unity.uiwidgets.devtools/Editor/v2/src/framework_controller.cs
-
48com.unity.uiwidgets.devtools/Editor/v2/src/utils.cs
-
65com.unity.uiwidgets.devtools/Editor/v2/src/config_specific/drag_and_drop/drag_and_drop.cs
-
55com.unity.uiwidgets.devtools/Editor/v2/src/config_specific/import_export/import_export.cs
-
12com.unity.uiwidgets.devtools/Editor/v2/src/framework/framework_core.cs
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using NUnit.Framework.Api; |
|||
public static Dictionary<string, object> offlineDataJson = new Dictionary<string, object>(){}; |
|||
public static FrameworkController frameworkController => globals[typeof(FrameworkController)] as FrameworkController; |
|||
|
|||
public static void setGlobal(Type clazz, dynamic instance) { |
|||
globals[clazz] = instance; |
|||
} |
|||
} |
|||
} |
|
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.ui; |
|||
|
|||
public InspectorController( |
|||
// @required this.inspectorService,
|
|||
InspectorTreeController inspectorTree = null, |
|||
InspectorTreeController detailsTree = null, |
|||
// @required this.treeType,
|
|||
InspectorController parent = null, |
|||
bool isSummaryTree = true, |
|||
VoidCallback onExpandCollapseSupported = null, |
|||
VoidCallback onLayoutExplorerSupported = null |
|||
) |
|||
{ |
|||
this.inspectorTree = inspectorTree; |
|||
this.parent = parent; |
|||
this.isSummaryTree = isSummaryTree; |
|||
this.onExpandCollapseSupported = onExpandCollapseSupported; |
|||
this.onLayoutExplorerSupported = onLayoutExplorerSupported; |
|||
} |
|||
|
|||
InspectorTreeController inspectorTree; |
|||
// public readonly FlutterTreeType treeType;
|
|||
|
|||
// public readonly InspectorService inspectorService;
|
|||
|
|||
bool _disposed = false; |
|||
|
|||
InspectorController parent; |
|||
|
|||
public readonly bool isSummaryTree; |
|||
|
|||
public readonly VoidCallback onExpandCollapseSupported; |
|||
|
|||
public readonly VoidCallback onLayoutExplorerSupported; |
|||
|
|||
|
|||
// public override void dispose() {
|
|||
// D.assert(!_disposed);
|
|||
// _disposed = true;
|
|||
// flutterIsolateSubscription.cancel();
|
|||
// if (inspectorService != null) {
|
|||
// shutdownTree(false);
|
|||
// }
|
|||
// _treeGroups?.clear(false);
|
|||
// _treeGroups = null;
|
|||
// _selectionGroups?.clear(false);
|
|||
// _selectionGroups = null;
|
|||
// details?.dispose();
|
|||
// base.dispose();
|
|||
// }
|
|||
|
|||
|
|||
} |
|||
} |
|
|||
namespace Unity.UIWidgets.DevTools |
|||
{ |
|||
public class FrameworkController |
|||
{ |
|||
public FrameworkController() |
|||
{ |
|||
_init(); |
|||
} |
|||
|
|||
// StreamController<string> _pageChangeController =
|
|||
// StreamController.broadcast();
|
|||
|
|||
void _init() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public void notifyPageChange(string pageId) { |
|||
// _pageChangeController.add(pageId);
|
|||
} |
|||
|
|||
} |
|||
|
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.foundation; |
|||
|
|||
namespace Unity.UIWidgets.DevTools |
|||
{ |
|||
public class utils |
|||
{ |
|||
public static readonly float pi = 3.1415926535897932f; |
|||
public static float degToRad(float deg) => deg * (pi / 180.0f); |
|||
} |
|||
|
|||
class JsonUtils { |
|||
// JsonUtils._();
|
|||
|
|||
public static string getStringMember(Dictionary<string, object> json, string memberName) { |
|||
// TODO(jacobr): should we handle non-string values with a reasonable
|
|||
// toString differently?
|
|||
return json[memberName] as string; |
|||
} |
|||
|
|||
public static int getIntMember(Dictionary<string, object> json, string memberName) { |
|||
if (json.ContainsKey(memberName)) |
|||
{ |
|||
return (int) json[memberName]; |
|||
} |
|||
return -1; |
|||
} |
|||
|
|||
public static List<string> getValues(Dictionary<string, object> json, string member) { |
|||
List<object> values = (List<object>)json[member]; |
|||
if (values == null || values.isEmpty()) { |
|||
return new List<string>(); |
|||
} |
|||
|
|||
List<string> res = new List<string>(); |
|||
foreach (var value in values) |
|||
{ |
|||
res.Add(value.ToString()); |
|||
} |
|||
return res; |
|||
} |
|||
|
|||
static bool hasJsonData(String data) { |
|||
return data != null && data.isNotEmpty() && data != "null"; |
|||
} |
|||
} |
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.widgets; |
|||
using Unity.UIWidgets.foundation; |
|||
|
|||
namespace Unity.UIWidgets.DevTools.config_specific.drag_and_drop |
|||
{ |
|||
|
|||
public delegate void HandleDrop(Dictionary<string, object> data); |
|||
public class DragAndDrop : StatefulWidget { |
|||
public DragAndDrop( |
|||
HandleDrop handleDrop= null, |
|||
Widget child = null |
|||
) |
|||
{ |
|||
this.handleDrop = handleDrop; |
|||
this.child = child; |
|||
} |
|||
|
|||
|
|||
public readonly HandleDrop handleDrop; |
|||
|
|||
public readonly Widget child; |
|||
|
|||
public override State createState() => new DragAndDropState(); |
|||
} |
|||
|
|||
public class DragAndDropState : State<DragAndDrop> { |
|||
ValueNotifier<bool> _dragging = new ValueNotifier<bool>(false); |
|||
|
|||
NotificationsState notifications; |
|||
|
|||
|
|||
public override void didChangeDependencies() { |
|||
notifications = Notifications.of(context); |
|||
base.didChangeDependencies(); |
|||
} |
|||
|
|||
|
|||
public override Widget build(BuildContext context) { |
|||
return new ValueListenableBuilder<bool>( |
|||
valueListenable: _dragging, |
|||
builder: (context2, dragging, _) => { |
|||
// TODO(kenz): use AnimatedOpacity instead.
|
|||
return new Opacity( |
|||
opacity: dragging ? 0.5f : 1.0f, |
|||
child: widget.child |
|||
); |
|||
} |
|||
); |
|||
} |
|||
|
|||
void dragOver() { |
|||
_dragging.value = true; |
|||
} |
|||
|
|||
void dragLeave() { |
|||
_dragging.value = false; |
|||
} |
|||
|
|||
void drop() { |
|||
_dragging.value = false; |
|||
} |
|||
} |
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.ui; |
|||
using UnityEngine; |
|||
|
|||
namespace Unity.UIWidgets.DevTools.config_specific.import_export |
|||
{ |
|||
public delegate void PushSnapshotScreenForImport(string screenId); |
|||
public static class ImportExportUtils{ |
|||
public static readonly string devToolsSnapshotKey = "devToolsSnapshot"; |
|||
public static readonly string activeScreenIdKey = "activeScreenId"; |
|||
} |
|||
|
|||
public class ImportController |
|||
{ |
|||
// public ImportController(
|
|||
// this._notifications,
|
|||
// this._pushSnapshotScreenForImport
|
|||
// );
|
|||
|
|||
public readonly PushSnapshotScreenForImport _pushSnapshotScreenForImport; |
|||
|
|||
// public readonly NotificationService _notifications;
|
|||
public static readonly int repeatImportTimeBufferMs = 500; |
|||
DateTime previousImportTime; |
|||
|
|||
public ImportController(NotificationsState of, Action<string> pushSnapshotScreenForImport) |
|||
{ |
|||
this._pushSnapshotScreenForImport = _pushSnapshotScreenForImport; |
|||
} |
|||
|
|||
public void importData(Dictionary<string, object> json) { |
|||
var now = DateTime.Now; |
|||
if (previousImportTime != null && |
|||
(now.Millisecond - previousImportTime.Millisecond) |
|||
.abs() < |
|||
repeatImportTimeBufferMs) { |
|||
return; |
|||
} |
|||
previousImportTime = now; |
|||
|
|||
var isDevToolsSnapshot = json[ImportExportUtils.devToolsSnapshotKey]; |
|||
if (isDevToolsSnapshot == null) { |
|||
Debug.Log("isDevToolsSnapshot == null"); |
|||
return; |
|||
} |
|||
|
|||
var activeScreenId = json[ImportExportUtils.activeScreenIdKey]; |
|||
Globals.offlineDataJson = json; |
|||
// _notifications.push(attemptingToImportMessage(activeScreenId));
|
|||
// _pushSnapshotScreenForImport(activeScreenId);
|
|||
} |
|||
|
|||
} |
|||
} |
|
|||
namespace Unity.UIWidgets.DevTools.framework |
|||
{ |
|||
public class FrameworkCore |
|||
{ |
|||
public static void initGlobals() |
|||
{ |
|||
// setGlobal(ServiceConnectionManager, ServiceConnectionManager());
|
|||
// setGlobal(MessageBus, MessageBus());
|
|||
Globals.setGlobal(typeof(FrameworkController), new FrameworkController()); |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue