private void StartSelectInventoryWeapons(Actor actor) { var items = actor.StatusController.Inventory.Weapons; Broker.Global.Publish(RequestShowGridUI.Get(items, i => { this.StartChangeWeapon(actor, i); }, () => { Broker.Global.Publish(RequestHideGridUI.Get()); Broker.Global.Publish(ChangeWeaponUserInputMessages.End.Get()); })); }
private void StartChangeEquippedAccessory(Actor actor) { var items = actor.StatusController.EquippedAccessoryIcons; Broker.Global.Publish(RequestShowGridUI.Get(items, i => { actor.StatusController.ChangeEquippedAccessory(i, this.possessionAccessoryIndex); Broker.Global.Publish(RequestHideGridUI.Get()); this.StartSelectPossessionAccessoryIndex(actor); }, () => { Broker.Global.Publish(RequestHideGridUI.Get()); this.StartSelectPossessionAccessoryIndex(actor); })); }
/// <summary> /// 所持しているアクセサリーのインデックス選択を開始する /// </summary> private void StartSelectPossessionAccessoryIndex(Actor actor) { var items = actor.StatusController.Inventory.Accessories; Broker.Global.Publish(RequestShowGridUI.Get(items, i => { this.possessionAccessoryIndex = i; Broker.Global.Publish(RequestHideGridUI.Get()); this.StartChangeEquippedAccessory(actor); }, () => { Broker.Global.Publish(RequestHideGridUI.Get()); Broker.Global.Publish(ChangeAccessoryUserInputMessages.End.Get()); })); }
/// <summary> /// 必要な武器を選択し終えるまで選択を再帰的に行う /// </summary> private static void StartSelectConsumeInstanceWeaponRecursive( this ISelectConsumeInstanceWeapons self, Actor actor, WeaponRecord targetWeaponRecord, List <WeaponRecord> targetWeaponRecords, List <InstanceWeapon> selectConsumeInstanceWeapons, Action <List <InstanceWeapon> > OnCompleteSelect, Action OnCancel ) { Assert.IsNotNull(targetWeaponRecord, $"対象となる{typeof(WeaponRecord)}がありません"); // 所持している武器から対象となる武器を抽出 var targetInstanceWeapons = actor.StatusController.Inventory.Weapons .Where(x => x.WeaponRecord == targetWeaponRecord) .ToList(); Broker.Global.Publish(RequestShowGridUI.Get(targetInstanceWeapons, i => { selectConsumeInstanceWeapons.Add(targetInstanceWeapons[i]); Broker.Global.Publish(RequestHideGridUI.Get()); var nextTargetWeaponRecord = GetTargetWeaponRecord(targetWeaponRecords, selectConsumeInstanceWeapons); // 次に選択する武器がない場合は完了処理を実行 if (nextTargetWeaponRecord == null) { OnCompleteSelect(selectConsumeInstanceWeapons); } else { self.StartSelectConsumeInstanceWeaponRecursive( actor, nextTargetWeaponRecord, targetWeaponRecords, selectConsumeInstanceWeapons, OnCompleteSelect, OnCancel ); } }, () => { OnCancel(); })); }
private void StartCreateWeapon(Actor actor) { var items = GameSystem.Instance.MasterData.AccessoryRecipe.GetViewableRecipes(actor.StatusController.Inventory); Broker.Global.Publish(RequestShowGridUI.Get(items, i => { var item = items[i]; if (!actor.StatusController.Inventory.IsEnough(item.NeedItems)) { Debug.Log("素材が足りない"); return; } if (!actor.StatusController.Inventory.IsEnough(item.Money)) { Debug.Log("お金が足りない"); return; } if (item.NeedItems.IsNeedWeapon) { this.StartSelectConsumeInstanceWeapon(actor, item.NeedItems, selectConsumeInstanceWeapons => { Broker.Global.Publish(RequestHideGridUI.Get()); this.AddAccessory(actor, item, selectConsumeInstanceWeapons); this.StartCreateWeapon(actor); }, () => { Broker.Global.Publish(RequestHideGridUI.Get()); this.StartCreateWeapon(actor); }); } else { this.AddAccessory(actor, item, null); } }, () => { Broker.Global.Publish(RequestHideGridUI.Get()); Broker.Global.Publish(CreateAccessoryUserInputMessages.End.Get()); })); }
/// <summary> /// アイテム修飾を装着する武器の選択を開始する /// </summary> private void StartSelectInstanceWeapon(Actor actor) { Broker.Global.Publish(RequestShowGridUI.Get(actor.StatusController.Inventory.Weapons, i => { var instanceWeapon = actor.StatusController.Inventory.Weapons[i]; if (instanceWeapon.WeaponRecord.ItemModifierLimit <= instanceWeapon.Modifiers.Count) { Debug.Log("制限を超えたので装着できない"); return; } this.selectWeapon = instanceWeapon; Broker.Global.Publish(RequestHideGridUI.Get()); this.StartSelectItemModifier(actor); }, () => { Broker.Global.Publish(RequestHideGridUI.Get()); Broker.Global.Publish(AttachItemModifierToWeaponUserInputMessages.End.Get()); })); }