Skip to content

Instantly share code, notes, and snippets.

@todorok1
Created August 14, 2025 04:17
Show Gist options
  • Select an option

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

Select an option

Save todorok1/327a04a2df09e80e69217e98efa3b2f3 to your computer and use it in GitHub Desktop.
シンプルRPGチュートリアル第118回 お店画面のアイテムウィンドウを制御するクラス
/// <summary>
/// 項目が選択された時の処理です。
/// </summary>
void OnPressedConfirmButton()
{
if (!IsValidSelection())
{
return;
}
if (_shopManager.SelectedCommand == ShopCommand.Buy)
{
var itemData = _buyController.GetItemData(_selectedIndex);
if (itemData == null)
{
return;
}
_shopManager.OnSelectedItem(itemData);
// 選択時の効果音を再生します。
AudioManager.Instance.PlaySe(SeNames.OK);
}
else if (_shopManager.SelectedCommand == ShopCommand.Sell)
{
var itemData = _sellController.GetItemData(_selectedIndex);
if (itemData == null)
{
return;
}
_shopManager.OnSelectedItem(itemData);
// 選択時の効果音を再生します。
AudioManager.Instance.PlaySe(SeNames.OK);
}
SetCanSelectState(false);
}
/// <summary>
/// キャンセルボタンが押された時の処理です。
/// </summary>
void OnPressedCancelButton()
{
// キャンセル時の効果音を再生します。
AudioManager.Instance.PlaySe(SeNames.Cancel);
StartCoroutine(HideProcess());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment