Skip to main content

DisplayObject

Namespace:FairyGUI
Source:Assets/Scripts/Core/DisplayObject.cs (line 12)

public class DisplayObject : EventDispatcher, IBatchable

Inheritance:EventDispatcher → DisplayObject

Interfaces:IBatchable

Inherited members​

EventDispatcher

AddCapture, AddEventListener, BroadcastEvent, BubbleEvent, DispatchEvent, RemoveCapture, RemoveEventListener, RemoveEventListeners, hasEventListeners, isDispatching

Constructors​

DisplayObject()​

public DisplayObject();

Source:Core/DisplayObject.cs (line 102)

Events​

onPaint​

public event Action onPaint;

Source:Core/DisplayObject.cs (line 47)

Fields​

_contentRect​

protected Rect _contentRect;

Source:Core/DisplayObject.cs (line 94)

_flags​

protected internal Flags _flags;

Source:Core/DisplayObject.cs (line 96)

_paintingInfo​

protected internal PaintingInfo _paintingInfo;

Source:Core/DisplayObject.cs (line 93)

_paintingMode​

protected internal int _paintingMode;

Source:Core/DisplayObject.cs (line 92)

_vertexMatrix​

protected NGraphics.VertexMatrix _vertexMatrix;

Source:Core/DisplayObject.cs (line 95)

gOwner​

public GObject gOwner;

Source:Core/DisplayObject.cs (line 52)

id​

public uint id;

Source:Core/DisplayObject.cs (line 57)

name​

public string name;

Source:Core/DisplayObject.cs (line 17)

Methods​

AddToBatch(List<BatchElement>, bool)​

virtual public BatchElement AddToBatch(List<BatchElement> batchElements, bool force);
ParameterTypeDescription
batchElementsList<BatchElement>
forcebool

Source:Core/DisplayObject.cs (line 1838)

CreateGameObject(string)​

protected void CreateGameObject(string gameObjectName);
ParameterTypeDescription
gameObjectNamestring

Source:Core/DisplayObject.cs (line 229)

DestroyGameObject()​

protected void DestroyGameObject();

Source:Core/DisplayObject.cs (line 253)

Dispose()​

virtual public void Dispose();

Source:Core/DisplayObject.cs (line 1785)

EnsureSizeCorrect()​

virtual public void EnsureSizeCorrect();

Source:Core/DisplayObject.cs (line 497)

EnterPaintingMode()​

public void EnterPaintingMode();

进入绘画模式,整个对象将画到一张RenderTexture上,然后这种贴图将代替原有的显示内容。 可以在onPaint回调里对这张纹理进行进一步操作,实现特殊效果。

Source:Core/DisplayObject.cs (line 1093)

EnterPaintingMode(int, Margin?)​

public void EnterPaintingMode(int requestorId, Margin? extend);

进入绘画模式,整个对象将画到一张RenderTexture上,然后这种贴图将代替原有的显示内容。 可以在onPaint回调里对这张纹理进行进一步操作,实现特殊效果。 可能有多个地方要求进入绘画模式,这里用requestorId加以区别,取值是1、2、4、8、16以此类推。1024内内部保留。用户自定义的id从1024开始。

ParameterTypeDescription
requestorIdint
extendMargin?纹理四周的留空。如果特殊处理后的内容大于原内容,那么这里的设置可以使纹理扩大。

Source:Core/DisplayObject.cs (line 1105)

EnterPaintingMode(int, Margin?, float)​

public void EnterPaintingMode(int requestorId, Margin? extend, float scale);

进入绘画模式,整个对象将画到一张RenderTexture上,然后这种贴图将代替原有的显示内容。 可以在onPaint回调里对这张纹理进行进一步操作,实现特殊效果。 可能有多个地方要求进入绘画模式,这里用requestorId加以区别,取值是1、2、4、8、16以此类推。1024内内部保留。用户自定义的id从1024开始。

ParameterTypeDescription
requestorIdint请求者id
extendMargin?扩展纹理。如果特殊处理后的内容大于原内容,那么这里的设置可以使纹理扩大。
scalefloat附加一个缩放系数

Source:Core/DisplayObject.cs (line 1118)

GetBounds(DisplayObject)​

virtual public Rect GetBounds(DisplayObject targetSpace);
ParameterTypeDescription
targetSpaceDisplayObject

Source:Core/DisplayObject.cs (line 1320)

GetScreenShot(Margin?, float)​

public Texture2D GetScreenShot(Margin? extend, float scale);
ParameterTypeDescription
extendMargin?
scalefloat

Source:Core/DisplayObject.cs (line 1231)

GlobalToLocal(Vector2)​

public Vector2 GlobalToLocal(Vector2 point);

将舞台坐标转换为本地坐标

ParameterTypeDescription
pointVector2

Source:Core/DisplayObject.cs (line 1371)

HitTest()​

virtual protected DisplayObject HitTest();

Source:Core/DisplayObject.cs (line 1353)

InvalidateBatchingState()​

public void InvalidateBatchingState();

Source:Core/DisplayObject.cs (line 1579)

LeavePaintingMode(int)​

public void LeavePaintingMode(int requestorId);

离开绘画模式

ParameterTypeDescription
requestorIdint

Source:Core/DisplayObject.cs (line 1171)

LocalToGlobal(Vector2)​

public Vector2 LocalToGlobal(Vector2 point);

将本地坐标转换为舞台坐标

ParameterTypeDescription
pointVector2

Source:Core/DisplayObject.cs (line 1419)

LocalToWorld(Vector3)​

public Vector3 LocalToWorld(Vector3 localPoint);
ParameterTypeDescription
localPointVector3

Source:Core/DisplayObject.cs (line 1487)

OnSizeChanged()​

virtual protected void OnSizeChanged();

Source:Core/DisplayObject.cs (line 501)

RemoveFromParent()​

public void RemoveFromParent();

Source:Core/DisplayObject.cs (line 1570)

SetGameObject(GameObject)​

protected void SetGameObject(GameObject gameObject);
ParameterTypeDescription
gameObjectGameObject

Source:Core/DisplayObject.cs (line 244)

SetLayer(int, bool)​

virtual protected bool SetLayer(int value, bool fromParent);
ParameterTypeDescription
valueint
fromParentbool

Source:Core/DisplayObject.cs (line 1732)

SetPosition(float, float, float)​

public void SetPosition(float xv, float yv, float zv);
ParameterTypeDescription
xvfloat
yvfloat
zvfloat

Source:Core/DisplayObject.cs (line 379)

SetRenderingOrder(UpdateContext, bool)​

virtual public void SetRenderingOrder(UpdateContext context, bool inBatch);
ParameterTypeDescription
contextUpdateContext
inBatchbool

Source:Core/DisplayObject.cs (line 880)

SetScale(float, float)​

public void SetScale(float xv, float yv);
ParameterTypeDescription
xvfloat
yvfloat

Source:Core/DisplayObject.cs (line 549)

SetSize(float, float)​

public void SetSize(float wv, float hv);
ParameterTypeDescription
wvfloat
hvfloat

Source:Core/DisplayObject.cs (line 478)

SetXY(float, float)​

public void SetXY(float xv, float yv);
ParameterTypeDescription
xvfloat
yvfloat

Source:Core/DisplayObject.cs (line 368)

TransformPoint(Vector2, DisplayObject)​

public Vector2 TransformPoint(Vector2 point, DisplayObject targetSpace);
ParameterTypeDescription
pointVector2
targetSpaceDisplayObjectnull if to world space

Source:Core/DisplayObject.cs (line 1515)

TransformRect(Rect, DisplayObject)​

public Rect TransformRect(Rect rect, DisplayObject targetSpace);
ParameterTypeDescription
rectRect
targetSpaceDisplayObjectnull if to world space

Source:Core/DisplayObject.cs (line 1533)

TransformRectPoint(float, float, DisplayObject, Vector4)​

protected void TransformRectPoint(float px, float py, DisplayObject targetSpace, ref Vector4 vec4);
ParameterTypeDescription
pxfloat
pyfloat
targetSpaceDisplayObject
vec4Vector4

Source:Core/DisplayObject.cs (line 1557)

Update(UpdateContext)​

virtual public void Update(UpdateContext context);
ParameterTypeDescription
contextUpdateContext

Source:Core/DisplayObject.cs (line 1585)

WorldToLocal(Vector3, Vector3)​

public Vector3 WorldToLocal(Vector3 worldPoint, Vector3 direction);

转换世界坐标点到等效的本地xy平面的点。等效的意思是他们在屏幕方向看到的位置一样。 返回的点是在对象的本地坐标空间,且z=0

ParameterTypeDescription
worldPointVector3
directionVector3

Source:Core/DisplayObject.cs (line 1447)

Properties​

alpha​

public float alpha { get; set; }

Source:Core/DisplayObject.cs (line 269)

blendMode​

public BlendMode blendMode { get; set; }

Source:Core/DisplayObject.cs (line 1289)

cacheAsBitmap​

public bool cacheAsBitmap { get; set; }

将整个显示对象(如果是容器,则容器包含的整个显示列表)静态化,所有内容被缓冲到一张纹理上。 DC将保持为1。CPU消耗将降到最低。但对象的任何变化不会更新。 当cacheAsBitmap已经为true时,再次调用cacheAsBitmap=true将会刷新对象一次。

Source:Core/DisplayObject.cs (line 1207)

cachedTransform​

public Transform cachedTransform { get; protected set; }

Source:Core/DisplayObject.cs (line 32)

cursor​

public string cursor { get; set; }

Source:Core/DisplayObject.cs (line 974)

filter​

public IFilter filter { get; set; }

Source:Core/DisplayObject.cs (line 1259)

focalLength​

public int focalLength { get; set; }

Source:Core/DisplayObject.cs (line 704)

focusable​

public bool focusable { get; set; }

If the object can be focused?

Source:Core/DisplayObject.cs (line 919)

focused​

public bool focused { get; }

If the object focused?

Source:Core/DisplayObject.cs (line 949)

gameObject​

public GameObject gameObject { get; protected set; }

Source:Core/DisplayObject.cs (line 27)

graphics​

public NGraphics graphics { get; protected set; }

Source:Core/DisplayObject.cs (line 37)

grayed​

public bool grayed { get; set; }

Source:Core/DisplayObject.cs (line 278)

height​

public float height { get; set; }

Source:Core/DisplayObject.cs (line 438)

home​

public Transform home { get; set; }

为对象设置一个默认的父Transform。当对象不在显示列表里时,它的GameObject挂到哪里。

Source:Core/DisplayObject.cs (line 1677)

isDisposed​

public bool isDisposed { get; }

Source:Core/DisplayObject.cs (line 991)

layer​

public int layer { get; set; }

Source:Core/DisplayObject.cs (line 901)

location​

public Vector3 location { get; set; }

This is the pivot position

Source:Core/DisplayObject.cs (line 814)

material​

public Material material { get; set; }

Source:Core/DisplayObject.cs (line 834)

onAddedToStage​

public EventListener onAddedToStage { get; }

Source:Core/DisplayObject.cs (line 183)

onClick​

public EventListener onClick { get; }

Source:Core/DisplayObject.cs (line 119)

onClickLink​

public EventListener onClickLink { get; }

Source:Core/DisplayObject.cs (line 207)

onFocusIn​

public EventListener onFocusIn { get; }

Source:Core/DisplayObject.cs (line 215)

onFocusOut​

public EventListener onFocusOut { get; }

Source:Core/DisplayObject.cs (line 223)

onKeyDown​

public EventListener onKeyDown { get; }

Source:Core/DisplayObject.cs (line 199)

onMouseWheel​

public EventListener onMouseWheel { get; }

Source:Core/DisplayObject.cs (line 175)

onRemovedFromStage​

public EventListener onRemovedFromStage { get; }

Source:Core/DisplayObject.cs (line 191)

onRightClick​

public EventListener onRightClick { get; }

Source:Core/DisplayObject.cs (line 127)

onRollOut​

public EventListener onRollOut { get; }

Source:Core/DisplayObject.cs (line 167)

onRollOver​

public EventListener onRollOver { get; }

Source:Core/DisplayObject.cs (line 159)

onTouchBegin​

public EventListener onTouchBegin { get; }

Source:Core/DisplayObject.cs (line 135)

onTouchEnd​

public EventListener onTouchEnd { get; }

Source:Core/DisplayObject.cs (line 151)

onTouchMove​

public EventListener onTouchMove { get; }

Source:Core/DisplayObject.cs (line 143)

paintingGraphics​

public NGraphics paintingGraphics { get; protected set; }

Source:Core/DisplayObject.cs (line 42)

paintingMode​

public bool paintingMode { get; }

Source:Core/DisplayObject.cs (line 1197)

parent​

public Container parent { get; private set; }

Source:Core/DisplayObject.cs (line 22)

perspective​

public bool perspective { get; set; }

当对象处于ScreenSpace,也就是使用正交相机渲染时,对象虽然可以绕X轴或者Y轴旋转,但没有透视效果。设置perspective,可以模拟出透视效果。

Source:Core/DisplayObject.cs (line 679)

pivot​

public Vector2 pivot { get; set; }

Source:Core/DisplayObject.cs (line 759)

pixelPerfect​

public bool pixelPerfect { get; set; }

If the object position is align by pixel

Source:Core/DisplayObject.cs (line 401)

position​

public Vector3 position { get; set; }

Source:Core/DisplayObject.cs (line 357)

renderingOrder​

public int renderingOrder { get; }

Source:Core/DisplayObject.cs (line 872)

rotation​

public float rotation { get; set; }

Source:Core/DisplayObject.cs (line 591)

rotationX​

public float rotationX { get; set; }

Source:Core/DisplayObject.cs (line 615)

rotationY​

public float rotationY { get; set; }

Source:Core/DisplayObject.cs (line 638)

scale​

public Vector2 scale { get; set; }

Source:Core/DisplayObject.cs (line 579)

scaleX​

public float scaleX { get; set; }

Source:Core/DisplayObject.cs (line 515)

scaleY​

public float scaleY { get; set; }

Source:Core/DisplayObject.cs (line 531)

shader​

public string shader { get; set; }

Source:Core/DisplayObject.cs (line 853)

size​

public Vector2 size { get; set; }

Source:Core/DisplayObject.cs (line 460)

skew​

public Vector2 skew { get; set; }

Source:Core/DisplayObject.cs (line 661)

stage​

public Stage stage { get; }

Source:Core/DisplayObject.cs (line 1028)

tabStop​

public bool tabStop { get; set; }

If the object can be navigated by TAB?

Source:Core/DisplayObject.cs (line 934)

topmost​

public Container topmost { get; }

Source:Core/DisplayObject.cs (line 1014)

touchDisabled​

public bool touchDisabled { get; }

Source:Core/DisplayObject.cs (line 1084)

touchable​

public bool touchable { get; set; }

Source:Core/DisplayObject.cs (line 1062)

visible​

public bool visible { get; set; }

Source:Core/DisplayObject.cs (line 287)

width​

public float width { get; set; }

Source:Core/DisplayObject.cs (line 416)

worldSpaceContainer​

public Container worldSpaceContainer { get; }

Source:Core/DisplayObject.cs (line 1039)

x​

public float x { get; set; }

Source:Core/DisplayObject.cs (line 312)

xy​

public Vector2 xy { get; set; }

Source:Core/DisplayObject.cs (line 348)

y​

public float y { get; set; }

Source:Core/DisplayObject.cs (line 324)

z​

public float z { get; set; }

Source:Core/DisplayObject.cs (line 336)