Beispiel #1
0
        // -------------------------------------------

        /*
         * OnJoinRoom
         */
        private void OnJoinRoom()
        {
            if (!m_filledList)
            {
                // JOIN ROOM IN LOBBY
#if ENABLE_BALANCE_LOADER
                UIEventController.Instance.DelayUIEvent(MenuScreenController.EVENT_MENUEVENTCONTROLLER_SHOW_LOADING_MESSAGE, 0.1f);
                CommsHTTPConfiguration.GetListRooms(true, "PLAYER_LOBBY");
#else
                if (m_nameRoom != null)
                {
                    LoadRooms(NetworkEventController.Instance.RoomsLobby, m_nameRoom.text);
                }
                else
                {
                    LoadRooms(NetworkEventController.Instance.RoomsLobby);
                }
#endif
                m_joinRoom.gameObject.SetActive(false);
            }
            else
            {
                ItemLobbyRoomView roomSelected = null;
                for (int i = 0; i < m_rooms.Count; i++)
                {
                    if (m_rooms[i].Selected)
                    {
                        roomSelected = m_rooms[i];
                    }
                }

                if (roomSelected != null)
                {
                    PlayerPrefs.SetString(ScreenCreateRoomView.PLAYERPREFS_YNT_ROOMNAME, roomSelected.DisplayName);
                    NetworkEventController.Instance.MenuController_SaveRoomNumberInServer(roomSelected.Room);
                    NetworkEventController.Instance.MenuController_SaveRoomNameInServer(roomSelected.DisplayName);
                    NetworkEventController.Instance.MenuController_SetNameRoomLobby(roomSelected.DisplayName);
                    MenuScreenController.Instance.ExtraData = roomSelected.ExtraData;

                    // JOIN ROOM IN LOBBY
#if ENABLE_BALANCE_LOADER
                    NetworkEventController.Instance.MenuController_SaveIPAddressServer(roomSelected.IPAddress);
                    NetworkEventController.Instance.MenuController_SavePortServer(roomSelected.Port);
#endif
                    JoinGamePressed();
                }
                else
                {
                    UIEventController.Instance.DispatchUIEvent(UIEventController.EVENT_SCREENMANAGER_OPEN_INFORMATION_SCREEN, ScreenInformationView.SCREEN_INFORMATION, UIScreenTypePreviousAction.KEEP_CURRENT_SCREEN, LanguageController.Instance.GetText("message.warning"), LanguageController.Instance.GetText("message.you.should.select.an.item"), null, "");
                }
            }
        }
Beispiel #2
0
        // -------------------------------------------

        /*
         * OnMenuBasicEvent
         */
        protected override void OnMenuEvent(string _nameEvent, params object[] _list)
        {
            base.OnMenuEvent(_nameEvent, _list);

            if (_nameEvent == ItemLobbyRoomView.EVENT_ITEM_ROOM_LOBBY_SELECTED)
            {
                ItemLobbyRoomView itemLobbyRoomView = (ItemLobbyRoomView)_list[0];
                for (int i = 0; i < m_rooms.Count; i++)
                {
                    if (m_rooms[i] == itemLobbyRoomView)
                    {
                        m_rooms[i].Selected = true;
                        m_buttonText.text   = LanguageController.Instance.GetText("screen.lobby.join.the.selected.room");
                        m_joinRoom.gameObject.SetActive(true);
                        if (SearchIcon != null)
                        {
                            SearchIcon.SetActive(false);
                        }
                        if (JoinIcon != null)
                        {
                            JoinIcon.SetActive(true);
                        }
                        m_filledList = true;
                    }
                    else
                    {
                        m_rooms[i].Selected = false;
                    }
                }
            }
            if (_nameEvent == ClientTCPEventsController.EVENT_CLIENT_TCP_LIST_OF_GAME_ROOMS)
            {
                if (m_nameRoom != null)
                {
                    LoadRooms(NetworkEventController.Instance.RoomsLobby, m_nameRoom.text);
                }
                else
                {
                    LoadRooms(NetworkEventController.Instance.RoomsLobby);
                }
            }
            if (_nameEvent == MenuScreenController.EVENT_MENUEVENTCONTROLLER_SHOW_LOADING_MESSAGE)
            {
                UIEventController.Instance.DispatchUIEvent(UIEventController.EVENT_SCREENMANAGER_OPEN_GENERIC_SCREEN, ScreenLoadingView.SCREEN_NAME, UIScreenTypePreviousAction.KEEP_CURRENT_SCREEN, false, null);
            }
            if (_nameEvent == GetListRoomsHTTP.EVENT_CLIENT_HTTP_LIST_OF_GAME_ROOMS)
            {
                UIEventController.Instance.DispatchUIEvent(MenuScreenController.EVENT_FORCE_DESTRUCTION_POPUP);
                if (_list.Length == 1)
                {
                    if (m_nameRoom != null)
                    {
                        LoadRooms((List <ItemMultiTextEntry>)_list[0], m_nameRoom.text);
                    }
                    else
                    {
                        LoadRooms((List <ItemMultiTextEntry>)_list[0]);
                    }
                }
                else
                {
                    UIEventController.Instance.DispatchUIEvent(UIEventController.EVENT_SCREENMANAGER_OPEN_INFORMATION_SCREEN, ScreenInformationView.SCREEN_INFORMATION, UIScreenTypePreviousAction.KEEP_CURRENT_SCREEN, LanguageController.Instance.GetText("message.error"), LanguageController.Instance.GetText("screen.room.list.not.retrieved"), null, "");
                }
            }
        }