private void Awake() { ExitGames.Client.Photon.ConnectionProtocol connectProtocol = ExitGames.Client.Photon.ConnectionProtocol.Udp; chatClient = new ChatClient(this, connectProtocol); chatClient.ChatRegion = "Asia"; //anywhere else than US and europe ExitGames.Client.Photon.Chat.AuthenticationValues authValues = new ExitGames.Client.Photon.Chat.AuthenticationValues(); authValues.UserId = "uniqueUserNameHere"; authValues.AuthType = ExitGames.Client.Photon.Chat.CustomAuthenticationType.None; chatClient.Connect("3a6c9000-dce8-4bc3-a4f9-c38378ace551", versionName, authValues); }
private void Connect() { Debug.Log("GAMECHAT: Connect"); if (string.IsNullOrEmpty(PhotonNetwork.PhotonServerSettings.ChatAppID)) { print("No ChatAppID provided"); return; } chatChannel = PhotonNetwork.room.Name + "CHANNEL"; /************* append room name *****************/ Debug.Log("GAMECHAT: About to connect to chat"); ExitGames.Client.Photon.ConnectionProtocol connectProtocol = ExitGames.Client.Photon.ConnectionProtocol.Udp; chatClient = new ChatClient(this, connectProtocol); chatClient.ChatRegion = "Cae"; ExitGames.Client.Photon.Chat.AuthenticationValues authValues = new ExitGames.Client.Photon.Chat.AuthenticationValues(); authValues.UserId = usernameText; authValues.AuthType = ExitGames.Client.Photon.Chat.CustomAuthenticationType.None; chatClient.Connect(PhotonNetwork.PhotonServerSettings.ChatAppID, "0.0.1", authValues); Debug.Log("GAMECHAT: Connected"); }
/// <summary> /// Méthode qui modifie le preset de connection. Avec IP Port Socket. /// </summary> /// <param name="value"></param> public void onNewConnectionPreset(int value) { MS_adress = ConnectionsPreset[value].protocolAdress; AdressInput.text = MS_adress; MS_port = ConnectionsPreset[value].protocolDefaultPort; PortInput.text = MS_port.ToString(); MS_WebCloudConnection = ConnectionsPreset[value].useWebCloudConnection; MS_ConnVersion = ConnectionsPreset[value].connectionVersion; ConnVersionInput.text = MS_ConnVersion.ToString(); MS_protocol = ConnectionsPreset[value].protocolConn; switch (MS_protocol) { case ExitGames.Client.Photon.ConnectionProtocol.Udp: ProtocolDropdown.value = 0; break; case ExitGames.Client.Photon.ConnectionProtocol.Tcp: ProtocolDropdown.value = 1; break; case ExitGames.Client.Photon.ConnectionProtocol.WebSocket: ProtocolDropdown.value = 2; break; case ExitGames.Client.Photon.ConnectionProtocol.WebSocketSecure: ProtocolDropdown.value = 3; break; } if (MS_WebCloudConnection) { print("<color=blue>Preset = ConnectToRegion : " + MS_ConnVersion + " </color>"); } else { print("<color=blue>Preset = ConnectToMaster : " + MS_adress + ":" + MS_port + " " + MS_ConnVersion + " " + MS_protocol.ToString() + " </color>"); } }
public void SetMS_protocol(int value) { try { switch (value) { case 0: MS_protocol = ExitGames.Client.Photon.ConnectionProtocol.Udp; break; case 1: MS_protocol = ExitGames.Client.Photon.ConnectionProtocol.Tcp; break; case 2: MS_protocol = ExitGames.Client.Photon.ConnectionProtocol.WebSocket; break; case 3: MS_protocol = ExitGames.Client.Photon.ConnectionProtocol.WebSocketSecure; break; } } catch { } }
/////////////////////////////////////////////////////////////////////////////////////// /// /////////////////////////////////////////////////////////////////////////////////////// public ClientPeer(ExitGames.Client.Photon.IPhotonPeerListener listener, ExitGames.Client.Photon.ConnectionProtocol protocolType) : base(listener, protocolType) { }