浏览代码

Merge pull request #20 from Unity-Technologies/zxw/skiaBase

Zxw/skia base
/siyaoH-1.17-PlatformMessage
GitHub 4 年前
当前提交
af5ffd06
共有 5 个文件被更改,包括 60 次插入17 次删除
  1. 2
      Samples/UIWidgetsSamples_2019_4/Assets/TextTest.unity
  2. 10
      Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsExample.cs
  3. 34
      com.unity.uiwidgets/Runtime/gestures/converter.cs
  4. 4
      com.unity.uiwidgets/Runtime/rendering/view.cs
  5. 27
      engine/src/shell/common/shell.cc

2
Samples/UIWidgetsSamples_2019_4/Assets/TextTest.unity


m_GameObject: {fileID: 847097468}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 169ec79ce040653478e1a7725f34bbe1, type: 3}
m_Script: {fileID: 11500000, guid: 84eecb3d75338e24185f4fcd9d813a55, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}

10
Samples/UIWidgetsSamples_2019_4/Assets/UIWidgetsExample.cs


using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using FontStyle = Unity.UIWidgets.ui.FontStyle;
using ui_ = Unity.UIWidgets.widgets.ui_;

int counter = 0;
public override Widget build(BuildContext context) {
return new Column(
return new Container(
color: Colors.green,
child: new Column(
children: new List<Widget> {
new Text("Counter: " + this.counter),
new GestureDetector(

},
child: new Container(
padding: EdgeInsets.symmetric(20, 20),
color: Colors.blue,
color: this.counter % 2 == 0 ? Colors.blue : Colors.red,
);
)
);
}
}
}

34
com.unity.uiwidgets/Runtime/gestures/converter.cs


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;
using UnityEngine;
namespace Unity.UIWidgets.gestures {
class _PointerState {

switch (datum.change) {
case PointerChange.add: {
D.assert(!_pointers.ContainsKey(datum.device));
_PointerState state = _ensureStateForPointer(datum, position);
D.assert(state.lastPosition == position);
yield return new PointerAddedEvent(

}
}
break;
case PointerChange.remove: {
D.assert(_pointers.ContainsKey(datum.device));
_PointerState state = _pointers[datum.device];
if (state.down) {
yield return new PointerCancelEvent(
timeStamp: timeStamp,
pointer: state.pointer,
kind: kind,
device: datum.device,
position: position
);
}
if (position != state.lastPosition) {
yield return new PointerHoverEvent(
timeStamp: timeStamp,
kind: kind,
device: datum.device,
position: position
);
}
_pointers.Remove(datum.device);
yield return new PointerRemovedEvent(
timeStamp: timeStamp,
kind: kind,
device: datum.device,
position: position
);
break;
}
#if UNITY_EDITOR
// case PointerChange.dragFromEditorMove: {
// _PointerState state = _ensureStateForPointer(datum, position);

4
com.unity.uiwidgets/Runtime/rendering/view.cs


public readonly float devicePixelRatio;
public Matrix4 toMatrix() {
// return new Matrix4().diagonal3Values(this.devicePixelRatio, this.devicePixelRatio, 0);
return new Matrix4().identity();
return new Matrix4().diagonal3Values(this.devicePixelRatio, this.devicePixelRatio, 0);
//return new Matrix4().identity();
}
public override string ToString() {

27
engine/src/shell/common/shell.cc


// second. Otherwise, the timings of last few frames of an animation may
// never be reported until the next animation starts.
frame_timings_report_scheduled_ = true;
task_runners_.GetRasterTaskRunner()->PostDelayedTask(
[self = weak_factory_gpu_->GetWeakPtr()]() {
if (!self.get()) {
return;
}
self->frame_timings_report_scheduled_ = false;
if (self->UnreportedFramesCount() > 0) {
self->ReportTimings();
}
},
fml::TimeDelta::FromMilliseconds(kBatchTimeInMilliseconds));
task_runners_.GetUITaskRunner()->PostDelayedTask(
[self = this]() {
self->task_runners_.GetRasterTaskRunner()->PostTask(
[self2 = self->weak_factory_gpu_->GetWeakPtr()]() {
if (!self2.get()) {
return;
}
self2->frame_timings_report_scheduled_ = false;
if (self2->UnreportedFramesCount() > 0) {
self2->ReportTimings();
}
});
},
fml::TimeDelta::FromMilliseconds(kBatchTimeInMilliseconds)
);
}
}

正在加载...
取消
保存