mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-10 14:44:17 +00:00
first working version of new pause menu
This commit is contained in:
parent
541f4c333a
commit
1185732b28
9 changed files with 554 additions and 27 deletions
199
Assets/Prefabs/PauseMenuButton.prefab
Normal file
199
Assets/Prefabs/PauseMenuButton.prefab
Normal file
|
@ -0,0 +1,199 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1153812927624731389
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1879489219035276207}
|
||||
- component: {fileID: 4249448815197701008}
|
||||
- component: {fileID: 5268650787491342723}
|
||||
m_Layer: 5
|
||||
m_Name: Text
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1879489219035276207
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1153812927624731389}
|
||||
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: 4255322237893754860}
|
||||
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 &4249448815197701008
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1153812927624731389}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &5268650787491342723
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1153812927624731389}
|
||||
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: 22
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 1
|
||||
m_MinSize: 0
|
||||
m_MaxSize: 22
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: Button
|
||||
--- !u!1 &4469353898717795948
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4255322237893754860}
|
||||
- component: {fileID: 4485019371301182184}
|
||||
- component: {fileID: 8761464038165536048}
|
||||
- component: {fileID: 2472770546563269859}
|
||||
m_Layer: 5
|
||||
m_Name: PauseMenuButton
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &4255322237893754860
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4469353898717795948}
|
||||
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: 1879489219035276207}
|
||||
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: 180, y: 40}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4485019371301182184
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4469353898717795948}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &8761464038165536048
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4469353898717795948}
|
||||
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.14117648, g: 0.1254902, b: 0.24705882, 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 &2472770546563269859
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4469353898717795948}
|
||||
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: 8761464038165536048}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
|
||||
Culture=neutral, PublicKeyToken=null
|
7
Assets/Prefabs/PauseMenuButton.prefab.meta
Normal file
7
Assets/Prefabs/PauseMenuButton.prefab.meta
Normal file
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8c5d585192978944f82c398f36a2b425
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1900,7 +1900,9 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 661aa8bc19a0e4d3dbb894f6b7b77966, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
menuBar: {fileID: 1329773086393139728}
|
||||
openedWindowTextColor: {r: 0, g: 1, b: 0, a: 1}
|
||||
canvas: {fileID: 1569761911911314030}
|
||||
--- !u!1 &1693155584687832567
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -4702,7 +4704,8 @@ RectTransform:
|
|||
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: []
|
||||
m_Children:
|
||||
- {fileID: 6895597356213543365}
|
||||
m_Father: {fileID: 9213750055200343700}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
@ -6545,6 +6548,91 @@ MonoBehaviour:
|
|||
m_Calls: []
|
||||
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
|
||||
Culture=neutral, PublicKeyToken=null
|
||||
--- !u!1 &8998794227352548323
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6895597356213543365}
|
||||
- component: {fileID: 4479260070654253888}
|
||||
- component: {fileID: 1776402841919304481}
|
||||
- component: {fileID: 1329773086393139728}
|
||||
m_Layer: 0
|
||||
m_Name: ButtonsContainer
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &6895597356213543365
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8998794227352548323}
|
||||
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: 7599425881816116282}
|
||||
m_Father: {fileID: 2221193767689923803}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 170, y: -25}
|
||||
m_SizeDelta: {x: 300, y: -70}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4479260070654253888
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8998794227352548323}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &1776402841919304481
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8998794227352548323}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 1297475563, guid: f70555f144d8491a825f0804e09c671c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding:
|
||||
m_Left: 0
|
||||
m_Right: 0
|
||||
m_Top: 0
|
||||
m_Bottom: 0
|
||||
m_ChildAlignment: 0
|
||||
m_Spacing: 7
|
||||
m_ChildForceExpandWidth: 1
|
||||
m_ChildForceExpandHeight: 0
|
||||
m_ChildControlWidth: 0
|
||||
m_ChildControlHeight: 0
|
||||
--- !u!114 &1329773086393139728
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8998794227352548323}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3009b992d8a5e69499f649956b583a0c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
buttonsContainer: {fileID: 6895597356213543365}
|
||||
buttonPrefab: {fileID: 4469353898717795948, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
--- !u!1 &9222667703998931269
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -6663,3 +6751,128 @@ MonoBehaviour:
|
|||
m_Calls: []
|
||||
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
|
||||
Culture=neutral, PublicKeyToken=null
|
||||
--- !u!1001 &5943454724038923222
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 6895597356213543365}
|
||||
m_Modifications:
|
||||
- target: {fileID: 4469353898717795948, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: PauseMenuButton
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4255322237893754860, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4255322237893754860, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4255322237893754860, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4255322237893754860, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4255322237893754860, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4255322237893754860, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4255322237893754860, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4255322237893754860, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4255322237893754860, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4255322237893754860, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4255322237893754860, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4255322237893754860, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4255322237893754860, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4255322237893754860, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 180
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4255322237893754860, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 40
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4255322237893754860, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMin.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4255322237893754860, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4255322237893754860, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4255322237893754860, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4255322237893754860, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
propertyPath: m_Pivot.x
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4255322237893754860, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
propertyPath: m_Pivot.y
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 8c5d585192978944f82c398f36a2b425, type: 3}
|
||||
--- !u!224 &7599425881816116282 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 4255322237893754860, guid: 8c5d585192978944f82c398f36a2b425,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 5943454724038923222}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
|
|
@ -19,20 +19,30 @@ namespace SanAndreasUnity.UI {
|
|||
return m_isOpened;
|
||||
}
|
||||
set {
|
||||
if (m_isOpened == value)
|
||||
return;
|
||||
|
||||
m_isOpened = value;
|
||||
|
||||
Instance.canvas.enabled = m_isOpened;
|
||||
}
|
||||
}
|
||||
|
||||
public static event System.Action onDrawItems = delegate {};
|
||||
|
||||
// public Color windowsColor = new Color(0.5f, 0.5f, 0.5f, 0.8f);
|
||||
// private static Texture2D m_windowBackgroundTexture = null;
|
||||
// private static bool m_changedWindowStyle = false;
|
||||
// public Color windowsColor = new Color(0.5f, 0.5f, 0.5f, 0.8f);
|
||||
// private static Texture2D m_windowBackgroundTexture = null;
|
||||
// private static bool m_changedWindowStyle = false;
|
||||
|
||||
public MenuBar menuBar;
|
||||
|
||||
public Color openedWindowTextColor = Color.green;
|
||||
public Color ClosedWindowTextColor => this.menuBar.DefaultMenuEntryTextColor;
|
||||
|
||||
public static event System.Action onGUI = delegate {};
|
||||
|
||||
public Canvas canvas;
|
||||
|
||||
|
||||
|
||||
void Awake () {
|
||||
|
|
|
@ -22,6 +22,9 @@ namespace SanAndreasUnity.UI {
|
|||
if (this.IsRegisteredInMainMenu)
|
||||
MainMenu.SetEntryColor(m_mainMenuEntry, m_isOpened ? MainMenu.Instance.openedWindowTextColor : MainMenu.Instance.ClosedWindowTextColor);
|
||||
|
||||
if (m_pauseMenuEntry != null)
|
||||
PauseMenu.Instance.menuBar.SetEntryColor(m_pauseMenuEntry, m_isOpened ? PauseMenu.Instance.openedWindowTextColor : PauseMenu.Instance.ClosedWindowTextColor);
|
||||
|
||||
if (m_isOpened)
|
||||
{
|
||||
this.OnWindowOpened ();
|
||||
|
@ -85,6 +88,8 @@ namespace SanAndreasUnity.UI {
|
|||
[SerializeField] private float m_spaceAfterContent = 0f;
|
||||
public float SpaceAfterContent { get { return m_spaceAfterContent; } set { m_spaceAfterContent = value; } }
|
||||
|
||||
private Utilities.MenuBarEntry m_pauseMenuEntry;
|
||||
|
||||
[SerializeField] private bool m_registerInMainMenuOnStart = false;
|
||||
public bool IsRegisteredInMainMenu { get; private set; }
|
||||
private MenuEntry m_mainMenuEntry;
|
||||
|
@ -265,32 +270,19 @@ namespace SanAndreasUnity.UI {
|
|||
|
||||
public void RegisterButtonInPauseMenu() {
|
||||
|
||||
PauseMenu.onDrawItems += this.OnPauseMenuGUI;
|
||||
m_pauseMenuEntry = new Utilities.MenuBarEntry
|
||||
{
|
||||
name = this.windowName,
|
||||
clickAction = this.OnButtonClickedInPauseMenu
|
||||
};
|
||||
|
||||
PauseMenu.Instance.menuBar.RegisterMenuEntry(m_pauseMenuEntry);
|
||||
|
||||
}
|
||||
|
||||
public void UnRegisterButtonInPauseMenu() {
|
||||
|
||||
PauseMenu.onDrawItems -= this.OnPauseMenuGUI;
|
||||
|
||||
}
|
||||
|
||||
private void OnPauseMenuGUI() {
|
||||
|
||||
// display button for opening/closing window
|
||||
|
||||
var originalColor = GUI.contentColor;
|
||||
if (this.IsOpened)
|
||||
GUI.contentColor = PauseMenu.Instance.openedWindowTextColor;
|
||||
|
||||
// string text = this.IsOpened ? "Hide " + this.windowName : "Show " + this.windowName;
|
||||
string text = this.windowName;
|
||||
|
||||
if (GUILayout.Button (text)) {
|
||||
this.IsOpened = ! this.IsOpened;
|
||||
}
|
||||
|
||||
GUI.contentColor = originalColor;
|
||||
private void OnButtonClickedInPauseMenu()
|
||||
{
|
||||
this.IsOpened = !this.IsOpened;
|
||||
}
|
||||
|
||||
public void RegisterInMainMenu ()
|
||||
|
|
51
Assets/Scripts/Utilities/UI/MenuBar.cs
Normal file
51
Assets/Scripts/Utilities/UI/MenuBar.cs
Normal file
|
@ -0,0 +1,51 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace SanAndreasUnity.Utilities
|
||||
{
|
||||
|
||||
public class MenuBar : MonoBehaviour
|
||||
{
|
||||
MenuBarEntry m_rootMenuEntry = new MenuBarEntry();
|
||||
|
||||
public RectTransform buttonsContainer;
|
||||
public GameObject buttonPrefab;
|
||||
|
||||
public Color DefaultMenuEntryTextColor => this.buttonPrefab.GetComponentInChildren<Text>().color;
|
||||
|
||||
|
||||
|
||||
public void RegisterMenuEntry(MenuBarEntry menuEntry)
|
||||
{
|
||||
int indexOfMenuEntry = m_rootMenuEntry.AddChild(menuEntry);
|
||||
|
||||
GameObject buttonGo = Object.Instantiate(this.buttonPrefab);
|
||||
|
||||
buttonGo.name = menuEntry.name;
|
||||
|
||||
buttonGo.GetComponentInChildren<Text>().text = menuEntry.name;
|
||||
|
||||
buttonGo.transform.SetParent(this.buttonsContainer.transform, false);
|
||||
buttonGo.transform.SetSiblingIndex(indexOfMenuEntry);
|
||||
|
||||
buttonGo.GetComponent<Button>().onClick.AddListener(() => menuEntry.clickAction());
|
||||
|
||||
}
|
||||
|
||||
public Button GetMenuEntryButton(MenuBarEntry entry)
|
||||
{
|
||||
Transform child = this.buttonsContainer.transform.Find(entry.name);
|
||||
return child != null ? child.GetComponent<Button>() : null;
|
||||
}
|
||||
|
||||
public void SetEntryColor(MenuBarEntry entry, Color color)
|
||||
{
|
||||
var button = GetMenuEntryButton(entry);
|
||||
if (button != null)
|
||||
button.GetComponentInChildren<Text>().color = color;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
11
Assets/Scripts/Utilities/UI/MenuBar.cs.meta
Normal file
11
Assets/Scripts/Utilities/UI/MenuBar.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3009b992d8a5e69499f649956b583a0c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
33
Assets/Scripts/Utilities/UI/MenuBarEntry.cs
Normal file
33
Assets/Scripts/Utilities/UI/MenuBarEntry.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace SanAndreasUnity.Utilities
|
||||
{
|
||||
|
||||
public class MenuBarEntry
|
||||
{
|
||||
public string name = "";
|
||||
public int sortPriority = 0;
|
||||
public List<MenuBarEntry> children = new List<MenuBarEntry>();
|
||||
public System.Action drawAction = null;
|
||||
public System.Action clickAction = null;
|
||||
|
||||
public int AddChild(MenuBarEntry 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
11
Assets/Scripts/Utilities/UI/MenuBarEntry.cs.meta
Normal file
11
Assets/Scripts/Utilities/UI/MenuBarEntry.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3c256f83f853fb44a8c14709ac6cf436
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in a new issue