/// <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 SetupOverlayActionButtons(string itemId, string itemType, XmlNode assetsNode) { // Setup action buttons specific to the item type mOverlayRemoveButton.ClearOnPressedActions(); LocalAvatarEntity localAvatarEntity = GameFacade.Instance.RetrieveMediator <AvatarMediator>().LocalAvatarEntity; switch (itemType) { case ItemType.ROOM_BACKDROP: RoomManagerProxy roomManagerProxy = GameFacade.Instance.RetrieveProxy <RoomManagerProxy>(); if (roomManagerProxy.IsRoomOwner()) { ApplyImageToRoom(itemId); } else { mOverlayRemoveButton.Disable(); } break; case ItemType.TOPS: case ItemType.PANTS: case ItemType.SKIRT: case ItemType.BAGS: case ItemType.SHOES: case ItemType.MAKEUP: // Call method to apply clothing to body localAvatarEntity.ApplyTempClothingToAvatar(assetsNode); mOverlayRemoveButton.Enable(); mOverlayRemoveButton.Text = Translation.REMOVEIT; mOverlayRemoveButton.AddOnPressedAction(delegate() { //Remove clothing method. localAvatarEntity.RemoveClothingFromAvatar(assetsNode); mOverlayWindow.Showing = false; }); break; case ItemType.FACE: case ItemType.HAIR: case ItemType.BODY: // Call method to apply clothing to body localAvatarEntity.ApplyTempClothingToAvatar(assetsNode); mOverlayRemoveButton.Disable(); break; } }
public override void ExitState() { Console.WriteLine("GreenScreenRoomGameState.ExitState"); GameFacade.Instance.RemoveMediator(typeof(GreenScreenRoomStateMachine).Name); RoomManagerProxy roomManagerProxy = GameFacade.Instance.RetrieveProxy <RoomManagerProxy>(); if (roomManagerProxy != null && roomManagerProxy.CurrentRoom != null) { RoomId currentRoomId = roomManagerProxy.CurrentRoom.RoomId; RoomAPICommands.LeaveRoom(currentRoomId); } // Unregister Commands GameFacade.Instance.RemoveCommand(GameFacade.SEND_CHAT); GameFacade.Instance.RemoveCommand(GameFacade.RECV_CHAT); GameFacade.Instance.RemoveCommand(GameFacade.SEND_EMOTICON); GameFacade.Instance.RemoveCommand(GameFacade.RECV_EMOTICON); }
private IClientDistributedRoom BuildRoomDistributedObject(DistributedObjectId id, List <object> messageData) { RoomType roomType = CheckType.TryAssignType <RoomType>(messageData[2]); IClientDistributedRoom clientDistributedRoom = null; switch (roomType) { case RoomType.GreenScreenRoom: clientDistributedRoom = new ClientDistributedGreenScreenRoom(mSendMessage, id, messageData); break; case RoomType.MiniGameRoom: throw new System.Exception("we shouldn't be creating these anymore in this way!! talk to matt!"); } RoomManagerProxy roomManagerProxy = GameFacade.Instance.RetrieveProxy <RoomManagerProxy>(); roomManagerProxy.UpdateCurrentRoomReference(clientDistributedRoom); return(clientDistributedRoom); }