public void UpdateCurrentRoomReference(IClientDistributedRoom room) { mCurrentRoom = room; UserAccountProxy userAccountProxy = GameFacade.Instance.RetrieveProxy <UserAccountProxy>(); userAccountProxy.SetAccountProperty <RoomId>(UserAccountProperties.LastRoomId, mCurrentRoom.RoomId); }
public TutorialState(GreenScreenRoomTutorialGui tutorialGui, Action <TutorialState> tutorialStateFinishedCallback) { if (tutorialGui == null) { throw new ArgumentNullException("tutorialGui"); } mTutorialGui = tutorialGui; mTutorialStateFinishedCallback = tutorialStateFinishedCallback; mUserAccountProxy = GameFacade.Instance.RetrieveProxy <UserAccountProxy>(); }
/// <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(); } } }
/// <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); }
public GreenScreenRoomTutorialStateMachine() { IGuiManager guiManager = GameFacade.Instance.RetrieveMediator <RuntimeGuiManager>(); mUserAccountProxy = GameFacade.Instance.RetrieveProxy <UserAccountProxy>(); mTutorialGui = new GreenScreenRoomTutorialGui(guiManager, mTutorialGuiPath); mInactiveState = new InactiveState(); mMovementTutorialState = new MovementTutorialState(mTutorialGui, NextTutorial); mGoShoppingTutorialState = new GoShoppingTutorialState(mTutorialGui, RemoveTutorialFromList); mMapTutorialState = new MapTutorialState(mTutorialGui, EmptyCallback); mGetCashTutorialState = new GetCashTutorialState(mTutorialGui, RemoveTutorialFromList); mDecorateTutorialState = new DecorateTutorialState(mTutorialGui, RemoveTutorialFromList); mInactiveState.AddTransition(mGoShoppingTutorialState); mGoShoppingTutorialState.AddTransition(mInactiveState); mInactiveState.AddTransition(mMovementTutorialState); mMovementTutorialState.AddTransition(mInactiveState); mInactiveState.AddTransition(mMapTutorialState); mMapTutorialState.AddTransition(mInactiveState); mInactiveState.AddTransition(mGetCashTutorialState); mGetCashTutorialState.AddTransition(mInactiveState); mInactiveState.AddTransition(mDecorateTutorialState); mDecorateTutorialState.AddTransition(mInactiveState); this.EnterInitialState(mInactiveState); SetUpGreenScreenRoomTutorials(); mScheduler = GameFacade.Instance.RetrieveMediator <SchedulerMediator>().Scheduler; }