main menu buttons almost done

This commit is contained in:
in0finite 2020-04-18 23:13:19 +02:00
parent 552e4453e0
commit 6b58fdf964
6 changed files with 592 additions and 11 deletions

View file

@ -0,0 +1,199 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &5831535386160725726
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6556015425999570828}
- component: {fileID: 8797780880911886259}
- component: {fileID: 716333809257762208}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6556015425999570828
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5831535386160725726}
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: 8927010980271201231}
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!222 &8797780880911886259
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5831535386160725726}
m_CullTransparentMesh: 0
--- !u!114 &716333809257762208
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5831535386160725726}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.8301887, g: 0.8301887, b: 0.8301887, 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: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 30
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
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!1 &9144763033384219215
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8927010980271201231}
- component: {fileID: 9138667228417146571}
- component: {fileID: 4141083121869060371}
- component: {fileID: 7115660482297094336}
m_Layer: 5
m_Name: MainMenuButton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8927010980271201231
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9144763033384219215}
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: 6556015425999570828}
m_Father: {fileID: 0}
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: 140, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &9138667228417146571
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9144763033384219215}
m_CullTransparentMesh: 0
--- !u!114 &4141083121869060371
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9144763033384219215}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.27268726, g: 0.22895159, b: 0.46226418, 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_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
m_UseSpriteMesh: 0
--- !u!114 &7115660482297094336
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9144763033384219215}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
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: 4141083121869060371}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c5e7e3e4ef714514090db34e6278e452
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -667,7 +667,8 @@ Transform:
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_Children:
- {fileID: 8427225095601868331}
m_Father: {fileID: 4450559263798022}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -691,6 +692,9 @@ MonoBehaviour:
drawBackground: 1
backgroundColor: {r: 0.064887136, g: 0.04111782, b: 0.11320752, a: 1}
drawLogo: 1
buttonsContainer: {fileID: 8593699161208457630}
buttonPrefab: {fileID: 9144763033384219215, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
--- !u!1 &1594478129176806
GameObject:
m_ObjectHideFlags: 0
@ -1873,7 +1877,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -83.00012, y: 275}
m_AnchoredPosition: {x: -83.000244, y: 275}
m_SizeDelta: {x: 130, y: 70}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2479142476268879446
@ -2113,6 +2117,105 @@ MonoBehaviour:
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Aim
--- !u!1 &1834090693128192380
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8427225095601868331}
- component: {fileID: 4580190521452898284}
- component: {fileID: 4787442104432958793}
- component: {fileID: 2165882217537595020}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8427225095601868331
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1834090693128192380}
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: 8593699161208457630}
m_Father: {fileID: 4649684838142242}
m_RootOrder: 0
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!223 &4580190521452898284
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1834090693128192380}
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!114 &4787442104432958793
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1834090693128192380}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 1280, y: 720}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!114 &2165882217537595020
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1834090693128192380}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!1 &1887190014988715603
GameObject:
m_ObjectHideFlags: 0
@ -2775,7 +2878,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -83.00012, y: 125}
m_AnchoredPosition: {x: -83.000244, y: 125}
m_SizeDelta: {x: 130, y: 70}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3929411723994903192
@ -3555,7 +3658,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -83.00012, y: 200}
m_AnchoredPosition: {x: -83.000244, y: 200}
m_SizeDelta: {x: 130, y: 70}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1157941167379231062
@ -5029,7 +5132,7 @@ Canvas:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6553587779773763042}
m_Enabled: 1
m_Enabled: 0
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
@ -5449,6 +5552,105 @@ MonoBehaviour:
y: 0
width: 1
height: 1
--- !u!1 &7440295692224049306
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8593699161208457630}
- component: {fileID: 8945428129181930115}
- component: {fileID: 8327691202590681875}
- component: {fileID: 87587368906071952}
m_Layer: 5
m_Name: Panel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8593699161208457630
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7440295692224049306}
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: 962322869222756652}
m_Father: {fileID: 8427225095601868331}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 90}
m_SizeDelta: {x: -100, y: 120}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8945428129181930115
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7440295692224049306}
m_CullTransparentMesh: 0
--- !u!114 &8327691202590681875
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7440295692224049306}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.392}
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
m_FillCenter: 0
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
--- !u!114 &87587368906071952
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7440295692224049306}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -405508275, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 4
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 0
m_ChildControlHeight: 0
--- !u!1 &7884037108542363516
GameObject:
m_ObjectHideFlags: 0
@ -5800,7 +6002,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -83.00012, y: 350}
m_AnchoredPosition: {x: -83.000244, y: 350}
m_SizeDelta: {x: 130, y: 70}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4280313578773494885
@ -5882,3 +6084,128 @@ MonoBehaviour:
m_Calls: []
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!1001 &8555087484270299875
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 8593699161208457630}
m_Modifications:
- target: {fileID: 9144763033384219215, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
propertyPath: m_Name
value: Button
objectReference: {fileID: 0}
- target: {fileID: 8927010980271201231, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8927010980271201231, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8927010980271201231, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
propertyPath: m_LocalPosition.z
value: -0.0003653844
objectReference: {fileID: 0}
- target: {fileID: 8927010980271201231, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8927010980271201231, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8927010980271201231, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8927010980271201231, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8927010980271201231, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8927010980271201231, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8927010980271201231, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8927010980271201231, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8927010980271201231, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8927010980271201231, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8927010980271201231, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
propertyPath: m_SizeDelta.x
value: 150
objectReference: {fileID: 0}
- target: {fileID: 8927010980271201231, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
propertyPath: m_SizeDelta.y
value: 60
objectReference: {fileID: 0}
- target: {fileID: 8927010980271201231, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8927010980271201231, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8927010980271201231, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8927010980271201231, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8927010980271201231, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 8927010980271201231, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c5e7e3e4ef714514090db34e6278e452, type: 3}
--- !u!224 &962322869222756652 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 8927010980271201231, guid: c5e7e3e4ef714514090db34e6278e452,
type: 3}
m_PrefabInstance: {fileID: 8555087484270299875}
m_PrefabAsset: {fileID: 0}

View file

@ -3,6 +3,7 @@ using UnityEngine;
using SanAndreasUnity.Behaviours;
using UnityEngine.SceneManagement;
using SanAndreasUnity.Utilities;
using UnityEngine.UI;
namespace SanAndreasUnity.UI
{
@ -27,6 +28,11 @@ namespace SanAndreasUnity.UI
static MenuEntry s_rootMenuEntry = new MenuEntry();
static bool s_hasMenuEntriesToAdd = false;
public RectTransform buttonsContainer;
public GameObject buttonPrefab;
void Awake()
@ -105,7 +111,37 @@ namespace SanAndreasUnity.UI
public static void RegisterMenuEntry (MenuEntry menuEntry)
{
s_rootMenuEntry.AddChild (menuEntry);
int indexOfMenuEntry = s_rootMenuEntry.AddChild (menuEntry);
GameObject buttonGo = Instantiate(Instance.buttonPrefab);
buttonGo.GetComponentInChildren<Text>().text = menuEntry.name;
buttonGo.transform.SetParent(Instance.buttonsContainer.transform, false);
buttonGo.transform.SetSiblingIndex(indexOfMenuEntry);
buttonGo.GetComponent<Button>().onClick.AddListener(() => menuEntry.clickAction());
//Instance.buttonsContainer.GetComponent<HorizontalLayoutGroup>();
//MenuEntriesChanged();
}
static void MenuEntriesChanged()
{
if (s_hasMenuEntriesToAdd)
return;
s_hasMenuEntriesToAdd = true;
Instance.Invoke(nameof(UpdateMenuEntries), 0.0001f);
}
void UpdateMenuEntries()
{
s_hasMenuEntriesToAdd = false;
}
}

View file

@ -9,15 +9,22 @@ namespace SanAndreasUnity.UI
public int sortPriority = 0;
public List<MenuEntry> children = new List<MenuEntry>();
public System.Action drawAction = null;
public System.Action clickAction = null;
public void AddChild(MenuEntry entry)
public int AddChild(MenuEntry entry)
{
int index = this.children.FindIndex(e => e.sortPriority > entry.sortPriority);
if (index < 0)
{
this.children.Add(entry);
return 0;
}
else
{
this.children.Insert(index, entry);
return index;
}
}

View file

@ -296,8 +296,8 @@ namespace SanAndreasUnity.UI {
this.IsRegisteredInMainMenu = true;
MenuEntry menuEntry = new MenuEntry(){name = this.windowName, sortPriority = m_sortPriorityForMainMenu,
drawAction = () => this.OnMainMenuGUI()};
MenuEntry menuEntry = new MenuEntry(){ name = this.windowName, sortPriority = m_sortPriorityForMainMenu,
drawAction = () => this.OnMainMenuGUI(), clickAction = this.OnButtonClickedInMainMenu };
MainMenu.RegisterMenuEntry (menuEntry);
}
@ -311,12 +311,17 @@ namespace SanAndreasUnity.UI {
if (MainMenu.DrawMenuEntry (this.windowName))
{
this.IsOpened = !this.IsOpened;
this.OnButtonClickedInMainMenu();
}
GUI.contentColor = originalColor;
}
private void OnButtonClickedInMainMenu()
{
this.IsOpened = !this.IsOpened;
}
}
}