Ejemplo n.º 1
0
        /// <summary>
        /// Handle initial entry into the game.  Put user in a default location based on their if they are a first time user,
        /// and their entry point into the client from the web
        /// </summary>
        private void HandleInitialEntryToGame()
        {
            UserAccountProxy userAccountProxy = GameFacade.Instance.RetrieveProxy <UserAccountProxy>();
            bool             isFirstTimeUser  = false;

            Console.WriteLine("User properties " + userAccountProxy.ToString());
            if (!userAccountProxy.TryGetAccountProperty <bool>(UserAccountProperties.FirstTimeUser, ref isFirstTimeUser))
            {
                Console.WriteLine("First time user property not set, assume it our first time in");
                isFirstTimeUser = true;
            }

            ConfigManagerClient configManager = GameFacade.Instance.RetrieveProxy <ConfigManagerClient>();
            bool returnUsersStartMinigame     = configManager.GetBool("return_users_start_minigame", true);

            if (isFirstTimeUser)
            {
                ConnectionProxy connectionProxy = GameFacade.Instance.RetrieveProxy <ConnectionProxy>();
                switch (connectionProxy.WebEntryPointId)
                {
                case FunnelGlobals.PUBLIC_LOBBY:
                    RoomManagerProxy roomManager = GameFacade.Instance.RetrieveProxy <RoomManagerProxy>();
                    roomManager.JoinLastRoom();
                    break;

                case FunnelGlobals.FASHION_MINIGAME:
                    SendNotification(GameFacade.SWITCHING_TO_FASHION_MINI_GAME);
                    break;

                default:
                    throw new Exception("Unexpected entry point received: " + connectionProxy.WebEntryPointId);
                }
                // Set firstTimeUser property to false
                userAccountProxy.SetAccountProperty <bool>(UserAccountProperties.FirstTimeUser, false);
            }
            else
            {
                if (returnUsersStartMinigame)
                {
                    SendNotification(GameFacade.SWITCHING_TO_FASHION_MINI_GAME);
                }
                else
                {
                    Console.WriteLine("Not a First time user go to room");
                    // Returning user.  Go to default room
                    RoomManagerProxy roomManager = GameFacade.Instance.RetrieveProxy <RoomManagerProxy>();
                    roomManager.JoinLastRoom();
                }
            }
        }
        private void SetUpGreenScreenRoomTutorials()
        {
            bool completedTutorial = false;

            mUserAccountProxy.TryGetAccountProperty <bool>(UserAccountProperties.HasCompleteMoveTutorial, ref completedTutorial);
            if (!completedTutorial)
            {
                mTutorialsToShow.Add(mMovementTutorialState);
            }

            mUserAccountProxy.TryGetAccountProperty <bool>(UserAccountProperties.HasCompletedShoppingTutorial, ref completedTutorial);
            if (!completedTutorial)
            {
                mTutorialsToShow.Add(mGoShoppingTutorialState);
            }

            mUserAccountProxy.TryGetAccountProperty <bool>(UserAccountProperties.HasCompletedOpenMapTutorial, ref completedTutorial);
            if (!completedTutorial)
            {
                mTutorialsToShow.Add(mMapTutorialState);
            }

            mUserAccountProxy.TryGetAccountProperty <bool>(UserAccountProperties.HasCompletedDecorateTutorial, ref completedTutorial);
            completedTutorial = false;
            bool isRoomowner = GameFacade.Instance.RetrieveProxy <RoomManagerProxy>().IsRoomOwner();

            if (!completedTutorial && isRoomowner)
            {
                mTutorialsToShow.Add(mDecorateTutorialState);
            }

            //mUserAccountProxy.TryGetAccountProperty<bool>(UserAccountProperties.HasCompletedGetCashTutorial, ref completedTutorial);
            //if (!completedTutorial)
            //{
            //    mTutorialsToShow.Add(mGetCashTutorialState);
            //}
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Join last room user was in.  If user hasn't ever been in a room, put him in a default public room
        /// </summary>
        public void JoinLastRoom()
        {
            UserAccountProxy userAccountProxy = GameFacade.Instance.RetrieveProxy <UserAccountProxy>();

            RoomId lastVisitedRoom = null;

            // Try and get last room from user properties, if it doesn't exist, use the default hardcoded room
            if (!userAccountProxy.TryGetAccountProperty <RoomId>(UserAccountProperties.LastRoomId, ref lastVisitedRoom))
            {
                lastVisitedRoom = mDefaultPublicRoomId;
            }

            Console.WriteLine("Going to last visited room: " + lastVisitedRoom.ToString());
            RoomAPICommands.SwitchRoom(lastVisitedRoom, MessageSubType.ClientOwnedRooms);
            GameFacade.Instance.SendNotification(GameFacade.SWITCHING_TO_GREEN_SCREEN_ROOM);
        }