// -------------------------------------------

        /*
         * Constructor
         */
        public override void Initialize(params object[] _list)
        {
            base.Initialize(_list);

            m_root      = this.gameObject;
            m_container = m_root.transform.Find("Content");

            m_container.Find("Title").GetComponent <Text>().text = LanguageController.Instance.GetText("screen.facebook.select.invitation.to.accept");

            m_acceptInvitations = m_container.Find("Button_Accept").GetComponent <Button>();
            m_container.Find("Button_Accept/Text").GetComponent <Text>().text = LanguageController.Instance.GetText("screen.facebook.accept.invitation");
            m_acceptInvitations.onClick.AddListener(OnAcceptInvitationsPressed);

            m_buttonBack = m_container.Find("Button_Back").GetComponent <Button>();
            m_buttonBack.onClick.AddListener(BackPressed);

            m_grid = m_container.Find("ScrollList/Grid").gameObject;

            // JOIN ROOM IN FACEBOOK
#if ENABLE_BALANCE_LOADER
            UIEventController.Instance.DelayUIEvent(MenuScreenController.EVENT_MENUEVENTCONTROLLER_SHOW_LOADING_MESSAGE, 0.1f);
            CommsHTTPConfiguration.GetListRooms(false, FacebookController.Instance.Id);
#else
            LoadInvitations(ClientTCPEventsController.Instance.RoomsInvited);
#endif

            UIEventController.Instance.UIEvent += new UIEventHandler(OnMenuEvent);
        }
Example #2
0
        // -------------------------------------------

        /*
         * Will create a new room for lobby
         */
        public void MenuController_CreateNewLobbyRoom(string _nameLobby, int _finalNumberOfPlayers, string _extraData)
        {
            MultiplayerConfiguration.SaveNameRoomLobby(_nameLobby);
#if ENABLE_BALANCE_LOADER
            UIEventController.Instance.DispatchUIEvent(MenuScreenController.EVENT_MENUEVENTCONTROLLER_SHOW_LOADING_MESSAGE);
            CommsHTTPConfiguration.CreateNewRoom(true, _nameLobby, ClientTCPEventsController.GetPlayersString(_finalNumberOfPlayers), _extraData);
#else
            MenuController_CreateRoomForLobby(_nameLobby, _finalNumberOfPlayers, _extraData);
#endif
        }
Example #3
0
        // -------------------------------------------

        /*
         * Will create a new room for friends
         */
        public void MenuController_CreateNewFacebookRoom(string _friends, List <string> _friendsIDs, string _extraData)
        {
#if ENABLE_BALANCE_LOADER
            UIEventController.Instance.DispatchUIEvent(MenuScreenController.EVENT_MENUEVENTCONTROLLER_SHOW_LOADING_MESSAGE);
            MultiplayerConfiguration.SaveFriendsGame(_friends);
            MultiplayerConfiguration.SaveNumberOfPlayers(_friends.Split(',').Length);
            CommsHTTPConfiguration.CreateNewRoom(false, FacebookController.Instance.NameHuman, _friends, _extraData);
#else
            ClientTCPEventsController.Instance.CreateRoomForFriends(_friendsIDs.ToArray(), _extraData);
#endif
        }
Example #4
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, "");
                }
            }
        }
Example #5
0
        // -------------------------------------------

        /*
         * Constructor
         */
        public override void Initialize(params object[] _list)
        {
            base.Initialize(_list);

            if (_list.Length > 0)
            {
                if (_list[0] != null)
                {
                    m_screenBack = (string)_list[0];
                }
            }

            m_root      = this.gameObject;
            m_container = m_root.transform.Find("Content");

#if !ALTERNATIVE_TITLE
            m_container.Find("Title").GetComponent <Text>().text = LanguageController.Instance.GetText("message.game.title");
#else
            m_container.Find("Title").GetComponent <Text>().text = LanguageController.Instance.GetText("message.game.mobile.title");
#endif

            m_joinRoom        = m_container.Find("Button_Join").GetComponent <Button>();
            m_buttonText      = m_container.Find("Button_Join/Text").GetComponent <Text>();
            m_buttonText.text = LanguageController.Instance.GetText("screen.lobby.join.the.selected.room");
            m_joinRoom.onClick.AddListener(OnJoinRoom);

            if (m_container.Find("Button_Back") != null)
            {
                m_buttonBack = m_container.Find("Button_Back").GetComponent <Button>();
                m_buttonBack.onClick.AddListener(BackPressed);
            }

            m_grid = m_container.Find("ScrollList/Grid").gameObject;

            if (m_container.Find("RoomName") != null)
            {
                m_nameRoom = m_container.Find("RoomName").GetComponent <InputField>();
                if (m_nameRoom != null)
                {
                    m_nameRoom.onValueChanged.AddListener(OnNameRoom);
                }
            }

            if (!ENABLE_FILTERING || (m_nameRoom == null))
            {
                if (m_nameRoom != null)
                {
                    m_nameRoom.gameObject.SetActive(false);
                }
                m_joinRoom.gameObject.SetActive(true);
                if (SearchIcon != null)
                {
                    SearchIcon.SetActive(false);
                }
                if (JoinIcon != null)
                {
                    JoinIcon.SetActive(true);
                }
                m_filledList = true;

                // 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
                LoadRooms(NetworkEventController.Instance.RoomsLobby);
#endif
            }


            UIEventController.Instance.UIEvent += new UIEventHandler(OnMenuEvent);
        }