102 lines
3.1 KiB
C#
102 lines
3.1 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class VRStylesDropdown : MonoBehaviour
|
|
{
|
|
public enum StyleType
|
|
{
|
|
UI_INPUT = 0,
|
|
WALK = 1,
|
|
ROTATE = 2,
|
|
TELEPORT = 3,
|
|
HUD_ROTATE = 4
|
|
}
|
|
|
|
private Dropdown dropdown;
|
|
|
|
public StyleType styleType;
|
|
|
|
private void Start()
|
|
{
|
|
InitList();
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
InitList();
|
|
}
|
|
|
|
private void InitList()
|
|
{
|
|
if ((bool)VRManager.Instance)
|
|
{
|
|
dropdown = base.gameObject.GetComponent<Dropdown>();
|
|
dropdown.options.Clear();
|
|
dropdown.options.Capacity = 0;
|
|
if (styleType == StyleType.UI_INPUT)
|
|
{
|
|
dropdown.options.Add(new Dropdown.OptionData(Utilities.GetTranslation("VR_OPTIONS/GAZE")));
|
|
dropdown.options.Add(new Dropdown.OptionData(Utilities.GetTranslation("VR_OPTIONS/POINTER")));
|
|
dropdown.value = (int)VRManager.Instance.uIInputStyle;
|
|
}
|
|
else if (styleType == StyleType.WALK)
|
|
{
|
|
dropdown.options.Add(new Dropdown.OptionData(Utilities.GetTranslation("VR_OPTIONS/FREE")));
|
|
dropdown.options.Add(new Dropdown.OptionData(Utilities.GetTranslation("VR_OPTIONS/GAZE_TELEPORT")));
|
|
dropdown.options.Add(new Dropdown.OptionData(Utilities.GetTranslation("VR_OPTIONS/POINTER_TELEPORT")));
|
|
dropdown.value = (int)VRManager.Instance.playerWalkStyle;
|
|
}
|
|
else if (styleType == StyleType.ROTATE)
|
|
{
|
|
dropdown.options.Add(new Dropdown.OptionData(Utilities.GetTranslation("VR_OPTIONS/FREE")));
|
|
dropdown.options.Add(new Dropdown.OptionData(Utilities.GetTranslation("VR_OPTIONS/STEP")));
|
|
dropdown.options.Add(new Dropdown.OptionData(Utilities.GetTranslation("VR_OPTIONS/FADE_STEP")));
|
|
dropdown.value = (int)VRManager.Instance.playerRotateStyle;
|
|
}
|
|
else if (styleType == StyleType.TELEPORT)
|
|
{
|
|
dropdown.options.Add(new Dropdown.OptionData(Utilities.GetTranslation("VR_OPTIONS/INSTANT")));
|
|
dropdown.options.Add(new Dropdown.OptionData(Utilities.GetTranslation("VR_OPTIONS/FADE")));
|
|
dropdown.value = (int)VRManager.Instance.teleportStyle;
|
|
}
|
|
else if (styleType == StyleType.HUD_ROTATE)
|
|
{
|
|
dropdown.options.Add(new Dropdown.OptionData(Utilities.GetTranslation("GUI/NONE")));
|
|
dropdown.options.Add(new Dropdown.OptionData(Utilities.GetTranslation("VR_OPTIONS/FREE")));
|
|
dropdown.options.Add(new Dropdown.OptionData(Utilities.GetTranslation("VR_OPTIONS/STEP")));
|
|
dropdown.value = (int)VRManager.Instance.hudRotateStyle;
|
|
}
|
|
dropdown.RefreshShownValue();
|
|
}
|
|
}
|
|
|
|
public void UpdateSetting()
|
|
{
|
|
if (styleType == StyleType.UI_INPUT)
|
|
{
|
|
VRManager.Instance.ChangeUIInputStyle((VRManager.UIInputStyle)dropdown.value);
|
|
}
|
|
else if (styleType == StyleType.WALK)
|
|
{
|
|
VRManager.Instance.ChangeWalkStyle((VRManager.PlayerWalkStyle)dropdown.value);
|
|
}
|
|
else if (styleType == StyleType.ROTATE)
|
|
{
|
|
VRManager.Instance.ChangeRotateStyle((VRManager.PlayerRotateStyle)dropdown.value);
|
|
}
|
|
else if (styleType == StyleType.TELEPORT)
|
|
{
|
|
VRManager.Instance.ChangeTeleportStyle((VRManager.TeleportStyle)dropdown.value);
|
|
}
|
|
else if (styleType == StyleType.HUD_ROTATE)
|
|
{
|
|
VRManager.Instance.SetHUDRotateStyle((VRManager.HUDRotateStyle)dropdown.value);
|
|
}
|
|
}
|
|
|
|
public void LanguageChanged()
|
|
{
|
|
InitList();
|
|
}
|
|
}
|