浏览代码

Merge remote-tracking branch 'upstream/master' into keyboard

/main
fzhangtj 6 年前
当前提交
b89636b7
共有 15 个文件被更改,包括 1147 次插入7 次删除
  1. 2
      Runtime/editor/editor_window.cs
  2. 2
      Runtime/rendering/layer.cs
  3. 2
      Runtime/rendering/texture.cs
  4. 4
      Runtime/ui/window.cs
  5. 12
      Runtime/widgets/texture.cs
  6. 14
      Samples/UIWidgetSample/ToDoAppSample.cs
  7. 15
      Samples/UIWidgetSample/UIWidgetSample.unity
  8. 8
      Samples/UIWidgetSample/Resources.meta
  9. 20
      Samples/UIWidgetSample/VideoSampleComponent.cs
  10. 11
      Samples/UIWidgetSample/VideoSampleComponent.cs.meta
  11. 34
      Samples/UIWidgetSample/Resources/VideoSampleRT.renderTexture
  12. 8
      Samples/UIWidgetSample/Resources/VideoSampleRT.renderTexture.meta
  13. 1001
      Samples/UIWidgetSample/Resources/file_example_MOV_480_700kB.mov
  14. 21
      Samples/UIWidgetSample/Resources/file_example_MOV_480_700kB.mov.meta

2
Runtime/editor/editor_window.cs


public abstract class WindowAdapter : Window {
static readonly List<WindowAdapter> _windowAdapters = new List<WindowAdapter>();
public static IEnumerable<WindowAdapter> windowAdapters {
public static List<WindowAdapter> windowAdapters {
get { return _windowAdapters; }
}

2
Runtime/rendering/layer.cs


public readonly bool freeze;
internal override flow.Layer addToScene(SceneBuilder builder, Offset layerOffset = null) {
layerOffset = layerOffset ?? Offset.zero;
Rect shiftedRect = this.rect.shift(layerOffset);
builder.addTexture(
this.texture,

2
Runtime/rendering/texture.cs


namespace Unity.UIWidgets.rendering {
public class TextureBox : RenderBox {
public TextureBox(Texture texture) {
public TextureBox(Texture texture = null) {
D.assert(texture != null);
this._texture = texture;
}

4
Runtime/ui/window.cs


public abstract void scheduleFrame(bool regenerateLayerTree = true);
public void textureFrameAvailable() {
this.scheduleFrame(false);
}
public abstract void render(Scene scene);
public abstract void scheduleMicrotask(Action callback);

12
Runtime/widgets/texture.cs


using Unity.UIWidgets.editor;
using Unity.UIWidgets.ui;
public Texture(Key key, UnityEngine.Texture texture) : base(key: key) {
public static void textureFrameAvailable(Window instance = null) {
if (instance == null) {
WindowAdapter.windowAdapters.ForEach(w => w.scheduleFrame(false));
} else {
instance.scheduleFrame(false);
}
}
public Texture(Key key = null, UnityEngine.Texture texture = null) : base(key: key) {
D.assert(texture != null);
this.texture = texture;
}

14
Samples/UIWidgetSample/ToDoAppSample.cs


using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using Texture = Unity.UIWidgets.widgets.Texture;
namespace UIWidgetsSample {
public class ToDoAppSample : UIWidgetsSamplePanel {

);
}
Widget videoTexture() {
var texture = Resources.Load<RenderTexture>("VideoSampleRT");
return new Center(
child: new Container(
width: 480, height: 270,
child: new Texture(texture: texture)
)
);
}
public override Widget build(BuildContext context) {
var container = new Container(
padding: EdgeInsets.all(10),

this.textInput(),
// textInput(),
this.contents(),
this.videoTexture(),
}
)
);

15
Samples/UIWidgetSample/UIWidgetSample.unity


- component: {fileID: 1387978527}
- component: {fileID: 1387978529}
- component: {fileID: 1387978528}
- component: {fileID: 1387978530}
m_Layer: 5
m_Name: ToAppPanel
m_TagString: Untagged

m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1387978526}
m_CullTransparentMesh: 0
--- !u!114 &1387978530
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1387978526}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c1b5fe397122c4c5988b2bddfe92bd95, type: 3}
m_Name:
m_EditorClassIdentifier:
videoClip: {fileID: 32900000, guid: 9906c152cf75248e98d1edd60759f014, type: 3}
renderTexture: {fileID: 8400000, guid: 53bf3f9b1464948cbb3f58add96afa32, type: 2}
--- !u!1 &1399904530
GameObject:
m_ObjectHideFlags: 0

8
Samples/UIWidgetSample/Resources.meta


fileFormatVersion: 2
guid: 77196fe8699ab4d4ebcdcd40d51ad725
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

20
Samples/UIWidgetSample/VideoSampleComponent.cs


using UnityEngine;
using UnityEngine.Video;
using Texture = Unity.UIWidgets.widgets.Texture;
namespace UIWidgetsSample {
public class VideoSampleComponent : MonoBehaviour {
public VideoClip videoClip;
public RenderTexture renderTexture;
void Start() {
var videoPlayer = this.gameObject.AddComponent<VideoPlayer>();
videoPlayer.clip = this.videoClip;
videoPlayer.targetTexture = this.renderTexture;
videoPlayer.isLooping = true;
videoPlayer.sendFrameReadyEvents = true;
videoPlayer.frameReady += (_, __) => Texture.textureFrameAvailable();
videoPlayer.Play();
}
}
}

11
Samples/UIWidgetSample/VideoSampleComponent.cs.meta


fileFormatVersion: 2
guid: c1b5fe397122c4c5988b2bddfe92bd95
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

34
Samples/UIWidgetSample/Resources/VideoSampleRT.renderTexture


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!84 &8400000
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: VideoSampleRT
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
m_Width: 480
m_Height: 480
m_AntiAliasing: 1
m_DepthFormat: 2
m_ColorFormat: 0
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 0
m_Aniso: 0
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1

8
Samples/UIWidgetSample/Resources/VideoSampleRT.renderTexture.meta


fileFormatVersion: 2
guid: 53bf3f9b1464948cbb3f58add96afa32
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 8400000
userData:
assetBundleName:
assetBundleVariant:

1001
Samples/UIWidgetSample/Resources/file_example_MOV_480_700kB.mov
文件差异内容过多而无法显示
查看文件

21
Samples/UIWidgetSample/Resources/file_example_MOV_480_700kB.mov.meta


fileFormatVersion: 2
guid: 9906c152cf75248e98d1edd60759f014
VideoClipImporter:
externalObjects: {}
serializedVersion: 2
useLegacyImporter: 0
quality: 0.5
isColorLinear: 0
frameRange: 0
startFrame: -1
endFrame: -1
colorSpace: 0
deinterlace: 0
encodeAlpha: 0
flipVertical: 0
flipHorizontal: 0
importAudio: 1
targetSettings: {}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存