Exemple #1
0
        public override void Initialize()
        {
            base.Initialize();

            selectionArea.combineEquipmentButton.OnClick
            .Subscribe(_ => State.SetValueAndForceNotify(StateType.CombineEquipment))
            .AddTo(gameObject);
            selectionArea.combineConsumableButton.OnClick
            .Subscribe(_ => State.SetValueAndForceNotify(StateType.CombineConsumable))
            .AddTo(gameObject);
            selectionArea.enhanceEquipmentButton.OnClick
            .Subscribe(_ => State.SetValueAndForceNotify(StateType.EnhanceEquipment))
            .AddTo(gameObject);

            selectionArea.combineEquipmentButton.SetLockCondition(GameConfig
                                                                  .RequireClearedStageLevel.CombinationEquipmentAction);
            selectionArea.combineConsumableButton.SetLockCondition(GameConfig
                                                                   .RequireClearedStageLevel.CombinationConsumableAction);
            selectionArea.enhanceEquipmentButton.SetLockCondition(GameConfig
                                                                  .RequireClearedStageLevel.ItemEnhancementAction);

            _toggleGroup = new ToggleGroup();
            _toggleGroup.OnToggledOn.Subscribe(SubscribeOnToggledOn).AddTo(gameObject);
            _toggleGroup.RegisterToggleable(combineEquipmentCategoryButton);
            _toggleGroup.RegisterToggleable(combineConsumableCategoryButton);
            _toggleGroup.RegisterToggleable(enhanceEquipmentCategoryButton);
            _toggleGroup.DisabledFunc = () => !CanHandleInputEvent;

            combineEquipmentCategoryButton.SetLockCondition(GameConfig.RequireClearedStageLevel
                                                            .CombinationEquipmentAction);
            combineConsumableCategoryButton.SetLockCondition(GameConfig.RequireClearedStageLevel
                                                             .CombinationConsumableAction);
            enhanceEquipmentCategoryButton.SetLockCondition(GameConfig.RequireClearedStageLevel
                                                            .ItemEnhancementAction);

            State.Subscribe(SubscribeState).AddTo(gameObject);

            itemRecipe.Initialize();

            combinationPanel.submitButton.OnSubmitClick.Subscribe(_ => OnCombinationSubmit(combinationPanel))
            .AddTo(gameObject);

            combinationPanel.RequiredBlockIndexSubject.ObserveOnMainThread()
            .Subscribe(ShowBlockIndex).AddTo(gameObject);

            elementalCombinationPanel.submitButton.OnSubmitClick.Subscribe(_ =>
            {
                ActionCombinationEquipment(elementalCombinationPanel);
                var itemBase = elementalCombinationPanel.recipeCellView.ItemView.Model.ItemBase.Value;
                StartCoroutine(CoCombineNPCAnimation(itemBase, elementalCombinationPanel.SubscribeOnClickSubmit));
            }).AddTo(gameObject);

            elementalCombinationPanel.RequiredBlockIndexSubject.ObserveOnMainThread()
            .Subscribe(ShowBlockIndex).AddTo(gameObject);

            blur.gameObject.SetActive(false);

            CombinationSlotStateSubject.CombinationSlotState.Subscribe(_ => ResetSelectedIndex())
            .AddTo(gameObject);
            Game.Game.instance.Agent.BlockIndexSubject.ObserveOnMainThread()
            .Subscribe(SubscribeBlockIndex)
            .AddTo(gameObject);
        }