Skip to content

Instantly share code, notes, and snippets.

@todorok1
Created May 13, 2025 09:02
Show Gist options
  • Select an option

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

Select an option

Save todorok1/63bb701cddb0fdf5b34491d38060a5a9 to your computer and use it in GitHub Desktop.
シンプルRPGチュートリアル第75回 メニュー画面全体を管理するクラス
/// <summary>
/// 選択されたメニューに応じた処理を呼び出します。
/// </summary>
void HandleMenu()
{
switch (SelectedMenu)
{
case MenuCommand.Item:
case MenuCommand.Magic:
ShowItemMenu();
break;
case MenuCommand.Equipment:
ShowEquipmentMenu();
break;
case MenuCommand.Status:
ShowStatusMenu();
break;
case MenuCommand.Save:
// セーブメニューを開く処理
break;
case MenuCommand.QuitGame:
// ゲーム終了処理
break;
case MenuCommand.Close:
_topMenuWindowController.CloseMenu();
break;
}
}
/// <summary>
/// アイテムメニューを表示します。
/// </summary>
void ShowItemMenu()
{
MenuPhase = MenuPhase.Item;
_menuItemWindowController.SetUpController(this);
_menuItemWindowController.SetUpWindow();
_menuItemWindowController.SetPageElement();
_menuItemWindowController.ShowWindow();
_menuItemWindowController.SetCanSelectState(true);
}
/// <summary>
/// 装備メニューを表示します。
/// </summary>
void ShowEquipmentMenu()
{
MenuPhase = MenuPhase.Equipment;
_menuEquipmentWindowController.SetUpController(this);
_menuEquipmentWindowController.ShowWindow();
}
/// <summary>
/// ステータスメニューを表示します。
/// </summary>
void ShowStatusMenu()
{
MenuPhase = MenuPhase.Status;
_menuStatusWindowController.SetUpController(this);
_menuStatusWindowController.ShowWindow();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment