Exemplo n.º 1
0
    // 他プレイヤーが退室した際のコールバック
    private void OnOtherPlayerDisconnected(MonobitEngine.MonobitPlayer otherPlayer)
    {
        int length = m_PlayerInfos.Length;

        for (int i = 0; i < length; ++i)
        {
            PlayerInfoGUI playerInfo = m_PlayerInfos[i].GetComponent <PlayerInfoGUI>();

            if (playerInfo.ID != otherPlayer.ID)
            {
                continue;
            }
            playerInfo.Clear();
            //  m_PlayerInfos[i].SetActive(false);
            break;
        }
        var pLength = MonobitNetwork.playerList.Length;

        for (int i = 0; i < length; ++i)
        {
            PlayerInfoGUI playerInfo = m_PlayerInfos[i].GetComponent <PlayerInfoGUI>();
            if (pLength > i)
            {
                playerInfo.Set(MonobitNetwork.playerList[i]);
            }
            else
            {
                playerInfo.Clear();
            }
        }
        UpdatePlayersCount();
    }
Exemplo n.º 2
0
    // 他プレイヤーが入室した際のコールバック
    private void OnOtherPlayerConnected(MonobitEngine.MonobitPlayer newPlayer)
    {
        int length = m_PlayerInfos.Length;

        for (int i = 0; i < length; ++i)
        {
            PlayerInfoGUI playerInfo = m_PlayerInfos[i].GetComponent <PlayerInfoGUI>();
            if (playerInfo.IsEntry)
            {
                continue;
            }
            playerInfo.Set(newPlayer);
            m_PlayerInfos[i].SetActive(true);
            break;
        }
        UpdatePlayersCount();
    }