Skip to content

Instantly share code, notes, and snippets.

@todorok1
Created August 14, 2025 01:20
Show Gist options
  • Select an option

  • Save todorok1/0975fbabd57f968f3371284099c9e30f to your computer and use it in GitHub Desktop.

Select an option

Save todorok1/0975fbabd57f968f3371284099c9e30f to your computer and use it in GitHub Desktop.
シンプルRPGチュートリアル第117回 メニューのトップ画面を制御するクラス
/// <summary>
/// コマンドを選択します。
/// </summary>
void SelectCommand()
{
if (_menuManager == null)
{
return;
}
if (_menuManager.MenuPhase != MenuPhase.Top)
{
return;
}
if (Input.GetKeyUp(KeyCode.UpArrow))
{
SetPreCommand();
_uiController.ShowSelectedCursor(_selectedCommand);
}
else if (Input.GetKeyUp(KeyCode.DownArrow))
{
SetNextCommand();
_uiController.ShowSelectedCursor(_selectedCommand);
}
else if (InputGameKey.ConfirmButton())
{
// 選択時の効果音を再生します。
AudioManager.Instance.PlaySe(SeNames.OK);
_menuManager.OnSelectedMenu(_selectedCommand);
}
else if (InputGameKey.CancelButton())
{
// キャンセル時の効果音を再生します。
AudioManager.Instance.PlaySe(SeNames.Cancel);
CloseMenu();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment