Пример #1
0
        public RoomPickerGui(IGuiManager guiManager, System.Action <RoomType> sendSwitchingToRoomTypeNotification)
            : base(guiManager, mResourcePath)
        {
            mSendSwitchingToRoomTypeNotification = sendSwitchingToRoomTypeNotification;
            foreach (IGuiElement element in this.AllElements)
            {
                if (element.Name == "RoomPickerGui" && element is Window)
                {
                    mMainWindow = (Window)element;
                    mMainWindow.OnShowing(OnShowingCallback);

                    mTitleLabel = mMainWindow.SelectSingleElement <Label>("MainFrame/RoomListingsFrame/TitleBarLabel");
                    //we're going to initially display the client's rooms so the "My Rooms" title should be displayed first
                    mTitleLabel.Text = Translation.ROOM_PICKER_MY_ROOMS;

                    Button closeButton = mMainWindow.SelectSingleElement <Button>("MainFrame/RoomListingsFrame/CancelButton");
                    closeButton.AddOnPressedAction(
                        delegate()
                    {
                        mMainWindow.Showing = false;
                    }
                        );

                    //setup the buttons for displaying the various types of rooms
                    Button clientOwnedRoomsButton   = mMainWindow.SelectSingleElement <Button>("MainFrame/RoomListingButtons/ClientOwnedRoomsButton");
                    Button friendsRoomsButton       = mMainWindow.SelectSingleElement <Button>("MainFrame/RoomListingButtons/FriendsRoomsButton");
                    Button hangoutPublicRoomsButton = mMainWindow.SelectSingleElement <Button>("MainFrame/RoomListingButtons/HangoutPublicRoomsButton");

                    clientOwnedRoomsButton.AddOnPressedAction
                    (
                        delegate()
                    {
                        ClearRoomsWindow();
                        UpdateWindowTitleLabel(MessageSubType.ClientOwnedRooms);
                        RoomAPICommands.RequestRoomsFromServer(MessageSubType.ClientOwnedRooms);
                        mCurrentRoomRequestType = MessageSubType.ClientOwnedRooms;
                    }
                    );
                    friendsRoomsButton.AddOnPressedAction
                    (
                        delegate()
                    {
                        ClearRoomsWindow();
                        UpdateWindowTitleLabel(MessageSubType.FriendsRooms);
                        RoomAPICommands.RequestRoomsFromServer(MessageSubType.FriendsRooms);
                        mCurrentRoomRequestType = MessageSubType.FriendsRooms;
                    }
                    );
                    hangoutPublicRoomsButton.AddOnPressedAction
                    (
                        delegate()
                    {
                        ClearRoomsWindow();
                        UpdateWindowTitleLabel(MessageSubType.PublicRooms);
                        RoomAPICommands.RequestRoomsFromServer(MessageSubType.PublicRooms);
                        mCurrentRoomRequestType = MessageSubType.PublicRooms;
                    }
                    );

                    //set up the grid view / scroll area where the rooms are listed
                    mRoomListScrollFrame       = mMainWindow.SelectSingleElement <IGuiFrame>("MainFrame/RoomListingsFrame/RoomListScrollFrame");
                    mRoomListingPrototypeFrame = mMainWindow.SelectSingleElement <IGuiFrame>("MainFrame/RoomListingsFrame/RoomListScrollFrame/RoomListingPrototypeFrame");
                    mRoomListScrollFrame.RemoveChildWidget(mRoomListingPrototypeFrame);
                }
            }
        }
Пример #2
0
 public void RequestRooms(MessageSubType roomRequestType)
 {
     RoomAPICommands.RequestRoomsFromServer(roomRequestType);
     UpdateWindowTitleLabel(roomRequestType);
     ClearRoomsWindow();
 }