コード例 #1
0
        public void OnButtonCreateRoomClicked()
        {
            SimulationSettings.InitialBalance = (int)SliderInitialBalance.value;
            SimulationSettings.TargetBalance  = (int)SliderTargetBalance.value;
            SimulationSettings.MinimalBalance = (int)SliderMinimalBalance.value;

            RoomOptions options = new RoomOptions();

            options.MaxPlayers          = (byte)SliderNumberOfPlayers.value;
            options.CleanupCacheOnLeave = true;

            //Photon requires to use string keys
            Hashtable roomProperties = new Hashtable();

            roomProperties.Add(
                RoomCustomPropertiesKey.SettingsOfSimulationInitialBalance.ToString(), SimulationSettings.InitialBalance);
            roomProperties.Add(
                RoomCustomPropertiesKey.SettingsOfSimulationTargetBalance.ToString(), SimulationSettings.TargetBalance);
            roomProperties.Add(
                RoomCustomPropertiesKey.SettingsOfSimulationMinimalBalance.ToString(), SimulationSettings.MinimalBalance);
            options.CustomRoomProperties = roomProperties;

            ButtonCreateRoom.interactable = false;
            PhotonNetwork.CreateRoom(InputFieldRoomName.text, options, PhotonNetwork.lobby);
            UIRoom.SetPhotonPlayerRoomLobbyState(RoomLobbyPlayerState.NotReady);
        }
コード例 #2
0
        public void OnButtonReadyClicked()
        {
            RoomLobbyPlayerState state =
                (RoomLobbyPlayerState)PhotonNetwork.player.CustomProperties[PlayerCustomPropertiesKey.RoomLobbyPlayerState.ToString()];

            state = (state == RoomLobbyPlayerState.Ready) ? RoomLobbyPlayerState.NotReady : RoomLobbyPlayerState.Ready;
            UIRoom.SetPhotonPlayerRoomLobbyState(state);
            SetReadyButtonText(state);
        }
コード例 #3
0
        /*Public methods*/

        public void OnButtonJoinRoomClicked()
        {
            UIRoom.SetPhotonPlayerRoomLobbyState(RoomLobbyPlayerState.NotReady);
            ButtonJoinRoom.interactable = false;
            PhotonNetwork.JoinRoom(SelectedRoom.Name);
        }