/// <summary> /// Enables all interface elements. Including buttons and text fields. /// The search button states are preserved. /// </summary> private void EnableInterfaceElements() { animatedButtonList.ForEach((x) => x.Enable()); filterButtonList.ForEach((x) => x.Enable()); avatarButtonList.ForEach((x) => x.ShouldUpdate = true); tabButtonList.Enable(); AnimatedButton button; switch (searchFilter.AvatarCategory) { case AvatarCategory.Hat: button = filterHatButton; break; case AvatarCategory.Body: button = filterBodyButton; break; case AvatarCategory.Goggles: button = filterGogglesButton; break; case AvatarCategory.Flag: button = filterFlagButton; break; case AvatarCategory.ExItem: button = filterExItemButton; break; case AvatarCategory.Pet: button = filterPetButton; break; case AvatarCategory.Misc: button = filterMiscButton; break; default: button = filterExtraButton; break; } button.ChangeButtonState(ButtonAnimationState.Activated); giftButton.Disable(true); cashChargeButton.Disable(true); //Update filter buttons if (searchFilter.CurrentPage == 0) { filterLeftButton.Disable(true); } else if (filterLeftButton.IsDisabled) { filterLeftButton.Enable(); } if (searchFilter.CurrentPage + 1 == searchFilter.LastPage) { filterRightButton.Disable(true); } else if (filterRightButton.IsDisabled) { filterRightButton.Enable(); } //Search text field searchTextField.Enable(); searchTextField.ActivateElement(); }
/// <summary> /// This action is meant for avatar inventory and shop buttons. /// </summary> private void AvatarButtonAction(object sender) { AvatarButton avatarButton = (AvatarButton)sender; selectedAvatarMetadata = avatarButton.AvatarMetadata; // If it is a inventory button if (searchFilter.IsRenderingInventory) { // Equip player.EquipAvatar(selectedAvatarMetadata.AvatarCategory, selectedAvatarMetadata.ID); // Update Equipped avatarButtonList.ForEach((x) => x.HideEquippedIndicator()); avatarButton.ShowEquippedIndicator(); inventoryRiderPreview.ReplaceAvatar(selectedAvatarMetadata); inventoryInGamePreview.ReplaceAvatar(selectedAvatarMetadata); tryButton.Disable(true); buyButton.Disable(true); return; } // If it isn't an inventory button avatarButtonList.ForEach((x) => { x.Disable(); x.Enable(); }); avatarButton.ChangeButtonState(ButtonAnimationState.Activated, true); if (shopRiderPreview.GetEquippedAvatarID(selectedAvatarMetadata.AvatarCategory) != selectedAvatarMetadata.ID) { tryButton.Enable(); } else { tryButton.Disable(true); } if (player.Gold >= selectedAvatarMetadata.GoldPrice || player.Cash >= selectedAvatarMetadata.CashPrice) { if (!player.OwnedAvatar[selectedAvatarMetadata.AvatarCategory].Contains(selectedAvatarMetadata.ID)) { buyButton.Enable(); } else { buyButton.Disable(true); } } }
private void ChangeTeamAction(object sender) { AnimatedButton b = (AnimatedButton)sender; b.Disable(); b.OnDisabled = (a) => { b.Enable(); }; ServerInformationHandler.ChangeTeam(); }
private void OptionsCloseAction(object sender) { buttonList.ForEach((x) => x.Enable()); animatedButtonList.ForEach((x) => x.ShouldUpdate = true); options.Enable(); }