浏览代码
Merge pull request #187 from Unity-Technologies/handle_touches_on_mobile
Merge pull request #187 from Unity-Technologies/handle_touches_on_mobile
Handle touches on mobile/main
GitHub
4 年前
当前提交
6f52260c
共有 14 个文件被更改,包括 243 次插入 和 323 次删除
-
38com.unity.uiwidgets/Runtime/Plugins/x86_64/libUIWidgets.dll.meta
-
8com.unity.uiwidgets/Runtime/engine/UIWidgetsPanelWrapper.cs
-
2engine/Scripts/lib_build.py
-
179engine/src/shell/platform/unity/android/uiwidgets_panel.cc
-
43engine/src/shell/platform/unity/android/uiwidgets_panel.h
-
40engine/src/shell/platform/unity/darwin/ios/uiwidgets_panel.h
-
178engine/src/shell/platform/unity/darwin/ios/uiwidgets_panel.mm
-
3engine/src/shell/platform/unity/darwin/macos/uiwidgets_panel.mm
-
3engine/src/shell/platform/unity/windows/uiwidgets_panel.cc
-
72Samples/UIWidgetsSamples_2019_4/Assets/WidgetsSample/MobileTouchSample.cs
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using uiwidgets; |
|||
using Unity.UIWidgets.engine; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEngine; |
|||
using UnityEngine.Networking; |
|||
using Image = Unity.UIWidgets.widgets.Image; |
|||
using ui_ = Unity.UIWidgets.widgets.ui_; |
|||
|
|||
namespace UIWidgetsSample |
|||
{ |
|||
public class MobileTouchSample : UIWidgetsPanel |
|||
{ |
|||
protected override void main() |
|||
{ |
|||
ui_.runApp(new MaterialApp( |
|||
title: "Http Request Sample", |
|||
home: new Scaffold( |
|||
body: new MobileTouchWidget() |
|||
) |
|||
)); |
|||
} |
|||
} |
|||
|
|||
public class MobileTouchWidget : StatefulWidget |
|||
{ |
|||
public MobileTouchWidget(Key key = null) : base(key) |
|||
{ |
|||
} |
|||
|
|||
public override State createState() |
|||
{ |
|||
return new MobileTouchWidgetState(); |
|||
} |
|||
} |
|||
|
|||
class MobileTouchWidgetState : State<MobileTouchWidget> |
|||
{ |
|||
private float scale = 1; |
|||
private int frameNo = 0; |
|||
private float rotation = 0; |
|||
|
|||
public override Widget build(BuildContext context) |
|||
{ |
|||
return new Column( |
|||
crossAxisAlignment: CrossAxisAlignment.center, |
|||
children: new List<Widget>() |
|||
{ |
|||
new Text("Frame: " + frameNo), |
|||
new Text("Scale: " + scale), |
|||
new Text("Rotation: " + rotation), |
|||
new GestureDetector( |
|||
child: new Container(height: 300, color: Colors.blue), |
|||
onScaleStart: details => { }, |
|||
onScaleUpdate: details => |
|||
{ |
|||
scale = details.scale; |
|||
rotation = details.rotation; |
|||
frameNo += 1; |
|||
setState(() => { }); |
|||
}, |
|||
onScaleEnd: details => { } |
|||
) |
|||
}); |
|||
} |
|||
} |
|||
} |
部分文件因为文件数量过多而无法显示
撰写
预览
正在加载...
取消
保存
Reference in new issue