浏览代码

Merge branch 'master' into shiyun_datepicker

/main
GitHub 3 年前
当前提交
863f4a8b
共有 44 个文件被更改,包括 1432 次插入268 次删除
  1. 2
      README-ZH.md
  2. 2
      README.md
  3. 2
      com.unity.uiwidgets/Runtime/cupertino/action_Sheet.cs
  4. 2
      com.unity.uiwidgets/Runtime/cupertino/dialog.cs
  5. 40
      com.unity.uiwidgets/Runtime/engine/UIWidgetsPanel.cs
  6. 9
      com.unity.uiwidgets/Runtime/engine/UIWidgetsPanelWrapper.cs
  7. 2
      com.unity.uiwidgets/Runtime/engine/raycastable/RaycastManager.cs
  8. 4
      com.unity.uiwidgets/Runtime/engine/raycastable/RaycastableContainer.cs
  9. 20
      com.unity.uiwidgets/Runtime/external/SplayTree.cs
  10. 2
      com.unity.uiwidgets/Runtime/material/chip.cs
  11. 2
      com.unity.uiwidgets/Runtime/material/input_decorator.cs
  12. 2
      com.unity.uiwidgets/Runtime/material/list_tile.cs
  13. 393
      com.unity.uiwidgets/Runtime/rendering/mouse_tracking.cs
  14. 3
      com.unity.uiwidgets/Runtime/widgets/LottiePainter.cs
  15. 8
      com.unity.uiwidgets/Runtime/widgets/actions.cs
  16. 2
      com.unity.uiwidgets/Runtime/widgets/binding.cs
  17. 12
      com.unity.uiwidgets/Runtime/widgets/framework.cs
  18. 2
      com.unity.uiwidgets/Runtime/widgets/layout_builder.cs
  19. 6
      com.unity.uiwidgets/Runtime/widgets/list_wheel_scroll_view.cs
  20. 2
      com.unity.uiwidgets/Runtime/widgets/sliver.cs
  21. 2
      com.unity.uiwidgets/Runtime/widgets/sliver_persistent_header.cs
  22. 2
      com.unity.uiwidgets/Runtime/widgets/table.cs
  23. 4
      com.unity.uiwidgets/Runtime/widgets/title.cs
  24. 1
      engine/src/lib/ui/window/pointer_data_packet_converter.cc
  25. 2
      engine/src/shell/platform/unity/darwin/ios/uiwidgets_system.mm
  26. 24
      engine/src/shell/platform/unity/darwin/ios/unity_surface_manager.h
  27. 44
      engine/src/shell/platform/unity/darwin/ios/unity_surface_manager.mm
  28. 2
      engine/src/shell/platform/unity/darwin/macos/uiwidgets_system.mm
  29. 24
      engine/src/shell/platform/unity/darwin/macos/unity_surface_manager.h
  30. 84
      engine/src/shell/platform/unity/darwin/macos/unity_surface_manager.mm
  31. 3
      Samples/UIWidgetsSamples_2019_4/Assets/RecastablePanelSample.meta
  32. 808
      Samples/UIWidgetsSamples_2019_4/Assets/Scene/RecastableTest.unity
  33. 7
      Samples/UIWidgetsSamples_2019_4/Assets/Scene/RecastableTest.unity.meta
  34. 40
      com.unity.uiwidgets/Runtime/engine/raycastable/UIWidgetsRaycastablePanel.cs
  35. 11
      com.unity.uiwidgets/Runtime/engine/raycastable/UIWidgetsRaycastablePanel.cs.meta
  36. 27
      Samples/UIWidgetsSamples_2019_4/Assets/RecastablePanelSample/PickUp.cs
  37. 3
      Samples/UIWidgetsSamples_2019_4/Assets/RecastablePanelSample/PickUp.cs.meta
  38. 92
      Samples/UIWidgetsSamples_2019_4/Assets/RecastablePanelSample/RaycastPanelSample.cs
  39. 3
      Samples/UIWidgetsSamples_2019_4/Assets/RecastablePanelSample/RaycastPanelSample.cs.meta

2
README-ZH.md


#### Wiki
目前开发团队仍在改进UIWidgets Wiki。 由于UIWidgets主要来源于Flutter,你也可以参考Flutter Wiki中与UIWidgets API对应部分的详细描述。
同时,你可以加入我们的讨论组( https://learn.unity.com/g/uiwidgets )
同时,你也可以加入我们的[讨论组](https://unity.cn/plate/uiwidgets)来和大家交流使用心得
#### 常问问题解答

2
README.md


The develop team is still working on the UIWidgets Wiki. However, since UIWidgets is mainly derived from Flutter,
you can refer to Flutter Wiki to access detailed descriptions of UIWidgets APIs
from those of their Flutter counterparts.
Meanwhile, you can join the discussion channel at (https://learn.unity.com/g/uiwidgets)
Meanwhile, you can join our [discussion channel](https://unity.cn/plate/uiwidgets) to keep in touch with the community.
#### FAQ

2
com.unity.uiwidgets/Runtime/cupertino/action_Sheet.cs


_AlertSections.actionsSection);
}
internal override void forgetChild(Element child) {
public override void forgetChild(Element child) {
D.assert(child == _contentElement || child == _actionsElement);
if (_contentElement == child) {
_contentElement = null;

2
com.unity.uiwidgets/Runtime/cupertino/dialog.cs


_AlertDialogSections.actionsSection);
}
internal override void forgetChild(Element child) {
public override void forgetChild(Element child) {
D.assert(child == _contentElement || child == _actionsElement);
if (_contentElement == child) {
_contentElement = null;

40
com.unity.uiwidgets/Runtime/engine/UIWidgetsPanel.cs


}
}
[ExecuteInEditMode]
public partial class UIWidgetsPanel : RawImage, IUIWidgetsWindow {
static List<UIWidgetsPanel> panels = new List<UIWidgetsPanel>();

UIWidgetsPanelWrapper _wrapper;
protected UIWidgetsPanelWrapper wrapper {
get { return _wrapper; }
}
int _currentWidth {
get { return Mathf.RoundToInt(rectTransform.rect.width * canvas.scaleFactor); }
}

}
float _currentDevicePixelRatio {
protected float _currentDevicePixelRatio {
get {
#if !UNITY_EDITOR
return _wrapper.displayMetrics.DevicePixelRatioByDefault;

#endif
#endregion
IEnumerator ReEnableUIWidgetsNextFrame() {
yield return null;
enabled = true;
}
IEnumerator DoInitAndroid() {
yield return new WaitForEndOfFrame();
AndroidPlatformUtil.Init();
yield return new WaitForEndOfFrame();
enabled = true;
}
startCoroutine(DoInitAndroid());
AndroidPlatformUtil.Init();
startCoroutine(ReEnableUIWidgetsNextFrame());
return false;
}
return true;

#if !UNITY_EDITOR && UNITY_ANDROID
if (!IsAndroidInitialized()) {return ;}
#endif
// If user duplicates uiwidgets gameobject in scene, canvas could be null during OnEnable, which results in error. Skip to avoid error.
// More explanation: during duplication, editor wakes and enables behaviors in certain order. GameObject behaviors are enabled before canvas.
if(canvas == null){
enabled = false;
startCoroutine(ReEnableUIWidgetsNextFrame());
return;
}
#if !UNITY_EDITOR && UNITY_IOS
//the hook API cannot be automatically called on IOS, so we need try hook it here
Hooks.tryHook();

}
protected override void OnDisable() {
unregisterPanel(this);
D.assert(_wrapper != null);
_wrapper?.Destroy();
if (_wrapper != null) {
unregisterPanel(this);
_wrapper.Destroy();
}
_wrapper = null;
texture = null;
Input_OnDisable();

return new Offset(dx: screenPos.x, Screen.height - screenPos.y);
}
public void mainEntry() {
public virtual void mainEntry() {
main();
}

}
Vector2? _getPointerPosition(Vector2 position) {
var worldCamera = canvas.worldCamera;
var worldCamera = canvas.renderMode == RenderMode.ScreenSpaceOverlay ? null : canvas.worldCamera;
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(
rect: rectTransform, screenPoint: position, cam: worldCamera, out var localPoint)) {
var scaleFactor = canvas.scaleFactor;

9
com.unity.uiwidgets/Runtime/engine/UIWidgetsPanelWrapper.cs


}
}
public void Destroy() {
UIWidgetsPanel_onDisable(ptr: _ptr);
UIWidgetsPanel_dispose(ptr: _ptr);
_ptr = IntPtr.Zero;
if (_ptr != IntPtr.Zero) {
UIWidgetsPanel_onDisable(ptr: _ptr);
UIWidgetsPanel_dispose(ptr: _ptr);
_ptr = IntPtr.Zero;
}
_handle.Free();
_handle = default;

2
com.unity.uiwidgets/Runtime/engine/raycastable/RaycastManager.cs


using Unity.UIWidgets.ui;
using UnityEngine;
namespace Unity.UIWidgets.engine.raycast {
namespace Unity.UIWidgets.engine {
public class RaycastableRect {
bool _isDirty = true;

4
com.unity.uiwidgets/Runtime/engine/raycastable/RaycastableContainer.cs


using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
namespace Unity.UIWidgets.engine.raycast {
namespace Unity.UIWidgets.engine {
windowHashCode = Window.instance.GetHashCode();
windowHashCode = Isolate.current.GetHashCode();
}
readonly int windowHashCode;

20
com.unity.uiwidgets/Runtime/external/SplayTree.cs


using System.Collections.Generic;
using System.Linq;
namespace Unity.UIWidgets.external {
class SplayTree<TKey, TValue> : IDictionary<TKey, TValue> where TKey : IComparable<TKey> {
namespace Unity.UIWidgets.external {
public class SplayTree<TKey, TValue> : IDictionary<TKey, TValue> where TKey : IComparable<TKey> {
SplayTreeNode root;
int count;
int version = 0;

if (key == null) throw new Exception("should input null");
if (root == null) throw new Exception("root is null");
int comp = Splay(key);
if (comp < 0) return root.Key;
if (comp > 0) return root.Key;
SplayTreeNode node = root.LeftChild;
if (node == null) throw new Exception("does not exist");
while (node.RightChild != null) {

}
public TKey firstKey() {
if (root == null) return default; // TODO: this is suppose to be null
var first = First().Value;
return first.Key;
}
public TKey lastKey() {
if (root == null) return default; // TODO: this is suppose to be null
var last = Last().Value;
return last.Key;
}
if (comp > 0) return root.Key;
if (comp < 0) return root.Key;
SplayTreeNode node = root.LeftChild;
if (node == null) throw new Exception("does not exist");
while (node.LeftChild != null) {

2
com.unity.uiwidgets/Runtime/material/chip.cs


slotToChild.Values.Each((value) => { visitor(value); });
}
internal override void forgetChild(Element child) {
public override void forgetChild(Element child) {
D.assert(slotToChild.ContainsValue(child));
D.assert(childToSlot.ContainsKey(child));
_ChipSlot slot = childToSlot[child];

2
com.unity.uiwidgets/Runtime/material/input_decorator.cs


slotToChild.Values.Each((child) => { visitor(child); });
}
internal override void forgetChild(Element child) {
public override void forgetChild(Element child) {
D.assert(slotToChild.ContainsValue(child));
D.assert(childToSlot.ContainsKey(child));
_DecorationSlot slot = childToSlot[child];

2
com.unity.uiwidgets/Runtime/material/list_tile.cs


}
}
internal override void forgetChild(Element child) {
public override void forgetChild(Element child) {
D.assert(slotToChild.Values.Contains(child));
D.assert(childToSlot.Keys.Contains(child));
_ListTileSlot slot = childToSlot[child];

393
com.unity.uiwidgets/Runtime/rendering/mouse_tracking.cs


using System;
using System.Collections.Generic;
using System.Linq;
using Unity.UIWidgets.foundation;

public delegate void PointerExitEventListener(PointerExitEvent evt);
public delegate void PointerDragFromEditorEnterEventListener(PointerDragFromEditorEnterEvent evt);
public delegate void PointerDragFromEditorHoverEventListener(PointerDragFromEditorHoverEvent evt);
public delegate void PointerDragFromEditorExitEventListener(PointerDragFromEditorExitEvent evt);
public delegate void _UpdatedDeviceHandler(_MouseState mouseState,
HashSet<MouseTrackerAnnotation> previousAnnotations);
public delegate void PointerDragFromEditorReleaseEventListener(PointerDragFromEditorReleaseEvent evt);
public delegate void _UpdatedDeviceHandler(_MouseState mouseState, HashSet<MouseTrackerAnnotation> previousAnnotations);
public class _MouseState {
PointerEvent _latestEvent;
public class _MouseState {
public _MouseState(PointerEvent initialEvent = null
) {
D.assert(initialEvent != null);

public HashSet<MouseTrackerAnnotation> annotations {
get { return _annotations;}
}
HashSet<MouseTrackerAnnotation> _annotations = new HashSet<MouseTrackerAnnotation>();
public HashSet<MouseTrackerAnnotation> replaceAnnotations(HashSet<MouseTrackerAnnotation> value) {
HashSet<MouseTrackerAnnotation> previous = _annotations;
_annotations = value;
return previous;
}
public HashSet<MouseTrackerAnnotation> annotations { get; private set; } =
new HashSet<MouseTrackerAnnotation>();
// The most recently processed mouse event observed from this device.
public PointerEvent latestEvent {

_latestEvent = value;
}
}
PointerEvent _latestEvent;
get { return latestEvent.device;}
get { return latestEvent.device; }
}
public HashSet<MouseTrackerAnnotation> replaceAnnotations(HashSet<MouseTrackerAnnotation> value) {
var previous = annotations;
annotations = value;
return previous;
return Event == null ? "null" : describeIdentity(Event);
return Event == null ? "null" : describeIdentity(Object: Event);
string describeLatestEvent = $"latestEvent: {describeEvent(latestEvent)}";
string describeAnnotations = $"annotations: [list of {annotations.Count}]";
return $"{describeIdentity(this)}"+$"({describeLatestEvent}, {describeAnnotations})";
var describeLatestEvent = $"latestEvent: {describeEvent(Event: latestEvent)}";
var describeAnnotations = $"annotations: [list of {annotations.Count}]";
return $"{describeIdentity(this)}" + $"({describeLatestEvent}, {describeAnnotations})";
public class MouseTrackerAnnotation {
public class MouseTrackerAnnotation : Diagnosticable {
public readonly PointerEnterEventListener onEnter;
public readonly PointerExitEventListener onExit;
public readonly PointerHoverEventListener onHover;
PointerExitEventListener onExit = null,
PointerDragFromEditorEnterEventListener onDragFromEditorEnter = null,
PointerDragFromEditorHoverEventListener onDragFromEditorHover = null,
PointerDragFromEditorExitEventListener onDragFromEditorExit = null,
PointerDragFromEditorReleaseEventListener onDragFromEditorRelease = null
PointerExitEventListener onExit = null
this.onDragFromEditorEnter = onDragFromEditorEnter;
this.onDragFromEditorHover = onDragFromEditorHover;
this.onDragFromEditorExit = onDragFromEditorExit;
this.onDragFromEditorRelease = onDragFromEditorRelease;
public readonly PointerEnterEventListener onEnter;
public readonly PointerHoverEventListener onHover;
public readonly PointerExitEventListener onExit;
public readonly PointerDragFromEditorEnterEventListener onDragFromEditorEnter;
public readonly PointerDragFromEditorHoverEventListener onDragFromEditorHover;
public readonly PointerDragFromEditorExitEventListener onDragFromEditorExit;
public readonly PointerDragFromEditorReleaseEventListener onDragFromEditorRelease;
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {
base.debugFillProperties(properties: properties);
properties.add(new FlagsSummary<Delegate>(
"callbacks",
new Dictionary<string, Delegate> {
{"enter", onEnter},
{"hover", onHover},
{"exit", onExit}
},
"<none>"
));
}
public readonly MouseTrackerAnnotation annotation;
public HashSet<int> activeDevices = new HashSet<int>();
}
public delegate IEnumerable<MouseTrackerAnnotation> MouseDetectorAnnotationFinder(Offset offset);
public class MouseTracker : ChangeNotifier {
public readonly Dictionary<int, _MouseState> _mouseStates = new Dictionary<int, _MouseState>();
readonly PointerRouter _router;
public readonly MouseTrackerAnnotation annotation;
public readonly Dictionary<MouseTrackerAnnotation, _TrackedAnnotation> _trackedAnnotations =
new Dictionary<MouseTrackerAnnotation, _TrackedAnnotation>();
public HashSet<int> activeDevices = new HashSet<int>();
}
public readonly MouseDetectorAnnotationFinder annotationFinder;
public delegate IEnumerable<MouseTrackerAnnotation> MouseDetectorAnnotationFinder(Offset offset);
bool _duringDeviceUpdate;
public bool _hasScheduledPostFrameCheck;
public class MouseTracker : ChangeNotifier{
router.addGlobalRoute(_handleEvent);
router.addGlobalRoute(route: _handleEvent);
public bool mouseIsConnected {
get { return _mouseStates.isNotEmpty(); }
}
public static bool _duringBuildPhase {
get { return SchedulerBinding.instance.schedulerPhase == SchedulerPhase.persistentCallbacks; }
}
_router.removeGlobalRoute(_handleEvent);
_router.removeGlobalRoute(route: _handleEvent);
public readonly MouseDetectorAnnotationFinder annotationFinder;
readonly Dictionary<int, PointerEvent> _lastMouseEvent = new Dictionary<int, PointerEvent>();
readonly PointerRouter _router;
public readonly Dictionary<int, _MouseState> _mouseStates = new Dictionary<int, _MouseState>();
public bool mouseIsConnected {
get { return _lastMouseEvent.isNotEmpty(); }
}
if (state == null)
if (state == null) {
}
PointerEvent lastEvent = state.latestEvent;
var lastEvent = state.latestEvent;
D.assert((value is PointerAddedEvent) == (lastEvent is PointerRemovedEvent));
if (value is PointerSignalEvent)
D.assert(value is PointerAddedEvent == lastEvent is PointerRemovedEvent);
if (value is PointerSignalEvent) {
}
public readonly Dictionary<MouseTrackerAnnotation, _TrackedAnnotation> _trackedAnnotations =
new Dictionary<MouseTrackerAnnotation, _TrackedAnnotation>();
if (Event.kind != PointerDeviceKind.mouse)
if (Event.kind != PointerDeviceKind.mouse) {
if (Event is PointerSignalEvent)
}
if (Event is PointerSignalEvent) {
int device = Event.device;
_MouseState existingState = _mouseStates.getOrDefault(device);
if (!_shouldMarkStateDirty(existingState, Event))
}
var device = Event.device;
var existingState = _mouseStates.getOrDefault(key: device);
if (!_shouldMarkStateDirty(state: existingState, value: Event)) {
PointerEvent previousEvent = existingState?.latestEvent;
}
var previousEvent = existingState?.latestEvent;
handleUpdatedDevice: (_MouseState mouseState, HashSet<MouseTrackerAnnotation> previousAnnotations) =>{
D.assert(mouseState.device == Event.device);
_dispatchDeviceCallbacks(
(mouseState, previousAnnotations) => {
D.assert(mouseState.device == Event.device);
_dispatchDeviceCallbacks(
lastAnnotations: previousAnnotations,
nextAnnotations: mouseState.annotations,
previousEvent: previousEvent,

);
}
public HashSet<MouseTrackerAnnotation> _findAnnotations(_MouseState state) {
var globalPosition = state.latestEvent.position;
var device = state.device;
var result = new HashSet<MouseTrackerAnnotation>();
foreach (var values in annotationFinder(offset: globalPosition)) {
result.Add(item: values);
}
return _mouseStates.ContainsKey(key: device)
? result
: new HashSet<MouseTrackerAnnotation>();
}
public void _updateAllDevices() {
_updateDevices(
handleUpdatedDevice: (mouseState, previousAnnotations) => {
_dispatchDeviceCallbacks(
lastAnnotations: previousAnnotations,
nextAnnotations: mouseState.annotations,
previousEvent: mouseState.latestEvent
);
}
);
}
void _updateDevices(
PointerEvent targetEvent = null,
_UpdatedDeviceHandler handleUpdatedDevice = null) {
D.assert(handleUpdatedDevice != null);
D.assert(result: !_duringBuildPhase);
D.assert(result: !_duringDeviceUpdate);
var mouseWasConnected = mouseIsConnected;
_MouseState targetState = null;
if (targetEvent != null) {
targetState = _mouseStates.getOrDefault(key: targetEvent.device);
if (targetState == null) {
targetState = new _MouseState(initialEvent: targetEvent);
_mouseStates[key: targetState.device] = targetState;
}
else {
D.assert(!(targetEvent is PointerAddedEvent));
targetState.latestEvent = targetEvent;
if (targetEvent is PointerRemovedEvent) {
_mouseStates.Remove(key: targetEvent.device);
}
}
}
D.assert(targetState == null == (targetEvent == null));
D.assert(() => {
_duringDeviceUpdate = true;
return true;
});
var dirtyStates = targetEvent == null
? (IEnumerable<_MouseState>) _mouseStates.Values
: new List<_MouseState> {targetState};
foreach (var dirtyState in dirtyStates) {
var nextAnnotations = _findAnnotations(state: dirtyState);
var lastAnnotations = dirtyState.replaceAnnotations(value: nextAnnotations);
handleUpdatedDevice(mouseState: dirtyState, previousAnnotations: lastAnnotations);
}
D.assert(() => {
_duringDeviceUpdate = false;
return true;
});
if (mouseWasConnected != mouseIsConnected) {
notifyListeners();
}
}
) {
) {
PointerEvent latestEvent = unhandledEvent ?? previousEvent;
var latestEvent = unhandledEvent ?? previousEvent;
var exiting = new List<MouseTrackerAnnotation>();
if (!nextAnnotations.Contains(lastAnnotation)) {
exitingAnnotations.Append(lastAnnotation);
if (!nextAnnotations.Contains(item: lastAnnotation)) {
exiting.Add(item: lastAnnotation);
foreach ( MouseTrackerAnnotation annotation in exitingAnnotations) {
exitingAnnotations = exiting;
foreach (var annotation in exitingAnnotations) {
annotation.onExit(PointerExitEvent.fromMouseEvent(latestEvent));
annotation.onExit(PointerExitEvent.fromMouseEvent(hover: latestEvent));
List<MouseTrackerAnnotation> entering = new List<MouseTrackerAnnotation>();
var entering = new List<MouseTrackerAnnotation>();
if (!lastAnnotations.Contains(nextAnnotation)) {
entering.Add(nextAnnotation);
if (!lastAnnotations.Contains(item: nextAnnotation)) {
entering.Add(item: nextAnnotation);
}
}
foreach ( MouseTrackerAnnotation annotation in enteringAnnotations) {
foreach (var annotation in enteringAnnotations) {
annotation.onEnter(PointerEnterEvent.fromMouseEvent(latestEvent));
annotation.onEnter(PointerEnterEvent.fromMouseEvent(hover: latestEvent));
if (unhandledEvent is PointerHoverEvent) {
Offset lastHoverPosition = previousEvent is PointerHoverEvent ? previousEvent.position : null;
bool pointerHasMoved = lastHoverPosition == null || lastHoverPosition != unhandledEvent.position;
nextAnnotations.ToList().Reverse();
IEnumerable<MouseTrackerAnnotation> hoveringAnnotations = pointerHasMoved ? nextAnnotations : enteringAnnotations;
foreach ( MouseTrackerAnnotation annotation in hoveringAnnotations) {
if (annotation.onHover != null) {
annotation.onHover((PointerHoverEvent)unhandledEvent);
}
}
}
}
public HashSet<MouseTrackerAnnotation> _findAnnotations(_MouseState state) {
Offset globalPosition = state.latestEvent.position;
int device = state.device;
HashSet<MouseTrackerAnnotation> result = new HashSet<MouseTrackerAnnotation>();
foreach (var values in annotationFinder(globalPosition)) {
result.Add(values);
if (unhandledEvent is PointerHoverEvent) {
var lastHoverPosition = previousEvent is PointerHoverEvent ? previousEvent.position : null;
var pointerHasMoved = lastHoverPosition == null || lastHoverPosition != unhandledEvent.position;
nextAnnotations.ToList().Reverse();
var hoveringAnnotations = pointerHasMoved ? nextAnnotations : enteringAnnotations;
foreach (var annotation in hoveringAnnotations) {
if (annotation.onHover != null) {
annotation.onHover((PointerHoverEvent) unhandledEvent);
}
}
return (_mouseStates.ContainsKey(device))
? result
: new HashSet<MouseTrackerAnnotation>{} as HashSet<MouseTrackerAnnotation>;
public static bool _duringBuildPhase {
get {
return SchedulerBinding.instance.schedulerPhase == SchedulerPhase.persistentCallbacks;
}
}
public void _updateAllDevices() {
_updateDevices(
handleUpdatedDevice: (_MouseState mouseState, HashSet<MouseTrackerAnnotation> previousAnnotations)=> {
_dispatchDeviceCallbacks(
lastAnnotations: previousAnnotations,
nextAnnotations: mouseState.annotations,
previousEvent: mouseState.latestEvent,
unhandledEvent: null
);
}
);
}
bool _duringDeviceUpdate = false;
void _updateDevices(
PointerEvent targetEvent = null,
_UpdatedDeviceHandler handleUpdatedDevice = null) {
D.assert(handleUpdatedDevice != null);
D.assert(!_duringBuildPhase);
D.assert(!_duringDeviceUpdate);
bool mouseWasConnected = mouseIsConnected;
_MouseState targetState = null;
if (targetEvent != null) {
targetState = _mouseStates.getOrDefault(targetEvent.device);
if (targetState == null) {
targetState = new _MouseState(initialEvent: targetEvent);
_mouseStates[targetState.device] = targetState;
} else {
D.assert(!(targetEvent is PointerAddedEvent));
targetState.latestEvent = targetEvent;
if (targetEvent is PointerRemovedEvent)
_mouseStates.Remove(targetEvent.device);
}
public void schedulePostFrameCheck() {
D.assert(result: _duringBuildPhase);
D.assert(result: !_duringDeviceUpdate);
if (!mouseIsConnected) {
return;
D.assert((targetState == null) == (targetEvent == null));
D.assert(()=> {
_duringDeviceUpdate = true;
return true;
});
IEnumerable<_MouseState> dirtyStates = targetEvent == null ? (IEnumerable<_MouseState>) _mouseStates.Values : new List<_MouseState>{targetState};
foreach ( _MouseState dirtyState in dirtyStates) {
HashSet<MouseTrackerAnnotation> nextAnnotations = _findAnnotations(dirtyState);
HashSet<MouseTrackerAnnotation> lastAnnotations = dirtyState.replaceAnnotations(nextAnnotations);
handleUpdatedDevice(dirtyState, lastAnnotations);
}
D.assert(() =>{
_duringDeviceUpdate = false;
return true;
});
if (mouseWasConnected != mouseIsConnected)
notifyListeners();
}
public bool _hasScheduledPostFrameCheck = false;
public void schedulePostFrameCheck() {
D.assert(_duringBuildPhase);
D.assert(!_duringDeviceUpdate);
if (!mouseIsConnected)
return;
_hasScheduledPostFrameCheck = true;
SchedulerBinding.instance.addPostFrameCallback((stamp => {
D.assert(_hasScheduledPostFrameCheck);
_hasScheduledPostFrameCheck = false;
_updateAllDevices();
}));
_hasScheduledPostFrameCheck = true;
SchedulerBinding.instance.addPostFrameCallback(stamp => {
D.assert(result: _hasScheduledPostFrameCheck);
_hasScheduledPostFrameCheck = false;
_updateAllDevices();
});
}
}
}

3
com.unity.uiwidgets/Runtime/widgets/LottiePainter.cs


public override Widget build(BuildContext context) {
if (_round != 0) {
WidgetsBinding.instance.addPostFrameCallback((_) => {
if (!mounted) {
return;
}
setState(() => {
_frame += Time.deltaTime;
if (_frame > widget._duration) {

8
com.unity.uiwidgets/Runtime/widgets/actions.cs


class CallbackAction : UiWidgetAction {
public class CallbackAction : UiWidgetAction {
public CallbackAction(LocalKey intentKey, OnInvokeCallback onInvoke) : base(intentKey: intentKey) {
D.assert(onInvoke != null);
this.onInvoke = onInvoke;

}
class ActionDispatcher : Diagnosticable {
public class ActionDispatcher : Diagnosticable {
public ActionDispatcher() {
}

}
}
class Actions : InheritedWidget {
public class Actions : InheritedWidget {
public Actions(
Key key = null,
ActionDispatcher dispatcher = null,

}
class FocusableActionDetector : StatefulWidget {
public class FocusableActionDetector : StatefulWidget {
public FocusableActionDetector(
Key key = null,

2
com.unity.uiwidgets/Runtime/widgets/binding.cs


}
}
internal override void forgetChild(Element child) {
public override void forgetChild(Element child) {
D.assert(child == _child);
_child = null;
base.forgetChild(child);

12
com.unity.uiwidgets/Runtime/widgets/framework.cs


HashSet<Element> _debugForgottenChildrenWithGlobalKey = new HashSet<Element>();
internal virtual void forgetChild(Element child) {
public virtual void forgetChild(Element child) {
D.assert(() => {
if (child.widget.key is GlobalKey)
_debugForgottenChildrenWithGlobalKey.Add(child);

}
}
internal override void forgetChild(Element child) {
public override void forgetChild(Element child) {
D.assert(child == _child);
_child = null;
base.forgetChild(child);

protected RenderObjectElement(RenderObjectWidget widget) : base(widget) {
}
public new RenderObjectWidget widget {
public new virtual RenderObjectWidget widget {
get { return (RenderObjectWidget) base.widget; }
}

public LeafRenderObjectElement(LeafRenderObjectWidget widget) : base(widget) {
}
internal override void forgetChild(Element child) {
public override void forgetChild(Element child) {
D.assert(false);
base.forgetChild(child);
}

}
}
internal override void forgetChild(Element child) {
public override void forgetChild(Element child) {
D.assert(child == _child);
_child = null;
base.forgetChild(child);

}
}
internal override void forgetChild(Element child) {
public override void forgetChild(Element child) {
D.assert(_children.Contains(child));
D.assert(!_forgottenChildren.Contains(child));
_forgottenChildren.Add(child);

2
com.unity.uiwidgets/Runtime/widgets/layout_builder.cs


visitor(_child);
}
internal override void forgetChild(Element child) {
public override void forgetChild(Element child) {
D.assert(child == _child);
_child = null;
base.forgetChild(child);

6
com.unity.uiwidgets/Runtime/widgets/list_wheel_scroll_view.cs


}
}
internal override void forgetChild(Element child) {
_childElements.Remove((int) child.slot);
base.forgetChild(child: child);
public override void forgetChild(Element child) {
_childElements.Remove((int) (child.slot));
base.forgetChild(child);
}
}

2
com.unity.uiwidgets/Runtime/widgets/sliver.cs


}
internal override void forgetChild(Element child) {
public override void forgetChild(Element child) {
D.assert(child != null);
D.assert(child.slot != null);
D.assert(_childElements.ContainsKey((int) child.slot));

2
com.unity.uiwidgets/Runtime/widgets/sliver_persistent_header.cs


});
}
internal override void forgetChild(Element child) {
public override void forgetChild(Element child) {
D.assert(child == this.child);
this.child = null;
base.forgetChild(child);

2
com.unity.uiwidgets/Runtime/widgets/table.cs


}
}
internal override void forgetChild(Element child) {
public override void forgetChild(Element child) {
_forgottenChildren.Add(child);
}
}

4
com.unity.uiwidgets/Runtime/widgets/title.cs


Widget child = null
) : base(key: key) {
D.assert(title != null);
D.assert(color != null && color.alpha == 0xFF);
//in flutter, the background color is not allowed to be transparent because there is nothing behind the UI. But in UIWidgets it is
//possible to put a unity scene under the ui panel. Therefore we can discard the assertion on "color.alpha == 0xFF" here
D.assert(color != null);
this.color = color;
this.child = child;
this.title = title;

1
engine/src/lib/ui/window/pointer_data_packet_converter.cc


PointerData synthesized_hover_event = pointer_data;
synthesized_hover_event.change = PointerData::Change::kHover;
synthesized_hover_event.synthesized = 1;
synthesized_hover_event.buttons = state.previous_buttons;
UpdateDeltaAndState(synthesized_hover_event, state);
converted_pointers.push_back(synthesized_hover_event);

2
engine/src/shell/platform/unity/darwin/ios/uiwidgets_system.mm


unity_uiwidgets_->SetWakeUpCallback(nullptr);
unity_uiwidgets_ = nullptr;
UnitySurfaceManager::ReleaseResource();
unity_interfaces_ = nullptr;
}

24
engine/src/shell/platform/unity/darwin/ios/unity_surface_manager.h


#pragma once
#include <vector>
#include <OpenGLES/EAGL.h>
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>

#include "flutter/fml/macros.h"
namespace uiwidgets {
struct GLContextPair
{
EAGLContext *gl_context_;
EAGLContext *gl_resource_context_;
GLContextPair(EAGLContext* gl, EAGLContext* gl_resource)
{
gl_context_ = gl;
gl_resource_context_ = gl_resource;
}
};
//openGLES contexts
static EAGLContext *gl_context_;
static EAGLContext *gl_resource_context_;
//openGL contexts pool
static std::vector<GLContextPair> gl_context_pool_;
static void ReleaseResource();
void* CreateRenderTexture(size_t width, size_t height);

uint32_t GetFbo();
private:
static GLContextPair GetFreeOpenGLContext();
void RecycleOpenGLContext(EAGLContext* gl, EAGLContext* gl_resource);
EAGLContext *gl_context_;
EAGLContext *gl_resource_context_;
GLuint default_fbo_ = 0;
GLuint gl_tex_ = 0;
CVOpenGLESTextureCacheRef gl_tex_cache_ref_ = nullptr;

44
engine/src/shell/platform/unity/darwin/ios/unity_surface_manager.mm


namespace uiwidgets {
EAGLContext* UnitySurfaceManager::gl_context_ = nullptr;
EAGLContext* UnitySurfaceManager::gl_resource_context_ = nullptr;
std::vector<GLContextPair> UnitySurfaceManager::gl_context_pool_;
GLContextPair UnitySurfaceManager::GetFreeOpenGLContext()
{
if (gl_context_pool_.size() == 0)
{
EAGLContext* gl = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
EAGLContext* gl_resource = [[EAGLContext alloc] initWithAPI:[gl API] sharegroup: [gl sharegroup]];
return GLContextPair(gl, gl_resource);
}
auto context_pair = gl_context_pool_.back();
gl_context_pool_.pop_back();
return context_pair;
}
void UnitySurfaceManager::RecycleOpenGLContext(EAGLContext* gl, EAGLContext* gl_resource)
{
MakeCurrentContext();
ClearCurrentContext();
MakeCurrentResourceContext();
ClearCurrentContext();
gl_context_pool_.push_back(GLContextPair(gl, gl_resource));
}
void UnitySurfaceManager::ReleaseResource()
{
while(gl_context_pool_.size() > 0)
{
gl_context_pool_.pop_back();
}
}
UnitySurfaceManager::UnitySurfaceManager(IUnityInterfaces* unity_interfaces)
{

//create opengl context
if (gl_context_ == nullptr && gl_resource_context_ == nullptr) {
gl_context_ = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
gl_resource_context_ = [[EAGLContext alloc] initWithAPI:[gl_context_ API] sharegroup: [gl_context_ sharegroup]];
auto new_context = GetFreeOpenGLContext();
gl_context_ = new_context.gl_context_;
gl_resource_context_ = new_context.gl_resource_context_;
}
FML_DCHECK(gl_context_ != nullptr && gl_resource_context_ != nullptr);

void UnitySurfaceManager::ReleaseNativeRenderContext()
{
FML_DCHECK(gl_resource_context_);
RecycleOpenGLContext(gl_context_, gl_resource_context_);
gl_context_ = nullptr;
gl_resource_context_ = nullptr;
[EAGLContext setCurrentContext:nil];

2
engine/src/shell/platform/unity/darwin/macos/uiwidgets_system.mm


unity_uiwidgets_->SetWakeUpCallback(nullptr);
unity_uiwidgets_ = nullptr;
UnitySurfaceManager::ReleaseResource();
unity_interfaces_ = nullptr;
}

24
engine/src/shell/platform/unity/darwin/macos/unity_surface_manager.h


#include <AppKit/AppKit.h>
#include <Metal/Metal.h>
#include <CoreVideo/CoreVideo.h>
#include <vector>
struct GLContextPair
{
NSOpenGLContext *gl_context_;
NSOpenGLContext *gl_resource_context_;
GLContextPair(NSOpenGLContext* gl, NSOpenGLContext* gl_resource)
{
gl_context_ = gl;
gl_resource_context_ = gl_resource;
}
};
//openGL contexts
static NSOpenGLContext *gl_context_;
static NSOpenGLContext *gl_resource_context_;
//openGL contexts pool
static std::vector<GLContextPair> gl_context_pool_;
static void ReleaseResource();
void* CreateRenderTexture(size_t width, size_t height);

uint32_t GetFbo();
private:
static GLContextPair GetFreeOpenGLContext();
void RecycleOpenGLContext(NSOpenGLContext* gl, NSOpenGLContext* gl_resource);
NSOpenGLContext *gl_context_;
NSOpenGLContext *gl_resource_context_;
GLuint default_fbo_ = 0;
GLuint gl_tex_ = 0;
CVOpenGLTextureCacheRef gl_tex_cache_ref_ = nullptr;

84
engine/src/shell/platform/unity/darwin/macos/unity_surface_manager.mm


namespace uiwidgets {
NSOpenGLContext* UnitySurfaceManager::gl_context_ = nullptr;
NSOpenGLContext* UnitySurfaceManager::gl_resource_context_ = nullptr;
std::vector<GLContextPair> UnitySurfaceManager::gl_context_pool_;
GLContextPair UnitySurfaceManager::GetFreeOpenGLContext()
{
if (gl_context_pool_.size() == 0)
{
NSOpenGLPixelFormatAttribute attrs[] =
{
NSOpenGLPFAAccelerated,
0
};
NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
NSOpenGLContext* gl_resource;
NSOpenGLContext* gl;
while(gl_resource == nil) {
gl = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil];
gl_resource = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:gl];
if (gl_resource == nil) {
CGLReleaseContext([gl CGLContextObj]);
gl = nullptr;
}
}
return GLContextPair(gl, gl_resource);
}
auto context_pair = gl_context_pool_.back();
gl_context_pool_.pop_back();
return context_pair;
}
void UnitySurfaceManager::RecycleOpenGLContext(NSOpenGLContext* gl, NSOpenGLContext* gl_resource)
{
MakeCurrentContext();
ClearCurrentContext();
MakeCurrentResourceContext();
ClearCurrentContext();
gl_context_pool_.push_back(GLContextPair(gl, gl_resource));
}
void UnitySurfaceManager::ReleaseResource()
{
while(gl_context_pool_.size() > 0)
{
auto context_pair = gl_context_pool_.back();
CGLReleaseContext([context_pair.gl_context_ CGLContextObj]);
CGLReleaseContext([context_pair.gl_resource_context_ CGLContextObj]);
gl_context_pool_.pop_back();
}
}
UnitySurfaceManager::UnitySurfaceManager(IUnityInterfaces* unity_interfaces)
{

//create opengl context
if (gl_context_ == nullptr && gl_resource_context_ == nullptr) {
NSOpenGLPixelFormatAttribute attrs[] =
{
NSOpenGLPFAAccelerated,
0
};
NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
//gl_context_ may be created unproperly, we can check this using the relevant gl_resource_context_
//loop until the created gl_context_ is ok, otherwise the program will crash anyway
while(gl_resource_context_ == nil) {
gl_context_ = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil];
gl_resource_context_ = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:gl_context_];
if (gl_resource_context_ == nil) {
CGLReleaseContext(gl_context_.CGLContextObj);
gl_context_ = nullptr;
}
}
auto new_context = GetFreeOpenGLContext();
gl_context_ = new_context.gl_context_;
gl_resource_context_ = new_context.gl_resource_context_;
}
FML_DCHECK(gl_context_ != nullptr && gl_resource_context_ != nullptr);

void UnitySurfaceManager::ReleaseNativeRenderContext()
{
FML_DCHECK(gl_resource_context_);
FML_DCHECK(gl_context_);
FML_DCHECK(gl_context_);
RecycleOpenGLContext(gl_context_, gl_resource_context_);
gl_context_ = nullptr;
gl_resource_context_ = nullptr;
FML_DCHECK(metal_device_ != nullptr);
metal_device_ = nullptr;

3
Samples/UIWidgetsSamples_2019_4/Assets/RecastablePanelSample.meta


fileFormatVersion: 2
guid: 78f35cf41bb14f94b6607619fd61814b
timeCreated: 1627370684

808
Samples/UIWidgetsSamples_2019_4/Assets/Scene/RecastableTest.unity


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.44657874, g: 0.49641275, b: 0.5748172, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!28 &406348655
Texture2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
serializedVersion: 2
m_Width: 0
m_Height: 0
m_CompleteImageSize: 0
m_TextureFormat: 0
m_MipCount: 1
m_IsReadable: 1
m_IgnoreMasterTextureLimit: 0
m_IsPreProcessed: 0
m_StreamingMipmaps: 0
m_StreamingMipmapsPriority: 0
m_AlphaIsTransparency: 0
m_ImageCount: 0
m_TextureDimension: 2
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 1
m_MipBias: 0
m_WrapU: 0
m_WrapV: 0
m_WrapW: 0
m_LightmapFormat: 0
m_ColorSpace: 0
image data: 0
_typelessdata:
m_StreamData:
offset: 0
size: 0
path:
--- !u!1 &764046566
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 764046568}
- component: {fileID: 764046567}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &764046567
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 764046566}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &764046568
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 764046566}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &847097468
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 847097469}
- component: {fileID: 847097471}
- component: {fileID: 847097470}
m_Layer: 5
m_Name: RawImage
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &847097469
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 847097468}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2122288190}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &847097470
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 847097468}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 815fa4781092478880d764710562f43e, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Texture: {fileID: 406348655}
m_UVRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
hardwareAntiAliasing: 0
fonts: []
--- !u!222 &847097471
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 847097468}
m_CullTransparentMesh: 0
--- !u!1 &1242484622
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1242484626}
- component: {fileID: 1242484625}
- component: {fileID: 1242484624}
- component: {fileID: 1242484623}
- component: {fileID: 1242484627}
- component: {fileID: 1242484628}
m_Layer: 0
m_Name: Cube
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!65 &1242484623
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1242484622}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1242484624
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1242484622}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &1242484625
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1242484622}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1242484626
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1242484622}
m_LocalRotation: {x: -0.10465724, y: -0.09479626, z: -0.010022044, w: 0.9899293}
m_LocalPosition: {x: 0, y: 1.2, z: 10.99}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: -12.07, y: -10.94, z: 0}
--- !u!54 &1242484627
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1242484622}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!114 &1242484628
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1242484622}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2f49ce3509d94f0ab48ad05b702f9008, type: 3}
m_Name:
m_EditorClassIdentifier:
isHolding: 0
--- !u!1 &1290968256
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1290968260}
- component: {fileID: 1290968259}
- component: {fileID: 1290968258}
- component: {fileID: 1290968257}
m_Layer: 0
m_Name: Cube (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!65 &1290968257
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1290968256}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1290968258
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1290968256}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &1290968259
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1290968256}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1290968260
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1290968256}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -0.84, z: 1.9}
m_LocalScale: {x: 100, y: 1, z: 22}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1548023132
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1548023135}
- component: {fileID: 1548023134}
- component: {fileID: 1548023133}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1548023133
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1548023132}
m_Enabled: 1
--- !u!20 &1548023134
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1548023132}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 5.6
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1548023135
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1548023132}
m_LocalRotation: {x: 0.19187035, y: 0.022864925, z: -0.004471415, w: 0.9811437}
m_LocalPosition: {x: 0, y: 1, z: 0.32}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 22.13, y: 2.67, z: 0}
--- !u!1 &1900497009
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1900497012}
- component: {fileID: 1900497011}
- component: {fileID: 1900497010}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1900497010
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1900497009}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &1900497011
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1900497009}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 10
--- !u!4 &1900497012
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1900497009}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2122288186
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2122288190}
- component: {fileID: 2122288189}
- component: {fileID: 2122288188}
- component: {fileID: 2122288187}
- component: {fileID: 2122288191}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &2122288187
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2122288186}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &2122288188
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2122288186}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!223 &2122288189
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2122288186}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &2122288190
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2122288186}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 847097469}
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!225 &2122288191
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2122288186}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0

7
Samples/UIWidgetsSamples_2019_4/Assets/Scene/RecastableTest.unity.meta


fileFormatVersion: 2
guid: b123676e269e44b5c9d8825017d24473
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

40
com.unity.uiwidgets/Runtime/engine/raycastable/UIWidgetsRaycastablePanel.cs


using UnityEngine;
using Rect = UnityEngine.Rect;
namespace Unity.UIWidgets.engine {
[RequireComponent(typeof(RectTransform))]
public class UIWidgetsRaycastablePanel : UIWidgetsPanel, ICanvasRaycastFilter {
int windowHashCode;
public override void mainEntry() {
base.mainEntry();
windowHashCode = wrapper.isolate.GetHashCode();
RaycastManager.NewWindow(windowHashCode);
}
protected override void OnDisable() {
base.OnDisable();
RaycastManager.DisposeWindow(windowHashCode);
}
public bool IsRaycastLocationValid(Vector2 screenPoint, Camera eventCamera) {
if (!enabled) {
return true;
}
Vector2 local;
RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, screenPoint, eventCamera,
out local);
Rect rect = rectTransform.rect;
// Convert top left corner as reference origin point.
local.x += rectTransform.pivot.x * rect.width;
local.y -= rectTransform.pivot.y * rect.height;
local.x = local.x / (_currentDevicePixelRatio / canvas.scaleFactor);
local.y = -local.y / (_currentDevicePixelRatio / canvas.scaleFactor);
return !RaycastManager.CheckCastThrough(windowHashCode, local);
}
}
}

11
com.unity.uiwidgets/Runtime/engine/raycastable/UIWidgetsRaycastablePanel.cs.meta


fileFormatVersion: 2
guid: 154c331abdd97401399e5e5b4f53e337
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

27
Samples/UIWidgetsSamples_2019_4/Assets/RecastablePanelSample/PickUp.cs


using System;
using UnityEngine;
using UnityEngine.EventSystems;
namespace UIWidgetsSample
{
public class PickUp : MonoBehaviour
{
public bool isHolding = false;
private void OnMouseDown()
{
if (EventSystem.current.IsPointerOverGameObject())
{
return;
}
isHolding = true;
Debug.Log("Mouse Down Detected !!!");
}
private void OnMouseUp()
{
isHolding = false;
}
}
}

3
Samples/UIWidgetsSamples_2019_4/Assets/RecastablePanelSample/PickUp.cs.meta


fileFormatVersion: 2
guid: 2f49ce3509d94f0ab48ad05b702f9008
timeCreated: 1627366289

92
Samples/UIWidgetsSamples_2019_4/Assets/RecastablePanelSample/RaycastPanelSample.cs


using System.Collections.Generic;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.engine;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using FontStyle = Unity.UIWidgets.ui.FontStyle;
using Image = Unity.UIWidgets.widgets.Image;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
using ui_ = Unity.UIWidgets.widgets.ui_;
namespace UIWidgetsSample
{
public class RaycastPanelSample : UIWidgetsRaycastablePanel
{
protected override void main()
{
ui_.runApp(new MyApp());
}
class MyApp : StatelessWidget
{
public override Widget build(BuildContext context)
{
return new WidgetsApp(
home: new ExampleApp(),
color: Color.white,
pageRouteBuilder: (settings, builder) =>
new PageRouteBuilder(
settings: settings,
pageBuilder: (Buildcontext, animation, secondaryAnimation) => builder(context)
)
);
}
}
class ExampleApp : StatefulWidget
{
public ExampleApp(Key key = null) : base(key)
{
}
public override State createState()
{
return new ExampleState();
}
}
class ExampleState : State<ExampleApp>
{
int counter;
private bool raycastable = true;
public override Widget build(BuildContext context)
{
var child = new Container(
padding: EdgeInsets.symmetric(20, 20),
color: counter % 2 == 0 ? Color.fromARGB(255, 0, 255, 0) : Color.fromARGB(255, 0, 0, 255),
child: new Text("Click Me",
style: new TextStyle(fontFamily: "racher", fontWeight: FontWeight.w100))
);
return new Container(
color: Color.fromARGB(0, 0, 0, 0),
child: new Column(
children: new List<Widget>
{
new Text("Counter: " + counter,
style: new TextStyle(fontSize: 18, fontWeight: FontWeight.w100)),
new GestureDetector(
onTap: () =>
{
setState(() =>
{
counter++;
});
},
child: raycastable ? (Widget) new RaycastableContainer(
child: child) : child
)
}
)
);
}
}
}
}

3
Samples/UIWidgetsSamples_2019_4/Assets/RecastablePanelSample/RaycastPanelSample.cs.meta


fileFormatVersion: 2
guid: 815fa4781092478880d764710562f43e
timeCreated: 1627370684

部分文件因为文件数量过多而无法显示

正在加载...
取消
保存