Inheritance: MonoBehaviour
コード例 #1
0
    public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matchList)
    {
        status.text = "";

        if (!success || matchList == null)
        {
            status.text = "Couldn't get room list.";
            return;
        }

        foreach (MatchInfoSnapshot match in matchList)
        {
            GameObject roomListItemGo = Instantiate(roomListItemPrefab);
            roomListItemGo.transform.SetParent(roomListParent);

            RoomListItem roomListItem = roomListItemGo.GetComponent <RoomListItem>();

            if (roomListItem != null)
            {
                roomListItem.Setup(match, JoinRoom);
            }

            // as well as setting up a callback function that will join the game.

            roomList.Add(roomListItemGo);
        }

        if (roomList.Count == 0)
        {
            status.text = "No room at the moment";
        }
    }
コード例 #2
0
 public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matches)
 {
     status.text = "";
     if (!success)
     {
         status.text = "Couldn't get room list.";
         return;
     }
     ClearRoomList();
     foreach (MatchInfoSnapshot match in matches)
     {
         GameObject _roomListItemGameObject = Instantiate <GameObject>(roomListItemPrefab);
         _roomListItemGameObject.transform.SetParent(roomListParent);
         // component to set up name/userCount + join game callback function.
         RoomListItem _roomListItem = _roomListItemGameObject.GetComponent <RoomListItem>();
         if (_roomListItem != null)
         {
             _roomListItem.Setup(match, JoinRoom);
         }
         roomList.Add(_roomListItemGameObject);
     }
     if (roomList.Count == 0)
     {
         status.text = "No rooms available.";
     }
 }
コード例 #3
0
    public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matchList)
    {
        status.text = "";

        if (matchList == null)
        {
            status.text = "Couldn't get room list.";
            return;
        }

        foreach (MatchInfoSnapshot match in matchList)
        {
            GameObject _roomListItemGO = Instantiate(roomListItemPrefab);
            _roomListItemGO.transform.SetParent(roomListParent);

            RoomListItem _roomListItem = _roomListItemGO.GetComponent <RoomListItem>();
            if (_roomListItem != null)
            {
                _roomListItem.Setup(match, JoinRoom);
            }
            // that will take care of setting up the name/amount of users
            // as well as setting up a callback function that will join the game.

            roomList.Add(_roomListItemGO);
        }

        // if we have no rooms to join we give a new text value
        if (roomList.Count == 0)
        {
            status.text = "No rooms at the moment..";
        }
    }
コード例 #4
0
    public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matchList)
    {
        base.OnMatchList(success, extendedInfo, matchList);
        status.text = "";
        if (matchList == null)
        {
            status.text = "Could not get matches.";
            return;
        }
        ClearRoomList();
        for (int m = 0; m < matchList.Count; m++)
        {
            GameObject _roomListItemGO = Instantiate(roomListItemPrefab);
            _roomListItemGO.transform.SetParent(roomListParent);

            RoomListItem _roomListItem = _roomListItemGO.GetComponent <RoomListItem>();
            if (_roomListItem != null)
            {
                _roomListItem.Setup(matchList[m], JoinRoom);
            }

            roomList.Add(_roomListItemGO);
        }
        if (roomList.Count == 0)
        {
            status.text = "No matches found.";
        }
    }
コード例 #5
0
        public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matches)
        {
            status.text = "";
            if (roomList == null)
            {
                status.text = "Couldn't get room list";
                return;
            }

            foreach (MatchInfoSnapshot item in matches)
            {
                GameObject roomListItemGO = Instantiate(roomListItemPrefab);
                roomListItemGO.transform.SetParent(roomListParent);
                RoomListItem _roomListItem = roomListItemGO.GetComponent <RoomListItem>();
                if (_roomListItem != null)
                {
                    _roomListItem.Setup(item, JoinRoom);
                }
                roomList.Add(roomListItemGO);
            }

            if (roomList.Count == 0)
            {
                status.text = "No rooms at the moment";
            }
        }
コード例 #6
0
    public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matches)
    {
        status.text = "";

        if (!success || matches == null)
        {
            status.text = "Couldn't get room list.";
            return;
        }

        for (int i = 0; i < matches.Count; i++)
        {
            GameObject roomListItemGO = Instantiate(roomListItemPrefab);
            roomListItemGO.transform.SetParent(roomListParent);

            // 룸 리스트 아이템에 셋업
            RoomListItem roomListItem = roomListItemGO.GetComponent <RoomListItem>();

            if (roomListItem != null)
            {
                roomListItem.Setup(matches[i], JoinRoom);
            }

            //룸 리스트에 아이템 추가
            roomList.Add(roomListItemGO);
        }

        if (roomList.Count == 0)
        {
            status.text = "No room at the moment.";
        }
    }
コード例 #7
0
ファイル: JoinGame.cs プロジェクト: savi30/SmallWorldsTanks
    public void OnMatchList(bool success, string info, List <MatchInfoSnapshot> matches)
    {
        status.text = "";
        if (matches == null)
        {
            status.text = "Network Error";
            return;
        }

        if (matches.Count == 0)
        {
            status.text = "No rooms found";
        }

        ClearRoomList();
        foreach (var match in matches)
        {
            GameObject _roomListItemGO = Instantiate(roomListItemPrefab, roomListParent);

            RoomListItem roomListItem = _roomListItemGO.GetComponent <RoomListItem>();
            if (roomListItem != null)
            {
                roomListItem.Setup(match, JoinRoom);
            }

            rooms.Add(_roomListItemGO);
        }
    }
コード例 #8
0
ファイル: JoinGame.cs プロジェクト: dmenear/multiplayer-fps
    public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matchList)
    {
        status.text = "";
        if (!success)
        {
            status.text = "Failed to get list.";
            return;
        }

        foreach (MatchInfoSnapshot match in matchList)
        {
            GameObject roomListItem = Instantiate(roomListItemPrefab);
            roomListItem.transform.SetParent(roomListParent);
            RoomListItem rli = roomListItem.GetComponent <RoomListItem>();
            if (rli != null)
            {
                rli.Setup(match, JoinRoom);
            }
            roomList.Add(roomListItem);
        }

        if (roomList.Count == 0)
        {
            status.text = "No online servers found.";
        }
    }
コード例 #9
0
    public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matchList)
    {
        status.text = "";

        if (!success || matchList == null)
        {
            status.text = "No matches found";
            return;
        }
        ClearRoomList();


        foreach (MatchInfoSnapshot match in matchList)
        {
            GameObject _roomlistItemGO = Instantiate(roomListItemPrefab);
            _roomlistItemGO.transform.SetParent(roomListParent);

            RoomListItem _roomListItem = _roomlistItemGO.GetComponent <RoomListItem>();
            if (_roomListItem != null)
            {
                _roomListItem.Setup(match, JoinRoom);
            }

            //have a components sit on gameobject to take care of settings up the name/amout of users and set callback to join the game
            roomList.Add(_roomlistItemGO);
        }
        if (roomList.Count == 0)
        {
            status.text = "No matches currently available";
        }
    }
コード例 #10
0
    public void GetRoomLIst()
    {
        RoomInfo[] roomInfos = PhotonNetwork.GetRoomList();
        //Debug.Log(roomInfos.Length);

        for (int i = 0; i < roomInfos.Length; i++)
        {
            if (m_roomItemPrefab == null)
            {
                return;
            }
            if (m_roomListParent == null)
            {
                return;
            }

            GameObject roomItemgo = Instantiate(m_roomItemPrefab, m_roomListParent.transform);
            roomItemgo.name = m_roomItemPrefab.name + i + 1;

            RoomListItem item = roomItemgo.GetComponent <RoomListItem>();
            if (item == null)
            {
                Destroy(roomItemgo);
                return;
            }

            item.InitRoomListItem(roomInfos[i].Name, roomInfos[i].PlayerCount, roomInfos[i].MaxPlayers);
        }
    }
コード例 #11
0
ファイル: JoinGame.cs プロジェクト: ClayMStamper/Flux-Battle
    public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matches)
    {
        status.text = "";

        if (matches == null)
        {
            status.text = "Couldn't get room list";
            return;
        }

        for (int i = 0; i < matches.Count; i++)
        {
            GameObject roomListItemGameObject = Instantiate(roomListItemPrefab) as GameObject;
            roomListItemGameObject.transform.SetParent(roomListParent);

            roomList.Add(roomListItemGameObject);

            RoomListItem roomListItem = roomListItemGameObject.GetComponent <RoomListItem>();
            if (roomListItem != null)
            {
                roomListItem.Setup(matches[i], JoinRoom);
            }
            else
            {
                Debug.LogError("RoomListItem component = null");
            }
        }

        if (roomList.Count == 0)
        {
            status.text = "No rooms available";
        }
    }
コード例 #12
0
    public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matchList)
    {
        status.text = "";

        if (!success || matchList == null)
        {
            status.text = "No se pueden obtener salas.";
            return;
        }

        foreach (MatchInfoSnapshot match in matchList)
        {
            GameObject _roomListItemGO = Instantiate(roomListItemPrefab);
            _roomListItemGO.transform.SetParent(roomListParent);

            RoomListItem _roomListItem = _roomListItemGO.GetComponent <RoomListItem>();
            if (_roomListItem != null)
            {
                _roomListItem.Setup(match, JoinRoom);
            }


            // as well as setting up a callback function that will join the game.

            roomList.Add(_roomListItemGO);
        }

        if (roomList.Count == 0)
        {
            status.text = "No hay partidas en este momento..";
        }
    }
コード例 #13
0
        async Task updateRoomInfo(RoomInfo roomInfo)
        {
            RoomInfo newRoomInfo = await client.checkRoomInfo(roomInfo);

            if (newRoomInfo != null)
            {
                int index = _LANRoomList.FindIndex(r => r.isSameRoom(roomInfo));
                if (index >= -1)
                {
                    _LANRoomList[index] = newRoomInfo;
                    RoomList     list = ui.NetworkingPageGroup.LANPanel.RoomScrollView.RoomList;
                    RoomListItem item = list.getItems()[index];
                    refreshRoomListItem(item, newRoomInfo);
                }
            }
            else
            {
                int index = _LANRoomList.FindIndex(r => r.isSameRoom(roomInfo));
                if (index > -1)
                {
                    _LANRoomList.RemoveAt(index);
                    RoomList list = ui.NetworkingPageGroup.LANPanel.RoomScrollView.RoomList;
                    list.removeItem(list.getItems()[index]);
                }
            }
        }
コード例 #14
0
    public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matchList)
    {
        status.text = "";
        if (!success || matchList == null)
        {
            status.text = "Couldn't get matches..";
            return;
        }


        // MatchDesc has been renamed to MatchInfoSnapshot.
        foreach (MatchInfoSnapshot match in matchList)
        {
            GameObject _roomListItemGO = Instantiate(roomListItemPrefab);
            _roomListItemGO.transform.SetParent(roomListParent);

            // have a component on gameobject that will take care of setting up a name/amount of users.
            RoomListItem _roomListItem = _roomListItemGO.GetComponent <RoomListItem>();
            if (_roomListItem != null)
            {
                _roomListItem.Setup(match, JoinRoom);
            }
            // as well as setting up callback function that will join a game

            roomList.Add(_roomListItemGO);
        }

        if (roomList.Count == 0)
        {
            status.text = "no rooms available...";
        }
    }
コード例 #15
0
ファイル: JoinGame.cs プロジェクト: mbecke7/FirstFps
    private void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> responseData)
    {
        status.text = "";

        if (responseData == null || !success)
        {
            status.text = "Couldn't get room list.";
            return;
        }

        ClearRoomList();

        foreach (MatchInfoSnapshot matchInfo in responseData)
        {
            GameObject _roomListItemGO = Instantiate(roomListItemPrefab);
            _roomListItemGO.transform.SetParent(roomListParent);

            RoomListItem _roomListItem = _roomListItemGO.GetComponent <RoomListItem>();
            if (_roomListItem != null)
            {
                _roomListItem.Setup(matchInfo, JoinRoom);
            }
            roomList.Add(_roomListItemGO);
        }

        if (roomList.Count == 0)
        {
            status.text = "No Games Found";
        }
    }
コード例 #16
0
    public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matchList)
    {
        status.text = "";
        if (!success || matchList == null)
        {
            status.text = "Couldn't get room list.";
            return;
        }

        foreach (MatchInfoSnapshot match in matchList)
        {
            GameObject _roomListItemGO = Instantiate(roomListItemPrefab);
            _roomListItemGO.transform.SetParent(roomListParent, false);
            RoomListItem _roomListItem = _roomListItemGO.GetComponent <RoomListItem>();
            if (_roomListItem != null)
            {
                _roomListItem.Setup(match, JoinRoom);
            }

            roomList.Add(_roomListItemGO);
        }

        if (roomList.Count == 0)
        {
            status.text = "No rooms found.";
        }
    }
コード例 #17
0
    public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matchList)
    {
        status.text = "";
        if (!success || matchList == null)
        {
            status.text = "Couldn't get room list";
            return;
        }

        foreach (MatchInfoSnapshot match in matchList)
        {
            GameObject roomListItemGO = Instantiate(roomListItemPrefab);
            roomListItemGO.transform.SetParent(roomListParent);

            RoomListItem _roomListItem = roomListItemGO.GetComponent <RoomListItem>();
            if (_roomListItem != null)
            {
                _roomListItem.Setup(match, JoinRoom);
            }

            //Have a component sit on the gameobject that will take care
            //of setting up the name and amount of users as well as setting
            //up a callback function that will join the game
            roomList.Add(roomListItemGO);
        }

        if (roomList.Count == 0)
        {
            status.text = "No rooms at the moment :(";
        }
    }
コード例 #18
0
ファイル: JoinGame.cs プロジェクト: Devastor/Unity_shooter
    public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matchList)
    {
        status.text = "";

        if (success == false)        // || matchList == null)
        {
            status.text = "Couldn't connect to matchmaking, reason: " + extendedInfo + ".";
            return;
        }



        foreach (MatchInfoSnapshot match in matchList)
        {
            GameObject _roomListItemGO = Instantiate(roomListItemPrefab);
            _roomListItemGO.transform.SetParent(roomListParent);

            RoomListItem _roomListItem = _roomListItemGO.GetComponent <RoomListItem>();

            if (_roomListItem != null)
            {
                _roomListItem.Setup(match, JoinRoom);
            }

            roomList.Add(_roomListItemGO);
        }
        if (roomList.Count == 0)
        {
            status.text = "No rooms at the moment.";
        }
    }
コード例 #19
0
    public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matches)
    {
        status.text = "";

        if (matches == null)
        {
            status.text = "Couldn't get room list.";
            return;
        }

        foreach (MatchInfoSnapshot match in matches) // Note: When Brackeys says MatchDesc, use MatchInfoSnapshot.
        {
            GameObject _roomListItemGO = Instantiate(roomListItemPrefab);
            _roomListItemGO.transform.SetParent(roomListParent);

            RoomListItem _roomListItem = _roomListItemGO.GetComponent <RoomListItem>();
            if (_roomListItem != null)
            {
                _roomListItem.Setup(match, JoinRoom);
            }

            roomList.Add(_roomListItemGO);
        }

        if (roomList.Count == 0)
        {
            status.text = "No rooms at the moment.";
        }
    }
コード例 #20
0
    public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matches)
    {
        status.text = "";

        if (success)
        {
            //find the match with the minimum number of players and join that match
            foreach (MatchInfoSnapshot match in matches)
            {
                GameObject roomListItemGO = Instantiate(roomListItemPrefab, roomListParent);

                RoomListItem _roomListItem = roomListItemGO.GetComponent <RoomListItem>();
                if (_roomListItem != null)
                {
                    _roomListItem.SetMatchInfo(match, JoinRoom);
                }
                //have component sit on game object that will set name/amount of users
                //as wel as setting up callback function that will join the game.

                roomList.Add(roomListItemGO);
            }

            Debug.Log(roomList.Count);
            if (roomList.Count == 0)
            {
                status.text = "No Rooms";
            }
        }
        else
        {
            Debug.Log("Couldn't Connect to Matchmaker");
        }
    }
コード例 #21
0
ファイル: JoinGame.cs プロジェクト: raynerlrh/DRAGONZ
    public void OnMatchList(ListMatchResponse matchList)
    {
        status.text = "";

        if (matchList == null)
        {
            status.text = "No rooms found";
            return;
        }

        foreach (MatchDesc match in matchList.matches)
        {
            GameObject _roomListItemGO = Instantiate(roomListItemPrefab);
            _roomListItemGO.transform.SetParent(roomListParent);

            RoomListItem _roomListItem = _roomListItemGO.GetComponent <RoomListItem>();
            if (_roomListItem != null)
            {
                _roomListItem.Setup(match, JoinRoom);
            }

            roomList.Add(_roomListItemGO);
        }

        if (roomList.Count == 0)
        {
            status.text = "0 rooms";
        }
    }
コード例 #22
0
 public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matches)
 {
     status.text = "";//set text
     if (matches == null)
     {
         status.text = "couldn't get room list."; // if there are no mathces set text and return
         return;
     }
     ClearRoomList();
     foreach (MatchInfoSnapshot match in matches)                             // for each match in matches list
     {
         GameObject roomListItem = Instantiate(RoomListItemPrefab);           //Instantiate the button for the room
         roomListItem.transform.SetParent(RoomListParent);                    //set the parent for the instanciated object
         RoomListItem _RoomList = roomListItem.GetComponent <RoomListItem>(); //assing the script componect from the Instantiated object
         if (_RoomList != null)
         {
             _RoomList.SetUp(match, JoinRoom); //call the setup function from the room list script and send the currennt match and the join room function
         }
         RoomList.Add(roomListItem);           //add the Instantiated object to a list of rooms
     }
     if (RoomList.Count == 0)
     {
         status.text = "No Rooms Available"; // if no rooms set text
     }
 }
コード例 #23
0
    public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matches)
    {
        status.text = ""; //deletes the text in status.text
        if (!success || matches == null)
        {
            status.text = "Couldn't get room list.";
            return;
        }


        foreach (MatchInfoSnapshot match in matches)//Loop to add new elements based on descriptions found in "matches"
        {
            GameObject _roomListItemGO = Instantiate(roomListItemPrefab);
            _roomListItemGO.transform.SetParent(roomListParent);                        //Parent it to the room list parent
            RoomListItem _roomListItem = _roomListItemGO.GetComponent <RoomListItem>(); //Space to have a component sit on the gameobject that will take care of setting up the name/amount of users
            //as well as setting up a callback function that will join the game.
            if (_roomListItem != null)
            {
                _roomListItem.Setup(match, JoinRoom);
            }

            roomList.Add(_roomListItemGO);
        }

        if (roomList.Count == 0)
        {
            status.text = "No rooms at the moment.";
        }
    }
コード例 #24
0
ファイル: JoinGame.cs プロジェクト: jinasakura/MultiplayerFPS
    private void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matchList)
    {
        //throw new NotImplementedException();
        status.text = "";
        if (!success || matchList == null)
        {
            status.text = "Couldn't get Room List";
            return;
        }

        ClearRoomList();
        foreach (MatchInfoSnapshot item in matchList)
        {
            GameObject _roomListItemGO = Instantiate(roomListItemPrefab);
            _roomListItemGO.transform.SetParent(roomListParent);

            RoomListItem _roomListItem = _roomListItemGO.GetComponent <RoomListItem>();
            if (_roomListItem != null)
            {
                _roomListItem.Setup(item, JoinRoom);
            }

            //as well as setting up a callback function that will join the game.

            roomList.Add(_roomListItemGO);
        }

        if (roomList.Count == 0)
        {
            status.text = "No room at the moment.";
        }
    }
コード例 #25
0
    public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matchList)
    {
        status.text = "";
        if (matchList == null)
        {
            status.text = "coulnd't get room list.";
            return;
        }

        foreach (MatchInfoSnapshot match in matchList)
        {
            GameObject _roomListItemGO = Instantiate(RoomListItemPrefab);
            _roomListItemGO.transform.SetParent(RoomListParent);

            //_roomListItem is an script that i added in the _roomListItemGO prefab and that deals with writing the name of the room and the current players.
            RoomListItem _roomListItem = _roomListItemGO.GetComponent <RoomListItem>();
            if (_roomListItem != null)
            {
                _roomListItem.Setup(match, JoinRoom);
            }
            //Setting up a callback function that will be called from the _roomListItemGO._roomListItem script joinGame.



            roomList.Add(_roomListItemGO);
        }
        if (roomList.Count == 0)
        {
            status.text = "No rooms available at the moment";
        }
    }
コード例 #26
0
    public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matchList)
    {
        status.text = "";

        if (matchList == null)
        {
            status.text = "Unable to find rooms.";
            return;
        }

        foreach (MatchInfoSnapshot matchInfo in matchList)
        {
            GameObject roomListItemGO = Instantiate(roomListItemPrefab);
            roomListItemGO.transform.SetParent(roomListParent);

            RoomListItem listItem = (RoomListItem)roomListItemGO.GetComponent <RoomListItem>();

            if (listItem != null)
            {
                listItem.Setup(matchInfo, JoinRoom);
            }

            roomList.Add(roomListItemGO);
        }

        if (roomList.Count == 0)
        {
            status.text = "No room available.";
        }
    }
コード例 #27
0
    public void OnMatchList(bool sucess, string extendedInfo, List <MatchInfoSnapshot> matchList)
    {
        status.text = "";
        if (matchList == null)
        {
            status.text = "couldn't get match list.";
            return;
        }



        foreach (MatchInfoSnapshot match in matchList)
        {
            GameObject _roomListItemGo = Instantiate(roomListItemPrefab);
            _roomListItemGo.transform.SetParent(roomListParent);
            _roomListItemGo.transform.localScale = new Vector3(1, 1, 1);

            RoomListItem _roomListItem = _roomListItemGo.GetComponent <RoomListItem>();

            if (_roomListItem != null)
            {
                _roomListItem.Setup(match, JoinRoom);
            }

            roomList.Add(_roomListItemGo);
        }

        if (roomList.Count == 0)
        {
            status.text = "No rooms available";
        }
    }
コード例 #28
0
    public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matchList)
    {
        Debug.Log("OnMatchList");

        textWarning.text = "";

        if (!success || matchList == null)
        {
            textWarning.text = "Couldn't get room list.";

            return;
        }

        foreach (MatchInfoSnapshot match in matchList)
        {
            GameObject _roomListItemGO = Instantiate(roomListItemPrefab);

            _roomListItemGO.transform.SetParent(roomListParent);

            RoomListItem _roomListItem = _roomListItemGO.GetComponent <RoomListItem>();

            if (_roomListItem != null)
            {
                _roomListItem.Setup(match, ReadyToSelectCharacter);
            }

            roomList.Add(_roomListItemGO);
        }

        if (roomList.Count == 0)
        {
            textWarning.text = "No rooms at the moment.";
        }
    }
コード例 #29
0
    public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matches)
    {
        if (matches.Count == 0)
        {
            status.text = "No matches found";
            return;
        }

        ClearRoomList();
        foreach (MatchInfoSnapshot match in matches)
        {
            //dont need to set position due to scroll view doing it for us
            GameObject _roomListItemGameObject = Instantiate(roomListItemPrefab);
            _roomListItemGameObject.transform.SetParent(roomListParent);

            RoomListItem _roomListItem = _roomListItemGameObject.GetComponent <RoomListItem>();
            if (_roomListItem != null)
            {
                _roomListItem.Setup(match, JoinRoom);
            }
            //component sitting on gameobject that handles name/room size and a callback function for joining
            roomList.Add(_roomListItemGameObject);
        }

        if (roomList.Count == 0)
        {
            status.text = "No matches found";
        }
    }
コード例 #30
0
ファイル: JoinGame.cs プロジェクト: h35765469/FunWar
    private void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> responseData)
    {
        status.text = "";

        if (!success || responseData == null)
        {
            status.text = "Couldn`t get matches";
            return;
        }

        foreach (MatchInfoSnapshot match in responseData)
        {
            GameObject _roomListItemGameObject = Instantiate(roomListItemPrefab);
            _roomListItemGameObject.transform.SetParent(roomListParent);

            RoomListItem roomListItem = _roomListItemGameObject.GetComponent <RoomListItem>();
            if (roomListItem != null)
            {
                roomListItem.Setup(match, JoinRoom);
            }

            roomList.Add(_roomListItemGameObject);
        }

        if (roomList.Count == 0)
        {
            status.text = "No rooms at the moment";
        }
    }
コード例 #31
0
 public void Select(RoomListItem room)
 {
     this.SelectedRoom = room;
 }
コード例 #32
0
 public void Deselect(RoomListItem caller)
 {
     if (this.SelectedRoom == caller)
         { this.SelectedRoom = null; }
 }