summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Assets/Test/05_Mask/05_Mask.unity500
-rw-r--r--Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/MaskableGraphic.cs6
-rw-r--r--Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Mask/Mask.cs62
-rw-r--r--Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Mask/MaskUtilities.cs7
-rw-r--r--Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Mask/RectMask2D.cs20
5 files changed, 311 insertions, 284 deletions
diff --git a/Assets/Test/05_Mask/05_Mask.unity b/Assets/Test/05_Mask/05_Mask.unity
index 2441bbc..58a57b5 100644
--- a/Assets/Test/05_Mask/05_Mask.unity
+++ b/Assets/Test/05_Mask/05_Mask.unity
@@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
- m_IndirectSpecularColor: {r: 0.18028334, g: 0.22571343, b: 0.30692208, a: 1}
+ m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
@@ -88,6 +88,7 @@ LightmapSettings:
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
+ m_ShowResolutionOverlay: 1
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !u!196 &4
@@ -112,74 +113,6 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
---- !u!1 &159377744
-GameObject:
- m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
- serializedVersion: 5
- m_Component:
- - component: {fileID: 159377745}
- - component: {fileID: 159377747}
- - component: {fileID: 159377746}
- m_Layer: 5
- m_Name: Image (1)
- m_TagString: Untagged
- m_Icon: {fileID: 0}
- m_NavMeshLayer: 0
- m_StaticEditorFlags: 0
- m_IsActive: 1
---- !u!224 &159377745
-RectTransform:
- m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 159377744}
- m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
- m_LocalPosition: {x: 73.6, y: 124, z: 0}
- m_LocalScale: {x: 1, y: 1, z: 1}
- m_Children: []
- m_Father: {fileID: 797222066}
- m_RootOrder: 1
- m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
- m_AnchorMin: {x: 0.5, y: 0.5}
- m_AnchorMax: {x: 0.5, y: 0.5}
- m_AnchoredPosition: {x: 73.6, y: 124}
- m_SizeDelta: {x: 100, y: 100}
- m_Pivot: {x: 0.5, y: 0.5}
---- !u!114 &159377746
-MonoBehaviour:
- m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 159377744}
- m_Enabled: 1
- m_EditorHideFlags: 0
- m_Script: {fileID: 11500000, guid: 0cba8e295482e184f9f6a5a8f2b559c3, type: 3}
- m_Name:
- m_EditorClassIdentifier:
- m_Material: {fileID: 0}
- m_Color: {r: 1, g: 1, b: 1, a: 1}
- m_RaycastTarget: 1
- m_OnCullStateChanged:
- m_PersistentCalls:
- m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, Assembly-CSharp,
- Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
- m_Sprite: {fileID: 21300000, guid: 4c39797c0008dfb429eaf35a53f9ae9b, type: 3}
- m_Type: 0
- m_PreserveAspect: 0
- m_FillCenter: 1
- m_FillMethod: 4
- m_FillAmount: 1
- m_FillClockwise: 1
- m_FillOrigin: 0
---- !u!222 &159377747
-CanvasRenderer:
- m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 159377744}
--- !u!1 &392020843
GameObject:
m_ObjectHideFlags: 0
@@ -243,6 +176,7 @@ Camera:
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
+ m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
@@ -325,47 +259,47 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
---- !u!1 &683583036
+--- !u!1 &565444304
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- - component: {fileID: 683583037}
- - component: {fileID: 683583039}
- - component: {fileID: 683583038}
+ - component: {fileID: 565444305}
+ - component: {fileID: 565444307}
+ - component: {fileID: 565444306}
m_Layer: 5
- m_Name: Image
+ m_Name: Image_Pico
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
---- !u!224 &683583037
+--- !u!224 &565444305
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 683583036}
+ m_GameObject: {fileID: 565444304}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
- m_Father: {fileID: 1281586982}
- m_RootOrder: 0
+ m_Father: {fileID: 1067901026}
+ m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
- m_AnchoredPosition: {x: 0, y: 0}
+ m_AnchoredPosition: {x: -123, y: 117}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
---- !u!114 &683583038
+--- !u!114 &565444306
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 683583036}
+ m_GameObject: {fileID: 565444304}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cba8e295482e184f9f6a5a8f2b559c3, type: 3}
@@ -379,7 +313,7 @@ MonoBehaviour:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, Assembly-CSharp,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
- m_Sprite: {fileID: 21300000, guid: 4c39797c0008dfb429eaf35a53f9ae9b, type: 3}
+ m_Sprite: {fileID: 21300000, guid: e3947587ecd38f84fbd22c51232fb9c7, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -387,118 +321,91 @@ MonoBehaviour:
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
---- !u!222 &683583039
+--- !u!222 &565444307
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 683583036}
---- !u!1 &728889361
+ m_GameObject: {fileID: 565444304}
+--- !u!1 &905563187
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- - component: {fileID: 728889365}
- - component: {fileID: 728889364}
- - component: {fileID: 728889363}
- - component: {fileID: 728889362}
+ - component: {fileID: 905563188}
+ - component: {fileID: 905563190}
+ - component: {fileID: 905563189}
m_Layer: 5
- m_Name: Canvas
+ m_Name: Image_Fog
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
---- !u!114 &728889362
-MonoBehaviour:
+--- !u!224 &905563188
+RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 728889361}
- m_Enabled: 1
- m_EditorHideFlags: 0
- m_Script: {fileID: 11500000, guid: 0dc7198a94080b64e9e51e6f934b3e35, type: 3}
- m_Name:
- m_EditorClassIdentifier:
- m_IgnoreReversedGraphics: 1
- m_BlockingObjects: 0
- m_BlockingMask:
- serializedVersion: 2
- m_Bits: 4294967295
---- !u!114 &728889363
+ m_GameObject: {fileID: 905563187}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 1067901026}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0.5, y: 0.5}
+ m_AnchorMax: {x: 0.5, y: 0.5}
+ m_AnchoredPosition: {x: -4, y: 24}
+ m_SizeDelta: {x: 100, y: 100}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &905563189
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 728889361}
+ m_GameObject: {fileID: 905563187}
m_Enabled: 1
m_EditorHideFlags: 0
- m_Script: {fileID: 11500000, guid: debcf26b89013e446a6de5574715c5af, type: 3}
+ m_Script: {fileID: 11500000, guid: 0cba8e295482e184f9f6a5a8f2b559c3, type: 3}
m_Name:
m_EditorClassIdentifier:
- m_UiScaleMode: 0
- m_ReferencePixelsPerUnit: 100
- m_ScaleFactor: 1
- m_ReferenceResolution: {x: 800, y: 600}
- m_ScreenMatchMode: 0
- m_MatchWidthOrHeight: 0
- m_PhysicalUnit: 3
- m_FallbackScreenDPI: 96
- m_DefaultSpriteDPI: 96
- m_DynamicPixelsPerUnit: 1
---- !u!223 &728889364
-Canvas:
- m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 728889361}
- m_Enabled: 1
- serializedVersion: 3
- m_RenderMode: 0
- m_Camera: {fileID: 0}
- m_PlaneDistance: 100
- m_PixelPerfect: 0
- m_ReceivesEvents: 1
- m_OverrideSorting: 0
- m_OverridePixelPerfect: 0
- m_SortingBucketNormalizedSize: 0
- m_AdditionalShaderChannelsFlag: 0
- m_SortingLayerID: 0
- m_SortingOrder: 0
- m_TargetDisplay: 0
---- !u!224 &728889365
-RectTransform:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, Assembly-CSharp,
+ Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
+ m_Sprite: {fileID: 21300000, guid: 4c39797c0008dfb429eaf35a53f9ae9b, type: 3}
+ m_Type: 0
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+--- !u!222 &905563190
+CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 728889361}
- m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
- m_LocalPosition: {x: 393, y: 306.5, z: 0}
- m_LocalScale: {x: 1, y: 1, z: 1}
- m_Children:
- - {fileID: 1281586982}
- - {fileID: 797222066}
- m_Father: {fileID: 0}
- m_RootOrder: 3
- m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
- m_AnchorMin: {x: 0.5, y: 0.5}
- m_AnchorMax: {x: 0.5, y: 0.5}
- m_AnchoredPosition: {x: 0, y: 0}
- m_SizeDelta: {x: 100, y: 100}
- m_Pivot: {x: 0.5, y: 0.5}
---- !u!1 &797222065
+ m_GameObject: {fileID: 905563187}
+--- !u!1 &1067901025
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- - component: {fileID: 797222066}
- - component: {fileID: 797222069}
- - component: {fileID: 797222068}
- - component: {fileID: 797222067}
+ - component: {fileID: 1067901026}
+ - component: {fileID: 1067901029}
+ - component: {fileID: 1067901028}
+ - component: {fileID: 1067901027}
m_Layer: 5
m_Name: Mask
m_TagString: Untagged
@@ -506,32 +413,32 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
---- !u!224 &797222066
+--- !u!224 &1067901026
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 797222065}
+ m_GameObject: {fileID: 1067901025}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
- m_LocalPosition: {x: 139.77, y: 0, z: 0}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- - {fileID: 957986383}
- - {fileID: 159377745}
- m_Father: {fileID: 728889365}
- m_RootOrder: 1
+ - {fileID: 905563188}
+ - {fileID: 565444305}
+ m_Father: {fileID: 1479783677}
+ m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
- m_AnchoredPosition: {x: 139.77, y: 0}
+ m_AnchoredPosition: {x: 161, y: 3}
m_SizeDelta: {x: 95.47, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
---- !u!114 &797222067
+--- !u!114 &1067901027
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 797222065}
+ m_GameObject: {fileID: 1067901025}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 570773b73e8b0334fb410b7457eb8b6a, type: 3}
@@ -552,207 +459,258 @@ MonoBehaviour:
y: 0
width: 1
height: 1
---- !u!222 &797222068
+--- !u!222 &1067901028
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 797222065}
---- !u!114 &797222069
+ m_GameObject: {fileID: 1067901025}
+--- !u!114 &1067901029
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 797222065}
+ m_GameObject: {fileID: 1067901025}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bfc675de41855c44aaedb7af695ba899, type: 3}
m_Name:
m_EditorClassIdentifier:
- m_ShowMaskGraphic: 1
---- !u!1 &884199309
+ m_ShowMaskGraphic: 0
+--- !u!1 &1479783676
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- - component: {fileID: 884199310}
- - component: {fileID: 884199312}
- - component: {fileID: 884199311}
+ - component: {fileID: 1479783677}
+ - component: {fileID: 1479783680}
+ - component: {fileID: 1479783679}
+ - component: {fileID: 1479783678}
m_Layer: 5
- m_Name: Image (1)
+ m_Name: CanvasParent
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
---- !u!224 &884199310
+--- !u!224 &1479783677
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 884199309}
+ m_GameObject: {fileID: 1479783676}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
- m_LocalPosition: {x: 23.51, y: 111.2, z: 0}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
- m_Children: []
- m_Father: {fileID: 1281586982}
- m_RootOrder: 1
+ m_Children:
+ - {fileID: 1067901026}
+ m_Father: {fileID: 1691876112}
+ m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
- m_AnchorMin: {x: 0.5, y: 0.5}
- m_AnchorMax: {x: 0.5, y: 0.5}
- m_AnchoredPosition: {x: 23.51, y: 111.2}
- m_SizeDelta: {x: 100, y: 100}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 0, y: 0}
+ m_AnchoredPosition: {x: 58.270004, y: -0.0000076293945}
+ m_SizeDelta: {x: 665, y: 374}
m_Pivot: {x: 0.5, y: 0.5}
---- !u!114 &884199311
+--- !u!114 &1479783678
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 884199309}
+ m_GameObject: {fileID: 1479783676}
m_Enabled: 1
m_EditorHideFlags: 0
- m_Script: {fileID: 11500000, guid: 0cba8e295482e184f9f6a5a8f2b559c3, type: 3}
+ m_Script: {fileID: 11500000, guid: 0dc7198a94080b64e9e51e6f934b3e35, type: 3}
m_Name:
m_EditorClassIdentifier:
- m_Material: {fileID: 0}
- m_Color: {r: 1, g: 1, b: 1, a: 1}
- m_RaycastTarget: 1
- m_OnCullStateChanged:
- m_PersistentCalls:
- m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, Assembly-CSharp,
- Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
- m_Sprite: {fileID: 21300000, guid: 4c39797c0008dfb429eaf35a53f9ae9b, type: 3}
- m_Type: 0
- m_PreserveAspect: 0
- m_FillCenter: 1
- m_FillMethod: 4
- m_FillAmount: 1
- m_FillClockwise: 1
- m_FillOrigin: 0
---- !u!222 &884199312
-CanvasRenderer:
+ m_IgnoreReversedGraphics: 1
+ m_BlockingObjects: 0
+ m_BlockingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+--- !u!114 &1479783679
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1479783676}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: debcf26b89013e446a6de5574715c5af, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_UiScaleMode: 0
+ m_ReferencePixelsPerUnit: 100
+ m_ScaleFactor: 1
+ m_ReferenceResolution: {x: 800, y: 600}
+ m_ScreenMatchMode: 0
+ m_MatchWidthOrHeight: 0
+ m_PhysicalUnit: 3
+ m_FallbackScreenDPI: 96
+ m_DefaultSpriteDPI: 96
+ m_DynamicPixelsPerUnit: 1
+--- !u!223 &1479783680
+Canvas:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 884199309}
---- !u!1 &957986382
+ m_GameObject: {fileID: 1479783676}
+ m_Enabled: 1
+ serializedVersion: 3
+ m_RenderMode: 0
+ m_Camera: {fileID: 0}
+ m_PlaneDistance: 100
+ m_PixelPerfect: 0
+ m_ReceivesEvents: 1
+ m_OverrideSorting: 0
+ m_OverridePixelPerfect: 0
+ m_SortingBucketNormalizedSize: 0
+ m_AdditionalShaderChannelsFlag: 0
+ m_SortingLayerID: 0
+ m_SortingOrder: -160
+ m_TargetDisplay: 0
+--- !u!1 &1691876111
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- - component: {fileID: 957986383}
- - component: {fileID: 957986385}
- - component: {fileID: 957986384}
+ - component: {fileID: 1691876112}
+ - component: {fileID: 1691876113}
m_Layer: 5
- m_Name: Image
+ m_Name: RectMask2DParent
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
---- !u!224 &957986383
+--- !u!224 &1691876112
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 957986382}
- m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_GameObject: {fileID: 1691876111}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
- m_Children: []
- m_Father: {fileID: 797222066}
+ m_Children:
+ - {fileID: 1479783677}
+ m_Father: {fileID: 1730598754}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
- m_AnchoredPosition: {x: 0, y: 0}
- m_SizeDelta: {x: 100, y: 100}
+ m_AnchoredPosition: {x: 96.78, y: 57.40001}
+ m_SizeDelta: {x: 310.1, y: 114.8}
m_Pivot: {x: 0.5, y: 0.5}
---- !u!114 &957986384
+--- !u!114 &1691876113
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 957986382}
+ m_GameObject: {fileID: 1691876111}
m_Enabled: 1
m_EditorHideFlags: 0
- m_Script: {fileID: 11500000, guid: 0cba8e295482e184f9f6a5a8f2b559c3, type: 3}
+ m_Script: {fileID: 11500000, guid: c06d6b758f7cbc148afa25153c439510, type: 3}
m_Name:
m_EditorClassIdentifier:
- m_Material: {fileID: 0}
- m_Color: {r: 1, g: 1, b: 1, a: 1}
- m_RaycastTarget: 1
- m_OnCullStateChanged:
- m_PersistentCalls:
- m_Calls: []
- m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, Assembly-CSharp,
- Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
- m_Sprite: {fileID: 21300000, guid: 4c39797c0008dfb429eaf35a53f9ae9b, type: 3}
- m_Type: 0
- m_PreserveAspect: 0
- m_FillCenter: 1
- m_FillMethod: 4
- m_FillAmount: 1
- m_FillClockwise: 1
- m_FillOrigin: 0
---- !u!222 &957986385
-CanvasRenderer:
- m_ObjectHideFlags: 0
- m_PrefabParentObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 957986382}
---- !u!1 &1281586981
+--- !u!1 &1730598750
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- - component: {fileID: 1281586982}
- - component: {fileID: 1281586983}
+ - component: {fileID: 1730598754}
+ - component: {fileID: 1730598753}
+ - component: {fileID: 1730598752}
+ - component: {fileID: 1730598751}
m_Layer: 5
- m_Name: Rect2DMask
+ m_Name: CanvasAcsent
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
---- !u!224 &1281586982
-RectTransform:
+--- !u!114 &1730598751
+MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 1281586981}
- m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
- m_LocalPosition: {x: 8.76, y: 0, z: 0}
- m_LocalScale: {x: 1, y: 1, z: 1}
- m_Children:
- - {fileID: 683583037}
- - {fileID: 884199310}
- m_Father: {fileID: 728889365}
- m_RootOrder: 0
- m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
- m_AnchorMin: {x: 0.5, y: 0.5}
- m_AnchorMax: {x: 0.5, y: 0.5}
- m_AnchoredPosition: {x: 8.76, y: 0}
- m_SizeDelta: {x: 52.98, y: 100}
- m_Pivot: {x: 0.5, y: 0.5}
---- !u!114 &1281586983
+ m_GameObject: {fileID: 1730598750}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 0dc7198a94080b64e9e51e6f934b3e35, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreReversedGraphics: 1
+ m_BlockingObjects: 0
+ m_BlockingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+--- !u!114 &1730598752
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
- m_GameObject: {fileID: 1281586981}
+ m_GameObject: {fileID: 1730598750}
m_Enabled: 1
m_EditorHideFlags: 0
- m_Script: {fileID: 11500000, guid: c06d6b758f7cbc148afa25153c439510, type: 3}
+ m_Script: {fileID: 11500000, guid: debcf26b89013e446a6de5574715c5af, type: 3}
m_Name:
m_EditorClassIdentifier:
+ m_UiScaleMode: 0
+ m_ReferencePixelsPerUnit: 100
+ m_ScaleFactor: 1
+ m_ReferenceResolution: {x: 800, y: 600}
+ m_ScreenMatchMode: 0
+ m_MatchWidthOrHeight: 0
+ m_PhysicalUnit: 3
+ m_FallbackScreenDPI: 96
+ m_DefaultSpriteDPI: 96
+ m_DynamicPixelsPerUnit: 1
+--- !u!223 &1730598753
+Canvas:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1730598750}
+ m_Enabled: 1
+ serializedVersion: 3
+ m_RenderMode: 0
+ m_Camera: {fileID: 392020846}
+ m_PlaneDistance: 100
+ m_PixelPerfect: 0
+ m_ReceivesEvents: 1
+ m_OverrideSorting: 0
+ m_OverridePixelPerfect: 0
+ m_SortingBucketNormalizedSize: 0
+ m_AdditionalShaderChannelsFlag: 0
+ m_SortingLayerID: 0
+ m_SortingOrder: 0
+ m_TargetDisplay: 0
+--- !u!224 &1730598754
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1730598750}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 0, y: 0, z: 0}
+ m_Children:
+ - {fileID: 1691876112}
+ m_Father: {fileID: 0}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 0, y: 0}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0, y: 0}
--- !u!1 &1908451111
GameObject:
m_ObjectHideFlags: 0
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/MaskableGraphic.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/MaskableGraphic.cs
index 51e2fe2..0d0f327 100644
--- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/MaskableGraphic.cs
+++ b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/MaskableGraphic.cs
@@ -68,6 +68,7 @@ namespace UnityEngine.UI
if (m_ShouldRecalculateStencil)
{
var rootCanvas = MaskUtilities.FindRootSortOverrideCanvas(transform);
+ // Graphic在masks下的深度,如果不是0且没有mask组件意味着是普通的非mask用graphic(如果是0一定是mask用的graphic)
m_StencilValue = maskable ? MaskUtilities.GetStencilDepth(transform, rootCanvas) : 0;
m_ShouldRecalculateStencil = false;
}
@@ -78,6 +79,11 @@ namespace UnityEngine.UI
Mask maskComponent = GetComponent<Mask>();
if (m_StencilValue > 0 && (maskComponent == null || !maskComponent.IsActive()))
{
+ // Ref = (1 << stencilValue) - 1
+ // Op = Keep
+ // Func = Equal
+ // ReadMask = (1 << stencilValue) - 1
+ // WriteMask = 0
var maskMat = StencilMaterial.Add(toUse, (1 << m_StencilValue) - 1, StencilOp.Keep, CompareFunction.Equal, ColorWriteMask.All, (1 << m_StencilValue) - 1, 0);
StencilMaterial.Remove(m_MaskMaterial);
m_MaskMaterial = maskMat;
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Mask/Mask.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Mask/Mask.cs
index 39dc291..19a5575 100644
--- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Mask/Mask.cs
+++ b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Mask/Mask.cs
@@ -41,13 +41,11 @@ namespace UnityEngine.UI
public Graphic graphic
{
get { return m_Graphic ?? (m_Graphic = GetComponent<Graphic>()); }
- }
-
- [NonSerialized]
- private Material m_MaskMaterial;
-
- [NonSerialized]
- private Material m_UnmaskMaterial;
+ }
+
+ [NonSerialized] private Material m_MaskMaterial;
+
+ [NonSerialized] private Material m_UnmaskMaterial;
protected Mask()
{}
@@ -123,7 +121,7 @@ namespace UnityEngine.UI
var rootSortCanvas = MaskUtilities.FindRootSortOverrideCanvas(transform);
var stencilDepth = MaskUtilities.GetStencilDepth(transform, rootSortCanvas);
- if (stencilDepth >= 8)
+ if (stencilDepth >= 8) // 不支持8层及以上的mask, 0-7支持,这是因为stencilRef和stencilMask只有一个字节
{
Debug.LogError("Attempting to use a stencil mask with depth > 8", gameObject);
return baseMaterial;
@@ -133,12 +131,22 @@ namespace UnityEngine.UI
// if we are at the first level...
// we want to destroy what is there
- if (desiredStencilBit == 1)
- {
+ if (desiredStencilBit == 1) // 最上层的mask
+ {
+ // Ref = 1
+ // Op = Replace
+ // Func = Always
+ // ReadMask = 255
+ // WriteMask = 255
var maskMaterial = StencilMaterial.Add(baseMaterial, 1, StencilOp.Replace, CompareFunction.Always, m_ShowMaskGraphic ? ColorWriteMask.All : 0);
StencilMaterial.Remove(m_MaskMaterial);
- m_MaskMaterial = maskMaterial;
-
+ m_MaskMaterial = maskMaterial;
+
+ // Ref = 1
+ // Op = Zero
+ // Func = Always
+ // ReadMask = 255
+ // WriteMask = 255
var unmaskMaterial = StencilMaterial.Add(baseMaterial, 1, StencilOp.Zero, CompareFunction.Always, 0);
StencilMaterial.Remove(m_UnmaskMaterial);
m_UnmaskMaterial = unmaskMaterial;
@@ -148,11 +156,22 @@ namespace UnityEngine.UI
return m_MaskMaterial;
}
+ // Ref = desiredStencilBit | (desiredStencilBit - 1)
+ // Op = Replace
+ // Func = Equal
+ // ReadMask = desiredStencilBit - 1
+ // WriteMask = desiredStencilBit | (desiredStencilBit - 1)
+
//otherwise we need to be a bit smarter and set some read / write masks
var maskMaterial2 = StencilMaterial.Add(baseMaterial, desiredStencilBit | (desiredStencilBit - 1), StencilOp.Replace, CompareFunction.Equal, m_ShowMaskGraphic ? ColorWriteMask.All : 0, desiredStencilBit - 1, desiredStencilBit | (desiredStencilBit - 1));
StencilMaterial.Remove(m_MaskMaterial);
m_MaskMaterial = maskMaterial2;
+ // Ref = desiredStencilBit - 1
+ // Op = Replace
+ // Func = Equal
+ // ReadMask = desiredStencilBit - 1
+ // WriteMask = desiredStencilBit | (desiredStencilBit - 1)
graphic.canvasRenderer.hasPopInstruction = true;
var unmaskMaterial2 = StencilMaterial.Add(baseMaterial, desiredStencilBit - 1, StencilOp.Replace, CompareFunction.Equal, 0, desiredStencilBit - 1, desiredStencilBit | (desiredStencilBit - 1));
StencilMaterial.Remove(m_UnmaskMaterial);
@@ -161,6 +180,25 @@ namespace UnityEngine.UI
graphic.canvasRenderer.SetPopMaterial(m_UnmaskMaterial, 0);
return m_MaskMaterial;
+ }
+
+
+ #region UGUI_DEBUG
+
+ Vector3[] cornors = new Vector3[4];
+
+ void OnDrawGizmos()
+ {
+ Rect rect = rectTransform.rect;
+ Gizmos.color = Color.yellow;
+ rectTransform.GetWorldCorners(cornors);
+ for (int i = 0; i < cornors.Length; ++i)
+ {
+ Gizmos.DrawLine(cornors[i], cornors[(i + 1) % cornors.Length]);
+ }
}
+
+ #endregion
+
}
}
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Mask/MaskUtilities.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Mask/MaskUtilities.cs
index c975dc6..6abce5a 100644
--- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Mask/MaskUtilities.cs
+++ b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Mask/MaskUtilities.cs
@@ -37,6 +37,7 @@ namespace UnityEngine.UI
ListPool<Component>.Release(components);
}
+ //从下往上找到第一个OverrideSorting的canvas或者root(即null)
public static Transform FindRootSortOverrideCanvas(Transform start)
{
var canvasList = ListPool<Canvas>.Get();
@@ -56,6 +57,7 @@ namespace UnityEngine.UI
return canvas != null ? canvas.transform : null;
}
+ // 返回Mask在canvas下(canvas下所有的masks下)的深度
public static int GetStencilDepth(Transform transform, Transform stopAfter)
{
var depth = 0;
@@ -85,6 +87,7 @@ namespace UnityEngine.UI
return depth;
}
+ // father是child的祖先节点或者father == child
public static bool IsDescendantOrSelf(Transform father, Transform child)
{
if (father == null || child == null)
@@ -164,7 +167,9 @@ namespace UnityEngine.UI
bool shouldAdd = true;
for (int j = canvasComponents.Count - 1; j >= 0; j--)
{
- if (!IsDescendantOrSelf(canvasComponents[j].transform, rectMaskComponents[i].transform) && canvasComponents[j].overrideSorting)
+ // 如果rectMask2D是canvas的祖先节点且这个canvas勾选了OverrideSorting,那么这个rectMask2D就会失效
+ if (!IsDescendantOrSelf(canvasComponents[j].transform, rectMaskComponents[i].transform)
+ && canvasComponents[j].overrideSorting)
{
shouldAdd = false;
break;
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Mask/RectMask2D.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Mask/RectMask2D.cs
index 5f8f2e7..d973b34 100644
--- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Mask/RectMask2D.cs
+++ b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Mask/RectMask2D.cs
@@ -16,6 +16,7 @@ namespace UnityEngine.UI
[NonSerialized]
private RectTransform m_RectTransform;
+ // 可裁剪的Graphics
[NonSerialized]
private HashSet<IClippable> m_ClipTargets = new HashSet<IClippable>();
@@ -173,6 +174,25 @@ namespace UnityEngine.UI
{
base.OnCanvasHierarchyChanged();
m_ShouldRecalculateClipRects = true;
+ }
+
+
+ #region UGUI_DEBUG
+
+ Vector3[] cornors = new Vector3[4];
+
+ void OnDrawGizmos()
+ {
+ Rect rect = rectTransform.rect;
+ Gizmos.color = Color.red;
+ rectTransform.GetWorldCorners(cornors);
+ for (int i = 0; i < cornors.Length; ++i)
+ {
+ Gizmos.DrawLine(cornors[i], cornors[(i + 1) % cornors.Length]);
+ }
}
+
+ #endregion
+
}
}