Ejemplo n.º 1
0
        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());
            }));
        }
Ejemplo n.º 2
0
        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);
            }));
        }
Ejemplo n.º 3
0
        /// <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();
            }));
        }
Ejemplo n.º 5
0
        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());
            }));
        }
        /// <summary>
        /// アイテム修飾の選択を開始する
        /// </summary>
        private void StartSelectItemModifier(Actor actor)
        {
            var items = GameSystem.Instance.MasterData.ItemModifierRecipe.GetViewableRecipes(actor.StatusController.Inventory);

            Broker.Global.Publish(RequestShowListUI.Get(items, i =>
            {
                var inventory = actor.StatusController.Inventory;

                var item = items[i];
                if (!inventory.IsEnough(item.NeedItems))
                {
                    Debug.Log("素材が足りない");
                    return;
                }

                if (!inventory.IsEnough(item.Money))
                {
                    Debug.Log("お金が足りない");
                    return;
                }

                // 武器の消費が必要なら選択開始
                if (item.NeedItems.IsNeedWeapon)
                {
                    Broker.Global.Publish(RequestHideListUI.Get(null));
                    this.StartSelectConsumeInstanceWeapon(actor, item.NeedItems, (selectConsumeInstanceWeapons) =>
                    {
                        this.Attach(actor, item, selectConsumeInstanceWeapons);

                        if (this.CanAttach)
                        {
                            this.StartSelectItemModifier(actor);
                        }
                        else
                        {
                            this.StartSelectInstanceWeapon(actor);
                        }
                    }, () =>
                    {
                        Broker.Global.Publish(RequestHideGridUI.Get());
                        this.StartSelectItemModifier(actor);
                    });
                }
                else
                {
                    this.Attach(actor, item, null);
                }

                // 修飾数が制限値になった場合は終了
                if (!this.CanAttach)
                {
                    Broker.Global.Publish(RequestHideListUI.Get(() =>
                    {
                        this.StartSelectInstanceWeapon(actor);
                    }));
                }
            }, () =>
            {
                Broker.Global.Publish(RequestHideListUI.Get(null));
                this.StartSelectInstanceWeapon(actor);
            }));
        }