Skip to content

Instantly share code, notes, and snippets.

@todorok1
Created July 4, 2025 13:12
Show Gist options
  • Select an option

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

Select an option

Save todorok1/d25fc1bb3383bd3ef7aaa4d356f98ea7 to your computer and use it in GitHub Desktop.
シンプルRPGチュートリアル第98回 選択肢ウィンドウの動作を制御するクラス
/// <summary>
/// 決定ボタンが押された時の処理です。
/// </summary>
protected virtual void OnPressedConfirmButton()
{
if (_callback != null)
{
_callback.OnSelectedOption(_selectedIndex);
}
StartCoroutine(HideProcess());
}
/// <summary>
/// キャンセルボタンが押された時の処理です。
/// </summary>
protected virtual void OnPressedCancelButton()
{
// キャンセルされた場合は、区別できるように-1を渡します。
int canceledIndex = -1;
if (_callback != null)
{
_callback.OnSelectedOption(canceledIndex);
}
StartCoroutine(HideProcess());
}
/// <summary>
/// 選択ウィンドウを非表示にする処理です。
/// </summary>
protected IEnumerator HideProcess()
{
_canSelect = false;
yield return null;
HideWindow();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment