浏览代码

Merge pull request #60 from Unity-Technologies/dev_1.17.5

Dev 1.17.5
/siyaoH-1.17-PlatformMessage
GitHub 4 年前
当前提交
14bc8cfa
共有 9 个文件被更改,包括 77 次插入81 次删除
  1. 72
      Samples/UIWidgetsSamples_2019_4/Assets/Script/TextTest.cs
  2. 24
      com.unity.uiwidgets/Runtime/async2/timer.cs
  3. 8
      com.unity.uiwidgets/Runtime/rendering/object.cs
  4. 26
      com.unity.uiwidgets/Runtime/rendering/sliver_multi_box_adaptor.cs
  5. 11
      com.unity.uiwidgets/Runtime/rendering/sliver_padding.cs
  6. 4
      com.unity.uiwidgets/Runtime/widgets/framework.cs
  7. 9
      com.unity.uiwidgets/Runtime/widgets/sliver.cs
  8. 2
      com.unity.uiwidgets/Runtime/widgets/sliver_fill.cs
  9. 2
      engine/src/lib/ui/ui_mono_state.cc

72
Samples/UIWidgetsSamples_2019_4/Assets/Script/TextTest.cs


using UIWidgetsGallery.gallery;
using Color = Unity.UIWidgets.ui.Color;
using Random = UnityEngine.Random;
public class UIWidgetsExample : UIWidgetsPanel
public class TextTest : UIWidgetsPanel
class MyApp : StatelessWidget
{
public override Widget build(BuildContext context)

);
// return new CupertinoPageScaffold(
// child: new Center(
// child: new CupertinoButton(
// child: new Text(
// "THIS IS TAB #"
// ),
// onPressed: () =>
// {
// Navigator.of(context).push(
// new CupertinoPageRoute(builder: (contex3) =>
// {
// return
// new CupertinoAlertDemo();
// })
// );
// }
// )
// //new Text("hello world!", style: CupertinoTheme.of(context).textTheme.navTitleTextStyle)
// )
// //backgroundColor: Colors.brown
// );
List<BottomNavigationBarItem> items = new List<BottomNavigationBarItem>();
return new CupertinoPageScaffold(
child: new Center(
child: new CupertinoButton(
child: new Text(
"THIS IS TAB #",
style: new TextStyle(color: Color.fromARGB(255, 255, 0, 0))
),
onPressed: () =>
{
Navigator.of(context).push(
new CupertinoPageRoute(builder: (contex3) =>
{
return
new Container(color: Color.fromARGB(255, 0, 255, 0));
})
);
}
)//,
//new Text("hello world!", style: CupertinoTheme.of(context).textTheme.navTitleTextStyle)
),
backgroundColor: Color.fromARGB(255, 255, 255, 0)
);
/*List<BottomNavigationBarItem> items = new List<BottomNavigationBarItem>();
items.Add(new BottomNavigationBarItem(
icon: new Icon(CupertinoIcons.bell),
title: new Text("views")

middle: (index == 0) ? new Text("views") : new Text("articles")
),
child: new Center(
child: new CupertinoButton(
child: new Text(
"THIS IS TAB #",

//.copyWith(fontSize:32)
),
onPressed: () =>
{
Navigator.of(contex1).push(

}
);
})
);
);*/
public override Widget build(BuildContext context)
{
return new CupertinoPageScaffold(

);
}
}
}

24
com.unity.uiwidgets/Runtime/async2/timer.cs


cancel();
}
public abstract int tick { get; }
public abstract long tick { get; }
public abstract bool isActive { get; }

}
class _Timer : Timer {
int _tick = 0;
long _tick = 0;
int _wakeupTime;
long _wakeupTime;
_Timer(ZoneUnaryCallback callback, int wakeupTime, int milliSeconds, bool repeating) {
_Timer(ZoneUnaryCallback callback, long wakeupTime, int milliSeconds, bool repeating) {
_callback = callback;
_wakeupTime = wakeupTime;
_milliSeconds = milliSeconds;

milliSeconds = 0;
}
int now = UIMonoState_timerMillisecondClock();
int wakeupTime = (milliSeconds == 0) ? now : (now + 1 + milliSeconds);
long now = UIMonoState_timerMillisecondClock();
long wakeupTime = (milliSeconds == 0) ? now : (now + 1 + milliSeconds);
_Timer timer = new _Timer(callback, wakeupTime, milliSeconds, repeating);
timer._enqueue();

public override bool isActive => _callback != null;
public override int tick => _tick;
public override long tick => _tick;
void _advanceWakeupTime() {
if (_milliSeconds > 0) {

void _enqueue() {
Isolate.ensureExists();
GCHandle callabackHandle = GCHandle.Alloc(this);
UIMonoState_postTaskForTime(_postTaskForTime, (IntPtr) callabackHandle, _wakeupTime * MILLI_TO_NANO);
GCHandle callbackHandle = GCHandle.Alloc(this);
UIMonoState_postTaskForTime(_postTaskForTime, (IntPtr) callbackHandle, _wakeupTime * MILLI_TO_NANO);
}
[MonoPInvokeCallback(typeof(UIMonoState_postTaskForTimeCallback))]

}
else if (timer._milliSeconds > 0) {
var ms = timer._milliSeconds;
int overdue = UIMonoState_timerMillisecondClock() - timer._wakeupTime;
long overdue = UIMonoState_timerMillisecondClock() - timer._wakeupTime;
int missedTicks = overdue / ms;
long missedTicks = overdue / ms;
timer._wakeupTime += missedTicks * ms;
timer._tick += missedTicks;
}

}
[DllImport(NativeBindings.dllName)]
static extern int UIMonoState_timerMillisecondClock();
static extern long UIMonoState_timerMillisecondClock();
delegate void UIMonoState_postTaskForTimeCallback(IntPtr callbackHandle);

8
com.unity.uiwidgets/Runtime/rendering/object.cs


using Rect = Unity.UIWidgets.ui.Rect;
namespace Unity.UIWidgets.rendering {
public class ParentData {
public interface IParentData {
void detach();
}
public class ParentData : IParentData {
public virtual void detach() {
}

ChildType child { get; set; }
}
public interface ContainerParentDataMixin<ChildType> where ChildType : RenderObject {
public interface ContainerParentDataMixin<ChildType> : IParentData where ChildType : RenderObject {
ChildType previousSibling { get; set; }
ChildType nextSibling { get; set; }
}

26
com.unity.uiwidgets/Runtime/rendering/sliver_multi_box_adaptor.cs


using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.rendering {
public class KeepAliveParentDataMixin : ParentData {
public bool keepAlive = false;
public interface IKeepAliveParentDataMixin : IParentData {
bool keptAlive { get; }
bool keepAlive { get; set; }
}
public class KeepAliveParentDataMixin : ParentData, IKeepAliveParentDataMixin {
bool _keepAlive = false;
public bool keepAlive {
get { return _keepAlive; }
set { _keepAlive = value; }
}
bool keptAlive { get; }
public bool keptAlive { get; }
}
public interface RenderSliverBoxChildManager {

bool debugAssertChildListLocked();
}
public class SliverMultiBoxAdaptorParentData : ContainerParentDataMixinSliverLogicalParentData<RenderBox> {
public class SliverMultiBoxAdaptorParentData : ContainerParentDataMixinSliverLogicalParentData<RenderBox>, IKeepAliveParentDataMixin {
public bool keepAlive = false;
bool _keepAlive = false;
public bool keepAlive {
get { return _keepAlive; }
set { _keepAlive = value; }
}
public bool keptAlive {
get { return _keptAlive; }

11
com.unity.uiwidgets/Runtime/rendering/sliver_padding.cs


public abstract class RenderSliverEdgeInsetsPadding : RenderObjectWithChildMixinRenderSliver<RenderSliver> {
EdgeInsets resolvedPadding { get; }
protected virtual EdgeInsets resolvedPadding { get; }
float? beforePadding {
get {
D.assert(constraints != null);

if (!(child.parentData is SliverPhysicalParentData))
child.parentData = new SliverPhysicalParentData();
}
protected override void performLayout() {
protected override void performLayout() {
SliverConstraints constraints = this.constraints;
D.assert(resolvedPadding != null);
float? beforePadding = this.beforePadding;

paintExtent: paintExtent,
layoutExtent: Mathf.Min(mainAxisPaddingPaintExtent + childLayoutGeometry.layoutExtent, paintExtent),
cacheExtent: Mathf.Min(mainAxisPaddingCacheExtent + childLayoutGeometry.cacheExtent, constraints.remainingCacheExtent),
maxPaintExtent: mainAxisPadding ?? 0.0f + childLayoutGeometry.maxPaintExtent,
maxPaintExtent: (mainAxisPadding ?? 0.0f) + childLayoutGeometry.maxPaintExtent,
hitTestExtent: Mathf.Max(
mainAxisPaddingPaintExtent + childLayoutGeometry.paintExtent,
beforePaddingPaintExtent + childLayoutGeometry.hitTestExtent

this.child = child;
}
EdgeInsets resolvedPadding {
protected override EdgeInsets resolvedPadding {
get { return _resolvedPadding;}
}
EdgeInsets _resolvedPadding;

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


}
}
public abstract class ParentDataWidget<T> : ParentDataWidget where T : ParentData {
public abstract class ParentDataWidget<T> : ParentDataWidget where T : IParentData {
public ParentDataWidget(Key key = null, Widget child = null)
: base(key: key, child: child) {
}

public override bool debugIsValidRenderObject(RenderObject renderObject) {
D.assert(typeof(T) != typeof(ParentData));
D.assert(typeof(T) != typeof(IParentData));
return renderObject.parentData is T;
}

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


}
}*/
public class KeepAlive : ParentDataWidget<KeepAliveParentDataMixin> {
public class KeepAlive : ParentDataWidget<IKeepAliveParentDataMixin> {
public KeepAlive(
Key key = null,
bool keepAlive = true,

public readonly bool keepAlive;
public override void applyParentData(RenderObject renderObject) {
D.assert(renderObject.parentData is SliverMultiBoxAdaptorParentData);
// SliverMultiBoxAdaptorParentData parentData = (SliverMultiBoxAdaptorParentData) renderObject.parentData;
KeepAliveParentDataMixin parentData = (KeepAliveParentDataMixin) renderObject.parentData ;
D.assert(renderObject.parentData is IKeepAliveParentDataMixin);
IKeepAliveParentDataMixin parentData = (IKeepAliveParentDataMixin) renderObject.parentData ;
if (((KeepAliveParentDataMixin)parentData).keepAlive != keepAlive) {
if (((IKeepAliveParentDataMixin)parentData).keepAlive != keepAlive) {
parentData.keepAlive = keepAlive;
var targetParent = renderObject.parent;
if (targetParent is RenderObject && !keepAlive) {

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


float _viewportFraction;
public EdgeInsets resolvedPadding {
protected override EdgeInsets resolvedPadding {
get {
return _resolvedPadding;
}

2
engine/src/lib/ui/ui_mono_state.cc


fml::TimeDelta::FromNanoseconds(target_time_nanos)));
}
UIWIDGETS_API(int)
UIWIDGETS_API(int64_t)
UIMonoState_timerMillisecondClock() { return Mono_TimelineGetMicros() / 1000; }
} // namespace uiwidgets
正在加载...
取消
保存