public void Initialize() { if (_initialized) { return; } var combination = Widget.Find <Combination>(); _initialized = true; _equipmentToggleGroup.OnToggledOn.Subscribe(SubscribeOnEquipmentToggledOn).AddTo(gameObject); _equipmentToggleGroup.RegisterToggleable(weaponTabButton); _equipmentToggleGroup.RegisterToggleable(armorTabButton); _equipmentToggleGroup.RegisterToggleable(beltTabButton); _equipmentToggleGroup.RegisterToggleable(necklaceTabButton); _equipmentToggleGroup.RegisterToggleable(ringTabButton); _equipmentToggleGroup.DisabledFunc = () => !combination.CanHandleInputEvent; _consumableToggleGroup.OnToggledOn.Subscribe(SubscribeOnConsumableToggledOn).AddTo(gameObject); _consumableToggleGroup.RegisterToggleable(hpTabButton); _consumableToggleGroup.RegisterToggleable(atkTabButton); _consumableToggleGroup.RegisterToggleable(criTabButton); _consumableToggleGroup.RegisterToggleable(hitTabButton); _consumableToggleGroup.RegisterToggleable(defTabButton); _consumableToggleGroup.DisabledFunc = () => !combination.CanHandleInputEvent; _equipmentToggleableMap = new Dictionary <string, ItemSubType>() { { weaponTabButton.Name, ItemSubType.Weapon }, { armorTabButton.Name, ItemSubType.Armor }, { beltTabButton.Name, ItemSubType.Belt }, { necklaceTabButton.Name, ItemSubType.Necklace }, { ringTabButton.Name, ItemSubType.Ring }, }; _consumableToggleableMap = new Dictionary <string, StatType>() { { hpTabButton.Name, StatType.HP }, { atkTabButton.Name, StatType.ATK }, { criTabButton.Name, StatType.CRI }, { hitTabButton.Name, StatType.HIT }, { defTabButton.Name, StatType.DEF }, }; LoadRecipes(); _itemFilterType.Subscribe(SubScribeFilterType).AddTo(gameObject); _statFilterType.Subscribe(SubScribeFilterType).AddTo(gameObject); _state.Subscribe(SubscribeState).AddTo(gameObject); ReactiveAvatarState.QuestList.Subscribe(SubscribeHasNotification) .AddTo(gameObject); }
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); }