public void SetToggledOnItemType(ItemSubType itemSubType) { IToggleable toggleable = GetButton(itemSubType); _equipmentToggleGroup.SetToggledOn(toggleable); SubscribeOnEquipmentToggledOn(toggleable); }
private void SubscribeState(StateType value) { if (_enhanceEquipment is null) { _enhanceEquipment = Find <EnhanceEquipment>(); } Find <ItemInformationTooltip>().Close(); Find <BottomMenu>().ToggleGroup.SetToggledOffAll(); selectionArea.root.SetActive(value == StateType.SelectMenu); leftArea.SetActive(value != StateType.SelectMenu); var tutorialController = Game.Game.instance.Stage.TutorialController; var tutorialProgress = 0; switch (value) { case StateType.SelectMenu: _selectedSpeechBubble = speechBubbleForEquipment; speechBubbleForUpgrade.gameObject.SetActive(false); _toggleGroup.SetToggledOffAll(); _enhanceEquipment.Hide(); combinationPanel.Hide(); elementalCombinationPanel.Hide(); categoryTabArea.SetActive(false); itemRecipe.gameObject.SetActive(false); break; case StateType.CombineEquipment: Mixpanel.Track("Unity/Combine Equipment"); _selectedSpeechBubble = speechBubbleForEquipment; speechBubbleForUpgrade.gameObject.SetActive(false); _enhanceEquipment.Hide(); combinationPanel.Hide(); elementalCombinationPanel.Hide(); ShowSpeech("SPEECH_COMBINE_EQUIPMENT_"); if (!categoryTabArea.activeSelf) { Animator.Play("ShowLeftArea", -1, 0.0f); OnTweenRecipe(); } categoryTabArea.SetActive(true); itemRecipe.gameObject.SetActive(true); itemRecipe.ShowEquipmentCellViews(_equipmentRecipeIdToGo); itemRecipe.SetState(ItemRecipe.State.Equipment); _equipmentRecipeIdToGo = null; _toggleGroup.SetToggledOn(combineEquipmentCategoryButton); break; case StateType.CombineConsumable: _selectedSpeechBubble = speechBubbleForEquipment; speechBubbleForUpgrade.gameObject.SetActive(false); _enhanceEquipment.Hide(); combinationPanel.Hide(); elementalCombinationPanel.Hide(); ShowSpeech("SPEECH_COMBINE_CONSUMABLE_"); if (!categoryTabArea.activeSelf) { Animator.Play("ShowLeftArea", -1, 0.0f); OnTweenRecipe(); } categoryTabArea.SetActive(true); itemRecipe.gameObject.SetActive(true); itemRecipe.ShowConsumableCellViews(); itemRecipe.SetState(ItemRecipe.State.Consumable); _toggleGroup.SetToggledOn(combineConsumableCategoryButton); break; case StateType.EnhanceEquipment: _selectedSpeechBubble = speechBubbleForUpgrade; speechBubbleForEquipment.gameObject.SetActive(false); _toggleGroup.SetToggledOn(enhanceEquipmentCategoryButton); _enhanceEquipment.Show(true); combinationPanel.Hide(); elementalCombinationPanel.Hide(); ShowSpeech("SPEECH_COMBINE_ENHANCE_EQUIPMENT_"); if (!categoryTabArea.activeSelf) { Animator.Play("ShowLeftArea", -1, 0.0f); OnTweenRecipe(); } categoryTabArea.SetActive(true); itemRecipe.gameObject.SetActive(false); break; case StateType.CombinationConfirm: _toggleGroup.SetToggledOffAll(); OnTweenRecipe(); if (_equipmentRecipeIdToGo.HasValue) { if (selectedRecipe.ItemSubType == ItemSubType.Food) { OnClickConsumableRecipe(); } else { var isElemental = selectedRecipe.ElementalType != ElementalType.Normal; OnClickEquipmentRecipe(isElemental); } _equipmentRecipeIdToGo = null; break; } var rectTransform = (RectTransform)selectedRecipe.transform; var pos = rectTransform.GetWorldPositionOfCenter(); var recipeClickVFX = VFXController.instance.CreateAndChaseCam <RecipeClickVFX>(pos); if (selectedRecipe.ItemSubType == ItemSubType.Food) { recipeClickVFX.OnFinished = () => { OnClickConsumableRecipe(); categoryTabArea.SetActive(false); itemRecipe.gameObject.SetActive(false); }; } else { var isElemental = selectedRecipe.ElementalType != ElementalType.Normal; recipeClickVFX.OnFinished = () => { OnClickEquipmentRecipe(isElemental); categoryTabArea.SetActive(false); itemRecipe.gameObject.SetActive(false); }; } recipeClickVFX.Play(); break; default: throw new ArgumentOutOfRangeException(nameof(value), value, null); } }