diff options
author | chai <chaifix@163.com> | 2021-05-06 14:51:05 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-05-06 14:51:05 +0800 |
commit | f342c68d13bddf451ab6cd64fc5b13cf65b65c4f (patch) | |
tree | b3457f6c2c9b42017e84a01aef854a4e67586ddc | |
parent | d0e1834bd1972b4262d3e9b46ed55698a7f92025 (diff) | |
parent | 70ee31ea614d248f67f3d98ada5acb981def7e58 (diff) |
Merge branch 'master' of warmcat.org:/home/git-repo/UGUI_LEARN
# Conflicts:
# Assets/Test/08_Button.meta
# Assets/Test/08_Button/08_Button.unity
# Assets/Test/08_Button/08_Button.unity.meta
-rw-r--r-- | Assets/LogHelper.cs | 16 | ||||
-rw-r--r-- | Assets/LogHelper.cs.meta | 11 | ||||
-rw-r--r-- | Assets/Test/08_Button.meta | 2 | ||||
-rw-r--r-- | Assets/Test/08_Button/08_Button.unity | 695 | ||||
-rw-r--r-- | Assets/Test/08_Button/08_Button.unity.meta | 2 | ||||
-rw-r--r-- | Assets/Test/08_Button/UI08Button.cs | 39 | ||||
-rw-r--r-- | Assets/Test/08_Button/UI08Button.cs.meta | 11 | ||||
-rw-r--r-- | Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/BaseEventData.cs | 2 | ||||
-rw-r--r-- | Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Button.cs | 8 | ||||
-rw-r--r-- | Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Navigation.cs | 10 | ||||
-rw-r--r-- | Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Selectable.cs | 35 | ||||
-rw-r--r-- | Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Slider.cs | 6 | ||||
-rw-r--r-- | Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Toggle.cs | 6 |
13 files changed, 628 insertions, 215 deletions
diff --git a/Assets/LogHelper.cs b/Assets/LogHelper.cs new file mode 100644 index 0000000..f95bf18 --- /dev/null +++ b/Assets/LogHelper.cs @@ -0,0 +1,16 @@ +#define UGUI_DEBUG +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class LogHelper +{ + + public static void Log(string content) + { +#if UGUI_DEBUG + Debug.Log(content); +#endif + } + +} diff --git a/Assets/LogHelper.cs.meta b/Assets/LogHelper.cs.meta new file mode 100644 index 0000000..f6d6dd1 --- /dev/null +++ b/Assets/LogHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 00a660da41438ca4b9cbdd92e673dffe +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Test/08_Button.meta b/Assets/Test/08_Button.meta index 5358191..a1d9618 100644 --- a/Assets/Test/08_Button.meta +++ b/Assets/Test/08_Button.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9a12b1d423942054194e070eebe28a41 +guid: d1549736e1032e841bfb6e2fef719151 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Test/08_Button/08_Button.unity b/Assets/Test/08_Button/08_Button.unity index 3987044..bc64821 100644 --- a/Assets/Test/08_Button/08_Button.unity +++ b/Assets/Test/08_Button/08_Button.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} + m_IndirectSpecularColor: {r: 0.18028334, g: 0.22571343, b: 0.30692208, a: 1} --- !u!157 &3 LightmapSettings: m_ObjectHideFlags: 0 @@ -113,16 +113,127 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} ---- !u!1 &94043798 +--- !u!1 &66578916 GameObject: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} serializedVersion: 5 m_Component: - - component: {fileID: 94043801} - - component: {fileID: 94043800} - - component: {fileID: 94043799} + - component: {fileID: 66578917} + - component: {fileID: 66578920} + - component: {fileID: 66578919} + - component: {fileID: 66578918} + m_Layer: 5 + m_Name: Button1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &66578917 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 66578916} + 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: + - {fileID: 608677559} + m_Father: {fileID: 506934306} + 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: 155, y: 235} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &66578918 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 66578916} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a754c749030e1d848bed7a3cb2e5520f, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 1 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 66578919} + m_OnClick: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, Assembly-CSharp, Version=0.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &66578919 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 66578916} + 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: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &66578920 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 66578916} +--- !u!1 &73859093 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 73859096} + - component: {fileID: 73859095} + - component: {fileID: 73859094} m_Layer: 0 m_Name: EventSystem m_TagString: Untagged @@ -130,12 +241,12 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!114 &94043799 +--- !u!114 &73859094 MonoBehaviour: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 94043798} + m_GameObject: {fileID: 73859093} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: e2665fa6a1fb2474d8a5c19f72f8d0c6, type: 3} @@ -148,12 +259,12 @@ MonoBehaviour: m_InputActionsPerSecond: 10 m_RepeatDelay: 0.5 m_ForceModuleActive: 0 ---- !u!114 &94043800 +--- !u!114 &73859095 MonoBehaviour: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 94043798} + m_GameObject: {fileID: 73859093} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 153642a2f08376d4daebdf63af9e161a, type: 3} @@ -162,12 +273,12 @@ MonoBehaviour: m_FirstSelected: {fileID: 0} m_sendNavigationEvents: 1 m_DragThreshold: 5 ---- !u!4 &94043801 +--- !u!4 &73859096 Transform: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 94043798} + m_GameObject: {fileID: 73859093} 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} @@ -175,124 +286,117 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &314971747 +--- !u!1 &77620961 GameObject: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} serializedVersion: 5 m_Component: - - component: {fileID: 314971748} - - component: {fileID: 314971750} - - component: {fileID: 314971749} + - component: {fileID: 77620962} + - component: {fileID: 77620964} + - component: {fileID: 77620963} m_Layer: 5 - m_Name: Text + m_Name: Image m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!224 &314971748 +--- !u!224 &77620962 RectTransform: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 314971747} + m_GameObject: {fileID: 77620961} 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: 1725840241} + m_Father: {fileID: 1866958257} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} + 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: 0, y: 0} + m_SizeDelta: {x: 100, y: 100} m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &314971749 +--- !u!114 &77620963 MonoBehaviour: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 314971747} + m_GameObject: {fileID: 77620961} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 48696ad002dcb2146ab8d6ad72d455d7, type: 3} + m_Script: {fileID: 11500000, guid: 0cba8e295482e184f9f6a5a8f2b559c3, type: 3} m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + 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_FontData: - m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} - m_FontSize: 14 - m_FontStyle: 0 - m_BestFit: 0 - m_MinSize: 10 - m_MaxSize: 40 - m_Alignment: 4 - m_AlignByGeometry: 0 - m_RichText: 1 - m_HorizontalOverflow: 0 - m_VerticalOverflow: 0 - m_LineSpacing: 1 - m_Text: Button ---- !u!222 &314971750 + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &77620964 CanvasRenderer: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 314971747} ---- !u!1 &1725840240 + m_GameObject: {fileID: 77620961} +--- !u!1 &400413497 GameObject: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} serializedVersion: 5 m_Component: - - component: {fileID: 1725840241} - - component: {fileID: 1725840244} - - component: {fileID: 1725840243} - - component: {fileID: 1725840242} - - component: {fileID: 1725840245} + - component: {fileID: 400413498} + - component: {fileID: 400413501} + - component: {fileID: 400413500} + - component: {fileID: 400413499} m_Layer: 5 - m_Name: Button + m_Name: Button2 m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!224 &1725840241 +--- !u!224 &400413498 RectTransform: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1725840240} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_GameObject: {fileID: 400413497} + 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: - - {fileID: 314971748} - m_Father: {fileID: 2132178883} - m_RootOrder: 0 + - {fileID: 1766019939} + m_Father: {fileID: 506934306} + m_RootOrder: 2 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: 129, y: 133} m_SizeDelta: {x: 160, y: 30} m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &1725840242 +--- !u!114 &400413499 MonoBehaviour: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1725840240} + m_GameObject: {fileID: 400413497} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: a754c749030e1d848bed7a3cb2e5520f, type: 3} @@ -322,29 +426,18 @@ MonoBehaviour: m_PressedTrigger: Pressed m_DisabledTrigger: Disabled m_Interactable: 1 - m_TargetGraphic: {fileID: 1725840243} + m_TargetGraphic: {fileID: 400413500} m_OnClick: m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 1725840245} - m_MethodName: Onclickbutton - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 + m_Calls: [] m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null ---- !u!114 &1725840243 +--- !u!114 &400413500 MonoBehaviour: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1725840240} + m_GameObject: {fileID: 400413497} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 0cba8e295482e184f9f6a5a8f2b559c3, type: 3} @@ -366,99 +459,193 @@ MonoBehaviour: m_FillAmount: 1 m_FillClockwise: 1 m_FillOrigin: 0 ---- !u!222 &1725840244 +--- !u!222 &400413501 CanvasRenderer: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1725840240} ---- !u!114 &1725840245 + m_GameObject: {fileID: 400413497} +--- !u!1 &506934302 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 506934306} + - component: {fileID: 506934305} + - component: {fileID: 506934304} + - component: {fileID: 506934303} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &506934303 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 506934302} + 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 &506934304 MonoBehaviour: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1725840240} + m_GameObject: {fileID: 506934302} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: e561f1caafe6c884c832a4442ed2bd2e, type: 3} + m_Script: {fileID: 11500000, guid: debcf26b89013e446a6de5574715c5af, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!1 &1747648254 + 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 &506934305 +Canvas: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 506934302} + 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 &506934306 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 506934302} + 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: 66578917} + - {fileID: 1866958257} + - {fileID: 400413498} + 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 &608677558 GameObject: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} serializedVersion: 5 m_Component: - - component: {fileID: 1747648256} - - component: {fileID: 1747648255} - m_Layer: 0 - m_Name: Directional Light + - component: {fileID: 608677559} + - component: {fileID: 608677561} + - component: {fileID: 608677560} + m_Layer: 5 + m_Name: Text m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!108 &1747648255 -Light: +--- !u!224 &608677559 +RectTransform: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1747648254} + m_GameObject: {fileID: 608677558} + 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: 66578917} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &608677560 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 608677558} m_Enabled: 1 - serializedVersion: 8 - m_Type: 1 - m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} - m_Intensity: 1 - m_Range: 10 - m_SpotAngle: 30 - m_CookieSize: 10 - m_Shadows: - m_Type: 2 - m_Resolution: -1 - m_CustomResolution: -1 - m_Strength: 1 - m_Bias: 0.05 - m_NormalBias: 0.4 - m_NearPlane: 0.2 - m_Cookie: {fileID: 0} - m_DrawHalo: 0 - m_Flare: {fileID: 0} - m_RenderMode: 0 - m_CullingMask: - serializedVersion: 2 - m_Bits: 4294967295 - m_Lightmapping: 4 - m_AreaSize: {x: 1, y: 1} - m_BounceIntensity: 1 - m_ColorTemperature: 6570 - m_UseColorTemperature: 0 - m_ShadowRadius: 0 - m_ShadowAngle: 0 ---- !u!4 &1747648256 -Transform: + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 48696ad002dcb2146ab8d6ad72d455d7, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, 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_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Button1 +--- !u!222 &608677561 +CanvasRenderer: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1747648254} - m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} - m_LocalPosition: {x: 0, y: 3, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} ---- !u!1 &1818729509 + m_GameObject: {fileID: 608677558} +--- !u!1 &1388595804 GameObject: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} serializedVersion: 5 m_Component: - - component: {fileID: 1818729513} - - component: {fileID: 1818729512} - - component: {fileID: 1818729511} - - component: {fileID: 1818729510} + - component: {fileID: 1388595808} + - component: {fileID: 1388595807} + - component: {fileID: 1388595806} + - component: {fileID: 1388595805} m_Layer: 0 m_Name: Main Camera m_TagString: MainCamera @@ -466,29 +653,29 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!81 &1818729510 +--- !u!81 &1388595805 AudioListener: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1818729509} + m_GameObject: {fileID: 1388595804} m_Enabled: 1 ---- !u!124 &1818729511 +--- !u!124 &1388595806 Behaviour: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1818729509} + m_GameObject: {fileID: 1388595804} m_Enabled: 1 ---- !u!20 &1818729512 +--- !u!20 &1388595807 Camera: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1818729509} + m_GameObject: {fileID: 1388595804} m_Enabled: 1 serializedVersion: 2 - m_ClearFlags: 2 + m_ClearFlags: 1 m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} m_NormalizedViewPortRect: serializedVersion: 2 @@ -516,12 +703,12 @@ Camera: m_OcclusionCulling: 1 m_StereoConvergence: 10 m_StereoSeparation: 0.022 ---- !u!4 &1818729513 +--- !u!4 &1388595808 Transform: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1818729509} + m_GameObject: {fileID: 1388595804} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 1, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} @@ -529,97 +716,213 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &2132178879 +--- !u!1 &1766019938 GameObject: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} serializedVersion: 5 m_Component: - - component: {fileID: 2132178883} - - component: {fileID: 2132178882} - - component: {fileID: 2132178881} - - component: {fileID: 2132178880} + - component: {fileID: 1766019939} + - component: {fileID: 1766019941} + - component: {fileID: 1766019940} m_Layer: 5 - m_Name: Canvas + m_Name: Text m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!114 &2132178880 +--- !u!224 &1766019939 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1766019938} + 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: 400413498} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1766019940 MonoBehaviour: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 2132178879} + m_GameObject: {fileID: 1766019938} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 0dc7198a94080b64e9e51e6f934b3e35, type: 3} + m_Script: {fileID: 11500000, guid: 48696ad002dcb2146ab8d6ad72d455d7, type: 3} m_Name: m_EditorClassIdentifier: - m_IgnoreReversedGraphics: 1 - m_BlockingObjects: 0 - m_BlockingMask: - serializedVersion: 2 - m_Bits: 4294967295 ---- !u!114 &2132178881 + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, 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_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Button2 +--- !u!222 &1766019941 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1766019938} +--- !u!1 &1866958256 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1866958257} + - component: {fileID: 1866958258} + m_Layer: 5 + m_Name: Selectable + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1866958257 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1866958256} + 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: + - {fileID: 77620962} + m_Father: {fileID: 506934306} + 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: -139, y: 157} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1866958258 MonoBehaviour: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 2132178879} + m_GameObject: {fileID: 1866958256} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: debcf26b89013e446a6de5574715c5af, type: 3} + m_Script: {fileID: 11500000, guid: af75b3d5d7b48814da1f058ff4ae7653, 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 &2132178882 -Canvas: + m_Navigation: + m_Mode: 4 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 77620963} +--- !u!1 &1881376888 +GameObject: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 2132178879} + serializedVersion: 5 + m_Component: + - component: {fileID: 1881376890} + - component: {fileID: 1881376889} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1881376889 +Light: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1881376888} m_Enabled: 1 - serializedVersion: 3 + serializedVersion: 8 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} 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 &2132178883 -RectTransform: + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_Lightmapping: 4 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1881376890 +Transform: m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 2132178879} - 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: 1725840241} + m_GameObject: {fileID: 1881376888} + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] 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} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} diff --git a/Assets/Test/08_Button/08_Button.unity.meta b/Assets/Test/08_Button/08_Button.unity.meta index 92eaf30..d1307bf 100644 --- a/Assets/Test/08_Button/08_Button.unity.meta +++ b/Assets/Test/08_Button/08_Button.unity.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: fb3ab9743778dd44cb5437deb4d5c180 +guid: 6e9604b5cf83b9749bf7c4a9e01e835b DefaultImporter: externalObjects: {} userData: diff --git a/Assets/Test/08_Button/UI08Button.cs b/Assets/Test/08_Button/UI08Button.cs new file mode 100644 index 0000000..ec9f992 --- /dev/null +++ b/Assets/Test/08_Button/UI08Button.cs @@ -0,0 +1,39 @@ +using UnityEngine; +using System; +using System.Collections; + + +public class UI08Button : MonoBehaviour +{ + private void Start() + { + StartCoroutine(Speak()); + } + + void Update() + { + } + + IEnumerator Wait5Sec() + { + Debug.Log("Wait for 5 sec"); + yield return new WaitForSeconds(5); + Debug.Log("Wait for 5 sec done"); + } + + IEnumerator Speak() + { + int i = -1; + while (true) + { + Debug.Log("wait 1 sec" + (++i)); + yield return new WaitForSeconds(1); + yield return StartCoroutine(Wait5Sec()); + Debug.Log("wait 2 sec" + (++i)); + yield return new WaitForSeconds(2); + Debug.Log("wait 3 sec" + (++i)); + yield return new WaitForSeconds(3); + } + } + +} diff --git a/Assets/Test/08_Button/UI08Button.cs.meta b/Assets/Test/08_Button/UI08Button.cs.meta new file mode 100644 index 0000000..039e6d8 --- /dev/null +++ b/Assets/Test/08_Button/UI08Button.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 99ab7d3c5bba70e40b357da7797a6de7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/BaseEventData.cs b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/BaseEventData.cs index ecc94aa..f353314 100644 --- a/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/BaseEventData.cs +++ b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/BaseEventData.cs @@ -36,7 +36,7 @@ namespace UnityEngine.EventSystems public GameObject selectedObject { get { return m_EventSystem.currentSelectedGameObject; } - set { m_EventSystem.SetSelectedGameObject(value, this); } + set { m_EventSystem.SetSelectedGameObject(value, this); } // »á·¢ËÍÒ»¸öselecthandlerʼþ } } } diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Button.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Button.cs index 8641b05..d0c9ae3 100644 --- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Button.cs +++ b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Button.cs @@ -9,7 +9,10 @@ namespace UnityEngine.UI { // Button that's meant to work with mouse or touch-based devices. [AddComponentMenu("UI/Button", 30)] - public class Button : Selectable, IPointerClickHandler, ISubmitHandler + public class Button + : Selectable + , IPointerClickHandler // Êó±êµã»÷\´¥Ãþ + , ISubmitHandler // Input>Submit´¥·¢£¬±ÈÈçÊÖ±ú¡¢¼üÅÌij¸ö°´¼ü°´Ï { [Serializable] public class ButtonClickedEvent : UnityEvent {} @@ -28,6 +31,7 @@ namespace UnityEngine.UI set { m_OnClick = value; } } + // µ÷»Øµ÷ private void Press() { if (!IsActive() || !IsInteractable()) @@ -48,6 +52,8 @@ namespace UnityEngine.UI public virtual void OnSubmit(BaseEventData eventData) { + LogHelper.Log("OnSubmit() " + gameObject.name); + Press(); // if we get set disabled during the press diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Navigation.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Navigation.cs index 8dce1d5..98e77f9 100644 --- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Navigation.cs +++ b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Navigation.cs @@ -14,11 +14,11 @@ namespace UnityEngine.UI [Flags] public enum Mode { - None = 0, // No navigation - Horizontal = 1, // Automatic horizontal navigation - Vertical = 2, // Automatic vertical navigation - Automatic = 3, // Automatic navigation in both dimensions - Explicit = 4, // Explicitly specified only + None = 0, // 0 No navigation + Horizontal = 1, // 1 Automatic horizontal navigation + Vertical = 2, // 10 Automatic vertical navigation + Automatic = 3, // 11 Automatic navigation in both dimensions + Explicit = 4, // Explicitly specified only } // Which method of navigation will be used. diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Selectable.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Selectable.cs index c0cda18..9cc6178 100644 --- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Selectable.cs +++ b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Selectable.cs @@ -13,13 +13,14 @@ namespace UnityEngine.UI public class Selectable : UIBehaviour, - IMoveHandler, - IPointerDownHandler, IPointerUpHandler, - IPointerEnterHandler, IPointerExitHandler, - ISelectHandler, IDeselectHandler + IMoveHandler, // Input>Horizontal\VerticalÒÆ¶¯Ê±ÊÕµ½Õâ¸öÏûÏ¢ + IPointerDownHandler, IPointerUpHandler, // µã»÷click + IPointerEnterHandler, IPointerExitHandler, // ÐüÍ£hover + ISelectHandler, IDeselectHandler // navigation»ñµÃ½¹µãʱÊÕµ½Õâ¸öÏûÏ¢ { // Selection state + // µ±Ç°³¡¾°ÖеÄSelectable×é¼þ // List of all the selectable objects currently active in the scene private static List<Selectable> s_List = new List<Selectable>(); public static List<Selectable> allSelectables { get { return s_List; } } @@ -349,7 +350,7 @@ namespace UnityEngine.UI Vector3 pos = transform.TransformPoint(GetPointOnRectEdge(transform as RectTransform, localDir)); float maxScore = Mathf.NegativeInfinity; Selectable bestPick = null; - for (int i = 0; i < s_List.Count; ++i) + for (int i = 0; i < s_List.Count; ++i) // ±éÀúµ±Ç°³¡¾°ÖеÄËùÓÐselectable×é¼þ { Selectable sel = s_List[i]; @@ -410,7 +411,7 @@ namespace UnityEngine.UI void Navigate(AxisEventData eventData, Selectable sel) { if (sel != null && sel.IsActive()) - eventData.selectedObject = sel.gameObject; + eventData.selectedObject = sel.gameObject; // »á·¢ËÍÒ»¸öselectHandlerʼþ } // Find the selectable object to the left of this one. @@ -469,12 +470,15 @@ namespace UnityEngine.UI return null; } + // input>horizontal\vertical²úÉúÕâ¸öʼþ£¬ public virtual void OnMove(AxisEventData eventData) { + LogHelper.Log("OnMove() " + gameObject.name ); + switch (eventData.moveDir) { case MoveDirection.Right: - Navigate(eventData, FindSelectableOnRight()); + Navigate(eventData, FindSelectableOnRight()); // »áÏòÏÂÒ»¸öselectableObj·¢ËÍÒ»¸öOnSelectÏûÏ¢ break; case MoveDirection.Up: @@ -496,6 +500,7 @@ namespace UnityEngine.UI if (m_TargetGraphic == null) return; + // ÆðÒ»¸öгÌ×ötween¶¯» m_TargetGraphic.CrossFadeColor(targetColor, instant ? 0f : m_Colors.fadeDuration, true, true); } @@ -512,6 +517,8 @@ namespace UnityEngine.UI if (transition != Transition.Animation || animator == null || !animator.isActiveAndEnabled || !animator.hasBoundPlayables || string.IsNullOrEmpty(triggername)) return; + LogHelper.Log("trigger animation"); + animator.ResetTrigger(m_AnimationTriggers.normalTrigger); animator.ResetTrigger(m_AnimationTriggers.pressedTrigger); animator.ResetTrigger(m_AnimationTriggers.highlightedTrigger); @@ -578,6 +585,7 @@ namespace UnityEngine.UI m_CurrentSelectionState = SelectionState.Normal; } + // ¸üÐÂ״̬²¥·Å¶¯» // Change the button to the correct state private void EvaluateAndTransitionToSelectionState(BaseEventData eventData) { @@ -598,12 +606,14 @@ namespace UnityEngine.UI public virtual void OnPointerDown(PointerEventData eventData) { + LogHelper.Log("OnPointerDown() "+ gameObject.name); + if (eventData.button != PointerEventData.InputButton.Left) return; // Selection tracking if (IsInteractable() && navigation.mode != Navigation.Mode.None && EventSystem.current != null) - EventSystem.current.SetSelectedGameObject(gameObject, eventData); + EventSystem.current.SetSelectedGameObject(gameObject, eventData); // Ñ¡ÖÐÕâ¸öUI×é¼þ isPointerDown = true; EvaluateAndTransitionToSelectionState(eventData); @@ -611,6 +621,8 @@ namespace UnityEngine.UI public virtual void OnPointerUp(PointerEventData eventData) { + LogHelper.Log("OnPointerUp() " + gameObject.name); + if (eventData.button != PointerEventData.InputButton.Left) return; @@ -620,24 +632,31 @@ namespace UnityEngine.UI public virtual void OnPointerEnter(PointerEventData eventData) { + LogHelper.Log("OnPointerEnter() " + gameObject.name); + isPointerInside = true; EvaluateAndTransitionToSelectionState(eventData); } public virtual void OnPointerExit(PointerEventData eventData) { + LogHelper.Log("OnPointerExit() " + gameObject.name); + isPointerInside = false; EvaluateAndTransitionToSelectionState(eventData); } + // ±»Ñ¡ÖÐ public virtual void OnSelect(BaseEventData eventData) { + LogHelper.Log("OnSelect() " + gameObject.name); hasSelection = true; EvaluateAndTransitionToSelectionState(eventData); } public virtual void OnDeselect(BaseEventData eventData) { + LogHelper.Log("OnDeselect() " + gameObject.name); hasSelection = false; EvaluateAndTransitionToSelectionState(eventData); } diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Slider.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Slider.cs index ce8f4bb..4e80fb3 100644 --- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Slider.cs +++ b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Slider.cs @@ -6,7 +6,11 @@ namespace UnityEngine.UI { [AddComponentMenu("UI/Slider", 33)] [RequireComponent(typeof(RectTransform))] - public class Slider : Selectable, IDragHandler, IInitializePotentialDragHandler, ICanvasElement + public class Slider + : Selectable + , IDragHandler + , IInitializePotentialDragHandler + , ICanvasElement // ±à¼Æ÷ϲŻáÓõ½ { public enum Direction { diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Toggle.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Toggle.cs index 5dc9275..8dc4c82 100644 --- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Toggle.cs +++ b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/UIControls/Toggle.cs @@ -10,7 +10,11 @@ namespace UnityEngine.UI /// </summary> [AddComponentMenu("UI/Toggle", 31)] [RequireComponent(typeof(RectTransform))] - public class Toggle : Selectable, IPointerClickHandler, ISubmitHandler, ICanvasElement + public class Toggle + : Selectable + , IPointerClickHandler + , ISubmitHandler + , ICanvasElement // 编辑器下用到 { public enum ToggleTransition { |