-
-
Save todorok1/14b6b7f6d556cc23442b95bc04548024 to your computer and use it in GitHub Desktop.
シンプルRPGチュートリアル第98回 お店の選択肢ウィンドウの動作を制御するクラス
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
| namespace SimpleRpg | |
| { | |
| /// <summary> | |
| /// お店の選択肢ウィンドウの動作を制御するクラスです。 | |
| /// FindAnyObjectByTypeを使用して取得できるように、OptionWindowControllerを継承した別クラスとして実装しています。 | |
| /// </summary> | |
| public class ShopOptionWindowController : OptionWindowController | |
| { | |
| /// <summary> | |
| /// 選択結果を通知する先です。 | |
| /// </summary> | |
| IShopOptionCallback _callback; | |
| /// <summary> | |
| /// コントローラの状態をセットアップします。 | |
| /// </summary> | |
| /// <param name="callback">コールバック先</param> | |
| public void RegisterShopCallback(IShopOptionCallback callback) | |
| { | |
| _callback = callback; | |
| } | |
| /// <summary> | |
| /// 決定ボタンが押された時の処理です。 | |
| /// </summary> | |
| protected override void OnPressedConfirmButton() | |
| { | |
| if (_callback != null) | |
| { | |
| _callback.OnSelectedShopOption(_selectedIndex); | |
| } | |
| StartCoroutine(HideProcess()); | |
| } | |
| /// <summary> | |
| /// キャンセルボタンが押された時の処理です。 | |
| /// </summary> | |
| protected override void OnPressedCancelButton() | |
| { | |
| // キャンセルされた場合は、区別できるように-1を渡します。 | |
| int canceledIndex = -1; | |
| if (_callback != null) | |
| { | |
| _callback.OnSelectedShopOption(canceledIndex); | |
| } | |
| StartCoroutine(HideProcess()); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment