fix UI and destroy radial menu

This commit is contained in:
2023-11-17 15:12:15 +02:00
parent cb2eba5731
commit 725081c2cd
3 changed files with 120 additions and 47 deletions
+112 -44
View File
@@ -126,7 +126,7 @@ PrefabInstance:
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_TransformParent: {fileID: 1722008531}
m_Modifications:
- target: {fileID: 285991863475209957, guid: 6f2eba3ec0db6614da69d5ac2ea53168,
type: 3}
@@ -136,17 +136,17 @@ PrefabInstance:
- target: {fileID: 285991863475209978, guid: 6f2eba3ec0db6614da69d5ac2ea53168,
type: 3}
propertyPath: m_LocalPosition.x
value: 0.8634455
value: 159.83063
objectReference: {fileID: 0}
- target: {fileID: 285991863475209978, guid: 6f2eba3ec0db6614da69d5ac2ea53168,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
value: 415.47473
objectReference: {fileID: 0}
- target: {fileID: 285991863475209978, guid: 6f2eba3ec0db6614da69d5ac2ea53168,
type: 3}
propertyPath: m_LocalPosition.z
value: 7.7236156
value: -385.94473
objectReference: {fileID: 0}
- target: {fileID: 285991863475209978, guid: 6f2eba3ec0db6614da69d5ac2ea53168,
type: 3}
@@ -156,7 +156,7 @@ PrefabInstance:
- target: {fileID: 285991863475209978, guid: 6f2eba3ec0db6614da69d5ac2ea53168,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 285991863475209978, guid: 6f2eba3ec0db6614da69d5ac2ea53168,
type: 3}
@@ -166,7 +166,7 @@ PrefabInstance:
- target: {fileID: 285991863475209978, guid: 6f2eba3ec0db6614da69d5ac2ea53168,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 285991863475209978, guid: 6f2eba3ec0db6614da69d5ac2ea53168,
type: 3}
@@ -312,22 +312,22 @@ PrefabInstance:
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_TransformParent: {fileID: 1722008531}
m_Modifications:
- target: {fileID: 168138393772344589, guid: 910e671451e1bf94e9bba00c3809c94a,
type: 3}
propertyPath: m_LocalPosition.x
value: 3.35
value: 162.31718
objectReference: {fileID: 0}
- target: {fileID: 168138393772344589, guid: 910e671451e1bf94e9bba00c3809c94a,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
value: 415.47473
objectReference: {fileID: 0}
- target: {fileID: 168138393772344589, guid: 910e671451e1bf94e9bba00c3809c94a,
type: 3}
propertyPath: m_LocalPosition.z
value: 7.24
value: -386.42834
objectReference: {fileID: 0}
- target: {fileID: 168138393772344589, guid: 910e671451e1bf94e9bba00c3809c94a,
type: 3}
@@ -337,7 +337,7 @@ PrefabInstance:
- target: {fileID: 168138393772344589, guid: 910e671451e1bf94e9bba00c3809c94a,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 168138393772344589, guid: 910e671451e1bf94e9bba00c3809c94a,
type: 3}
@@ -347,7 +347,7 @@ PrefabInstance:
- target: {fileID: 168138393772344589, guid: 910e671451e1bf94e9bba00c3809c94a,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 168138393772344589, guid: 910e671451e1bf94e9bba00c3809c94a,
type: 3}
@@ -406,22 +406,22 @@ PrefabInstance:
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_TransformParent: {fileID: 1722008531}
m_Modifications:
- target: {fileID: 601545095124417014, guid: 0fafbaeeaa5eb474f92520556cd36c7a,
type: 3}
propertyPath: m_LocalPosition.x
value: 4.1167035
value: 163.08388
objectReference: {fileID: 0}
- target: {fileID: 601545095124417014, guid: 0fafbaeeaa5eb474f92520556cd36c7a,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
value: 415.47473
objectReference: {fileID: 0}
- target: {fileID: 601545095124417014, guid: 0fafbaeeaa5eb474f92520556cd36c7a,
type: 3}
propertyPath: m_LocalPosition.z
value: 0.64517367
value: -393.02316
objectReference: {fileID: 0}
- target: {fileID: 601545095124417014, guid: 0fafbaeeaa5eb474f92520556cd36c7a,
type: 3}
@@ -718,6 +718,12 @@ GameObject:
type: 3}
m_PrefabInstance: {fileID: 1771395765}
m_PrefabAsset: {fileID: 0}
--- !u!4 &1077787213 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 168138393772344589, guid: 910e671451e1bf94e9bba00c3809c94a,
type: 3}
m_PrefabInstance: {fileID: 346725577}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1199904943
GameObject:
m_ObjectHideFlags: 0
@@ -799,7 +805,7 @@ PrefabInstance:
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_TransformParent: {fileID: 1722008531}
m_Modifications:
- target: {fileID: 6690402950241401348, guid: 0a46dd346180abf4084703e1511257a6,
type: 3}
@@ -809,17 +815,17 @@ PrefabInstance:
- target: {fileID: 8971066017072020675, guid: 0a46dd346180abf4084703e1511257a6,
type: 3}
propertyPath: m_LocalPosition.x
value: 4.0737844
value: 163.04097
objectReference: {fileID: 0}
- target: {fileID: 8971066017072020675, guid: 0a46dd346180abf4084703e1511257a6,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
value: 415.47473
objectReference: {fileID: 0}
- target: {fileID: 8971066017072020675, guid: 0a46dd346180abf4084703e1511257a6,
type: 3}
propertyPath: m_LocalPosition.z
value: 2.9972954
value: -390.67105
objectReference: {fileID: 0}
- target: {fileID: 8971066017072020675, guid: 0a46dd346180abf4084703e1511257a6,
type: 3}
@@ -829,17 +835,17 @@ PrefabInstance:
- target: {fileID: 8971066017072020675, guid: 0a46dd346180abf4084703e1511257a6,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8971066017072020675, guid: 0a46dd346180abf4084703e1511257a6,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8971066017072020675, guid: 0a46dd346180abf4084703e1511257a6,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 8971066017072020675, guid: 0a46dd346180abf4084703e1511257a6,
type: 3}
@@ -1098,6 +1104,43 @@ LightingSettings:
m_PVRFilteringAtrousPositionSigmaAO: 1
m_PVRTiledBaking: 0
m_RespectSceneVisibilityWhenBakingGI: 0
--- !u!1 &1722008530
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1722008531}
m_Layer: 0
m_Name: Interior
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1722008531
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1722008530}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -158.96718, y: -415.47473, z: 393.66833}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 7908616180843390433}
- {fileID: 1077787213}
- {fileID: 7908616181451444439}
- {fileID: 2013394553}
- {fileID: 1930557329}
- {fileID: 1825927640}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1771395765
PrefabInstance:
m_ObjectHideFlags: 0
@@ -1370,6 +1413,12 @@ NavMeshObstacle:
m_CarveOnlyStationary: 1
m_Center: {x: 0, y: 0, z: 0}
m_TimeToStationary: 0.5
--- !u!4 &1825927640 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 285991863475209978, guid: 6f2eba3ec0db6614da69d5ac2ea53168,
type: 3}
m_PrefabInstance: {fileID: 189367642}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1856998489
GameObject:
m_ObjectHideFlags: 0
@@ -1488,6 +1537,18 @@ MonoBehaviour:
m_LightCookieSize: {x: 1, y: 1}
m_LightCookieOffset: {x: 0, y: 0}
m_SoftShadowQuality: 0
--- !u!4 &1930557329 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 601545095124417014, guid: 0fafbaeeaa5eb474f92520556cd36c7a,
type: 3}
m_PrefabInstance: {fileID: 588586067}
m_PrefabAsset: {fileID: 0}
--- !u!4 &2013394553 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 8971066017072020675, guid: 0a46dd346180abf4084703e1511257a6,
type: 3}
m_PrefabInstance: {fileID: 1201212359}
m_PrefabAsset: {fileID: 0}
--- !u!114 &2044617393 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 8275706893144774487, guid: 521b72dd4ff91804b9184f046b548ddd,
@@ -7662,22 +7723,22 @@ PrefabInstance:
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_TransformParent: {fileID: 1722008531}
m_Modifications:
- target: {fileID: 5091233431665616032, guid: 9b71b0a8f71c7b04fb23f0c7662a5800,
type: 3}
propertyPath: m_LocalPosition.x
value: -3.32
value: 155.64717
objectReference: {fileID: 0}
- target: {fileID: 5091233431665616032, guid: 9b71b0a8f71c7b04fb23f0c7662a5800,
type: 3}
propertyPath: m_LocalPosition.y
value: 0.064
value: 415.53873
objectReference: {fileID: 0}
- target: {fileID: 5091233431665616032, guid: 9b71b0a8f71c7b04fb23f0c7662a5800,
type: 3}
propertyPath: m_LocalPosition.z
value: 1.75
value: -391.91833
objectReference: {fileID: 0}
- target: {fileID: 5091233431665616032, guid: 9b71b0a8f71c7b04fb23f0c7662a5800,
type: 3}
@@ -8030,9 +8091,9 @@ RectTransform:
- {fileID: 3663624859197747832}
m_Father: {fileID: 1092362465489143445}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 250, y: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 500, y: 30}
m_Pivot: {x: 0.5, y: 1}
--- !u!224 &5783904402449894470
@@ -8233,7 +8294,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!222 &6751831604721988051
CanvasRenderer:
m_ObjectHideFlags: 0
@@ -8409,9 +8470,9 @@ RectTransform:
m_Children: []
m_Father: {fileID: 1092362465489143445}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 250, y: -90}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 480, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &7483120163415344176
@@ -8534,6 +8595,18 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7908616180843390433 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 5091233431665616032, guid: 9b71b0a8f71c7b04fb23f0c7662a5800,
type: 3}
m_PrefabInstance: {fileID: 4628903844709325354}
m_PrefabAsset: {fileID: 0}
--- !u!4 &7908616181451444439 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 662032107352504808, guid: 7df4c91b7961f794da5a651e64cc8ac5,
type: 3}
m_PrefabInstance: {fileID: 8147919103805929846}
m_PrefabAsset: {fileID: 0}
--- !u!224 &7912047616648067868
RectTransform:
m_ObjectHideFlags: 0
@@ -8616,22 +8689,22 @@ PrefabInstance:
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_TransformParent: {fileID: 1722008531}
m_Modifications:
- target: {fileID: 662032107352504808, guid: 7df4c91b7961f794da5a651e64cc8ac5,
type: 3}
propertyPath: m_LocalPosition.x
value: -2.45
value: 156.51718
objectReference: {fileID: 0}
- target: {fileID: 662032107352504808, guid: 7df4c91b7961f794da5a651e64cc8ac5,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
value: 415.47473
objectReference: {fileID: 0}
- target: {fileID: 662032107352504808, guid: 7df4c91b7961f794da5a651e64cc8ac5,
type: 3}
propertyPath: m_LocalPosition.z
value: 6.97
value: -386.69833
objectReference: {fileID: 0}
- target: {fileID: 662032107352504808, guid: 7df4c91b7961f794da5a651e64cc8ac5,
type: 3}
@@ -9093,9 +9166,4 @@ SceneRoots:
- {fileID: 343793322}
- {fileID: 2106647848}
- {fileID: 4029620109630900202}
- {fileID: 4628903844709325354}
- {fileID: 346725577}
- {fileID: 8147919103805929846}
- {fileID: 1201212359}
- {fileID: 588586067}
- {fileID: 189367642}
- {fileID: 1722008531}
+7 -2
View File
@@ -11,9 +11,11 @@ public class RadialMenuItem : MonoBehaviour
private Button _radialMenuItemPrefab;
private Action<RadialMenuActions> _menuButtonClick=null;
private Dictionary<RadialMenuActions, RadialMenuActionDescription> _actions;
private RadialMenuItem _popupMenu;
public void ShowButtons(Dictionary<RadialMenuActions, RadialMenuActionDescription> actions, Action<RadialMenuActions> menuButtonClick)
public void ShowButtons(RadialMenuItem popupMenu, Dictionary<RadialMenuActions, RadialMenuActionDescription> actions, Action<RadialMenuActions> menuButtonClick)
{
_popupMenu = popupMenu;
_actions = actions;
_menuButtonClick = menuButtonClick;
for (int buttonsCount = 0; buttonsCount < actions.Count; buttonsCount++)
@@ -40,20 +42,23 @@ public class RadialMenuItem : MonoBehaviour
{
b.onClick.AddListener(() =>
{
CloseDialog();
Hide();
_menuButtonClick?.Invoke(_actions.ElementAt(buttonNumber).Key);
CloseDialog();
});
}
private void CloseDialog()
{
UIManager.Instance.Unfreeze();
Destroy(_popupMenu);
Destroy(this);
}
private void Hide()
{
gameObject.SetActive(false);
Destroy(gameObject);
}
}
+1 -1
View File
@@ -46,7 +46,7 @@ public class UIManager : MonoBehaviour
var popupMenu = Instantiate(_radialMenuItemPrefab);
popupMenu.transform.transform.SetParent(transform, false);
popupMenu.transform.position = Input.mousePosition;
popupMenu.ShowButtons(actions,itemsMenuCallback);
popupMenu.ShowButtons(popupMenu, actions,itemsMenuCallback);
}
public void Freeze()