浏览代码

[Feature] reformat the code with #if

/main
iizzaya 5 年前
当前提交
5f9473ff
共有 6 个文件被更改,包括 39 次插入64 次删除
  1. 16
      Runtime/gestures/binding.cs
  2. 4
      Runtime/gestures/events.cs
  3. 36
      Runtime/gestures/mouse_tracking.cs
  4. 30
      Runtime/rendering/proxy_box.cs
  5. 2
      Runtime/ui/pointer.cs
  6. 15
      Runtime/widgets/basic.cs

16
Runtime/gestures/binding.cs


if (hitTestResult != null ||
evt is PointerHoverEvent ||
evt is PointerAddedEvent ||
evt is PointerRemovedEvent
#if UNITY_EDITOR
|| evt is PointerDragFromEditorHoverEvent
|| evt is PointerDragFromEditorReleaseEvent
#endif
evt is PointerRemovedEvent ||
evt is PointerDragFromEditorHoverEvent ||
evt is PointerDragFromEditorReleaseEvent
) {
this.dispatchEvent(evt, hitTestResult);
}

if (hitTestResult == null) {
D.assert(evt is PointerHoverEvent ||
evt is PointerAddedEvent ||
evt is PointerRemovedEvent
#if UNITY_EDITOR
|| evt is PointerDragFromEditorHoverEvent
|| evt is PointerDragFromEditorReleaseEvent
#endif
evt is PointerRemovedEvent ||
evt is PointerDragFromEditorHoverEvent ||
evt is PointerDragFromEditorReleaseEvent
);
try {
this.pointerRouter.route(evt);

4
Runtime/gestures/events.cs


using System;
using Unity.UIWidgets.ui;
#if UNITY_EDITOR
#endif
namespace Unity.UIWidgets.gestures {
public abstract class PointerEvent {

}
}
#if UNITY_EDITOR
public class PointerDragFromEditorEnterEvent : PointerEvent {
public PointerDragFromEditorEnterEvent(
TimeSpan timeStamp,

);
}
}
#endif
public class PointerHoverEvent : PointerEvent {
public PointerHoverEvent(

36
Runtime/gestures/mouse_tracking.cs


public delegate void PointerExitEventListener(PointerExitEvent evt);
#if UNITY_EDITOR
public delegate void PointerDragFromEditorEnterEventListener(PointerDragFromEditorEnterEvent evt);
public delegate void PointerDragFromEditorHoverEventListener(PointerDragFromEditorHoverEvent evt);

public delegate void PointerDragFromEditorReleaseEventListener(PointerDragFromEditorReleaseEvent evt);
#endif
/// The annotation object used to annotate layers that are interested in mouse
/// movements.

PointerEnterEventListener onEnter = null,
PointerHoverEventListener onHover = null,
PointerExitEventListener onExit = null
#if UNITY_EDITOR
, PointerDragFromEditorEnterEventListener onDragFromEditorEnter = null
, PointerDragFromEditorHoverEventListener onDragFromEditorHover = null
, PointerDragFromEditorExitEventListener onDragFromEditorExit = null
, PointerDragFromEditorReleaseEventListener onDragFromEditorRelease = null
#endif
PointerExitEventListener onExit = null,
PointerDragFromEditorEnterEventListener onDragFromEditorEnter = null,
PointerDragFromEditorHoverEventListener onDragFromEditorHover = null,
PointerDragFromEditorExitEventListener onDragFromEditorExit = null,
PointerDragFromEditorReleaseEventListener onDragFromEditorRelease = null
#if UNITY_EDITOR
#endif
}
public readonly PointerEnterEventListener onEnter;

public readonly PointerExitEventListener onExit;
#if UNITY_EDITOR
#endif
public override string ToString() {
return

public partial class MouseTracker {
public MouseTracker(
PointerRouter router,
MouseDetectorAnnotationFinder annotationFinder) {
MouseDetectorAnnotationFinder annotationFinder,
bool inEditor = false
) {
this.inEditor = inEditor;
readonly bool inEditor;
readonly Dictionary<int, PointerEvent> _lastMouseEvent = new Dictionary<int, PointerEvent>();

public void attachAnnotation(MouseTrackerAnnotation annotation) {
this._trackedAnnotations[annotation] = new _TrackedAnnotation(annotation);
this._scheduleMousePositionCheck();
this._scheduleDragFromEditorMousePositionCheck();
if (this.inEditor) {
this._scheduleDragFromEditorMousePositionCheck();
}
#endif
}

PointerExitEvent.fromHoverEvent((PointerHoverEvent) this._lastMouseEvent[deviceId]));
}
#if UNITY_EDITOR
if (annotation.onDragFromEditorExit != null) {
if (this.inEditor && annotation.onDragFromEditorExit != null) {
annotation.onDragFromEditorExit(
PointerDragFromEditorExitEvent.fromDragFromEditorEvent(this._lastMouseEvent[deviceId]));
#endif

}
#if UNITY_EDITOR
this._handleDragFromEditorEvent(evt, deviceId);
if (this.inEditor) {
this._handleDragFromEditorEvent(evt, deviceId);
}
#endif
}

30
Runtime/rendering/proxy_box.cs


HitTestBehavior behavior = HitTestBehavior.deferToChild,
RenderBox child = null
#if UNITY_EDITOR
#endif
) : base(behavior: behavior, child: child) {
this.onPointerDown = onPointerDown;
this.onPointerMove = onPointerMove;

this._onPointerHover = onPointerHover;
this._onPointerExit = onPointerExit;
#if UNITY_EDITOR
#endif
this._onPointerExit != null
#if UNITY_EDITOR
|| this._onPointerDragFromEditorEnter != null
|| this._onPointerDragFromEditorHover != null
|| this._onPointerDragFromEditorExit != null
|| this._onPointerDragFromEditorRelease != null
#endif
this._onPointerExit != null ||
this._onPointerDragFromEditorEnter != null ||
this._onPointerDragFromEditorHover != null ||
this._onPointerDragFromEditorExit != null ||
this._onPointerDragFromEditorRelease != null
onExit: this._onPointerExit
#if UNITY_EDITOR
,onDragFromEditorEnter: this._onPointerDragFromEditorEnter
,onDragFromEditorHover: this._onPointerDragFromEditorHover
,onDragFromEditorExit: this._onPointerDragFromEditorExit
,onDragFromEditorRelease: this._onPointerDragFromEditorRelease
#endif
onExit: this._onPointerExit,
onDragFromEditorEnter: this._onPointerDragFromEditorEnter,
onDragFromEditorHover: this._onPointerDragFromEditorHover,
onDragFromEditorExit: this._onPointerDragFromEditorExit,
onDragFromEditorRelease: this._onPointerDragFromEditorRelease
#if UNITY_EDITOR
PointerDragFromEditorEnterEventListener _onPointerDragFromEditorEnter;
public PointerDragFromEditorEnterEventListener onPointerDragFromEditorEnter {

}
}
}
#endif
public PointerEnterEventListener onPointerEnter {
get { return this._onPointerEnter; }

2
Runtime/ui/pointer.cs


move,
up,
scroll,
#if UNITY_EDITOR
#endif
}
public enum PointerDeviceKind {

15
Runtime/widgets/basic.cs


HitTestBehavior behavior = HitTestBehavior.deferToChild,
Widget child = null,
#if UNITY_EDITOR
#endif
) : base(key: key, child: child) {
this.onPointerDown = onPointerDown;
this.onPointerMove = onPointerMove;

this.onPointerEnter = onPointerEnter;
this.onPointerScroll = onPointerScroll;
this.behavior = behavior;
#if UNITY_EDITOR
#endif
}
public readonly PointerDownEventListener onPointerDown;

public readonly PointerScrollEventListener onPointerScroll;
public readonly HitTestBehavior behavior;
#if UNITY_EDITOR
#endif
public override RenderObject createRenderObject(BuildContext context) {
return new RenderPointerListener(
onPointerDown: this.onPointerDown,

onPointerHover: this.onPointerHover,
onPointerScroll: this.onPointerScroll,
behavior: this.behavior,
#if UNITY_EDITOR
#endif
);
}

正在加载...
取消
保存