Ejemplo 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();
    }
Ejemplo n.º 2
0
    public void OnHostChanged(MonobitPlayer newHost)
    {
        // 新しくホストになったプレイヤーが自分で無ければ処理は不要
        if (!MonobitNetwork.isHost)
        {
            return;
        }

        // ホストに変更があったのでプレイヤーの情報を更新する
        int length = m_PlayerInfos.Length;

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

            plyaerInfo.InfoUpdate();
        }

        Hashtable playerCustomParam = MonobitNetwork.player.customParameters;

        playerCustomParam["ready"] = true;
        MonobitNetwork.SetPlayerCustomParameters(playerCustomParam);

        string startButtonText = MonobitNetwork.isHost ? "Start" : "Ready";

        m_Start.transform.Find("Text").GetComponent <Text>().text = startButtonText;
    }
Ejemplo n.º 3
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();
    }
Ejemplo n.º 4
0
    public void OnMonobitPlayerParametersChanged(object[] playerAndUpdatedParameters)
    {
        MonobitPlayer monobitPlayer = (MonobitPlayer)playerAndUpdatedParameters[0];
        Hashtable     playerParams  = (Hashtable)playerAndUpdatedParameters[1];

        int length = m_PlayerInfos.Length;

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

            if (plyaerInfo.ID != monobitPlayer.ID)
            {
                continue;
            }

            plyaerInfo.InfoUpdate();

            break;
        }
    }