public AvatarShop() { asyncPadlock = new object(); animatedButtonList = new List <AnimatedButton>(); filterButtonList = new List <AnimatedButton>(); spriteList = new List <Sprite>(); avatarButtonList = new List <AvatarButton>(); spriteTextList = new List <SpriteText>(); buttonList = new List <Button>(); player = GameInformation.Instance.PlayerInformation; //Background / Foreground Background = new Sprite(@"Interface/InGame/Scene/AvatarShop/Background", position: Parameter.ScreenCenter, layerDepth: DepthParameter.Foreground, shouldCopyAsset: false); foreground1 = new Sprite("Interface/InGame/Scene/AvatarShop/Foreground1", Vector2.Zero, DepthParameter.Foreground); foreground2 = new Sprite("Interface/InGame/Scene/AvatarShop/Foreground2", Vector2.Zero, DepthParameter.Foreground); foreground2.Color = Color.Transparent; foreground1.Pivot = foreground2.Pivot = Vector2.Zero; foreground1.Position = foreground2.Position = Parameter.ScreenCenter - Background.Pivot; spriteList.Add(foreground1); spriteList.Add(foreground2); //Interface components AddBottomAnimatedButtonsToScene(); AddFilterAnimatedButtonsToScene(); AddSearchTextToScene(); AddPreviewsToScene(); AddFilteringToScene(); //Tab Index tabButtonList = new TabButtonList(new Vector2(-110, -285), new List <TabButtonParameter>() { new TabButtonParameter(Language.AvatarShopTabShop, ShopTabButtonAction), new TabButtonParameter(Language.AvatarShopTabInventory, InventoryTabButtonAction), }); //AttributeButton Vector2 positionOffset = new Vector2(Background.SourceRectangle.Width, Background.SourceRectangle.Height) / 2; attributeMenu = new AttributeMenu(Parameter.ScreenCenter - positionOffset, player); //Buttons standard preset tryButton.Disable(true); buyButton.Disable(true); giftButton.Disable(true); cashChargeButton.Disable(true); //Popup configuration PopupHandler.PopupGameOptions.OnClose = OptionsCloseAction; //Feedbacks / Callbacks ServerInformationBroker.Instance.ActionCallbackDictionary.AddOrReplace(NetworkObjectParameters.GameServerAvatarShopBuyAvatarGold, GoldPurchaseConfirmationAsyncCallback); ServerInformationBroker.Instance.ActionCallbackDictionary.AddOrReplace(NetworkObjectParameters.GameServerAvatarShopBuyAvatarCash, CashPurchaseConfirmationAsyncCallback); }
/// <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(); }
private void OptionsAction(object sender) { buttonList.ForEach((x) => x.Disable()); animatedButtonList.ForEach((x) => x.ShouldUpdate = false); PopupHandler.PopupGameOptions.ShouldRender = true; options.Disable(); }
private void ChangeTeamAction(object sender) { AnimatedButton b = (AnimatedButton)sender; b.Disable(); b.OnDisabled = (a) => { b.Enable(); }; ServerInformationHandler.ChangeTeam(); }