Example #1
0
    //------------------------------------------------------------------------------//

    void Start()
    {
        SoundManager.Instance().PlayBGM(1);
        NetworkManager.Instance().AddNetworkOrderMessageEventListener(this);

        for (int i = 0; i < m_playerList.Count; i++)
        {
            GameObject player = m_playerList[i];
            //서버에서 체크하기 전에 세팅 금지
            if (i + 2 == GameManager.Instance().PLAYER.NETWORK_INDEX)
            {
                // 나다
                Image wait = GetProfileWait(player);
                if (wait != null)
                {
                    wait.enabled = false;
                }


                GetProfileHide(player).enabled = false;
                GetProfileName(player).text    = GameManager.Instance().PLAYER.USER_NAME;

                SetPlayerStatus(player, 0, GameManager.Instance().PLAYER.STATUS.STAT_SPEED);
                SetPlayerStatus(player, 1, GameManager.Instance().PLAYER.STATUS.STAT_POWER);
                SetPlayerStatus(player, 2, GameManager.Instance().PLAYER.STATUS.STAT_REPAIR);
            }
            else
            {
                Image wait = GetProfileWait(player);
                if (wait != null)
                {
                    wait.enabled = true;
                }
                GetProfileImage(player).color  = Color.black;
                GetProfileHide(player).enabled = true;
                GetProfileName(player).enabled = false;

                SetPlayerStatus(player, 0, 0);
                SetPlayerStatus(player, 1, 0);
                SetPlayerStatus(player, 2, 0);
            }
        }

        SetPlayerStatus(m_playerList[3], 2, 0);

        //NETWORK INDEX 요청
        NetworkManager.Instance().SendOrderMessage(
            JSONMessageTool.ToJsonOrderRequest(
                NetworkOrderController.ORDER_NAME, NetworkOrderController.ORDER_SPACE));


        if (GameManager.Instance().PLAYER.NETWORK_INDEX == 2)
        {
            //host
            m_startButton.gameObject.SetActive(true);
            m_readyButton.gameObject.SetActive(false);
        }
        else if (GameManager.Instance().PLAYER.NETWORK_INDEX > 2)
        {
            //user
            m_startButton.gameObject.SetActive(false);
            m_readyButton.gameObject.SetActive(true);
        }
        else
        {
            //옵저버
            m_startButton.gameObject.SetActive(false);
            m_readyButton.gameObject.SetActive(false);
        }
    }