private void DisplaySuccessDialog(XmlDocument xmlResponse) { XmlNode purchasedOfferNode = xmlResponse.SelectSingleNode("Response/purchaseResults/purchaseResult/offer"); XmlNode purchasedItemNode = purchasedOfferNode.SelectSingleNode("item"); string itemType = XmlUtility.GetStringAttribute(purchasedItemNode, "itemTypeName"); AnimationProxy animationProxy = GameFacade.Instance.RetrieveProxy <AnimationProxy>(); switch (itemType) { case "Emote": XmlNode assetInfoNode = purchasedItemNode.SelectSingleNode("Assets/Asset"); AssetInfo assetInfo = new ClientAssetInfo(assetInfoNode); string animationName = purchasedItemNode.SelectSingleNode("Assets/Asset/AssetData/AnimationName").InnerText; RigAnimationName rigAnimationName = (RigAnimationName)Enum.Parse(typeof(RigAnimationName), animationName); animationProxy.SetRigAnimationAssetInfo(rigAnimationName, assetInfo); animationProxy.SetOwnedEmote(rigAnimationName); break; case "Mood": List <AssetInfo> moodInfos = new List <AssetInfo>(); foreach (XmlNode moodInfoNode in purchasedItemNode.SelectNodes("Assets/Asset")) { AssetInfo moodInfo = new ClientAssetInfo(moodInfoNode); moodInfos.Add(moodInfo); } string moodName = XmlUtility.GetStringAttribute(purchasedItemNode, "buttonName"); moodName = moodName.Split(' ')[0]; MoodAnimation moodAnimationName = (MoodAnimation)Enum.Parse(typeof(MoodAnimation), moodName); animationProxy.SetMoodAnimationAssetInfo(moodAnimationName, moodInfos); animationProxy.SetOwnedMood(moodAnimationName); break; case "Emoticon": XmlNode emoticonInfoNode = purchasedItemNode.SelectSingleNode("Assets/Asset"); if (emoticonInfoNode == null) { Debug.LogError("EmoticonInfoNode was null: " + purchasedItemNode.OuterXml); break; } AssetInfo emoticonInfo = new ClientAssetInfo(emoticonInfoNode); animationProxy.SetEmoticonAssetInfo(emoticonInfo); animationProxy.SetOwnedEmoticon(emoticonInfo.Path); break; default: Console.Log("Successful purchase of item type: " + itemType + ". No action taken."); break; } // Parse out the price of the item and add it to the log XmlElement priceNode = (XmlElement)purchasedOfferNode.SelectSingleNode("price/money"); string currency = priceNode.GetAttribute("currencyName"); string price = priceNode.GetAttribute("amount"); string itemName = ((XmlElement)purchasedOfferNode).GetAttribute("name"); LogPurchaseSuccess(itemName, price, currency); }
public void Init() { mFaceAnimationFactory = new FaceAnimationFactory(FinishedLoadingFaceAnimationAssets); AnimationProxy animationProxy = new AnimationProxy(FinishedLoadingAnimationProxy); animationProxy.Init(); GameFacade.Instance.RegisterProxy(animationProxy); }
/// <summary> /// The callback for an Animation request /// </summary> /// <param name="receivedMessage"></param> public void HandlePlayerAnimationResponse(Message receivedMessage) { mMessageActions.Remove(MessageSubType.PlayerInventory); string response = (string)receivedMessage.Data[0]; XmlDocument xmlResponse = new XmlDocument(); xmlResponse.LoadXml(response); AnimationProxy animationProxy = GameFacade.Instance.RetrieveProxy <AnimationProxy>(); animationProxy.SetOwnedEmotesAndMoodsXml(xmlResponse); }
private void ShowIconMenu() { mAnimationProxy = GameFacade.Instance.RetrieveProxy <AnimationProxy>(); List <IWidget> enabledMenuButtons = new List <IWidget>(); List <IWidget> disabledMenuButtons = new List <IWidget>(); foreach (KeyValuePair <string, bool> kvp in mAnimationProxy.PlayableIconLookUpTable) { Button button; button = (Button)mIconMenuButton.Clone(); if (kvp.Value) { button.Enable(); enabledMenuButtons.Add(button); } else { button.Disable(); disabledMenuButtons.Add(button); } string emoticonPath = kvp.Key; mClientAssetRepository.LoadAssetFromPath <ImageAsset>(emoticonPath, delegate(ImageAsset asset) { button.Image = asset.Texture2D; button.AddOnPressedAction(delegate() { object[] args = { emoticonPath }; GameFacade.Instance.SendNotification(GameFacade.SEND_EMOTICON, args); EventLogger.Log(LogGlobals.CATEGORY_GUI, LogGlobals.EVENT_EMOTICON_CLICKED, "Emoticon", emoticonPath); Hide(); }); }); } List <IWidget> menuButtons = enabledMenuButtons; menuButtons.AddRange(disabledMenuButtons); ResizeIconWindow(mIconMenuWindow, mIconMenuButton, menuButtons.Count); RepositionWindow(mIconMenuWindow, mMainMenuWindow); int rows = menuButtons.Count / mIconFrameColumns + 1; mIconMenuGridView.SetPositionsWithBorderPadding(menuButtons, rows, mIconFrameColumns, 0, mMenuBorderPadding, mMenuBorderPadding, mIconButtonPadding); mIconMenuWindow.Showing = true; mTextMenuWindow.Showing = false; mLastWindowShowing = mIconMenuWindow; mLastWindowShowingToUpdate = "icon"; }
private void ShowEmoteMenu() { mAnimationProxy = GameFacade.Instance.RetrieveProxy <AnimationProxy>(); List <IWidget> enabledMenuButtons = new List <IWidget>(); List <IWidget> disabledMenuButtons = new List <IWidget>(); foreach (KeyValuePair <RigAnimationName, bool> kvp in mAnimationProxy.PlayableEmoteLookUpTable) { Button button = (Button)mActiveMenuButton.Clone(); if (kvp.Value) { button.Enable(); enabledMenuButtons.Add(button); } else { button.Disable(); disabledMenuButtons.Add(button); } button.Text = TranslateEmoteNameToDisplayName(kvp.Key.ToString()); string emoteName = kvp.Key.ToString(); button.AddOnPressedAction(delegate() { GameFacade.Instance.SendNotification(GameFacade.PLAY_EMOTE, emoteName); EventLogger.Log(LogGlobals.CATEGORY_GUI, LogGlobals.EVENT_EMOTE_CLICKED, "Emote", emoteName); Hide(); }); } List <IWidget> menuButtons = enabledMenuButtons; menuButtons.AddRange(disabledMenuButtons); ResizeTextMenuWindow(mTextMenuWindow, mActiveMenuButton, menuButtons.Count); RepositionWindow(mTextMenuWindow, mMainMenuWindow); mTextMenuGridView.SetPositionsWithBorderPadding(menuButtons, menuButtons.Count, 1, 0, mMenuBorderPadding, mMenuBorderPadding, mMenuButtonPadding); mTextMenuWindow.Showing = true; mIconMenuWindow.Showing = false; mLastWindowShowing = mTextMenuWindow; mLastWindowShowingToUpdate = "emote"; }
private void ShowMoodMenu() { mAnimationProxy = GameFacade.Instance.RetrieveProxy <AnimationProxy>(); List <IWidget> enabledMenuButtons = new List <IWidget>(); List <IWidget> disabledMenuButtons = new List <IWidget>(); foreach (KeyValuePair <MoodAnimation, bool> kvp in mAnimationProxy.PlayableMoodLookUpTable) { if (mCurrentMood == kvp.Key) { Button button = (Button)mActiveMoodButton.Clone(); button.AddOnPressedAction(delegate() { Hide(); }); enabledMenuButtons.Add(button); button.Text = kvp.Key.ToString(); } else { Button button = (Button)mActiveMenuButton.Clone(); if (kvp.Value) { button.Enable(); enabledMenuButtons.Add(button); } else { button.Disable(); disabledMenuButtons.Add(button); } button.Text = kvp.Key.ToString(); string moodNameString = kvp.Key.ToString(); button.AddOnPressedAction(delegate() { moodNameString = moodNameString.Split(' ')[0]; MoodAnimation moodName = (MoodAnimation)Enum.Parse(typeof(MoodAnimation), moodNameString); List <AssetInfo> assetInfos = GameFacade.Instance.RetrieveProxy <AnimationProxy>().GetMoodAssetInfos(moodName); GameFacade.Instance.RetrieveMediator <AvatarMediator>().LocalAvatarEntity.UpdateAssetsWithCallback(assetInfos, delegate(AvatarEntity avatarEntity) { GameFacade.Instance.RetrieveProxy <LocalAvatarProxy>().SaveDna(); }); EventLogger.Log(LogGlobals.CATEGORY_GUI, LogGlobals.EVENT_MOOD_CLICKED, "Mood", moodNameString); mCurrentMood = moodName; EventLogger.Log(LogGlobals.CATEGORY_GUI, LogGlobals.EVENT_MOOD_CLICKED, "Mood", moodNameString); Hide(); }); } } List <IWidget> menuButtons = enabledMenuButtons; menuButtons.AddRange(disabledMenuButtons); ResizeTextMenuWindow(mTextMenuWindow, mActiveMenuButton, menuButtons.Count); RepositionWindow(mTextMenuWindow, mMainMenuWindow); mTextMenuGridView.SetPositionsWithBorderPadding(menuButtons, menuButtons.Count, 1, 0, mMenuBorderPadding, mMenuBorderPadding, mMenuButtonPadding); mTextMenuWindow.Showing = true; mIconMenuWindow.Showing = false; mLastWindowShowing = mTextMenuWindow; mLastWindowShowingToUpdate = "mood"; }