コード例 #1
0
ファイル: Photon_Room.cs プロジェクト: Heartkage/Enchanter
        //--Set up when player enter or leave room--//
        void SetupRoomUI()
        {
            if (playersInRoom.Length > 0)
            {
                panel_Room.SetActive(true);
                room_Name.text = PhotonNetwork.CurrentRoom.Name;

                //--Set Player Name--//
                for (int i = 0; i < Photon_GameSetting.instance.maxPlayer; i++)
                {
                    if (i < playersInRoom.Length)
                    {
                        playerUI_List[i].SetActive(true);
                        UI_PlayerInfo info = playerUI_List[i].GetComponent <UI_PlayerInfo>();
                        info.SetPlayerInfo((i == 0) ? true : false, string.Concat("Player ", (i + 1).ToString()), ((i + 1) == myPlayerID) ? true : false);
                        info.SetBackgroundColor(false);
                    }
                    else
                    {
                        playerUI_List[i].SetActive(false);
                    }
                }


                //--Set Button--//
                if (PhotonNetwork.IsMasterClient)
                {
                    ready_Button.gameObject.SetActive(false);
                    start_Button.gameObject.SetActive(true);
                    if (playersInRoom.Length == 1)
                    {
                        start_Button.interactable = true;
                    }
                    else
                    {
                        start_Button.interactable = false;
                    }
                }
                else
                {
                    start_Button.gameObject.SetActive(false);
                    ready_Button.gameObject.SetActive(true);
                }

                //--Set Ready Button--//
                imReady          = false;
                readyPlayerCount = 0;
                UpdateReadyUI();
            }
        }