Files
Ultimate-Fishing-Simulator-…/Assets/Scripts/Assembly-CSharp/UI_SettingSelector.cs
2026-03-04 09:37:33 +08:00

79 lines
1.6 KiB
C#

using Obvious.Soap;
using UnityEngine;
public class UI_SettingSelector : MonoBehaviour
{
[SerializeField]
private BoolVariable isLureDepthSettingEnabled;
[SerializeField]
private IntVariable settingSelected;
[SerializeField]
private float dragYPos;
[SerializeField]
private float reelYPos;
[SerializeField]
private float depthPos;
[SerializeField]
private float dragXPos;
[SerializeField]
private float reelXPos;
[SerializeField]
private float depthXPos;
private void OnEnable()
{
SettingSelected_X_Pos_OnValueChanged(settingSelected.Value);
settingSelected.OnValueChanged += SettingSelected_X_Pos_OnValueChanged;
}
private void OnDisable()
{
settingSelected.OnValueChanged -= SettingSelected_X_Pos_OnValueChanged;
}
private void SettingSelected_Y_Pos_OnValueChanged(int obj)
{
RectTransform component = GetComponent<RectTransform>();
Vector2 anchoredPosition = component.anchoredPosition;
switch (obj)
{
case 0:
anchoredPosition.y = dragYPos;
break;
case 1:
anchoredPosition.y = reelYPos;
break;
case 2:
anchoredPosition.y = depthPos;
break;
}
component.anchoredPosition = anchoredPosition;
}
private void SettingSelected_X_Pos_OnValueChanged(int obj)
{
RectTransform component = GetComponent<RectTransform>();
Vector2 anchoredPosition = component.anchoredPosition;
switch (obj)
{
case 0:
anchoredPosition.x = dragXPos;
break;
case 1:
anchoredPosition.x = reelXPos;
break;
case 2:
anchoredPosition.x = depthXPos;
break;
}
component.anchoredPosition = anchoredPosition;
}
}