-
-
Save todorok1/d5eecb1a5ab750bdcc31daf6ae22133b 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> | |
| /// 選択中の項目が実行できるか確認します。 | |
| /// 魔法の場合は消費MPを確認、アイテムの場合は所持数を確認します。 | |
| /// </summary> | |
| /// <param name="selectedIndex">選択中のインデックス</param> | |
| public bool IsValidSelection(int selectedIndex) | |
| { | |
| bool isValid = false; | |
| int indexInPage = selectedIndex % 4; | |
| if (!_itemIdDictionary.ContainsKey(indexInPage)) | |
| { | |
| return isValid; | |
| } | |
| var itemId = _itemIdDictionary[indexInPage]; | |
| isValid = CanSelectItem(itemId); | |
| return isValid; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment