Пример #1
0
        public override void HandleNotification(INotification notification)
        {
            switch (notification.Name)
            {
            case GameFacade.APPLICATION_INIT:
                mInitTime = Time.realtimeSinceStartup;
                ShowSplashScreen();
                break;

            case GameFacade.CONNECTED:
                SendLoginCredentials();
                EventLogger.Log(LogGlobals.CATEGORY_CONNECTION, LogGlobals.EVENT_CONNECTED);
                //ShowLoginWindow();
                break;

            case GameFacade.LOGIN_SUCCESS:
                Console.WriteLine("Login Success (" + (Time.realtimeSinceStartup - mInitTime).ToString("f1") + "s)");
                HideSplashScreen();
                break;

            case GameFacade.LOGIN_FAILED:
                ShowLoginFailedPopup();
                break;
            }
        }
Пример #2
0
        /// <summary>
        /// Loads and sends a feed from the given path and name. Javascript will hide unity until the feed
        /// is taken care of and then when Unity is shown again, onFeedSent will be executed.
        /// </summary>
        public void PostFeed(long?targetId, string feedCopyDataPath, string feedDataName, Hangout.Shared.Action onFeedSent, string param)
        {
            if (String.IsNullOrEmpty(feedCopyDataPath))
            {
                throw new ArgumentNullException("feedCopyDataPath");
            }
            if (String.IsNullOrEmpty(feedDataName))
            {
                throw new ArgumentNullException("feedDataName");
            }
            if (onFeedSent == null)
            {
                throw new ArgumentNullException("onFeedSent");
            }

            // Log the post
            ConnectionProxy connectionProxy = GameFacade.Instance.RetrieveProxy <ConnectionProxy>();
            long            fromId          = connectionProxy.FacebookAccountId;
            string          extraProps      = String.Format("{0}|{1}", fromId, targetId);

            EventLogger.Log(LogGlobals.CATEGORY_FACEBOOK, LogGlobals.FACEBOOK_FEED_POST, feedDataName, extraProps);

            mAssetRepo.LoadAssetFromPath <XmlAsset>(feedCopyDataPath, delegate(XmlAsset asset)
            {
                mTaskCollection.Add(mScheduler.StartCoroutine(SendFeedJavascript(targetId, asset.XmlDocument, feedDataName, onFeedSent, param)));
            });
        }
Пример #3
0
 private void OnShowingCallback(bool showing)
 {
     if (showing)
     {
         GameFacade.Instance.SendNotification(GameFacade.PLAY_SOUND_MAP_OPEN);
         GameFacade.Instance.SendNotification(GameFacade.MAP_GUI_OPENED);
         EventLogger.Log(LogGlobals.CATEGORY_MAP, LogGlobals.EVENT_WINDOW_OPENED);
     }
     else
     {
         GameFacade.Instance.SendNotification(GameFacade.PLAY_SOUND_CLOSE);
         GameFacade.Instance.SendNotification(GameFacade.MAP_GUI_CLOSED);
         // Dont log for close window here, since window may already be closed.  Log on close button press
     }
 }
Пример #4
0
        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";
        }
Пример #5
0
        private void LogPurchaseSuccess(string itemName, string price, string currency)
        {
            string extraProps = "{\"item\":\"" + itemName + "\", \"price\":" + price + "}";

            // Log for metrics
            if (currency == "HOUTS")
            {
                EventLogger.Log(LogGlobals.CATEGORY_SHOPPING, LogGlobals.CASH_PURCHASE_SUCCESS, extraProps);
            }
            else if (currency == "VCOIN")
            {
                EventLogger.Log(LogGlobals.CATEGORY_SHOPPING, LogGlobals.COIN_PURCHASE_SUCCESS, extraProps);
            }
            // Mix panel funnel metrics
            string currencyProps = "{\"currency\":\"" + currency + "\"}";

            FunnelGlobals.Instance.LogFunnel(FunnelGlobals.FUNNEL_PURCHASE, FunnelGlobals.PURCHASE_COMPLETE, currencyProps);
        }
Пример #6
0
        private void Purchase()
        {
            mOverlayWindow.Showing = false;

            Hangout.Shared.Action onPurchaseConfirm = delegate()
            {
                SendPurchaseNotification(mCurrentSelectedItemOffer);
            };
            Hangout.Shared.Action onPurchaseCancel = delegate()
            {
                HideInfoAndOverlayFrames();
            };

            List <object> args = new List <object>();

            args.Add(Translation.PURCHASE_CONFIRM_TITLE);
            args.Add(Translation.PURCHASE_CONFIRM_TEXT);
            args.Add(onPurchaseConfirm);
            args.Add(onPurchaseCancel);
            GameFacade.Instance.SendNotification(GameFacade.SHOW_CONFIRM, args);

            XmlElement priceNode = (XmlElement)mCurrentSelectedItemOffer.SelectSingleNode("price/money");
            string     currency  = priceNode.GetAttribute("currencyName");
            string     itemName  = mCurrentSelectedItemOffer.GetAttribute("title");
            string     price     = priceNode.GetAttribute("amount");

            string extraProps = "{\"item\":\"" + itemName + "\", \"price\":" + price + "}";

            // Log for metrics
            if (currency == "HOUTS")
            {
                EventLogger.Log(LogGlobals.CATEGORY_SHOPPING, LogGlobals.CLICKED_ON_CASH_ITEM_BUY_BUTTON, extraProps);
            }
            else if (currency == "VCOIN")
            {
                EventLogger.Log(LogGlobals.CATEGORY_SHOPPING, LogGlobals.CLICKED_ON_COIN_ITEM_BUY_BUTTON, extraProps);
            }
            // Mix panel funnel metrics
            string currencyProps = "{\"currency\":\"" + currency + "\"}";

            FunnelGlobals.Instance.LogFunnel(FunnelGlobals.FUNNEL_PURCHASE, FunnelGlobals.CLICKED_BUY, currencyProps);
        }
Пример #7
0
        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";
        }
Пример #8
0
        /// <summary>
        /// Sends popup notification if there are were errors
        /// </summary>
        /// <param name="xmlResponse"><Response noun="HangoutUsers" verb="PurchaseItems"><errors><error code="270007"><message>Error msg</message><uuid>sessionId</uuid></error></errors></Response></param>
        /// <returns>True if there are errors, False if there were none</returns>
        private bool DisplayErrorDialog(XmlDocument xmlResponse)
        {
            XmlNodeList errors = xmlResponse.SelectNodes("/Response/errors/error");

            if (errors.Count > 0)
            {
                // Just show the first error for now.  Not sure if we can have more than one
                string errorCode = ((XmlElement)errors[0]).GetAttribute("code");
                string errorText = StoreErrorMessage.Instance.GetError(errorCode);

                Debug.LogError(errorText);

                List <object> args = new List <object>();
                args.Add(Translation.PURCHASE_ERROR_TITLE);
                args.Add(errorText);
                GameFacade.Instance.SendNotification(GameFacade.SHOW_DIALOG, args);

                EventLogger.Log(LogGlobals.CATEGORY_SHOPPING, LogGlobals.PURCHASE_FAILED);
                return(true);
            }
            return(false);
        }
Пример #9
0
        /// <summary>
        /// Send REQUEST_ITEM_PURCHASE notification
        /// </summary>
        /// <param name="itemOffer">Item being purchased</param>
        private void SendPurchaseNotification(XmlElement itemOfferNode)
        {
            XmlElement priceNode   = (XmlElement)itemOfferNode.SelectSingleNode("price/money");
            string     itemOfferId = itemOfferNode.GetAttribute("id");
            string     currency    = priceNode.GetAttribute("currencyName");
            string     itemName    = itemOfferNode.GetAttribute("title");
            string     price       = priceNode.GetAttribute("amount");

            if (itemOfferId == "")
            {
                throw new ArgumentNullException("itemOfferId must be supplied with PurchaseRequest");
            }
            if (currency == "")
            {
                throw new ArgumentNullException("currency must be supplied with PurchaseRequest");
            }
            // Make purchase request
            InventoryProxy inventoryProxy = GameFacade.Instance.RetrieveProxy <InventoryProxy>();

            inventoryProxy.PurchaseRequest(itemOfferId, currency, inventoryProxy.HandlePurchaseResponse);

            // Log for metrics
            if (currency == "HOUTS")
            {
                EventLogger.Log(LogGlobals.CATEGORY_SHOPPING, LogGlobals.CLICKED_ON_CASH_ITEM_BUY_CONFIRM,
                                itemName, price);
            }
            else if (currency == "VCOIN")
            {
                EventLogger.Log(LogGlobals.CATEGORY_SHOPPING, LogGlobals.CLICKED_ON_COIN_ITEM_BUY_CONFIRM,
                                itemName, price);
            }

            // Mix panel funnel metrics
            string currencyProps = "{\"currency\":\"" + currency + "\"}";

            FunnelGlobals.Instance.LogFunnel(FunnelGlobals.FUNNEL_PURCHASE, FunnelGlobals.CLICKED_CONFIRM, currencyProps);
        }
Пример #10
0
        private void BuildGui()
        {
            IGuiManager manager = GameFacade.Instance.RetrieveMediator <RuntimeGuiManager>();

            mRunwaySequenceGuiController = new GuiController(manager, PATH_TO_GUI);

            mExitButton = mRunwaySequenceGuiController.MainGui.SelectSingleElement <Button>("**/ExitButton");
            mExitButton.AddOnPressedAction(mOnExitCallback);
            mExitButton.Showing = false;
            GameFacade.Instance.RetrieveMediator <SchedulerMediator>().Scheduler.StartCoroutine(WaitThenDisplayExitButton());

            mTopPerformersFrame = mRunwaySequenceGuiController.MainGui.SelectSingleElement <GuiFrame>("**/TopPerformerFrame");

            // Build Title label
            // ISSUES WITH AVATAR PROXY.  Avatar proxy is set up when the local avatar distributed object is created.  This only happens
            // when the Green Screen Room is loaded first.
            Label titleLabel = mRunwaySequenceGuiController.MainGui.SelectSingleElement <Label>("**/TitleLabel");

            titleLabel.Text = String.Format(titleLabel.Text, GameFacade.Instance.RetrieveProxy <ConnectionProxy>().NickName, mLocationName);

            Pair <FacebookFriendInfo, FacebookFriendInfo> topPerformers = GetTopPerformers();

            if (topPerformers.First == null || topPerformers.Second == null)
            {
                mTopPerformersFrame.Showing = false;
                return;
            }
            // Populate the first ThankFrame:
            Image  topPerformerImage1     = mRunwaySequenceGuiController.MainGui.SelectSingleElement <Image>("**/TopPerformerImage1");
            Label  topPerformerNameLabel1 = mRunwaySequenceGuiController.MainGui.SelectSingleElement <Label>("**/TopPerformerNameLabel1");
            Button chooseButton1          = mRunwaySequenceGuiController.MainGui.SelectSingleElement <Button>("**/ChooseButton1");

            if (topPerformers.First != null)
            {
                if (topPerformers.First.ImageUrl != "")
                {
                    GameFacade.Instance.RetrieveProxy <ClientAssetRepository>().LoadAssetFromPath <ImageAsset>(topPerformers.First.ImageUrl, delegate(ImageAsset asset)
                    {
                        topPerformerImage1.Texture = asset.Texture2D;
                    });
                }
                topPerformerNameLabel1.Text = topPerformers.First.FirstName + " " + topPerformers.First.LastName;
                chooseButton1.AddOnPressedAction(delegate()
                {
                    GameFacade.Instance.RetrieveMediator <FacebookFeedMediator>().PostFeed(topPerformers.First.FbAccountId, FashionMinigame.FACEBOOK_FEED_COPY_PATH, "feed_thanks", FeedPostWindowClosed, topPerformers.First.FirstName + " " + topPerformers.First.LastName);
                    EventLogger.Log(LogGlobals.CATEGORY_FACEBOOK, LogGlobals.FACEBOOK_FEED_POST, "ThankTopPerformer", topPerformers.First.FirstName + " " + topPerformers.First.LastName);
                });
            }
            else
            {
                topPerformerNameLabel1.Showing = false;
                topPerformerImage1.Showing     = false;
                chooseButton1.Showing          = false;
            }

            Image  topPerformerImage2     = mRunwaySequenceGuiController.MainGui.SelectSingleElement <Image>("**/TopPerformerImage2");
            Label  topPerformerNameLabel2 = mRunwaySequenceGuiController.MainGui.SelectSingleElement <Label>("**/TopPerformerNameLabel2");
            Button chooseButton2          = mRunwaySequenceGuiController.MainGui.SelectSingleElement <Button>("**/ChooseButton2");

            if (topPerformers.Second != null)
            {
                if (topPerformers.Second.ImageUrl != "")
                {
                    GameFacade.Instance.RetrieveProxy <ClientAssetRepository>().LoadAssetFromPath <ImageAsset>(topPerformers.Second.ImageUrl, delegate(ImageAsset asset)
                    {
                        topPerformerImage2.Texture = asset.Texture2D;
                    });
                }
                topPerformerNameLabel2.Text = topPerformers.Second.FirstName + " " + topPerformers.Second.LastName;
                chooseButton2.AddOnPressedAction(delegate()
                {
                    GameFacade.Instance.RetrieveMediator <FacebookFeedMediator>().PostFeed(topPerformers.Second.FbAccountId, FashionMinigame.FACEBOOK_FEED_COPY_PATH, "feed_thanks", FeedPostWindowClosed, topPerformers.Second.FirstName + " " + topPerformers.Second.LastName);
                    EventLogger.Log(LogGlobals.CATEGORY_FACEBOOK, LogGlobals.FACEBOOK_FEED_POST, "ThankTopPerformer", topPerformers.Second.FirstName + " " + topPerformers.Second.LastName);
                });
            }
            else
            {
                topPerformerNameLabel2.Showing = false;
                topPerformerImage2.Showing     = false;
                chooseButton2.Showing          = false;
            }
        }
Пример #11
0
        /// <summary>
        /// Show the item detail popup
        /// </summary>
        /// <param name="button"></param>
        /// <param name="index">Index of the item on the current page that this button corresponds to</param>
        private void GridItemSelected(IWidget widget, XmlElement itemOfferNode, XmlElement itemNode)
        {
            XmlElement priceNode      = (XmlElement)itemOfferNode.SelectSingleNode("price/money");
            string     description    = itemOfferNode.GetAttribute("description");
            string     itemName       = itemOfferNode.GetAttribute("title");
            string     thumbnailUrl   = ConvertPaymentItemsUrl(itemNode.GetAttribute("smallImageUrl"));
            string     uniqueId       = itemNode.GetAttribute("name");
            string     itemExpiration = itemOfferNode.GetAttribute("endDate");
            string     itemQuantity   = itemOfferNode.GetAttribute("numAvailable");
            string     currency       = priceNode.GetAttribute("currencyName");
            string     price          = priceNode.GetAttribute("amount");
            string     itemType       = itemNode.GetAttribute("itemTypeName");
            XmlNode    assetsNode     = itemNode.SelectSingleNode("Assets");

            mCurrentSelectedItemOffer = itemOfferNode;

            ShowItemInfoOverlay(widget, thumbnailUrl, price, currency);

            ShowItemInfoFrame(itemName, description, itemExpiration, itemQuantity);

            SetupOverlayActionButtons(uniqueId, itemType, assetsNode);

            // Log for metrics
            if (currency == "HOUTS")
            {
                EventLogger.Log(LogGlobals.CATEGORY_SHOPPING, LogGlobals.CLICKED_ON_CASH_ITEM,
                                itemName, price);

                mItemOverlayActionButton.ClearOnPressedActions();
                mItemOverlayActionButton.AddOnPressedAction(delegate()
                {
                    mOverlayWindow.Showing = false;
                });

                // Disable the Buy button if you don't have enough currency to purchase.
                if (GameFacade.Instance.RetrieveProxy <InventoryProxy>().Houts < Double.Parse(price))
                {
                    mItemOverlayActionButton.AddOnPressedAction(delegate()
                    {
                        BuyCoinUtility.GoToBuyCashPage
                        (
                            Translation.NEED_CASH_TITLE,
                            Translation.NOT_ENOUGH_COIN,
                            delegate(string s)
                        {
                            Console.WriteLine("Opening cash store: " + s);
                        },
                            delegate()
                        {
                            GameFacade.Instance.SendNotification(GameFacade.GET_CASH_GUI_CLOSED);
                        }
                        );
                    });
                }
                else
                {
                    mItemOverlayActionButton.AddOnPressedAction(delegate()
                    {
                        Purchase();
                    });
                }
            }
            else
            {
                EventLogger.Log(LogGlobals.CATEGORY_SHOPPING, LogGlobals.CLICKED_ON_COIN_ITEM,
                                itemName, price);
                // Disable the Buy button if you don't have enough currency to purchase.
                if (GameFacade.Instance.RetrieveProxy <InventoryProxy>().VCoin < Double.Parse(price))
                {
                    mItemOverlayActionButton.AddOnPressedAction(delegate()
                    {
                        BuyCoinUtility.GoToBuyCashPage
                        (
                            Translation.NEED_CASH_TITLE,
                            Translation.NOT_ENOUGH_CASH,
                            delegate(string s)
                        {
                            Console.WriteLine("Opening cash store: " + s);
                        },
                            delegate()
                        {
                            GameFacade.Instance.SendNotification(GameFacade.GET_CASH_GUI_CLOSED);
                        }
                        );
                    });
                }
                else
                {
                    mItemOverlayActionButton.AddOnPressedAction(delegate()
                    {
                        Purchase();
                    });
                }
            }
            mRemoveButton.ClearOnPressedActions();
            mRemoveButton.AddOnPressedAction(delegate()
            {
                List <AssetInfo> assetInfos = new List <AssetInfo>();
                foreach (XmlNode assetNode in assetsNode.SelectNodes("Asset"))
                {
                    AssetInfo assetInfo = new ClientAssetInfo(assetNode);
                    assetInfos.Add(assetInfo);
                }
                GameFacade.Instance.RetrieveMediator <AvatarMediator>().LocalAvatarEntity.RemoveTempAssetInfos(assetInfos);
                mOverlayWindow.Showing = false;
            });
        }
Пример #12
0
        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";
        }
Пример #13
0
        public MapGui(IGuiManager guiManager) :
            base(guiManager, mResourcePath)
        {
            foreach (IGuiElement element in this.AllElements)
            {
                if (element.Name == "MapGui" && element is Window)
                {
                    mMainWindow = (Window)element;
                    mMainWindow.OnShowing(OnShowingCallback);

                    Button closeButton = mMainWindow.SelectSingleElement <Button>("HeaderFrame/CloseButton");
                    closeButton.AddOnPressedAction(
                        delegate()
                    {
                        mMainWindow.Showing = false;
                        EventLogger.Log(LogGlobals.CATEGORY_MAP, LogGlobals.EVENT_WINDOW_CLOSED);
                    }
                        );

                    Button myHangoutButton = mMainWindow.SelectSingleElement <Button>("MainFrame/MyHangout");
                    myHangoutButton.AddOnPressedAction(delegate()
                    {
                        GameFacade.Instance.RetrieveMediator <ToolbarMediator>().NavigationBar.ToggleWindow(GameFacade.SHOW_ROOM_PICKER_GUI, MessageSubType.ClientOwnedRooms);
                        //GameFacade.Instance.SendNotification(GameFacade.SHOW_ROOM_PICKER_GUI, MessageSubType.ClientOwnedRooms);
                        this.Showing = false;
                        EventLogger.Log(LogGlobals.CATEGORY_MAP, LogGlobals.MY_HANGOUT_CLICKED);
                    });

                    Button friendHangoutsButton = mMainWindow.SelectSingleElement <Button>("MainFrame/FriendHangouts");
                    friendHangoutsButton.AddOnPressedAction(delegate()
                    {
                        GameFacade.Instance.RetrieveMediator <ToolbarMediator>().NavigationBar.ToggleWindow(GameFacade.SHOW_ROOM_PICKER_GUI, MessageSubType.FriendsRooms);
                        this.Showing = false;
                        EventLogger.Log(LogGlobals.CATEGORY_MAP, LogGlobals.FRIEND_HANGOUT_CLICKED);
                    });

                    Button publicHangoutsButton = mMainWindow.SelectSingleElement <Button>("MainFrame/PublicHangouts");
                    publicHangoutsButton.AddOnPressedAction(delegate()
                    {
                        GameFacade.Instance.RetrieveMediator <ToolbarMediator>().NavigationBar.ToggleWindow(GameFacade.SHOW_ROOM_PICKER_GUI, MessageSubType.PublicRooms);
                        this.Showing = false;
                        EventLogger.Log(LogGlobals.CATEGORY_MAP, LogGlobals.PUBLIC_HANGOUT_CLICKED);
                    });

                    Button shopButton = mMainWindow.SelectSingleElement <Button>("MainFrame/Shop");
                    shopButton.AddOnPressedAction(delegate()
                    {
                        this.Showing = false;
                        GameFacade.Instance.RetrieveMediator <ToolbarMediator>().NavigationBar.ToggleWindow(GameFacade.SHOP_BUTTON_CLICKED);
                        EventLogger.Log(LogGlobals.CATEGORY_MAP, LogGlobals.SHOP_CLICKED);
                    });

                    Button fashionFrenzyButton = mMainWindow.SelectSingleElement <Button>("MainFrame/FashionFrenzy");
                    fashionFrenzyButton.AddOnPressedAction(delegate()
                    {
                        this.Showing = false;
                        GameFacade.Instance.RetrieveMediator <ToolbarMediator>().NavigationBar.CloseAllWindows();
                        GameFacade.Instance.SendNotification(GameFacade.SWITCHING_TO_FASHION_MINI_GAME);
                        EventLogger.Log(LogGlobals.CATEGORY_MAP, LogGlobals.FASHION_CITY_CLICKED);
                    });
                }
            }
        }
Пример #14
0
        public NavigationBar(IGuiManager guiManager)
            : base(guiManager, mResourcePath)
        {
            mMainWindow           = (Window)this.MainGui;
            mMapButton            = mMainWindow.SelectSingleElement <Button>("MainFrame/Map");
            mFriendButton         = mMainWindow.SelectSingleElement <Button>("MainFrame/Friend");
            mRoomButton           = mMainWindow.SelectSingleElement <Button>("MainFrame/Room");
            mClosetButton         = mMainWindow.SelectSingleElement <Button>("MainFrame/Closet");
            mShopButton           = mMainWindow.SelectSingleElement <Button>("MainFrame/Shop");
            mSettingsButton       = mMainWindow.SelectSingleElement <Button>("MainFrame/Settings");
            mCurrentLocationLabel = mMainWindow.SelectSingleElement <Label>("MainFrame/CurrentLocationLabel");
            mEmoteMenuButton      = mMainWindow.SelectSingleElement <Button>("MainFrame/EmoteMenu");
            mEntourageButton      = mMainWindow.SelectSingleElement <Button>("MainFrame/Entourage");
            EmoteGuiController emoteController = new EmoteGuiController(GameFacade.Instance.RetrieveMediator <RuntimeGuiManager>());

            // Hide these until they are implemented
            mFriendButton.Showing   = false;
            mSettingsButton.Showing = false;

            mEntourageButton.AddOnPressedAction(delegate()
            {
                ToggleWindow(GameFacade.SHOW_ENTOURAGE);
                EventLogger.Log(LogGlobals.CATEGORY_GUI, LogGlobals.ENTOURAGE_BUTTON);
            });

            mRoomButton.AddOnPressedAction(delegate()
            {
                ToggleWindow(GameFacade.TOGGLE_ROOM_PICKER_GUI, MessageSubType.PublicRooms);
                EventLogger.Log(LogGlobals.CATEGORY_GUI, LogGlobals.ROOM_BUTTON);
            });

            mFriendButton.AddOnPressedAction(delegate()
            {
                ToggleWindow(GameFacade.FRIEND_BUTTON_CLICKED);
                EventLogger.Log(LogGlobals.CATEGORY_GUI, LogGlobals.FRIEND_BUTTON);
            });

            mClosetButton.AddOnPressedAction(delegate()
            {
                ToggleWindow(GameFacade.CLOSET_BUTTON_CLICKED);
                EventLogger.Log(LogGlobals.CATEGORY_GUI, LogGlobals.CLOSET_BUTTON);
            });

            mShopButton.AddOnPressedAction(delegate()
            {
                ToggleWindow(GameFacade.SHOP_BUTTON_CLICKED);
                EventLogger.Log(LogGlobals.CATEGORY_GUI, LogGlobals.SHOP_BUTTON);
            });

            mSettingsButton.AddOnPressedAction(delegate()
            {
                ToggleWindow(GameFacade.SETTINGS_BUTTON_CLICKED);
                EventLogger.Log(LogGlobals.CATEGORY_GUI, LogGlobals.SETTINGS_BUTTON);
            });
            mCurrentLocationLabel.Text = string.Empty;

            mMapButton.AddOnPressedAction(delegate()
            {
                ToggleWindow(GameFacade.MAP_BUTTON_CLICKED);
                EventLogger.Log(LogGlobals.CATEGORY_GUI, LogGlobals.MAP_BUTTON);
            });

            mEmoteMenuButton.AddOnPressedAction(delegate()
            {
                emoteController.ToggleOpen();
            });

            // Load chat bar
            IInputManager inputManager = GameFacade.Instance.RetrieveMediator <InputManagerMediator>();
            ChatMediator  chatMediator = GameFacade.Instance.RetrieveMediator <ChatMediator>();

            mChatWindow             = new ChatWindow(inputManager, mMainWindow.SelectSingleElement <IGuiFrame>("MainFrame/ChatBar"));
            chatMediator.ChatWindow = mChatWindow;
        }