feature/fix_ui_system #16

Merged
iwnc2020 merged 4 commits from feature/fix_ui_system into develop 2025-07-22 07:47:23 +00:00
21 changed files with 564 additions and 406 deletions

View File

@ -791,6 +791,134 @@
"isPartOfComposite": false "isPartOfComposite": false
} }
] ]
},
{
"name": "RestaurantUi",
"id": "09e9f166-1b94-40d7-92a5-306261fd4a45",
"actions": [
{
"name": "Submit",
"type": "Button",
"id": "e149792b-a700-4b90-a21d-8fc547741042",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Cancel",
"type": "Button",
"id": "38e6d893-5a8f-4e02-aabc-07829d32428a",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Interact1",
"type": "Button",
"id": "345ce67b-a186-4368-bd50-2384e93cf5ce",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Interact2",
"type": "Button",
"id": "7900b5b8-b140-4a58-9352-bbfea4704a1e",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "PreviousTab",
"type": "Button",
"id": "78e6de72-1e34-4422-b40f-3f0607115648",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "NextTab",
"type": "Button",
"id": "c1875db3-e751-4965-941e-be486ca994a4",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
}
],
"bindings": [
{
"name": "",
"id": "e35c75ec-b269-454d-93e0-b79adb0cadb2",
"path": "<Keyboard>/enter",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "Submit",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "0e22594f-9dac-4ffe-8048-a82ee21b2e44",
"path": "<Keyboard>/escape",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "Cancel",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "19e1fbbb-bff6-4e7b-a4df-79a390e38386",
"path": "<Keyboard>/e",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "Interact1",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "cfbf9b29-3d54-45fc-b740-699c18628211",
"path": "<Keyboard>/f",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "Interact2",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "cfa7a71b-fda7-4cbe-81cb-e02433aeea47",
"path": "<Keyboard>/q",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "PreviousTab",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "ce06d3e9-c611-4594-91c4-16b8dfdf1ce9",
"path": "<Keyboard>/r",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "NextTab",
"isComposite": false,
"isPartOfComposite": false
}
]
} }
], ],
"controlSchemes": [ "controlSchemes": [

View File

@ -11,7 +11,6 @@ GameObject:
- component: {fileID: 1761643478070701343} - component: {fileID: 1761643478070701343}
- component: {fileID: 5176902543201676162} - component: {fileID: 5176902543201676162}
- component: {fileID: 732677841941379807} - component: {fileID: 732677841941379807}
- component: {fileID: 8352859907019760819}
- component: {fileID: 3365694194251356714} - component: {fileID: 3365694194251356714}
- component: {fileID: 127430239903465757} - component: {fileID: 127430239903465757}
- component: {fileID: 3095965496140440094} - component: {fileID: 3095965496140440094}
@ -86,92 +85,6 @@ BoxCollider:
serializedVersion: 3 serializedVersion: 3
m_Size: {x: 0.3, y: 0.5, z: 0.1} m_Size: {x: 0.3, y: 0.5, z: 0.1}
m_Center: {x: 0, y: 0.25, z: 0.05} m_Center: {x: 0, y: 0.25, z: 0.05}
--- !u!114 &8352859907019760819
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5259510642736920361}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Actions: {fileID: -944628639613478452, guid: 052faaac586de48259a63d0c4782560b, type: 3}
m_NotificationBehavior: 2
m_UIInputModule: {fileID: 0}
m_DeviceLostEvent:
m_PersistentCalls:
m_Calls: []
m_DeviceRegainedEvent:
m_PersistentCalls:
m_Calls: []
m_ControlsChangedEvent:
m_PersistentCalls:
m_Calls: []
m_ActionEvents:
- m_PersistentCalls:
m_Calls: []
m_ActionId: 351f2ccd-1f9f-44bf-9bec-d62ac5c5f408
m_ActionName: 'Restaurant/Move[/Keyboard/w,/Keyboard/upArrow,/Keyboard/s,/Keyboard/downArrow,/Keyboard/a,/Keyboard/leftArrow,/Keyboard/d,/Keyboard/rightArrow]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: 6c2ab1b8-8984-453a-af3d-a3c78ae1679a
m_ActionName: 'Restaurant/Attack[/Mouse/leftButton,/Keyboard/enter]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: f1e71b7e-271b-4382-876a-260ea451296a
m_ActionName: 'Restaurant/Dash[/Keyboard/space]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: 852140f2-7766-474d-8707-702459ba45f3
m_ActionName: 'Restaurant/Interact[/Keyboard/e]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: c95b2375-e6d9-4b88-9c4c-c5e76515df4b
m_ActionName: 'Ui/Navigate[/Keyboard/w,/Keyboard/upArrow,/Keyboard/s,/Keyboard/downArrow,/Keyboard/a,/Keyboard/leftArrow,/Keyboard/d,/Keyboard/rightArrow]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: 7607c7b6-cd76-4816-beef-bd0341cfe950
m_ActionName: 'Ui/Submit[/Keyboard/enter]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: 15cef263-9014-4fd5-94d9-4e4a6234a6ef
m_ActionName: 'Ui/Cancel[/Keyboard/escape]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: 32b35790-4ed0-4e9a-aa41-69ac6d629449
m_ActionName: 'Ui/Point[/Mouse/position]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: 3c7022bf-7922-4f7c-a998-c437916075ad
m_ActionName: 'Ui/Click[/Mouse/leftButton]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: 44b200b1-1557-4083-816c-b22cbdf77ddf
m_ActionName: 'Ui/RightClick[/Mouse/rightButton]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: dad70c86-b58c-4b17-88ad-f5e53adf419e
m_ActionName: 'Ui/MiddleClick[/Mouse/middleButton]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: 0489e84a-4833-4c40-bfae-cea84b696689
m_ActionName: 'Ui/ScrollWheel[/Mouse/scroll]'
- m_PersistentCalls:
m_Calls: []
m_ActionId: 24908448-c609-4bc3-a128-ea258674378a
m_ActionName: Ui/TrackedDevicePosition
- m_PersistentCalls:
m_Calls: []
m_ActionId: 9caa3d8a-6b2f-4e8e-8bad-6ede561bd9be
m_ActionName: Ui/TrackedDeviceOrientation
m_NeverAutoSwitchControlSchemes: 0
m_DefaultControlScheme:
m_DefaultActionMap: Restaurant
m_SplitScreenIndex: -1
m_Camera: {fileID: 0}
--- !u!114 &3365694194251356714 --- !u!114 &3365694194251356714
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -0,0 +1,78 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &400999908655581056
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8535288295479870848}
- component: {fileID: 2911068230828892660}
- component: {fileID: 1957640103239870191}
m_Layer: 0
m_Name: InputManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8535288295479870848
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 400999908655581056}
serializedVersion: 2
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: 1
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2911068230828892660
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 400999908655581056}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Actions: {fileID: -944628639613478452, guid: 052faaac586de48259a63d0c4782560b, type: 3}
m_NotificationBehavior: 0
m_UIInputModule: {fileID: 0}
m_DeviceLostEvent:
m_PersistentCalls:
m_Calls: []
m_DeviceRegainedEvent:
m_PersistentCalls:
m_Calls: []
m_ControlsChangedEvent:
m_PersistentCalls:
m_Calls: []
m_ActionEvents: []
m_NeverAutoSwitchControlSchemes: 0
m_DefaultControlScheme:
m_DefaultActionMap:
m_SplitScreenIndex: -1
m_Camera: {fileID: 0}
--- !u!114 &1957640103239870191
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 400999908655581056}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f3a9c6e7027b3d944ae69e5e7ccc7627, type: 3}
m_Name:
m_EditorClassIdentifier:
_persistent: 1

View File

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

View File

@ -1,5 +1,76 @@
%YAML 1.1 %YAML 1.1
%TAG !u! tag:unity3d.com,2011: %TAG !u! tag:unity3d.com,2011:
--- !u!1 &437696462836866067
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4347279445921954555}
m_Layer: 5
m_Name: PopupPanel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4347279445921954555
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 437696462836866067}
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: 1
m_Children: []
m_Father: {fileID: 5760169274063006291}
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!1 &1575784571700335521
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6847447997747438717}
m_Layer: 5
m_Name: Panel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6847447997747438717
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1575784571700335521}
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: 1
m_Children:
- {fileID: 3187384646402155854}
m_Father: {fileID: 5781276071116979515}
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!1 &3727951609312695740 --- !u!1 &3727951609312695740
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -30,7 +101,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 1 m_ConstrainProportionsScale: 1
m_Children: m_Children:
- {fileID: 3187384646402155854} - {fileID: 6847447997747438717}
m_Father: {fileID: 5760169274063006291} m_Father: {fileID: 5760169274063006291}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
@ -92,7 +163,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 1 m_ConstrainProportionsScale: 1
m_Children: m_Children:
- {fileID: 4012699428012401594} - {fileID: 7887415862369799649}
m_Father: {fileID: 5760169274063006291} m_Father: {fileID: 5760169274063006291}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
@ -124,6 +195,42 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 828648aab79941544bf8ceb7b25b586c, type: 3} m_Script: {fileID: 11500000, guid: 828648aab79941544bf8ceb7b25b586c, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
--- !u!1 &6379980813304592546
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7887415862369799649}
m_Layer: 5
m_Name: Panel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7887415862369799649
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6379980813304592546}
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: 1
m_Children:
- {fileID: 4012699428012401594}
m_Father: {fileID: 2588022039611725067}
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!1 &6838253471355869082 --- !u!1 &6838253471355869082
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -157,6 +264,7 @@ RectTransform:
m_LocalScale: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 1 m_ConstrainProportionsScale: 1
m_Children: m_Children:
- {fileID: 4347279445921954555}
- {fileID: 2588022039611725067} - {fileID: 2588022039611725067}
- {fileID: 5781276071116979515} - {fileID: 5781276071116979515}
m_Father: {fileID: 0} m_Father: {fileID: 0}
@ -279,12 +387,12 @@ RectTransform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7861996272676595012} m_GameObject: {fileID: 7861996272676595012}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 1 m_ConstrainProportionsScale: 1
m_Children: [] m_Children: []
m_Father: {fileID: 5781276071116979515} m_Father: {fileID: 6847447997747438717}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
@ -359,7 +467,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 1 m_ConstrainProportionsScale: 1
m_Children: [] m_Children: []
m_Father: {fileID: 2588022039611725067} m_Father: {fileID: 7887415862369799649}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1} m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1} m_AnchorMax: {x: 0.5, y: 1}

View File

@ -16,9 +16,10 @@ MonoBehaviour:
- {fileID: 2098954470556750352, guid: 95aca5968f190f24eab9bd122ab241bc, type: 3} - {fileID: 2098954470556750352, guid: 95aca5968f190f24eab9bd122ab241bc, type: 3}
- {fileID: 4889131746858770208, guid: d90fdb17f0162334daadc6fc93e9a0e3, type: 3} - {fileID: 4889131746858770208, guid: d90fdb17f0162334daadc6fc93e9a0e3, type: 3}
- {fileID: 1192296378469776514, guid: a2de3c6e01c751e49bbd307cbfe04406, type: 3} - {fileID: 1192296378469776514, guid: a2de3c6e01c751e49bbd307cbfe04406, type: 3}
- {fileID: 1957640103239870191, guid: 0ea39e3605fda704092932acfe9e98fa, type: 3}
- {fileID: 7976048221308114627, guid: 14906596fa615704fb8fa4ac3111fc3b, type: 3} - {fileID: 7976048221308114627, guid: 14906596fa615704fb8fa4ac3111fc3b, type: 3}
- {fileID: 6471498998539637564, guid: fa2ad62c75b1549f09597e47ed5f7cfb, type: 3} - {fileID: 6471498998539637564, guid: fa2ad62c75b1549f09597e47ed5f7cfb, type: 3}
- {fileID: 7665229218737596710, guid: 71b177c2a18314c588da30429451666a, type: 3}
- {fileID: 622422277636247943, guid: d95124918e5a4a246abb0d378b14d3fa, type: 3} - {fileID: 622422277636247943, guid: d95124918e5a4a246abb0d378b14d3fa, type: 3}
- {fileID: 7665229218737596710, guid: 71b177c2a18314c588da30429451666a, type: 3}
- {fileID: 5539371897028506726, guid: 21cff8c1505cd8041a474795e35e0192, type: 3} - {fileID: 5539371897028506726, guid: 21cff8c1505cd8041a474795e35e0192, type: 3}
- {fileID: 8500549904376788358, guid: d81cf4649bf54485a8b0da7a235f3817, type: 3} - {fileID: 8500549904376788358, guid: d81cf4649bf54485a8b0da7a235f3817, type: 3}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 35d7905cfe8751640bedce0ce9a61b47
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -9,8 +9,6 @@ public static class GameEvents
public static TimeScaleChangeEvent RequestTimeScaleChangeEvent = new(); public static TimeScaleChangeEvent RequestTimeScaleChangeEvent = new();
public static FadeInEvent FadeInEvent = new(); public static FadeInEvent FadeInEvent = new();
public static FadeOutEvent FadeOutEvent = new(); public static FadeOutEvent FadeOutEvent = new();
public static OpenScreenUiEvent OpenScreenUiEvent = new();
public static CloseScreenUiEvent CloseScreenUiEvent = new();
public static OpenPopupUiEvent OpenPopupUiEvent = new(); public static OpenPopupUiEvent OpenPopupUiEvent = new();
public static ClosePopupUiEvent ClosePopupUiEvent = new(); public static ClosePopupUiEvent ClosePopupUiEvent = new();
public static ShowGlobalMessageEvent RequestShowGlobalMessageEvent = new(); public static ShowGlobalMessageEvent RequestShowGlobalMessageEvent = new();
@ -37,7 +35,7 @@ public class TimeScaleChangeEvent : IEvent
public class FadeInEvent : IEvent public class FadeInEvent : IEvent
{ {
public float Duration; public float Duration;
public TaskCompletionSource<bool> CompletionSource; public TaskCompletionSource<bool> CompletionSource = new();
public Task WaitAsync() => CompletionSource.Task; public Task WaitAsync() => CompletionSource.Task;
} }
@ -45,7 +43,7 @@ public class FadeInEvent : IEvent
public class FadeOutEvent : IEvent public class FadeOutEvent : IEvent
{ {
public float Duration; public float Duration;
public TaskCompletionSource<bool> CompletionSource; public TaskCompletionSource<bool> CompletionSource = new();
public Task WaitAsync() => CompletionSource.Task; public Task WaitAsync() => CompletionSource.Task;
} }
@ -57,16 +55,6 @@ public class ShowGlobalMessageEvent : IEvent
public float FadeDuration; public float FadeDuration;
} }
public class OpenScreenUiEvent : IEvent
{
public Type UiType;
}
public class CloseScreenUiEvent : IEvent
{
public Type UiType;
}
public class OpenPopupUiEvent : IEvent public class OpenPopupUiEvent : IEvent
{ {
public Type UiType; public Type UiType;

View File

@ -4,9 +4,15 @@ namespace DDD
{ {
public abstract class BaseUi : MonoBehaviour public abstract class BaseUi : MonoBehaviour
{ {
protected GameObject _panel;
public virtual bool IsBlockingTime => false; public virtual bool IsBlockingTime => false;
public virtual bool IsOpen => gameObject.activeSelf; public virtual bool IsOpen => gameObject.activeSelf;
protected virtual void Awake()
{
_panel = transform.Find(CommonConstants.Panel).gameObject;
}
protected virtual void Start() protected virtual void Start()
{ {
TryRegister(); TryRegister();
@ -20,7 +26,7 @@ protected virtual void OnDestroy()
protected virtual void TryRegister() { } protected virtual void TryRegister() { }
protected virtual void TryUnregister() { } protected virtual void TryUnregister() { }
public virtual void Open() => gameObject.SetActive(true); public virtual void Open() => _panel.SetActive(true);
public virtual void Close() => gameObject.SetActive(false); public virtual void Close() => _panel.SetActive(false);
} }
} }

View File

@ -6,19 +6,24 @@ namespace DDD
public class FadeUi : MonoBehaviour, IEventHandler<FadeInEvent>, IEventHandler<FadeOutEvent> public class FadeUi : MonoBehaviour, IEventHandler<FadeInEvent>, IEventHandler<FadeOutEvent>
{ {
private CanvasGroup _canvasGroup; private CanvasGroup _canvasGroup;
private GameObject _panel;
private void Awake() private void Awake()
{ {
_canvasGroup = GetComponent<CanvasGroup>(); _canvasGroup = GetComponent<CanvasGroup>();
_panel = transform.Find(CommonConstants.Panel).gameObject;
_canvasGroup.alpha = 0f; _canvasGroup.alpha = 0f;
_canvasGroup.gameObject.SetActive(false); _panel.SetActive(false);
}
private void OnEnable()
{
EventBus.Register<FadeInEvent>(this); EventBus.Register<FadeInEvent>(this);
EventBus.Register<FadeOutEvent>(this); EventBus.Register<FadeOutEvent>(this);
} }
private void OnDestroy() private void OnDisable()
{ {
EventBus.Unregister<FadeInEvent>(this); EventBus.Unregister<FadeInEvent>(this);
EventBus.Unregister<FadeOutEvent>(this); EventBus.Unregister<FadeOutEvent>(this);
@ -30,16 +35,14 @@ await _canvasGroup.DOFade(0f, evt.Duration)
.SetUpdate(true) .SetUpdate(true)
.AsyncWaitForCompletion(); .AsyncWaitForCompletion();
_canvasGroup.blocksRaycasts = false; _panel.SetActive(false);
_canvasGroup.gameObject.SetActive(false);
evt.CompletionSource.SetResult(true); evt.CompletionSource.SetResult(true);
} }
public async void Invoke(FadeOutEvent evt) public async void Invoke(FadeOutEvent evt)
{ {
_canvasGroup.gameObject.SetActive(true); _panel.SetActive(true);
_canvasGroup.blocksRaycasts = true;
await _canvasGroup.DOFade(1f, evt.Duration) await _canvasGroup.DOFade(1f, evt.Duration)
.SetUpdate(true) .SetUpdate(true)

View File

@ -14,20 +14,27 @@ public class GlobalMessageUi : BaseUi, IEventHandler<ShowGlobalMessageEvent>
private readonly Queue<ShowGlobalMessageEvent> _messageQueue = new(); private readonly Queue<ShowGlobalMessageEvent> _messageQueue = new();
private bool _isDisplayingMessage = false; private bool _isDisplayingMessage = false;
private void Awake() protected override void Awake()
{ {
base.Awake();
_canvasGroup = GetComponent<CanvasGroup>(); _canvasGroup = GetComponent<CanvasGroup>();
_messageText = GetComponentInChildren<TextMeshProUGUI>(); _messageText = GetComponentInChildren<TextMeshProUGUI>();
_canvasGroup.alpha = 0; _canvasGroup.alpha = 0;
_messageText.text = null; _messageText.text = null;
}
protected override void TryRegister()
{
base.TryRegister();
EventBus.Register(this); EventBus.Register(this);
} }
protected override void OnDestroy() protected override void TryUnregister()
{ {
base.OnDestroy(); base.TryUnregister();
EventBus.Unregister(this); EventBus.Unregister(this);
_fadeTween?.Kill(); _fadeTween?.Kill();

View File

@ -1,7 +1,78 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
namespace DDD namespace DDD
{ {
public class PopupUi : BaseUi public class PopupUi : BaseUi
{ {
protected UiInputBindingSo _uiInputBindingSo;
protected readonly List<(InputAction action, Action<InputAction.CallbackContext> handler)> _registeredHandlers = new();
protected override async void TryRegister()
{
base.TryRegister();
UiManager.Instance.RegisterPopupUI(this);
// So의 이름을 통일 : TestUi_UiInputBindingSo
string addressableKey = $"{GetType().Name}_{DataConstants.UiInputBindingSo}";
_uiInputBindingSo = await AssetManager.LoadAsset<UiInputBindingSo>(addressableKey);
Debug.Assert(_uiInputBindingSo != null, "_uiInputBindingSo != null");
foreach (var binding in _uiInputBindingSo.Bindings)
{
if (binding.InputAction == null) continue;
var action = binding.InputAction.action;
if (action == null) continue;
var handler = new Action<InputAction.CallbackContext>(ctx =>
{
if (UiManager.Instance.IsTopPopup(this))
{
OnInputPerformed(binding.ActionName, ctx);
}
});
action.Enable();
action.performed += handler;
_registeredHandlers.Add((action, handler));
}
}
protected override void TryUnregister()
{
base.TryUnregister();
UiManager.Instance.UnregisterPopupUI(this);
foreach (var (action, handler) in _registeredHandlers)
{
if (action != null)
{
action.performed -= handler;
action.Disable();
}
}
_registeredHandlers.Clear();
}
public override void Open()
{
base.Open();
transform.SetAsLastSibling();
if (UiManager.Instance.IsTopPopup(this))
{
InputManager.Instance.SwitchCurrentActionMap(_uiInputBindingSo.InputActionMaps);
}
}
protected virtual void OnInputPerformed(string actionName, InputAction.CallbackContext ctx) { }
public InputActionMaps GetInputActionMaps() => _uiInputBindingSo.InputActionMaps;
} }
} }

View File

@ -1,21 +1,20 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace DDD namespace DDD
{ {
public class UiManager : Singleton<UiManager>, IManager, IEventHandler<OpenScreenUiEvent>, IEventHandler<CloseScreenUiEvent>, public class UiManager : Singleton<UiManager>, IManager, IEventHandler<OpenPopupUiEvent>, IEventHandler<ClosePopupUiEvent>
IEventHandler<OpenPopupUiEvent>, IEventHandler<ClosePopupUiEvent>
{ {
private readonly Dictionary<Type, ScreenUi> _screenUIs = new();
private readonly Dictionary<Type, PopupUi> _popupUIs = new(); private readonly Dictionary<Type, PopupUi> _popupUIs = new();
private readonly Stack<PopupUi> _popupStack = new();
private InputActionMaps _previousActionMap = InputActionMaps.None;
private readonly object _uiPauseRequester = new(); private readonly object _uiPauseRequester = new();
public void PreInit() public void PreInit()
{ {
EventBus.Register<OpenScreenUiEvent>(this);
EventBus.Register<CloseScreenUiEvent>(this);
EventBus.Register<OpenPopupUiEvent>(this); EventBus.Register<OpenPopupUiEvent>(this);
EventBus.Register<ClosePopupUiEvent>(this); EventBus.Register<ClosePopupUiEvent>(this);
} }
@ -32,27 +31,10 @@ public void PostInit()
private void OnDestroy() private void OnDestroy()
{ {
EventBus.Unregister<OpenScreenUiEvent>(this);
EventBus.Unregister<CloseScreenUiEvent>(this);
EventBus.Unregister<OpenPopupUiEvent>(this); EventBus.Unregister<OpenPopupUiEvent>(this);
EventBus.Unregister<ClosePopupUiEvent>(this); EventBus.Unregister<ClosePopupUiEvent>(this);
} }
public void RegisterScreenUI(ScreenUi ui)
{
var type = ui.GetType();
_screenUIs.TryAdd(type, ui);
}
public void UnregisterScreenUI(ScreenUi ui)
{
var type = ui.GetType();
if (_screenUIs.TryGetValue(type, out var value) && value == ui)
{
_screenUIs.Remove(type);
}
}
public void RegisterPopupUI(PopupUi ui) public void RegisterPopupUI(PopupUi ui)
{ {
var type = ui.GetType(); var type = ui.GetType();
@ -68,63 +50,14 @@ public void UnregisterPopupUI(PopupUi ui)
} }
} }
private void CloseAllScreenUIs()
{
foreach (var screen in _screenUIs.Values)
{
if (screen.IsOpen)
{
screen.Close();
if (screen.IsBlockingTime)
{
var timeScaleChangeEvent = GameEvents.RequestTimeScaleChangeEvent;
timeScaleChangeEvent.Requester = _uiPauseRequester;
timeScaleChangeEvent.NewTimeScale = 1f;
EventBus.Broadcast(timeScaleChangeEvent);
}
}
}
}
public void Invoke(OpenScreenUiEvent evt)
{
if (_screenUIs.TryGetValue(evt.UiType, out var screen))
{
CloseAllScreenUIs();
screen.Open();
if (screen.IsBlockingTime)
{
var timeScaleChangeEvent = GameEvents.RequestTimeScaleChangeEvent;
timeScaleChangeEvent.Requester = screen;
timeScaleChangeEvent.NewTimeScale = 0f;
EventBus.Broadcast(timeScaleChangeEvent);
}
}
}
public void Invoke(CloseScreenUiEvent evt)
{
if (_screenUIs.TryGetValue(evt.UiType, out var screen))
{
screen.Close();
if (screen.IsBlockingTime)
{
var timeScaleChangeEvent = GameEvents.RequestTimeScaleChangeEvent;
timeScaleChangeEvent.Requester = screen;
timeScaleChangeEvent.NewTimeScale = 1f;
EventBus.Broadcast(timeScaleChangeEvent);
}
}
}
public void Invoke(OpenPopupUiEvent evt) public void Invoke(OpenPopupUiEvent evt)
{ {
if (_popupUIs.TryGetValue(evt.UiType, out var popup)) if (_popupUIs.TryGetValue(evt.UiType, out var popup))
{
if (!popup.IsOpen)
{ {
popup.Open(); popup.Open();
PushPopup(popup);
if (popup.IsBlockingTime) if (popup.IsBlockingTime)
{ {
@ -135,12 +68,16 @@ public void Invoke(OpenPopupUiEvent evt)
} }
} }
} }
}
public void Invoke(ClosePopupUiEvent evt) public void Invoke(ClosePopupUiEvent evt)
{ {
if (_screenUIs.TryGetValue(evt.UiType, out var popup)) if (_popupUIs.TryGetValue(evt.UiType, out var popup))
{
if (popup.IsOpen)
{ {
popup.Close(); popup.Close();
PopPopup(popup);
if (popup.IsBlockingTime) if (popup.IsBlockingTime)
{ {
@ -152,4 +89,50 @@ public void Invoke(ClosePopupUiEvent evt)
} }
} }
} }
public bool IsTopPopup(PopupUi popup)
{
return _popupStack.Count > 0 && _popupStack.Peek() == popup;
}
public void PushPopup(PopupUi popup)
{
if (_popupStack.Contains(popup)) return;
if (_popupStack.Count == 0)
{
_previousActionMap = InputManager.Instance.GetCurrentActionMap();
}
_popupStack.Push(popup);
}
public void PopPopup(PopupUi popup)
{
if (_popupStack.Count == 0) return;
if (_popupStack.Peek() == popup)
{
_popupStack.Pop();
}
else
{
var temp = _popupStack.Reverse().Where(p => p != popup).Reverse().ToList();
_popupStack.Clear();
foreach (var p in temp)
{
_popupStack.Push(p);
}
}
if (_popupStack.TryPeek(out var topPopup) && topPopup.IsOpen)
{
InputManager.Instance.SwitchCurrentActionMap(topPopup.GetInputActionMaps());
}
else
{
InputManager.Instance.SwitchCurrentActionMap(_previousActionMap);
}
}
}
} }

View File

@ -1,50 +1,44 @@
using System; using System;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using UnityEngine.InputSystem; using UnityEngine.InputSystem;
namespace DDD namespace DDD
{ {
public static class InputActionMapExtensions
{
public static string ToName(this InputActionMaps map)
{
return map.ToString();
}
}
public enum InputActionMaps public enum InputActionMaps
{ {
None = 0, None = 0,
Ui = 1, Ui = 1,
Restaurant = 2, Restaurant = 2,
RestaurantUi = 3
} }
[Flags] public class InputManager : Singleton<InputManager>, IManager
public enum RestaurantActions
{
None = 0,
Move = 1<<0,
Dash = 1<<1,
Interact = 1<<2
}
public class InputManager : Singleton<InputManager>
{ {
private PlayerInput _currentPlayerInput; private PlayerInput _currentPlayerInput;
protected override void OnAwake() public void PreInit()
{ {
base.OnAwake();
_currentPlayerInput = GetComponent<PlayerInput>(); _currentPlayerInput = GetComponent<PlayerInput>();
} }
// public void ChangeScene(SceneType sceneType) public Task Init()
// { {
// switch (sceneType) return Task.CompletedTask;
// { }
// case SceneType.Title:
// SwitchCurrentActionMap(InputActionMaps.Ui); public void PostInit()
// break; {
// case SceneType.Restaurant:
// SwitchCurrentActionMap(InputActionMaps.Restaurant); }
// break;
// default:
// throw new System.Exception("Invalid scene name");
// }
// }
private bool IsNullCurrentPlayerInput() private bool IsNullCurrentPlayerInput()
{ {
@ -54,193 +48,25 @@ private bool IsNullCurrentPlayerInput()
return true; return true;
} }
public InputAction GetAction(InputActionMaps actionMapName, string actionName)
{
if (IsNullCurrentPlayerInput()) return null;
var actionMap = _currentPlayerInput.actions.FindActionMap(actionMapName.ToString(), true);
if (actionMap == null)
{
Debug.LogError($"Action Map '{actionMapName}' not found!");
return null;
}
var action = actionMap.FindAction(actionName, true);
if (action == null)
{
Debug.LogError($"Action '{actionName}' not found in Action Map '{actionMapName}'!");
}
return action;
}
public string GetBoundKey(InputActionMaps actionMapName, string actionName)
{
if (IsNullCurrentPlayerInput()) return null;
var actionMap = _currentPlayerInput.actions.FindActionMap(actionMapName.ToString(), true);
if (actionMap == null)
{
Debug.LogError($"Action Map '{actionMapName}' not found!");
return null;
}
var action = actionMap.FindAction(actionName, true);
if (action == null)
{
Debug.LogError($"Action '{actionName}' not found in Action Map '{actionMapName}'!");
return null;
}
// 첫 번째 바인딩에서 키 이름 가져오기
foreach (var binding in action.bindings)
{
if (!string.IsNullOrEmpty(binding.path))
{
// 키 이름만 추출
var key = InputControlPath.ToHumanReadableString(binding.path,
InputControlPath.HumanReadableStringOptions.OmitDevice);
return key;
}
}
Debug.LogWarning($"No bindings found for action '{actionName}' in Action Map '{actionMapName}'.");
return null;
}
public string GetBoundKey(InputAction inputAction)
{
if (IsNullCurrentPlayerInput()) return null;
if (inputAction == null)
{
Debug.LogError($"Action not found'!");
return null;
}
// 첫 번째 바인딩에서 키 이름 가져오기
foreach (var binding in inputAction.bindings)
{
if (!string.IsNullOrEmpty(binding.path))
{
// 키 이름만 추출
var key = InputControlPath.ToHumanReadableString(binding.path,
InputControlPath.HumanReadableStringOptions.OmitDevice);
return key;
}
}
Debug.LogWarning($"No bindings found for action '{inputAction}'");
return null;
}
public bool IsCurrentActionMap(InputActionMaps inputActionMaps)
{
if (IsNullCurrentPlayerInput()) return false;
return _currentPlayerInput.currentActionMap.ToString() == inputActionMaps.ToString();
}
public void SwitchCurrentActionMap(string inputActionMaps)
{
if (IsNullCurrentPlayerInput()) return;
_currentPlayerInput.SwitchCurrentActionMap(inputActionMaps);
}
public void SwitchCurrentActionMap(InputActionMaps inputActionMaps) public void SwitchCurrentActionMap(InputActionMaps inputActionMaps)
{ {
if (IsNullCurrentPlayerInput()) return; if (IsNullCurrentPlayerInput() || inputActionMaps == InputActionMaps.None) return;
_currentPlayerInput.SwitchCurrentActionMap(inputActionMaps.ToString()); _currentPlayerInput.SwitchCurrentActionMap(inputActionMaps.ToName());
} }
public InputActionMap GetCurrentInputActionMap() public InputActionMaps GetCurrentActionMap()
{ {
if (IsNullCurrentPlayerInput()) return null; if (IsNullCurrentPlayerInput()) return InputActionMaps.None;
return _currentPlayerInput.currentActionMap; string mapName = _currentPlayerInput.currentActionMap.name;
} if (Enum.TryParse(mapName, out InputActionMaps parsedMap))
public void EnableCurrentPlayerInput()
{ {
if (!_currentPlayerInput) return; return parsedMap;
_currentPlayerInput.enabled = true;
} }
public void DisableCurrentPlayerInput() Debug.LogError($"[InputManager] 알 수 없는 ActionMap 이름: {mapName}");
{ return InputActionMaps.None;
if (IsNullCurrentPlayerInput()) return;
_currentPlayerInput.enabled = false;
}
public void DisableAllActionMaps()
{
if (IsNullCurrentPlayerInput()) return;
foreach (var element in _currentPlayerInput.actions.actionMaps)
{
element.Disable();
}
}
public void DisableAllActionsExcept(string exceptActionName)
{
if (IsNullCurrentPlayerInput()) return;
var exceptAction = _currentPlayerInput.currentActionMap.FindAction(exceptActionName);
foreach (var action in _currentPlayerInput.currentActionMap.actions)
{
if (action != exceptAction)
{
action.Disable();
}
else
{
action.Enable();
}
}
}
public void EnableAllActionsMaps()
{
if (IsNullCurrentPlayerInput()) return;
foreach (var action in _currentPlayerInput.actions)
{
action.Enable();
}
}
public void EnableAction(string actionName)
{
if (IsNullCurrentPlayerInput()) return;
var action = _currentPlayerInput.currentActionMap.FindAction(actionName);
if (action == null)
{
Debug.Log($"현재 Action Map인 {_currentPlayerInput.currentActionMap}에는 {actionName} Action이 존재하지 않습니다");
return;
}
action.Enable();
}
public void DisableAction(string actionName)
{
if (IsNullCurrentPlayerInput()) return;
var action = _currentPlayerInput.currentActionMap.FindAction(actionName);
if (action == null)
{
Debug.Log($"현재 Action Map인 {_currentPlayerInput.currentActionMap}에는 {actionName} Action이 존재하지 않습니다");
return;
}
action.Disable();
} }
} }
} }

View File

@ -0,0 +1,12 @@
using System;
using UnityEngine.InputSystem;
namespace DDD
{
[Serializable]
public class UiActionBinding
{
public string ActionName;
public InputActionReference InputAction;
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5ed1d4ce777f104419818be4e5c47e74

View File

@ -0,0 +1,12 @@
using System.Collections.Generic;
using UnityEngine;
namespace DDD
{
[CreateAssetMenu(fileName = "UiInputBindingSo", menuName = "Ui/UiInputBindingSo")]
public class UiInputBindingSo : ScriptableObject
{
public InputActionMaps InputActionMaps;
public List<UiActionBinding> Bindings = new();
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 56f8bbd3b49d1db4eacb33e52abb54be

View File

@ -70,6 +70,7 @@ public async Task OnReadyNewFlow(GameFlowState newFlowState)
var playerHandle = createRestaurantPlayerSoJob.OnReadyNewFlow(newFlowState); var playerHandle = createRestaurantPlayerSoJob.OnReadyNewFlow(newFlowState);
var propHandle = createEnvironmentSoJob.OnReadyNewFlow(newFlowState); var propHandle = createEnvironmentSoJob.OnReadyNewFlow(newFlowState);
// Combine handles and return it // Combine handles and return it
InputManager.Instance.SwitchCurrentActionMap(InputActionMaps.Restaurant);
await Task.WhenAll(playerHandle, propHandle); await Task.WhenAll(playerHandle, propHandle);
} }
} }

View File

@ -6,6 +6,7 @@ public static class CommonConstants
public const string RestaurantPlayer = "RestaurantPlayer"; public const string RestaurantPlayer = "RestaurantPlayer";
public const string BaseRestaurantEnvironment = "BaseRestaurantEnvironment"; public const string BaseRestaurantEnvironment = "BaseRestaurantEnvironment";
public const string Clone = "(Clone)"; public const string Clone = "(Clone)";
public const string Panel = "Panel";
} }
public static class DataConstants public static class DataConstants
@ -14,6 +15,7 @@ public static class DataConstants
public const string FoodDataSo = "FoodDataSo"; public const string FoodDataSo = "FoodDataSo";
public const string EnvironmentDataSo = "EnvironmentDataSo"; public const string EnvironmentDataSo = "EnvironmentDataSo";
public const string RestaurantPlayerDataSo = "RestaurantPlayerDataSo"; public const string RestaurantPlayerDataSo = "RestaurantPlayerDataSo";
public const string UiInputBindingSo = "UiInputBindingSo";
public const string AtlasLabel = "Atlas"; public const string AtlasLabel = "Atlas";
public const string BasePropSpriteMaterial = "BasePropSpriteMaterial"; public const string BasePropSpriteMaterial = "BasePropSpriteMaterial";