Наследование: ResponseBase
Пример #1
0
        void JoinMatch(NetworkID networkID, LobbyManager lobbyManager, MatchDesc match) {
			lobbyManager.DisplayIsConnecting ();
			lobbyManager.matchMaker.JoinMatch (networkID, "", lobbyManager.OnMatchJoined);
			lobbyManager.currentMatchValue = Int32.Parse(match.name.Split(' ')[match.name.Split(' ').Length-1]);
			lobbyManager.backDelegate = lobbyManager.QuitLobbyToMenu;
			lobbyManager.isMatchmaking = true;
		}
Пример #2
0
 public void setText(UnityEngine.Networking.Match.MatchDesc pDesc)
 {
     transform.GetChild (0).GetComponent<Text> ().text =
       "Name: " + pDesc.name +
     " Size: " + pDesc.currentSize + '/' + pDesc.maxSize;
     desc = pDesc;
 }
Пример #3
0
    //End void Start()
    //--------------------------------------------------------------------------------------------------------------------
    //Name:     matchResponse
    //Description:  Called once server has returned a list of available matches then displays them in the lobbies viewport
    //Parameters: UnityEngine.Networking.Match.ListmatchResponse matches
    //Returns:    NA
    //--------------------------------------------------------------------------------------------------------------------
    public void matchResponse(UnityEngine.Networking.Match.ListMatchResponse matches)
    {
        descriptions = matches.matches.ToArray ();

        //Remove any children currently present
        for (int i = 0; i < viewPort.transform.childCount; i++)
          Destroy (viewPort.transform.GetChild (i).gameObject);

        //Populate new list with the match options.
        for (int i = 0; i < descriptions.Length; i++) {
          GameObject content = GameObject.Instantiate (matchContent);
          content.transform.SetParent (viewPort.transform);
          RectTransform rect = content.GetComponent<RectTransform> ();
          rect.offsetMin = new Vector2 (0, -67 - 67 * i);
          rect.offsetMax = new Vector2 (1, -67 * i);
          content.transform.localScale = new Vector3 (1, 1, 1);

          content.GetComponent<MatchContent> ().setText (descriptions [i]);

          content.GetComponent<Button> ().onClick.AddListener (delegate {
        SelectedMatch = content.GetComponent<MatchContent> ().getDesctription ();
          });

        } //End for(int i = 0; i < descriptions.Length; i ++)
    }
 public void JoinGame(MatchDesc matchDescription = null)
 {
     if(isMatchmakingEnabled && matchDescription != null) //matchmaker
     {
         matchMaker.JoinMatch(matchDescription.networkId, "", OnMatchJoined);
     } else { //lan start client
         StartClient();
     }
 }
Пример #5
0
    public void JoinMatch(MatchDesc match)
    {
        JoinMatchRequest request = new JoinMatchRequest();
        request.appId = EloConfig.PROGRAM_APP_ID;
        request.projectId = EloConfig.CLOUD_PROJECT_ID;
        request.networkId = match.networkId;
        request.domain = 0;
        request.password = "";

        NetworkManager.singleton.matchMaker.JoinMatch(request, OnMatchJoined);
    }
        public void Populate(MatchDesc match, NetworkManager networkManager, Color c)
        {
            serverInfoText.text = match.name;

            slotInfo.text = match.currentSize.ToString() + "/" + match.maxSize.ToString(); ;

            NetworkID networkID = match.networkId;

            joinButton.onClick.RemoveAllListeners();
            joinButton.onClick.AddListener(() => { JoinMatch(networkID, networkManager); });
        }
Пример #7
0
 protected override void BeforeShow()
 {
     if(NetworkManager.singleton.matches == null)
         return;
     foreach(MatchDesc m in NetworkManager.singleton.matches){
         GameRow gameRow = Instantiate<GameRow>(gameRowPrefab);
         gameRow.Set (m);
         gameRow.transform.SetParent(GameListContainer);
         gameRow.button.onClick.AddListener(() => selectedMatch = m);
     }
 }
Пример #8
0
        public void Populate(MatchDesc match, LobbyManager lobbyManager, Color c)
        {
            serverInfoText.text = match.name;

            slotInfo.text = match.currentSize.ToString() + "/" + match.maxSize.ToString();

            NetworkID networkID = match.networkId;

            joinButton.onClick.RemoveAllListeners();
            joinButton.onClick.AddListener(() => { JoinMatch(networkID, lobbyManager); });

            GetComponent<Image>().color = c;
        }
Пример #9
0
 internal MatchInfoSnapshot(MatchDesc matchDesc)
 {
     this.networkId          = (NetworkID)matchDesc.networkId;
     this.hostNodeId         = matchDesc.hostNodeId;
     this.name               = matchDesc.name;
     this.averageEloScore    = matchDesc.averageEloScore;
     this.maxSize            = matchDesc.maxSize;
     this.currentSize        = matchDesc.currentSize;
     this.isPrivate          = matchDesc.isPrivate;
     this.matchAttributes    = matchDesc.matchAttributes;
     this.directConnectInfos = new List <MatchInfoSnapshot.MatchInfoDirectConnectSnapshot>();
     foreach (MatchDirectConnectInfo current in matchDesc.directConnectInfos)
     {
         this.directConnectInfos.Add(new MatchInfoSnapshot.MatchInfoDirectConnectSnapshot(current));
     }
 }
Пример #10
0
 internal MatchInfoSnapshot(MatchDesc matchDesc)
 {
     networkId          = matchDesc.networkId;
     hostNodeId         = matchDesc.hostNodeId;
     name               = matchDesc.name;
     averageEloScore    = matchDesc.averageEloScore;
     maxSize            = matchDesc.maxSize;
     currentSize        = matchDesc.currentSize;
     isPrivate          = matchDesc.isPrivate;
     matchAttributes    = matchDesc.matchAttributes;
     directConnectInfos = new List <MatchInfoDirectConnectSnapshot>();
     foreach (MatchDirectConnectInfo directConnectInfo in matchDesc.directConnectInfos)
     {
         directConnectInfos.Add(new MatchInfoDirectConnectSnapshot(directConnectInfo));
     }
 }
Пример #11
0
        //====== Server Command

        public void Amount(MatchDesc match)
        {
            MaxPlayers = match.maxSize;
        }
Пример #12
0
 private int GetVersion(MatchDesc desc)
 {
     return int.Parse(gamename.Match(desc.name).Groups[2].Value);
 }
Пример #13
0
    private GameListing ConvertListing(MatchDesc desc)
    {
        var listing = new GameListing();

        ParseName(desc.name,
                  out listing.name,
                  out listing.version,
                  out listing.count);

        listing.count = desc.currentSize;
        listing.match = desc;

        return listing;
    }
Пример #14
0
 public void Set(MatchDesc match)
 {
     gameNameText.text = match.name;
     playerCountText.text = match.currentSize.ToString() + "/" + match.maxSize.ToString();
 }
Пример #15
0
 public RoomButton(MatchDesc aRoom, Button abutton)
 {
     m_room = aRoom;
     m_button = abutton;
 }
Пример #16
0
        public void JoinRoom(MatchDesc aRoomInfo)
        {
            GameObject.Find("Version Text").transform.SetParent(null);
            GameObject.Find("FullScreen").transform.SetParent(null);
            int minLevel = 0;
            int maxLevel = 50;
            int playerLevel = GameObject.Find("BrainCloudStats").GetComponent<BrainCloudStats>().GetStats()[0].m_statValue;

            if (playerLevel < minLevel || playerLevel > maxLevel)
            {
                GameObject.Find("DialogDisplay").GetComponent<DialogDisplay>().DisplayDialog("You're not in that room's\nlevel range!");
                GameObject.Find("Version Text").transform.SetParent(GameObject.Find("Canvas").transform);
                GameObject.Find("FullScreen").transform.SetParent(GameObject.Find("Canvas").transform);
            }
            else
            {
                m_state = eMatchmakingState.GAME_STATE_JOIN_ROOM;
                try
                {
                    BombersNetworkManager.singleton.matchMaker.JoinMatch(aRoomInfo.networkId, "", OnMatchJoined);
                }
                catch (ArgumentException e)
                {
                    m_state = eMatchmakingState.GAME_STATE_SHOW_ROOMS;
                    GameObject.Find("Version Text").transform.SetParent(GameObject.Find("Canvas").transform);
                    GameObject.Find("FullScreen").transform.SetParent(GameObject.Find("Canvas").transform);
                    GameObject.Find("DialogDisplay").GetComponent<DialogDisplay>().DisplayDialog("You just left that room!");
					Debug.Log("caught ArgumentException " + e);
                }
                catch (Exception e)
                {
                    m_state = eMatchmakingState.GAME_STATE_SHOW_ROOMS;
                    GameObject.Find("Version Text").transform.SetParent(GameObject.Find("Canvas").transform);
                    GameObject.Find("FullScreen").transform.SetParent(GameObject.Find("Canvas").transform);
                    GameObject.Find("DialogDisplay").GetComponent<DialogDisplay>().DisplayDialog("Error joining room! Try restarting.");
					Debug.Log("caught Exception " + e);
                }
            }
        }
Пример #17
0
	public void OnClickBackOnJoinGameOverlay() {
		Debug.Log ("OnClickBackOnJoinGameOverlay()");
		selectedMatchDesc = null;
		onlineFindJoinGameOverlay.SetActive (false);
	}
Пример #18
0
 public MatchInfoObject(MatchDesc snapshot)
Пример #19
0
 public void JoinMatch(MatchDesc match)
 {
     networkManager.matchName = match.name;
     networkManager.matchSize = (uint)match.currentSize;
     networkManager.matchMaker.JoinMatch(match.networkId, "", networkManager.OnMatchJoined);
 }
Пример #20
0
 public void buttonClicked(MatchDesc desc)
 {
     networkMatch.JoinMatch(desc.networkId, "", OnMatchJoined);
 }
Пример #21
0
 public void JoinMatch(MatchDesc match)
 {
     //Debug.Log ("Join " + roomName);
     networkMatch.JoinMatch (match.networkId, "", OnMatchJoined);
 }
Пример #22
0
 public void SetMatch(MatchDesc info)
 {
     _myMatchDesc = info;
     _myText.text = _myMatchDesc.name;
     GetComponent<Button>().onClick.AddListener(() => JoinMatch());
 }
Пример #23
0
	public void OnClickSelectGame(MatchDesc selectedMatch) {
		Debug.Log ("OnClickSelectGame()");
		selectedMatchDesc = selectedMatch;
		onlineFindJoinGameOverlay.SetActive (true);
		onlineFindJoinGameNameText.text = selectedMatchDesc.name;
	}
Пример #24
0
 public void onRefreshClicked()
 {
     toggleWaitScreen (true, "Loading Matches");
     SelectedMatch = null;
 }
Пример #25
0
 public void Connect(MatchDesc room)
 {
     m_match.JoinMatch(room.networkId, "", OnMatchJoined);
 }