Fix hold point, radial menu UI need to be fixed
This commit is contained in:
@@ -9,6 +9,7 @@ GameObject:
|
|||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 3340653082405403250}
|
- component: {fileID: 3340653082405403250}
|
||||||
|
- component: {fileID: 2527699429244340186}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: HoldPoint
|
m_Name: HoldPoint
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@@ -31,6 +32,18 @@ Transform:
|
|||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 4028978448423354571}
|
m_Father: {fileID: 4028978448423354571}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &2527699429244340186
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3340653082405403251}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 99527458161e16442b3fb76c8f585ec8, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1001 &3340653081230671619
|
--- !u!1001 &3340653081230671619
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -951,6 +964,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: cf9ddd6d77ff9a7479edaeb2c8ae1078, type: 3}
|
m_Script: {fileID: 11500000, guid: cf9ddd6d77ff9a7479edaeb2c8ae1078, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
Sex: 0
|
||||||
--- !u!4 &4028978448423354571 stripped
|
--- !u!4 &4028978448423354571 stripped
|
||||||
Transform:
|
Transform:
|
||||||
m_CorrespondingSourceObject: {fileID: 1852576806548013000, guid: 32790d47acc86814982f18993097a759,
|
m_CorrespondingSourceObject: {fileID: 1852576806548013000, guid: 32790d47acc86814982f18993097a759,
|
||||||
|
|||||||
@@ -10,8 +10,13 @@ public class RadialMenuItem : MonoBehaviour
|
|||||||
[SerializeField]
|
[SerializeField]
|
||||||
private Button _radialMenuItemPrefab;
|
private Button _radialMenuItemPrefab;
|
||||||
private Dictionary<RadialMenuActions, RadialMenuActionDescription> _actions;
|
private Dictionary<RadialMenuActions, RadialMenuActionDescription> _actions;
|
||||||
UniTaskCompletionSource<RadialMenuActions> tcs = new UniTaskCompletionSource<RadialMenuActions>();
|
private UniTaskCompletionSource<RadialMenuActions> tcs = new UniTaskCompletionSource<RadialMenuActions>();
|
||||||
|
private float _buttonWidth;
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
_buttonWidth = _radialMenuItemPrefab.GetComponent<RectTransform>().rect.width;
|
||||||
|
}
|
||||||
|
|
||||||
public UniTask<RadialMenuActions> ShowButtons(Dictionary<RadialMenuActions, RadialMenuActionDescription> actions)
|
public UniTask<RadialMenuActions> ShowButtons(Dictionary<RadialMenuActions, RadialMenuActionDescription> actions)
|
||||||
{
|
{
|
||||||
@@ -25,14 +30,15 @@ public class RadialMenuItem : MonoBehaviour
|
|||||||
float posX = Mathf.Sin(theta);
|
float posX = Mathf.Sin(theta);
|
||||||
float posY = Mathf.Cos(theta);
|
float posY = Mathf.Cos(theta);
|
||||||
|
|
||||||
button.transform.localPosition = new Vector3(posX, posY, 0) * 100f;
|
button.transform.localPosition = new Vector3(posX, posY, 0) * 150f;
|
||||||
|
|
||||||
var textMeshPro = button.GetComponentInChildren<TextMeshProUGUI>();
|
var textMeshPro = button.GetComponentInChildren<TextMeshProUGUI>();
|
||||||
if (textMeshPro != null)
|
if (textMeshPro != null)
|
||||||
{
|
{
|
||||||
textMeshPro.text = actions.ElementAt(buttonsCount).Value.Description;
|
textMeshPro.text = actions.ElementAt(buttonsCount).Value.Description;
|
||||||
}
|
}
|
||||||
AddEvent(button, buttonsCount);
|
AddEvent(button, buttonsCount);
|
||||||
|
|
||||||
}
|
}
|
||||||
return tcs.Task;
|
return tcs.Task;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user