Exemple #1
0
        /// <summary>
        /// 类型:方法
        /// 名称:Connect
        /// 作者:taixihuase
        /// 作用:尝试通过 ip 地址、端口、传输协议及服务端进程名,与服务端连线
        /// 编写日期:2015/7/17
        /// </summary>
        /// <param name="ip"></param>
        /// <param name="port"></param>
        /// <param name="connectionProtocol"></param>
        /// <param name="serverName"></param>
        public void Connect(string ip, int port, ExitGames.Client.Photon.ConnectionProtocol connectionProtocol,
                            string serverName)
        {
            string serverAddress = ip + ":" + port.ToString();

            Peer = new PhotonPeer(this, connectionProtocol);
            Peer.Connect(serverAddress, serverName);
        }
    public ChattingClient(UpdateUI ui)
    {
        Debug.Log("Start ChattingClient");
        this.ui = ui;
        ExitGames.Client.Photon.ConnectionProtocol connectProtocol = ExitGames.Client.Photon.ConnectionProtocol.Udp;
        chatClient            = new ChatClient(this, connectProtocol);
        chatClient.ChatRegion = "EU";

        ExitGames.Client.Photon.Chat.AuthenticationValues authValues = new ExitGames.Client.Photon.Chat.AuthenticationValues();
        authValues.UserId   = "uniqueUserName";
        authValues.AuthType = ExitGames.Client.Photon.Chat.CustomAuthenticationType.None;

        chatClient.Connect(/*"d12a70e0-dafa-4716-abf7-9ac2c39619d6"*/ "ebbf7b53-da3e-4247-931d-76a205592ee0", "0.1", authValues);
    }