浏览代码

extract RawImage

/siyaoH-1.17-PlatformMessage
siyao 4 年前
当前提交
03fdf15d
共有 1 个文件被更改,包括 29 次插入10 次删除
  1. 39
      com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanel.cs

39
com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanel.cs


using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using AOT;
using Unity.UIWidgets.foundation;

using UnityEngine.UI;
using Canvas = UnityEngine.Canvas;
public partial class UIWidgetsPanel : RawImage {
public partial class UIWidgetsPanel : MonoBehaviour {
public class UIWidgetRawImage : RawImage {
UIWidgetsPanel _uiWidgetsPanel;
protected override void OnRectTransformDimensionsChange() {
_uiWidgetsPanel.OnRectTransformDimensionsChange();
}
}
UIWidgetRawImage _rawImage;
RectTransform rectTransform {
get { return _rawImage.rectTransform; }
}
Canvas canvas {
get { return _rawImage.canvas; }
}
Texture texture {
set { _rawImage.texture = value; }
}
public static UIWidgetsPanel current {
get { return Window.instance._panel; }
}

}
}
protected override void OnEnable() {
base.OnEnable();
void OnEnable() {
_rawImage = gameObject.AddComponent<UIWidgetRawImage>();
_recreateRenderTexture(_currentWidth, _currentHeight, _currentDevicePixelRatio);
_handle = GCHandle.Alloc(this);

}
}
protected override void OnRectTransformDimensionsChange() {
protected void OnRectTransformDimensionsChange() {
if (_ptr != IntPtr.Zero) {
if (_recreateRenderTexture(_currentWidth, _currentHeight, _currentDevicePixelRatio)) {
UIWidgetsPanel_onRenderTexture(_ptr,

}
}
protected override void OnDisable() {
protected void OnDisable() {
Input_OnDisable();
UIWidgetsPanel_onDisable(_ptr);

_handle.Free();
_handle = default;
_destroyRenderTexture();
Destroy(_rawImage);
base.OnDisable();
}
bool _recreateRenderTexture(int width, int height, float devicePixelRatio) {

正在加载...
取消
保存