Browse Source

Merge pull request #508 from ideka/menu-autoselect

Allow for menu options to be picked without clicking.
master
Chris Gregan 9 years ago committed by GitHub
parent
commit
5b8ba63d8c
  1. 291
      Assets/Fungus/Narrative/Resources/MenuDialog.prefab
  2. 12
      Assets/Fungus/Narrative/Scripts/MenuDialog.cs
  3. 21
      Assets/Fungus/UI/Scripts/SelectOnEnable.cs
  4. 12
      Assets/Fungus/UI/Scripts/SelectOnEnable.cs.meta

291
Assets/Fungus/Narrative/Resources/MenuDialog.prefab

@ -124,6 +124,23 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &141170
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 224: {fileID: 22470986}
- 114: {fileID: 11451014}
- 114: {fileID: 11432608}
m_Layer: 5
m_Name: DefaultSelectable
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &172108
GameObject:
m_ObjectHideFlags: 1
@ -383,7 +400,13 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0}
m_Color: {r: 1, g: 1, b: 1, a: .862745106}
m_Color: {r: 1, g: 1, b: 1, a: 0.8627451}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 21300000, guid: c207de86481ff7d48a2fba2fcc374723, type: 3}
m_Type: 1
m_PreserveAspect: 0
@ -412,11 +435,11 @@ MonoBehaviour:
m_Transition: 2
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: .145098045, g: .75686276, b: .87843138, a: .698039234}
m_PressedColor: {r: .0784313753, g: .513725519, b: .600000024, a: 1}
m_DisabledColor: {r: .588235319, g: .647058845, b: .666666687, a: .501960814}
m_HighlightedColor: {r: 0.14509805, g: 0.75686276, b: 0.8784314, a: 0.69803923}
m_PressedColor: {r: 0.078431375, g: 0.5137255, b: 0.6, a: 1}
m_DisabledColor: {r: 0.5882353, g: 0.64705884, b: 0.6666667, a: 0.5019608}
m_ColorMultiplier: 2
m_FadeDuration: .100000001
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 21300000, guid: 888feb4a32e3b564fb7e6f9b28cc8e10,
type: 3}
@ -485,7 +508,13 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: .588}
m_Color: {r: 1, g: 1, b: 1, a: 0.588}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
@ -513,12 +542,12 @@ MonoBehaviour:
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: .250980407, g: .250980407, b: .250980407, a: .501960814}
m_HighlightedColor: {r: .501960814, g: .501960814, b: .501960814, a: .698039234}
m_PressedColor: {r: .345098048, g: .345098048, b: .345098048, a: .698039234}
m_DisabledColor: {r: .250980407, g: .250980407, b: .250980407, a: .501960814}
m_NormalColor: {r: 0.2509804, g: 0.2509804, b: 0.2509804, a: 0.5019608}
m_HighlightedColor: {r: 0.5019608, g: 0.5019608, b: 0.5019608, a: 0.69803923}
m_PressedColor: {r: 0.34509805, g: 0.34509805, b: 0.34509805, a: 0.69803923}
m_DisabledColor: {r: 0.2509804, g: 0.2509804, b: 0.2509804, a: 0.5019608}
m_ColorMultiplier: 2
m_FadeDuration: .100000001
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
@ -555,6 +584,12 @@ MonoBehaviour:
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, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 12800000, guid: bb145366ce7024469a5758b08d31802c, type: 3}
m_FontSize: 40
@ -563,6 +598,7 @@ MonoBehaviour:
m_MinSize: 30
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
@ -580,7 +616,13 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: .200000003, g: .709803939, b: .898039222, a: .945098042}
m_Color: {r: 0.2, g: 0.70980394, b: 0.8980392, a: 0.94509804}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
@ -600,6 +642,54 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ee8371d2b2fe14a9ca0a9465140027de, type: 3}
m_Name:
m_EditorClassIdentifier:
autoSelectFirstButton: 0
--- !u!114 &11432608
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 141170}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1cbf240ac6442144f90a023c1b64d868, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &11451014
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 141170}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -234403039, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 11472144}
m_SelectOnDown: {fileID: 11472144}
m_SelectOnLeft: {fileID: 11472144}
m_SelectOnRight: {fileID: 11472144}
m_Transition: 0
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: 0
m_TargetGraphic: {fileID: 0}
--- !u!114 &11472108
MonoBehaviour:
m_ObjectHideFlags: 1
@ -613,6 +703,12 @@ MonoBehaviour:
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, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 12800000, guid: bb145366ce7024469a5758b08d31802c, type: 3}
m_FontSize: 40
@ -621,6 +717,7 @@ MonoBehaviour:
m_MinSize: 30
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
@ -664,11 +761,11 @@ MonoBehaviour:
m_Transition: 2
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: .145098045, g: .75686276, b: .87843138, a: .698039234}
m_PressedColor: {r: .0784313753, g: .513725519, b: .600000024, a: 1}
m_DisabledColor: {r: .588235319, g: .647058845, b: .666666687, a: .501960814}
m_HighlightedColor: {r: 0.14509805, g: 0.75686276, b: 0.8784314, a: 0.69803923}
m_PressedColor: {r: 0.078431375, g: 0.5137255, b: 0.6, a: 1}
m_DisabledColor: {r: 0.5882353, g: 0.64705884, b: 0.6666667, a: 0.5019608}
m_ColorMultiplier: 2
m_FadeDuration: .100000001
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 21300000, guid: 888feb4a32e3b564fb7e6f9b28cc8e10,
type: 3}
@ -698,7 +795,13 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0}
m_Color: {r: 1, g: 1, b: 1, a: .862745106}
m_Color: {r: 1, g: 1, b: 1, a: 0.8627451}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 21300000, guid: c207de86481ff7d48a2fba2fcc374723, type: 3}
m_Type: 1
m_PreserveAspect: 0
@ -719,7 +822,13 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0}
m_Color: {r: 1, g: 1, b: 1, a: .862745106}
m_Color: {r: 1, g: 1, b: 1, a: 0.8627451}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 21300000, guid: c207de86481ff7d48a2fba2fcc374723, type: 3}
m_Type: 1
m_PreserveAspect: 0
@ -748,11 +857,11 @@ MonoBehaviour:
m_Transition: 2
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: .145098045, g: .75686276, b: .87843138, a: .698039234}
m_PressedColor: {r: .0784313753, g: .513725519, b: .600000024, a: 1}
m_DisabledColor: {r: .588235319, g: .647058845, b: .666666687, a: .501960814}
m_HighlightedColor: {r: 0.14509805, g: 0.75686276, b: 0.8784314, a: 0.69803923}
m_PressedColor: {r: 0.078431375, g: 0.5137255, b: 0.6, a: 1}
m_DisabledColor: {r: 0.5882353, g: 0.64705884, b: 0.6666667, a: 0.5019608}
m_ColorMultiplier: 2
m_FadeDuration: .100000001
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 21300000, guid: 888feb4a32e3b564fb7e6f9b28cc8e10,
type: 3}
@ -801,6 +910,12 @@ MonoBehaviour:
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, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 12800000, guid: bb145366ce7024469a5758b08d31802c, type: 3}
m_FontSize: 40
@ -809,6 +924,7 @@ MonoBehaviour:
m_MinSize: 30
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
@ -827,6 +943,12 @@ MonoBehaviour:
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, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 12800000, guid: bb145366ce7024469a5758b08d31802c, type: 3}
m_FontSize: 40
@ -835,6 +957,7 @@ MonoBehaviour:
m_MinSize: 30
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
@ -878,11 +1001,11 @@ MonoBehaviour:
m_Transition: 2
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: .145098045, g: .75686276, b: .87843138, a: .698039234}
m_PressedColor: {r: .0784313753, g: .513725519, b: .600000024, a: 1}
m_DisabledColor: {r: .588235319, g: .647058845, b: .666666687, a: .501960814}
m_HighlightedColor: {r: 0.14509805, g: 0.75686276, b: 0.8784314, a: 0.69803923}
m_PressedColor: {r: 0.078431375, g: 0.5137255, b: 0.6, a: 1}
m_DisabledColor: {r: 0.5882353, g: 0.64705884, b: 0.6666667, a: 0.5019608}
m_ColorMultiplier: 2
m_FadeDuration: .100000001
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 21300000, guid: 888feb4a32e3b564fb7e6f9b28cc8e10,
type: 3}
@ -912,7 +1035,13 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0}
m_Color: {r: 1, g: 1, b: 1, a: .862745106}
m_Color: {r: 1, g: 1, b: 1, a: 0.8627451}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 21300000, guid: c207de86481ff7d48a2fba2fcc374723, type: 3}
m_Type: 1
m_PreserveAspect: 0
@ -933,7 +1062,13 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0}
m_Color: {r: 1, g: 1, b: 1, a: .862745106}
m_Color: {r: 1, g: 1, b: 1, a: 0.8627451}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 21300000, guid: c207de86481ff7d48a2fba2fcc374723, type: 3}
m_Type: 1
m_PreserveAspect: 0
@ -962,11 +1097,11 @@ MonoBehaviour:
m_Transition: 2
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: .145098045, g: .75686276, b: .87843138, a: .698039234}
m_PressedColor: {r: .0784313753, g: .513725519, b: .600000024, a: 1}
m_DisabledColor: {r: .588235319, g: .647058845, b: .666666687, a: .501960814}
m_HighlightedColor: {r: 0.14509805, g: 0.75686276, b: 0.8784314, a: 0.69803923}
m_PressedColor: {r: 0.078431375, g: 0.5137255, b: 0.6, a: 1}
m_DisabledColor: {r: 0.5882353, g: 0.64705884, b: 0.6666667, a: 0.5019608}
m_ColorMultiplier: 2
m_FadeDuration: .100000001
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 21300000, guid: 888feb4a32e3b564fb7e6f9b28cc8e10,
type: 3}
@ -1015,6 +1150,12 @@ MonoBehaviour:
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, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 12800000, guid: bb145366ce7024469a5758b08d31802c, type: 3}
m_FontSize: 40
@ -1023,6 +1164,7 @@ MonoBehaviour:
m_MinSize: 30
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
@ -1041,6 +1183,12 @@ MonoBehaviour:
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, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 12800000, guid: bb145366ce7024469a5758b08d31802c, type: 3}
m_FontSize: 40
@ -1049,6 +1197,7 @@ MonoBehaviour:
m_MinSize: 30
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
@ -1092,11 +1241,11 @@ MonoBehaviour:
m_Transition: 2
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: .145098045, g: .75686276, b: .87843138, a: .698039234}
m_PressedColor: {r: .0784313753, g: .513725519, b: .600000024, a: 1}
m_DisabledColor: {r: .588235319, g: .647058845, b: .666666687, a: .501960814}
m_HighlightedColor: {r: 0.14509805, g: 0.75686276, b: 0.8784314, a: 0.69803923}
m_PressedColor: {r: 0.078431375, g: 0.5137255, b: 0.6, a: 1}
m_DisabledColor: {r: 0.5882353, g: 0.64705884, b: 0.6666667, a: 0.5019608}
m_ColorMultiplier: 2
m_FadeDuration: .100000001
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 21300000, guid: 888feb4a32e3b564fb7e6f9b28cc8e10,
type: 3}
@ -1126,7 +1275,13 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0}
m_Color: {r: 1, g: 1, b: 1, a: .862745106}
m_Color: {r: 1, g: 1, b: 1, a: 0.8627451}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 21300000, guid: c207de86481ff7d48a2fba2fcc374723, type: 3}
m_Type: 1
m_PreserveAspect: 0
@ -1234,8 +1389,10 @@ Canvas:
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_SortingLayerID: 0
m_SortingOrder: 1
m_TargetDisplay: 0
--- !u!224 &22415094
RectTransform:
m_ObjectHideFlags: 1
@ -1253,7 +1410,7 @@ RectTransform:
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &22415102
RectTransform:
m_ObjectHideFlags: 1
@ -1264,6 +1421,7 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 22470986}
- {fileID: 22415112}
m_Father: {fileID: 0}
m_RootOrder: 0
@ -1280,7 +1438,7 @@ RectTransform:
m_GameObject: {fileID: 115108}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: .899999976, y: 1, z: 1}
m_LocalScale: {x: 0.9, y: 1, z: 1}
m_Children:
- {fileID: 22415116}
m_Father: {fileID: 22415112}
@ -1289,7 +1447,7 @@ RectTransform:
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &22415112
RectTransform:
m_ObjectHideFlags: 1
@ -1308,12 +1466,12 @@ RectTransform:
- {fileID: 22415094}
- {fileID: 22415108}
m_Father: {fileID: 22415102}
m_RootOrder: 0
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: -1.84769997e-05, y: 191}
m_RootOrder: 1
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -0.000018477, y: 191}
m_SizeDelta: {x: 1300, y: 0}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &22415116
RectTransform:
m_ObjectHideFlags: 1
@ -1331,7 +1489,7 @@ RectTransform:
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -20, y: -10}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &22415120
RectTransform:
m_ObjectHideFlags: 1
@ -1348,7 +1506,7 @@ RectTransform:
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &22415122
RectTransform:
m_ObjectHideFlags: 1
@ -1365,7 +1523,24 @@ RectTransform:
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 10, y: 0}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &22470986
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 141170}
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: 22415102}
m_RootOrder: 0
m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 1}
--- !u!224 &22472108
RectTransform:
m_ObjectHideFlags: 1
@ -1382,7 +1557,7 @@ RectTransform:
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &22472110
RectTransform:
m_ObjectHideFlags: 1
@ -1400,7 +1575,7 @@ RectTransform:
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &22472112
RectTransform:
m_ObjectHideFlags: 1
@ -1418,7 +1593,7 @@ RectTransform:
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &22472114
RectTransform:
m_ObjectHideFlags: 1
@ -1435,7 +1610,7 @@ RectTransform:
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &22472116
RectTransform:
m_ObjectHideFlags: 1
@ -1452,7 +1627,7 @@ RectTransform:
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &22472118
RectTransform:
m_ObjectHideFlags: 1
@ -1470,7 +1645,7 @@ RectTransform:
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &22472120
RectTransform:
m_ObjectHideFlags: 1
@ -1488,7 +1663,7 @@ RectTransform:
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &22472122
RectTransform:
m_ObjectHideFlags: 1
@ -1505,7 +1680,7 @@ RectTransform:
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &22472124
RectTransform:
m_ObjectHideFlags: 1
@ -1522,7 +1697,7 @@ RectTransform:
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &22472126
RectTransform:
m_ObjectHideFlags: 1
@ -1540,7 +1715,7 @@ RectTransform:
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!225 &22515124
CanvasGroup:
m_ObjectHideFlags: 1

12
Assets/Fungus/Narrative/Scripts/MenuDialog.cs

@ -9,6 +9,8 @@ using UnityEngine.Events;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.EventSystems;
using System.Linq;
namespace Fungus
{
@ -18,6 +20,9 @@ namespace Fungus
// Currently active Menu Dialog used to display Menu options
public static MenuDialog activeMenuDialog;
[Tooltip("Automatically select the first interactable button when the menu is shown.")]
public bool autoSelectFirstButton = false;
[NonSerialized]
public Button[] cachedButtons;
@ -110,6 +115,11 @@ namespace Fungus
button.interactable = interactable;
if (interactable && autoSelectFirstButton && !cachedButtons.Select((x) => x.gameObject).Contains(EventSystem.current.currentSelectedGameObject))
{
EventSystem.current.SetSelectedGameObject(button.gameObject);
}
Text textComponent = button.GetComponentInChildren<Text>();
if (textComponent != null)
{
@ -120,6 +130,8 @@ namespace Fungus
button.onClick.AddListener(delegate {
EventSystem.current.SetSelectedGameObject(null);
StopAllCoroutines(); // Stop timeout
Clear();

21
Assets/Fungus/UI/Scripts/SelectOnEnable.cs

@ -0,0 +1,21 @@
using UnityEngine;
using UnityEngine.UI;
namespace Fungus
{
[RequireComponent(typeof(Selectable))]
public class SelectOnEnable : MonoBehaviour
{
private Selectable selectable;
private void Awake()
{
selectable = GetComponent<Selectable>();
}
private void OnEnable()
{
selectable.Select();
}
}
}

12
Assets/Fungus/UI/Scripts/SelectOnEnable.cs.meta

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 1cbf240ac6442144f90a023c1b64d868
timeCreated: 1467246843
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Loading…
Cancel
Save