UI Improvements

This commit is contained in:
Dawid Pietrykowski 2022-09-03 21:27:31 +02:00
parent 050cf83a47
commit ca0eaa9568
9 changed files with 576 additions and 42 deletions

View File

@ -1,5 +1,241 @@
%YAML 1.1 %YAML 1.1
%TAG !u! tag:unity3d.com,2011: %TAG !u! tag:unity3d.com,2011:
--- !u!1 &2591488824423571653
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3352722539090700081}
- component: {fileID: 5880305822788777795}
- component: {fileID: 969588170665008701}
m_Layer: 5
m_Name: Number
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3352722539090700081
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2591488824423571653}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1571599801882550532}
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 &5880305822788777795
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2591488824423571653}
m_CullTransparentMesh: 1
--- !u!114 &969588170665008701
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2591488824423571653}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: 120
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 1
m_fontSizeBase: 1
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &4170641089806803452
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1571599801882550532}
- component: {fileID: 4730800695995231522}
- component: {fileID: 7303667705103387194}
- component: {fileID: 2882497699023574589}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1571599801882550532
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4170641089806803452}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.57142854, y: 0.2631579, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 3352722539090700081}
m_Father: {fileID: 6930264687477137093}
m_RootOrder: 1
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.1}
m_SizeDelta: {x: 1.75, y: 2}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!223 &4730800695995231522
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4170641089806803452}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 2
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 25
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!114 &7303667705103387194
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4170641089806803452}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, 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
m_PresetInfoIsWorld: 1
--- !u!114 &2882497699023574589
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4170641089806803452}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!1 &6930264686492252668 --- !u!1 &6930264686492252668
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -114,6 +350,7 @@ Transform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 6930264686492252671} - {fileID: 6930264686492252671}
- {fileID: 1571599801882550532}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

@ -219,6 +219,7 @@ RectTransform:
- {fileID: 861769592} - {fileID: 861769592}
- {fileID: 489742540} - {fileID: 489742540}
- {fileID: 762547646} - {fileID: 762547646}
- {fileID: 1540189690}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 8 m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -347,7 +348,7 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_text: 'A: 20 B: 44 C: 36 Suma: 100' m_text: "Ma\u0142e: 20 \u015Arednie: 20 Du\u017Ce: 20 Suma: 100"
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
@ -627,7 +628,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 300} m_AnchoredPosition: {x: 0, y: 261}
m_SizeDelta: {x: 1000, y: 50} m_SizeDelta: {x: 1000, y: 50}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &762547647 --- !u!114 &762547647
@ -650,7 +651,7 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_text: "Odrzuconych kierowc\xF3w: 0" m_text: "Ma\u0142e: 20 \u015Arednie: 20 Du\u017Ce: 20"
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
@ -762,8 +763,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 209, y: -246} m_AnchoredPosition: {x: 131.212, y: -261.92}
m_SizeDelta: {x: 200, y: 50} m_SizeDelta: {x: 254.411, y: 69.844}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &861769593 --- !u!114 &861769593
MonoBehaviour: MonoBehaviour:
@ -812,15 +813,15 @@ MonoBehaviour:
m_faceColor: m_faceColor:
serializedVersion: 2 serializedVersion: 2
rgba: 4294967295 rgba: 4294967295
m_fontSize: 36 m_fontSize: 54
m_fontSizeBase: 36 m_fontSizeBase: 54
m_fontWeight: 400 m_fontWeight: 400
m_enableAutoSizing: 0 m_enableAutoSizing: 0
m_fontSizeMin: 18 m_fontSizeMin: 18
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 0
m_HorizontalAlignment: 1 m_HorizontalAlignment: 2
m_VerticalAlignment: 256 m_VerticalAlignment: 512
m_textAlignment: 65535 m_textAlignment: 65535
m_characterSpacing: 0 m_characterSpacing: 0
m_wordSpacing: 0 m_wordSpacing: 0
@ -1018,8 +1019,8 @@ MonoBehaviour:
m_faceColor: m_faceColor:
serializedVersion: 2 serializedVersion: 2
rgba: 4294967295 rgba: 4294967295
m_fontSize: 24 m_fontSize: 31
m_fontSizeBase: 24 m_fontSizeBase: 31
m_fontWeight: 400 m_fontWeight: 400
m_enableAutoSizing: 0 m_enableAutoSizing: 0
m_fontSizeMin: 0 m_fontSizeMin: 0
@ -1209,7 +1210,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: af24978eff1b496b78bcc0aeccf046ed, type: 3} m_Script: {fileID: 11500000, guid: af24978eff1b496b78bcc0aeccf046ed, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
stepTime: 1 stepTime: 15
timeText: {fileID: 861769593} timeText: {fileID: 861769593}
countsText: {fileID: 489742541} countsText: {fileID: 489742541}
rejectedText: {fileID: 762547647} rejectedText: {fileID: 762547647}
@ -1317,8 +1318,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -242} m_AnchoredPosition: {x: -139, y: -261.92}
m_SizeDelta: {x: 168.73, y: 30} m_SizeDelta: {x: 239.464, y: 69.846}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1365705407 --- !u!114 &1365705407
MonoBehaviour: MonoBehaviour:
@ -1565,6 +1566,141 @@ Transform:
m_CorrespondingSourceObject: {fileID: 13560301962479320, guid: dbfe1689c60c23f129ff74156ff8e6a8, type: 3} m_CorrespondingSourceObject: {fileID: 13560301962479320, guid: dbfe1689c60c23f129ff74156ff8e6a8, type: 3}
m_PrefabInstance: {fileID: 1536635950} m_PrefabInstance: {fileID: 1536635950}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1 &1540189689
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1540189690}
- component: {fileID: 1540189692}
- component: {fileID: 1540189691}
m_Layer: 5
m_Name: Rejected (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1540189690
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1540189689}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 107864146}
m_RootOrder: 4
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: 319}
m_SizeDelta: {x: 1000, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1540189691
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1540189689}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: 'Pojazdy bez przydzielonego miejsca:'
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4278190080
m_fontColor: {r: 0, g: 0, b: 0, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 38.9
m_fontSizeBase: 38.9
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: -0.000022879001, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!222 &1540189692
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1540189689}
m_CullTransparentMesh: 1
--- !u!1 &1621832703 --- !u!1 &1621832703
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -6,8 +6,8 @@ namespace Parking
{ {
public class Driver public class Driver
{ {
public ParkingPreference ParkingPreference = ParkingPreference.Any; public readonly ParkingPreference ParkingPreference;
public int Priority; public readonly int Number;
public readonly Size Size; public readonly Size Size;
public DateTime[] Times; public DateTime[] Times;
public Spot Spot; public Spot Spot;
@ -15,12 +15,23 @@ namespace Parking
public GameObject GameObject; public GameObject GameObject;
public bool Rejected = false; public bool Rejected = false;
public Driver(Size size, int priority, ParkingPreference parkingPreference) public Driver(Size size, int number, ParkingPreference parkingPreference)
{ {
Size = size; Size = size;
Priority = priority; Number = number;
ParkingPreference = parkingPreference; ParkingPreference = parkingPreference;
} }
public void Reset()
{
Parked = false;
Rejected = false;
if(Spot != null)
Spot.Free = true;
Spot = null;
if(GameObject != null)
GameObject.Destroy(GameObject);
}
} }
public class Spot : IComparable<Spot> public class Spot : IComparable<Spot>
@ -29,6 +40,8 @@ namespace Parking
public bool Flipped; public bool Flipped;
public GameObject GameObject; public GameObject GameObject;
public bool Free = true; public bool Free = true;
public bool Reserved = false;
public Driver ReservedDriver = null;
public ParkingPreference ParkingDirection = ParkingPreference.Any; public ParkingPreference ParkingDirection = ParkingPreference.Any;
public Spot(Size size, bool flipped) public Spot(Size size, bool flipped)
@ -43,7 +56,6 @@ namespace Parking
} }
} }
public enum Size public enum Size
{ {
A = 0, A = 0,

View File

@ -57,7 +57,7 @@ namespace Parking
for (var i = 0; i < DataImporter.Drivers.Count && i + fixedCarSpots < carsToPlace; i++) for (var i = 0; i < DataImporter.Drivers.Count && i + fixedCarSpots < carsToPlace; i++)
counts[(int) DataImporter.Drivers[i].Size]++; counts[(int) DataImporter.Drivers[i].Size]++;
var countsString = $"A: {counts[0]} B: {counts[1]} C: {counts[2]} " + var countsString = $"Małe: {counts[0]} Średnie: {counts[1]} Duże: {counts[2]} " +
$"Suma: {counts.Sum()}"; $"Suma: {counts.Sum()}";
ParkingManager.Instance.UpdateText(countsString); ParkingManager.Instance.UpdateText(countsString);
Debug.Log(countsString); Debug.Log(countsString);

View File

@ -28,8 +28,10 @@ namespace Parking
public readonly List<List<Spot>> SpotMap = new() public readonly List<List<Spot>> SpotMap = new()
{new List<Spot>(), new List<Spot>(), new List<Spot>(), new List<Spot>()}; {new List<Spot>(), new List<Spot>(), new List<Spot>(), new List<Spot>()};
private TimeSpan _currentTime = TimeSpan.FromHours(5) + TimeSpan.FromMinutes(45); private static readonly TimeSpan StartTime = TimeSpan.FromHours(5) + TimeSpan.FromMinutes(45);
private int _rejectedDrivers = 0; private static readonly TimeSpan EndTime = TimeSpan.FromHours(17) + TimeSpan.FromMinutes(15);
private static TimeSpan _currentTime = StartTime;
private int[] _rejectedDrivers = {0, 0, 0, 0};
private void Awake() private void Awake()
{ {
@ -39,6 +41,8 @@ namespace Parking
private void Start() private void Start()
{ {
timeText.text = _currentTime.ToString(); timeText.text = _currentTime.ToString();
rejectedText.text = $"Małe: {_rejectedDrivers[0]} Średnie: {_rejectedDrivers[1]} " +
$"Duże: {_rejectedDrivers[2]}";
DataImporter.ReadFile("Assets/Data/v1.csv"); DataImporter.ReadFile("Assets/Data/v1.csv");
Debug.Log(DataImporter.Drivers); Debug.Log(DataImporter.Drivers);
InitialConfigurationGenerator generator = new(); InitialConfigurationGenerator generator = new();
@ -47,7 +51,17 @@ namespace Parking
public void AdvanceTime() public void AdvanceTime()
{ {
_currentTime += TimeSpan.FromMinutes(15); _currentTime += TimeSpan.FromMinutes(stepTime);
if (_currentTime > EndTime)
{
_currentTime = StartTime;
ResetDrivers();
_rejectedDrivers = new int[]{0, 0,0 ,0};
rejectedText.text = $"Małe: {_rejectedDrivers[0]} Średnie: {_rejectedDrivers[1]} " +
$"Duże: {_rejectedDrivers[2]}";
timeText.text = _currentTime.ToString();
return;
}
timeText.text = _currentTime.ToString(); timeText.text = _currentTime.ToString();
foreach (Driver driver in DataImporter.Drivers) foreach (Driver driver in DataImporter.Drivers)
if (_currentTime <= driver.Times[1].TimeOfDay && _currentTime > driver.Times[0].TimeOfDay && if (_currentTime <= driver.Times[1].TimeOfDay && _currentTime > driver.Times[0].TimeOfDay &&
@ -55,19 +69,25 @@ namespace Parking
{ {
if (!PlaceCarOnParking(driver)) if (!PlaceCarOnParking(driver))
{ {
Debug.Log($"Placing failed for car {driver.Priority}"); Debug.Log($"Placing failed for car {driver.Number}");
driver.Rejected = true; driver.Rejected = true;
_rejectedDrivers++; _rejectedDrivers[(int)driver.Size]++;
rejectedText.text = $"Odrzuconych kierowców: {_rejectedDrivers}"; rejectedText.text = $"Małe: {_rejectedDrivers[0]} Średnie: {_rejectedDrivers[1]} " +
$"Duże: {_rejectedDrivers[2]}";
} }
} }
else if (_currentTime > driver.Times[1].TimeOfDay && else if (_currentTime > driver.Times[1].TimeOfDay &&
driver.Parked) driver.Parked)
{ {
driver.Spot.Free = true; driver.Reset();
driver.Parked = false; }
driver.Spot = null; }
Destroy(driver.GameObject);
private void ResetDrivers()
{
foreach (Driver driver in DataImporter.Drivers)
{
driver.Reset();
} }
} }
@ -83,6 +103,9 @@ namespace Parking
driver.Spot = spot; driver.Spot = spot;
driver.Parked = true; driver.Parked = true;
driver.GameObject = Instantiate(carPrefab, spot.GameObject.transform, true); driver.GameObject = Instantiate(carPrefab, spot.GameObject.transform, true);
driver.GameObject.GetComponentInChildren<TextMeshProUGUI>().text = driver.Number.ToString();
driver.GameObject.GetComponentInChildren<TextMeshProUGUI>().transform.rotation =
Quaternion.Euler(new Vector3(0, 0, spot.Flipped ? 180 : 0));
driver.GameObject.transform.position = spot.GameObject.transform.position; driver.GameObject.transform.position = spot.GameObject.transform.position;
driver.GameObject.transform.rotation = driver.GameObject.transform.rotation =
Quaternion.Euler(new Vector3(0, 0, spot.Flipped ? 180 : 0)); Quaternion.Euler(new Vector3(0, 0, spot.Flipped ? 180 : 0));
@ -98,6 +121,9 @@ namespace Parking
driver.Spot = spot; driver.Spot = spot;
driver.Parked = true; driver.Parked = true;
driver.GameObject = Instantiate(carPrefab, spot.GameObject.transform, true); driver.GameObject = Instantiate(carPrefab, spot.GameObject.transform, true);
driver.GameObject.GetComponentInChildren<TextMeshProUGUI>().text = driver.Number.ToString();
driver.GameObject.GetComponentInChildren<TextMeshProUGUI>().transform.rotation =
Quaternion.Euler(new Vector3(0, 0, spot.Flipped ? 180 : 0));
driver.GameObject.transform.position = spot.GameObject.transform.position; driver.GameObject.transform.position = spot.GameObject.transform.position;
driver.GameObject.transform.rotation = driver.GameObject.transform.rotation =
Quaternion.Euler(new Vector3(0, 0, spot.Flipped ? 180 : 0)); Quaternion.Euler(new Vector3(0, 0, spot.Flipped ? 180 : 0));
@ -113,6 +139,55 @@ namespace Parking
countsText.text = text; countsText.text = text;
} }
private void ReconfigureSpots()
{
int[] freeSpots = GetFreeSpotCount();
List<Driver> nextCars = GetNextCars(10);
int[] plannedSpots = new[] {0, 0, 0, 0};
foreach (Driver driver in nextCars)
plannedSpots[(int)driver.Size]++;
int[] neededSpots = new[] {0, 0, 0, 0};
for (int i = 0; i < neededSpots.Length; i++)
neededSpots[i] = Math.Max(freeSpots[i] - plannedSpots[i], 0);
if (neededSpots.Max() > 0)
{
Debug.Log($"Needed spots = {neededSpots[0]} {neededSpots[1]} {neededSpots[2]} {neededSpots[3]}");
Debug.Log($"Attempting reconfiguration...");
}
}
private int[] GetFreeSpotCount()
{
int[] freeSpots = new[] {0, 0, 0, 0};
foreach (var t in SpotMap)
foreach (Spot spot in t)
if (spot.Free)
freeSpots[(int)spot.Size]++;
return freeSpots;
}
private List<Driver> GetNextCars(int n)
{
List<Driver> nextCars = new List<Driver>();
TimeSpan updatedTime = _currentTime + TimeSpan.FromMinutes(stepTime);
while (nextCars.Count < n && updatedTime < EndTime)
{
foreach (Driver driver in DataImporter.Drivers)
if (_currentTime + updatedTime <= driver.Times[1].TimeOfDay &&
_currentTime > driver.Times[0].TimeOfDay &&
!driver.Parked && !driver.Rejected && !nextCars.Contains(driver))
{
nextCars.Add(driver);
}
updatedTime += TimeSpan.FromMinutes(stepTime);
}
return nextCars;
}
private void ArrangeSpots(int[,] spotsCreated) private void ArrangeSpots(int[,] spotsCreated)
{ {
var spotMap = GenerateSpotMap(spotsCreated); var spotMap = GenerateSpotMap(spotsCreated);

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"dependencies": { "dependencies": {
"com.unity.collab-proxy": "1.17.1", "com.unity.collab-proxy": "1.17.2",
"com.unity.feature.2d": "1.0.0", "com.unity.feature.2d": "1.0.0",
"com.unity.ide.rider": "3.0.15", "com.unity.ide.rider": "3.0.15",
"com.unity.ide.visualstudio": "2.0.16", "com.unity.ide.visualstudio": "2.0.16",

View File

@ -95,7 +95,7 @@
"url": "https://packages.unity.com" "url": "https://packages.unity.com"
}, },
"com.unity.collab-proxy": { "com.unity.collab-proxy": {
"version": "1.17.1", "version": "1.17.2",
"depth": 0, "depth": 0,
"source": "registry", "source": "registry",
"dependencies": { "dependencies": {

View File

@ -1,2 +1,2 @@
m_EditorVersion: 2021.3.8f1 m_EditorVersion: 2021.3.9f1
m_EditorVersionWithRevision: 2021.3.8f1 (b30333d56e81) m_EditorVersionWithRevision: 2021.3.9f1 (ad3870b89536)