浏览代码
Merge branch 'kgdev' into 'master'
Merge branch 'kgdev' into 'master'
fix dismiss. See merge request upm-packages/ui-widgets/com.unity.uiwidgets!112/main
Fan Zhang
6 年前
当前提交
b9d246b2
共有 12 个文件被更改,包括 225 次插入 和 3 次删除
-
1Runtime/engine/UIWidgetsPanel.cs
-
35Runtime/rendering/layer.cs
-
19Runtime/ui/compositing.cs
-
4Runtime/ui/window.cs
-
2Runtime/widgets/app.cs
-
4Runtime/widgets/dismissible.cs
-
51Runtime/flow/texture_layer.cs
-
11Runtime/flow/texture_layer.cs.meta
-
58Runtime/rendering/texture.cs
-
11Runtime/rendering/texture.cs.meta
-
21Runtime/widgets/texture.cs
-
11Runtime/widgets/texture.cs.meta
|
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.ui; |
|||
using UnityEngine; |
|||
using Rect = Unity.UIWidgets.ui.Rect; |
|||
|
|||
namespace Unity.UIWidgets.flow { |
|||
public class TextureLayer : Layer { |
|||
|
|||
Offset _offset = Offset.zero; |
|||
|
|||
public Offset offset { |
|||
set { this._offset = value ?? Offset.zero; } |
|||
} |
|||
|
|||
Size _size; |
|||
|
|||
public Size size { |
|||
set { this._size = value; } |
|||
} |
|||
|
|||
Texture _texture; |
|||
|
|||
public Texture texture { |
|||
set { this._texture = value; } |
|||
} |
|||
|
|||
bool _freeze = false; |
|||
|
|||
public bool freeze { |
|||
set { this._freeze = value; } |
|||
} |
|||
|
|||
public override void preroll(PrerollContext context, Matrix3 matrix) { |
|||
this.paintBounds = Rect.fromLTWH( |
|||
this._offset.dx, this._offset.dy, this._size.width, this._size.height); |
|||
} |
|||
|
|||
public override void paint(PaintContext context) { |
|||
D.assert(this.needsPainting); |
|||
|
|||
if (this._texture == null) { |
|||
return; |
|||
} |
|||
|
|||
var image = new Image(this._texture, noDispose: true); |
|||
|
|||
var canvas = context.canvas; |
|||
canvas.drawImageRect(image, this.paintBounds, new Paint()); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 58b198e3ad2fc48dd999a86390611092 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.ui; |
|||
using UnityEngine; |
|||
using Rect = Unity.UIWidgets.ui.Rect; |
|||
|
|||
namespace Unity.UIWidgets.rendering { |
|||
public class TextureBox : RenderBox { |
|||
|
|||
public TextureBox(Texture texture) { |
|||
D.assert(texture != null); |
|||
this._texture = texture; |
|||
} |
|||
|
|||
public Texture texture { |
|||
get { return this._texture; } |
|||
set { |
|||
D.assert(value != null); |
|||
if (value != this._texture) { |
|||
this._texture = value; |
|||
this.markNeedsPaint(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
Texture _texture; |
|||
|
|||
protected override bool sizedByParent { |
|||
get { return true; } |
|||
} |
|||
|
|||
protected override bool alwaysNeedsCompositing { |
|||
get { return true; } |
|||
} |
|||
|
|||
public override bool isRepaintBoundary { |
|||
get { return true; } |
|||
} |
|||
|
|||
protected override void performResize() { |
|||
this.size = this.constraints.biggest; |
|||
} |
|||
|
|||
protected override bool hitTestSelf(Offset position) { |
|||
return true; |
|||
} |
|||
|
|||
public override void paint(PaintingContext context, Offset offset) { |
|||
if (this._texture == null) { |
|||
return; |
|||
} |
|||
|
|||
context.addLayer(new TextureLayer( |
|||
rect: Rect.fromLTWH(offset.dx, offset.dy, this.size.width, this.size.height), |
|||
texture: this._texture |
|||
)); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 6752d156317e44036a1924d168ded7e9 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.rendering; |
|||
|
|||
namespace Unity.UIWidgets.widgets { |
|||
public class Texture : LeafRenderObjectWidget { |
|||
public Texture(Key key, UnityEngine.Texture texture) : base(key: key) { |
|||
D.assert(texture != null); |
|||
this.texture = texture; |
|||
} |
|||
|
|||
public readonly UnityEngine.Texture texture; |
|||
|
|||
public override RenderObject createRenderObject(BuildContext context) { |
|||
return new TextureBox(texture: this.texture); |
|||
} |
|||
|
|||
public override void updateRenderObject(BuildContext context, RenderObject renderObject) { |
|||
((TextureBox) renderObject).texture = this.texture; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 5de15949323be4d0eb8faec4015cd792 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue