-
-
Save todorok1/62679f3415315f1d1bbf37a95d14848c to your computer and use it in GitHub Desktop.
シンプルRPGチュートリアル第119回 選択ウィンドウを制御するクラス
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// 選択中の位置に応じたカーソルを表示します。 | |
| /// </summary> | |
| void PostSelection() | |
| { | |
| ShowSelectionCursor(); | |
| ShowSelectedItemDescription(); | |
| } | |
| /// <summary> | |
| /// 選択中の位置に応じたカーソルを表示します。 | |
| /// </summary> | |
| void ShowSelectionCursor() | |
| { | |
| int index = _selectedIndex % 4; | |
| _uiController.ShowSelectedCursor(index); | |
| } | |
| /// <summary> | |
| /// 選択中の項目の説明を表示します。 | |
| /// </summary> | |
| void ShowSelectedItemDescription() | |
| { | |
| string description = string.Empty; | |
| if (_battleManager.SelectedCommand == BattleCommand.Magic) | |
| { | |
| var magicData = _magicController.GetMagicData(_selectedIndex); | |
| if (magicData != null) | |
| { | |
| description = magicData.magicDesc; | |
| } | |
| } | |
| else if (_battleManager.SelectedCommand == BattleCommand.Item) | |
| { | |
| var itemInfo = _itemController.GetItemInfo(_selectedIndex); | |
| if (itemInfo != null) | |
| { | |
| var itemData = ItemDataManager.GetItemDataById(itemInfo.itemId); | |
| if (itemData != null) | |
| { | |
| description = itemData.itemDesc; | |
| } | |
| } | |
| } | |
| _uiController.SetDescriptionText(description); | |
| } | |
| /// <summary> | |
| /// ウィンドウの状態をセットアップします。 | |
| /// </summary> | |
| public void SetUpWindow() | |
| { | |
| _uiController.SetUpControllerDictionary(); | |
| _uiController.ClearAllItemText(); | |
| _uiController.ClearDescriptionText(); | |
| InitializeSelect(); | |
| _magicController.SetCharacterMagic(); | |
| } | |
| /// <summary> | |
| /// 項目選択を初期化します。 | |
| /// </summary> | |
| public void InitializeSelect() | |
| { | |
| _page = 0; | |
| _selectedIndex = SelectionItemPosition.LeftTop; | |
| _uiController.ShowSelectedCursor(_selectedIndex); | |
| PostSelection(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment