Luke Stampfli
4 年前
当前提交
3e08e7ff
共有 116 个文件被更改,包括 14752 次插入 和 0 次删除
-
8Packages/packages-lock.json
-
5Packages/com.unity.multiplayer.transport.photon-realtime/CHANGELOG.md
-
7Packages/com.unity.multiplayer.transport.photon-realtime/CHANGELOG.md.meta
-
9Packages/com.unity.multiplayer.transport.photon-realtime/README.md
-
7Packages/com.unity.multiplayer.transport.photon-realtime/README.md.meta
-
8Packages/com.unity.multiplayer.transport.photon-realtime/Runtime.meta
-
8Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon.meta
-
8Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat.meta
-
8Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code.meta
-
18Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChannelCreationOptions.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChannelCreationOptions.cs.meta
-
14Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChannelWellKnownProperties.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChannelWellKnownProperties.cs.meta
-
191Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatChannel.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatChannel.cs.meta
-
1001Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatClient.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatClient.cs.meta
-
36Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatDisconnectCause.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatDisconnectCause.cs.meta
-
33Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatEventCode.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatEventCode.cs.meta
-
36Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatOperationCode.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatOperationCode.cs.meta
-
68Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatParameterCode.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatParameterCode.cs.meta
-
412Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatPeer.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatPeer.cs.meta
-
37Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatState.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatState.cs.meta
-
35Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatUserStatus.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatUserStatus.cs.meta
-
110Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/IChatClientListener.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/IChatClientListener.cs.meta
-
81Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/changes-chat.txt
-
7Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/changes-chat.txt.meta
-
8Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs.meta
-
5Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/Metro.meta
-
1001Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/Metro/Photon3Unity3D.dll
-
69Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/Metro/Photon3Unity3D.dll.meta
-
1Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/Metro/Photon3Unity3D.pri
-
8Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/Metro/Photon3Unity3D.pri.meta
-
1001Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/Photon3Unity3D.dll
-
106Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/Photon3Unity3D.dll.meta
-
1001Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/Photon3Unity3D.xml
-
9Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/Photon3Unity3D.xml.meta
-
5Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/WebSocket.meta
-
283Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/WebSocket/SocketWebTcp.cs
-
8Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/WebSocket/SocketWebTcp.cs.meta
-
161Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/WebSocket/WebSocket.cs
-
8Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/WebSocket/WebSocket.cs.meta
-
117Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/WebSocket/WebSocket.jslib
-
21Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/WebSocket/WebSocket.jslib.meta
-
3Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/WebSocket/websocket-sharp.README
-
4Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/WebSocket/websocket-sharp.README.meta
-
1001Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/WebSocket/websocket-sharp.dll
-
69Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/WebSocket/websocket-sharp.dll.meta
-
1001Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/changes-library.txt
-
8Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/changes-library.txt.meta
-
8Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/netstandard2.0.meta
-
47Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.deps.json
-
7Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.deps.json.meta
-
1001Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.dll
-
100Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.dll.meta
-
1001Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.xml
-
7Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.xml.meta
-
8Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime.meta
-
8Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code.meta
-
153Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code/AppSettings.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code/AppSettings.cs.meta
-
173Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code/ConnectionHandler.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code/ConnectionHandler.cs.meta
-
215Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code/Extensions.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code/Extensions.cs.meta
-
48Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code/FriendInfo.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code/FriendInfo.cs.meta
-
1001Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code/LoadBalancingClient.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code/LoadBalancingClient.cs.meta
-
1001Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code/LoadBalancingPeer.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code/LoadBalancingPeer.cs.meta
-
466Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code/PhotonPing.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code/PhotonPing.cs.meta
-
1Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code/PhotonPingClasses.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code/PhotonPingClasses.cs.meta
-
452Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code/Player.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code/Player.cs.meta
-
90Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code/Region.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code/Region.cs.meta
-
667Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code/RegionHandler.cs
-
11Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonRealtime/Code/RegionHandler.cs.meta
|
|||
Changelog |
|||
All notable changes to this package will be documented in this file. The format is based on Keep a Changelog |
|||
|
|||
[0.0.1-preview.1] - 2020-10-05 |
|||
This is the first release of Enet MLAPI Package |
|
|||
fileFormatVersion: 2 |
|||
guid: 9d6ccdb72b9b37548a841fcc1c4dee76 |
|||
TextScriptImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
Photon Realtime transport for MLAPI |
|||
|
|||
|
|||
--- |
|||
We do NOT have a license for the photon source so keep this internal. |
|||
|
|||
Original `license.txt` in the realtime sdk: |
|||
See the License Agreement at |
|||
https://www.photonengine.com/terms |
|
|||
fileFormatVersion: 2 |
|||
guid: ea5e2ac1b219ffb428dc8f61477267d2 |
|||
TextScriptImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: caaee5b70b02eae44b04ad8149d1ba63 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: ef193029478e7d84692c98b909eaaa00 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 02fbda138c6cf9143aacd0267c5db552 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 29466ff33d534e74baaef92e3459e59f |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
// ----------------------------------------------------------------------------------------------------------------------
|
|||
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
|
|||
// <remarks>ChannelCreationOptions is a parameter used when subscribing to a public channel for the first time.</remarks>
|
|||
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2018 Exit Games GmbH</copyright>
|
|||
// ----------------------------------------------------------------------------------------------------------------------
|
|||
|
|||
namespace Photon.Chat |
|||
{ |
|||
public class ChannelCreationOptions |
|||
{ |
|||
/// <summary>Default values of channel creation options.</summary>
|
|||
public static ChannelCreationOptions Default = new ChannelCreationOptions(); |
|||
/// <summary>Whether or not the channel to be created will allow client to keep a list of users.</summary>
|
|||
public bool PublishSubscribers { get; set; } |
|||
/// <summary>Limit of the number of users subscribed to the channel to be created.</summary>
|
|||
public int MaxSubscribers { get; set; } |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 8f478e74d7c37554ea2edebe1300c2f9 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
// ----------------------------------------------------------------------------------------------------------------------
|
|||
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
|
|||
// <remarks>ChannelWellKnownProperties contains the list of well-known channel properties.</remarks>
|
|||
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2018 Exit Games GmbH</copyright>
|
|||
// ----------------------------------------------------------------------------------------------------------------------
|
|||
|
|||
namespace Photon.Chat |
|||
{ |
|||
public class ChannelWellKnownProperties |
|||
{ |
|||
public const byte MaxSubscribers = 255; |
|||
public const byte PublishSubscribers = 254; |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 9ff211198d3295e4ca2a4fa56babeb3a |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
// ----------------------------------------------------------------------------------------------------------------------
|
|||
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
|
|||
// <remarks>ChatClient is the main class of this api.</remarks>
|
|||
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
|
|||
// ----------------------------------------------------------------------------------------------------------------------
|
|||
|
|||
#if UNITY_4_7 || UNITY_5 || UNITY_5_3_OR_NEWER
|
|||
#define SUPPORTED_UNITY
|
|||
#endif
|
|||
|
|||
namespace Photon.Chat |
|||
{ |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
#if SUPPORTED_UNITY || NETFX_CORE
|
|||
using Hashtable = ExitGames.Client.Photon.Hashtable; |
|||
using SupportClass = ExitGames.Client.Photon.SupportClass; |
|||
#endif
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// A channel of communication in Photon Chat, updated by ChatClient and provided as READ ONLY.
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// Contains messages and senders to use (read!) and display by your GUI.
|
|||
/// Access these by:
|
|||
/// ChatClient.PublicChannels
|
|||
/// ChatClient.PrivateChannels
|
|||
/// </remarks>
|
|||
public class ChatChannel |
|||
{ |
|||
/// <summary>Name of the channel (used to subscribe and unsubscribe).</summary>
|
|||
public readonly string Name; |
|||
|
|||
/// <summary>Senders of messages in chronological order. Senders and Messages refer to each other by index. Senders[x] is the sender of Messages[x].</summary>
|
|||
public readonly List<string> Senders = new List<string>(); |
|||
|
|||
/// <summary>Messages in chronological order. Senders and Messages refer to each other by index. Senders[x] is the sender of Messages[x].</summary>
|
|||
public readonly List<object> Messages = new List<object>(); |
|||
|
|||
/// <summary>If greater than 0, this channel will limit the number of messages, that it caches locally.</summary>
|
|||
public int MessageLimit; |
|||
|
|||
/// <summary>Unique channel ID.</summary>
|
|||
public int ChannelID; |
|||
|
|||
/// <summary>Is this a private 1:1 channel?</summary>
|
|||
public bool IsPrivate { get; protected internal set; } |
|||
|
|||
/// <summary>Count of messages this client still buffers/knows for this channel.</summary>
|
|||
public int MessageCount { get { return this.Messages.Count; } } |
|||
|
|||
/// <summary>
|
|||
/// ID of the last message received.
|
|||
/// </summary>
|
|||
public int LastMsgId { get; protected set; } |
|||
|
|||
private Dictionary<object, object> properties; |
|||
|
|||
/// <summary>Whether or not this channel keeps track of the list of its subscribers.</summary>
|
|||
public bool PublishSubscribers { get; protected set; } |
|||
|
|||
/// <summary>Maximum number of channel subscribers. 0 means infinite.</summary>
|
|||
public int MaxSubscribers { get; protected set; } |
|||
|
|||
/// <summary>Subscribed users.</summary>
|
|||
public readonly HashSet<string> Subscribers = new HashSet<string>(); |
|||
|
|||
/// <summary>Used internally to create new channels. This does NOT create a channel on the server! Use ChatClient.Subscribe.</summary>
|
|||
public ChatChannel(string name) |
|||
{ |
|||
this.Name = name; |
|||
} |
|||
|
|||
public bool TryGetProperty(string key, out object value) |
|||
{ |
|||
if (properties == null) |
|||
{ |
|||
value = default(object); |
|||
return false; |
|||
} |
|||
|
|||
return properties.TryGetValue(key, out value); |
|||
} |
|||
|
|||
/// <summary>Used internally to add messages to this channel.</summary>
|
|||
public void Add(string sender, object message, int msgId) |
|||
{ |
|||
this.Senders.Add(sender); |
|||
this.Messages.Add(message); |
|||
this.LastMsgId = msgId; |
|||
this.TruncateMessages(); |
|||
} |
|||
|
|||
/// <summary>Used internally to add messages to this channel.</summary>
|
|||
public void Add(string[] senders, object[] messages, int lastMsgId) |
|||
{ |
|||
this.Senders.AddRange(senders); |
|||
this.Messages.AddRange(messages); |
|||
this.LastMsgId = lastMsgId; |
|||
this.TruncateMessages(); |
|||
} |
|||
|
|||
/// <summary>Reduces the number of locally cached messages in this channel to the MessageLimit (if set).</summary>
|
|||
public void TruncateMessages() |
|||
{ |
|||
if (this.MessageLimit <= 0 || this.Messages.Count <= this.MessageLimit) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
int excessCount = this.Messages.Count - this.MessageLimit; |
|||
this.Senders.RemoveRange(0, excessCount); |
|||
this.Messages.RemoveRange(0, excessCount); |
|||
} |
|||
|
|||
/// <summary>Clear the local cache of messages currently stored. This frees memory but doesn't affect the server.</summary>
|
|||
public void ClearMessages() |
|||
{ |
|||
this.Senders.Clear(); |
|||
this.Messages.Clear(); |
|||
} |
|||
|
|||
/// <summary>Provides a string-representation of all messages in this channel.</summary>
|
|||
/// <returns>All known messages in format "Sender: Message", line by line.</returns>
|
|||
public string ToStringMessages() |
|||
{ |
|||
StringBuilder txt = new StringBuilder(); |
|||
for (int i = 0; i < this.Messages.Count; i++) |
|||
{ |
|||
txt.AppendLine(string.Format("{0}: {1}", this.Senders[i], this.Messages[i])); |
|||
} |
|||
return txt.ToString(); |
|||
} |
|||
|
|||
internal void ReadProperties(Dictionary<object, object> newProperties) |
|||
{ |
|||
if (newProperties != null && newProperties.Count > 0) |
|||
{ |
|||
if (this.properties == null) |
|||
{ |
|||
this.properties = new Dictionary<object, object>(newProperties.Count); |
|||
} |
|||
foreach (var k in newProperties.Keys) |
|||
{ |
|||
if (newProperties[k] == null) |
|||
{ |
|||
if (this.properties.ContainsKey(k)) |
|||
{ |
|||
this.properties.Remove(k); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
this.properties[k] = newProperties[k]; |
|||
} |
|||
} |
|||
object temp; |
|||
if (this.properties.TryGetValue(ChannelWellKnownProperties.PublishSubscribers, out temp)) |
|||
{ |
|||
this.PublishSubscribers = (bool)temp; |
|||
} |
|||
if (this.properties.TryGetValue(ChannelWellKnownProperties.MaxSubscribers, out temp)) |
|||
{ |
|||
this.MaxSubscribers = (int)temp; |
|||
} |
|||
} |
|||
} |
|||
|
|||
internal void AddSubscribers(string[] users) |
|||
{ |
|||
if (users == null) |
|||
{ |
|||
return; |
|||
} |
|||
for (int i = 0; i < users.Length; i++) |
|||
{ |
|||
this.Subscribers.Add(users[i]); |
|||
} |
|||
} |
|||
|
|||
internal void ClearProperties() |
|||
{ |
|||
if (this.properties != null && this.properties.Count > 0) |
|||
{ |
|||
this.properties.Clear(); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: d84ef73471cfacf4daee3a333fb0039a |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
1001
Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatClient.cs
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 3dc58b7807acc4d488636fa1d4019f2b |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
// ----------------------------------------------------------------------------------------------------------------------
|
|||
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
|
|||
// <remarks>ChatClient is the main class of this api.</remarks>
|
|||
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
|
|||
// ----------------------------------------------------------------------------------------------------------------------
|
|||
|
|||
namespace Photon.Chat |
|||
{ |
|||
/// <summary>Enumeration of causes for Disconnects (used in <see cref="ChatClient.DisconnectedCause"/>).</summary>
|
|||
/// <remarks>Read the individual descriptions to find out what to do about this type of disconnect.</remarks>
|
|||
public enum ChatDisconnectCause |
|||
{ |
|||
/// <summary>No error was tracked.</summary>
|
|||
None, |
|||
/// <summary>OnStatusChanged: The CCUs count of your Photon Server License is exhausted (temporarily).</summary>
|
|||
DisconnectByServerUserLimit, |
|||
/// <summary>OnStatusChanged: The server is not available or the address is wrong. Make sure the port is provided and the server is up.</summary>
|
|||
ExceptionOnConnect, |
|||
/// <summary>OnStatusChanged: The server disconnected this client. Most likely the server's send buffer is full (receiving too much from other clients).</summary>
|
|||
DisconnectByServer, |
|||
/// <summary>OnStatusChanged: This client detected that the server's responses are not received in due time. Maybe you send / receive too much?</summary>
|
|||
TimeoutDisconnect, |
|||
/// <summary>OnStatusChanged: Some internal exception caused the socket code to fail. Contact Exit Games.</summary>
|
|||
Exception, |
|||
/// <summary>OnOperationResponse: Authenticate in the Photon Cloud with invalid AppId. Update your subscription or contact Exit Games.</summary>
|
|||
InvalidAuthentication, |
|||
/// <summary>OnOperationResponse: Authenticate (temporarily) failed when using a Photon Cloud subscription without CCU Burst. Update your subscription.</summary>
|
|||
MaxCcuReached, |
|||
/// <summary>OnOperationResponse: Authenticate when the app's Photon Cloud subscription is locked to some (other) region(s). Update your subscription or change region.</summary>
|
|||
InvalidRegion, |
|||
/// <summary>OnOperationResponse: Operation that's (currently) not available for this client (not authorized usually). Only tracked for op Authenticate.</summary>
|
|||
OperationNotAllowedInCurrentState, |
|||
/// <summary>OnOperationResponse: Authenticate in the Photon Cloud with invalid client values or custom authentication setup in Cloud Dashboard.</summary>
|
|||
CustomAuthenticationFailed, |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: cb82ca173d68bbf45bdc93c4c827d4f2 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
// ----------------------------------------------------------------------------------------------------------------------
|
|||
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
|
|||
// <remarks>ChatClient is the main class of this api.</remarks>
|
|||
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
|
|||
// ----------------------------------------------------------------------------------------------------------------------
|
|||
|
|||
namespace Photon.Chat |
|||
{ |
|||
/// <summary>
|
|||
/// Wraps up internally used constants in Photon Chat events. You don't have to use them directly usually.
|
|||
/// </summary>
|
|||
public class ChatEventCode |
|||
{ |
|||
/// <summary>(0) Event code for messages published in public channels.</summary>
|
|||
public const byte ChatMessages = 0; |
|||
/// <summary>(1) Not Used. </summary>
|
|||
public const byte Users = 1;// List of users or List of changes for List of users
|
|||
/// <summary>(2) Event code for messages published in private channels</summary>
|
|||
public const byte PrivateMessage = 2; |
|||
/// <summary>(3) Not Used. </summary>
|
|||
public const byte FriendsList = 3; |
|||
/// <summary>(4) Event code for status updates. </summary>
|
|||
public const byte StatusUpdate = 4; |
|||
/// <summary>(5) Event code for subscription acks. </summary>
|
|||
public const byte Subscribe = 5; |
|||
/// <summary>(6) Event code for unsubscribe acks. </summary>
|
|||
public const byte Unsubscribe = 6; |
|||
/// <summary>(8) Event code for new user subscription to a channel where <see cref="ChatChannel.PublishSubscribers"/> is enabled. </summary>
|
|||
public const byte UserSubscribed = 8; |
|||
/// <summary>(9) Event code for when user unsubscribes from a channel where <see cref="ChatChannel.PublishSubscribers"/> is enabled. </summary>
|
|||
public const byte UserUnsubscribed = 9; |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: b1fd08cfa8721bf4c8ec428885ae1c39 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
// ----------------------------------------------------------------------------------------------------------------------
|
|||
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
|
|||
// <remarks>ChatClient is the main class of this api.</remarks>
|
|||
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
|
|||
// ----------------------------------------------------------------------------------------------------------------------
|
|||
|
|||
namespace Photon.Chat |
|||
{ |
|||
/// <summary>
|
|||
/// Wraps up codes for operations used internally in Photon Chat. You don't have to use them directly usually.
|
|||
/// </summary>
|
|||
public class ChatOperationCode |
|||
{ |
|||
/// <summary>(230) Operation Authenticate.</summary>
|
|||
public const byte Authenticate = 230; |
|||
|
|||
/// <summary>(0) Operation to subscribe to chat channels.</summary>
|
|||
public const byte Subscribe = 0; |
|||
/// <summary>(1) Operation to unsubscribe from chat channels.</summary>
|
|||
public const byte Unsubscribe = 1; |
|||
/// <summary>(2) Operation to publish a message in a chat channel.</summary>
|
|||
public const byte Publish = 2; |
|||
/// <summary>(3) Operation to send a private message to some other user.</summary>
|
|||
public const byte SendPrivate = 3; |
|||
|
|||
/// <summary>(4) Not used yet.</summary>
|
|||
public const byte ChannelHistory = 4; |
|||
|
|||
/// <summary>(5) Set your (client's) status.</summary>
|
|||
public const byte UpdateStatus = 5; |
|||
/// <summary>(6) Add friends the list of friends that should update you of their status.</summary>
|
|||
public const byte AddFriends = 6; |
|||
/// <summary>(7) Remove friends from list of friends that should update you of their status.</summary>
|
|||
public const byte RemoveFriends = 7; |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: d2e1a2163f978664f8e98cfc0e178f45 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
// ----------------------------------------------------------------------------------------------------------------------
|
|||
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
|
|||
// <remarks>ChatClient is the main class of this api.</remarks>
|
|||
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
|
|||
// ----------------------------------------------------------------------------------------------------------------------
|
|||
|
|||
namespace Photon.Chat |
|||
{ |
|||
/// <summary>
|
|||
/// Wraps up codes for parameters (in operations and events) used internally in Photon Chat. You don't have to use them directly usually.
|
|||
/// </summary>
|
|||
public class ChatParameterCode |
|||
{ |
|||
/// <summary>(0) Array of chat channels.</summary>
|
|||
public const byte Channels = 0; |
|||
/// <summary>(1) Name of a single chat channel.</summary>
|
|||
public const byte Channel = 1; |
|||
/// <summary>(2) Array of chat messages.</summary>
|
|||
public const byte Messages = 2; |
|||
/// <summary>(3) A single chat message.</summary>
|
|||
public const byte Message = 3; |
|||
/// <summary>(4) Array of names of the users who sent the array of chat messages.</summary>
|
|||
public const byte Senders = 4; |
|||
/// <summary>(5) Name of a the user who sent a chat message.</summary>
|
|||
public const byte Sender = 5; |
|||
/// <summary>(6) Not used.</summary>
|
|||
public const byte ChannelUserCount = 6; |
|||
/// <summary>(225) Name of user to send a (private) message to.</summary><remarks>The code is used in LoadBalancing and copied over here.</remarks>
|
|||
public const byte UserId = 225; |
|||
/// <summary>(8) Id of a message.</summary>
|
|||
public const byte MsgId = 8; |
|||
/// <summary>(9) Not used.</summary>
|
|||
public const byte MsgIds = 9; |
|||
/// <summary>(221) Secret token to identify an authorized user.</summary><remarks>The code is used in LoadBalancing and copied over here.</remarks>
|
|||
public const byte Secret = 221; |
|||
/// <summary>(15) Subscribe operation result parameter. A bool[] with result per channel.</summary>
|
|||
public const byte SubscribeResults = 15; |
|||
|
|||
/// <summary>(10) Status</summary>
|
|||
public const byte Status = 10; |
|||
/// <summary>(11) Friends</summary>
|
|||
public const byte Friends = 11; |
|||
/// <summary>(12) SkipMessage is used in SetOnlineStatus and if true, the message is not being broadcast.</summary>
|
|||
public const byte SkipMessage = 12; |
|||
|
|||
/// <summary>(14) Number of message to fetch from history. 0: no history. 1 and higher: number of messages in history. -1: all history.</summary>
|
|||
public const byte HistoryLength = 14; |
|||
|
|||
/// <summary>(21) WebFlags object for changing behaviour of webhooks from client.</summary>
|
|||
public const byte WebFlags = 21; |
|||
|
|||
/// <summary>(22) Properties of channel or user.</summary>
|
|||
/// <remarks>
|
|||
/// In event <see cref="ChatEventCode.Subscribe"/> it's always channel properties.
|
|||
/// </remarks>
|
|||
public const byte Properties = 22; |
|||
/// <summary>(23) Array of UserIds of users already subscribed to a channel.</summary>
|
|||
/// <remarks>Used in Subscribe event when PublishSubscribers is enabled.
|
|||
/// Does not include local user who just subscribed.
|
|||
/// Maximum length is (<see cref="ChatChannel.MaxSubscribers"/> - 1).</remarks>
|
|||
public const byte ChannelSubscribers = 23; |
|||
|
|||
/// <summary>
|
|||
/// Generated unique reusable room id
|
|||
/// </summary>
|
|||
public const byte UniqueRoomId = 29; |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 9ba813811b3fa234ab7bd4c8b8759faf |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
// ----------------------------------------------------------------------------------------------------------------------
|
|||
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
|
|||
// <remarks>ChatClient is the main class of this api.</remarks>
|
|||
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
|
|||
// ----------------------------------------------------------------------------------------------------------------------
|
|||
|
|||
#if UNITY_4_7 || UNITY_5 || UNITY_5_3_OR_NEWER
|
|||
#define SUPPORTED_UNITY
|
|||
#endif
|
|||
|
|||
namespace Photon.Chat |
|||
{ |
|||
using System; |
|||
using System.Diagnostics; |
|||
using System.Collections.Generic; |
|||
using ExitGames.Client.Photon; |
|||
|
|||
#if SUPPORTED_UNITY || NETFX_CORE
|
|||
using Hashtable = ExitGames.Client.Photon.Hashtable; |
|||
using SupportClass = ExitGames.Client.Photon.SupportClass; |
|||
#endif
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// Provides basic operations of the Photon Chat server. This internal class is used by public ChatClient.
|
|||
/// </summary>
|
|||
public class ChatPeer : PhotonPeer |
|||
{ |
|||
/// <summary>Name Server Host Name for Photon Cloud. Without port and without any prefix.</summary>
|
|||
public const string NameServerHost = "ns.exitgames.com"; |
|||
|
|||
/// <summary>Name Server for HTTP connections to the Photon Cloud. Includes prefix and port.</summary>
|
|||
public const string NameServerHttp = "http://ns.exitgamescloud.com:80/photon/n"; |
|||
|
|||
/// <summary>Name Server port per protocol (the UDP port is different than TCP, etc).</summary>
|
|||
private static readonly Dictionary<ConnectionProtocol, int> ProtocolToNameServerPort = new Dictionary<ConnectionProtocol, int>() { { ConnectionProtocol.Udp, 5058 }, { ConnectionProtocol.Tcp, 4533 }, { ConnectionProtocol.WebSocket, 9093 }, { ConnectionProtocol.WebSocketSecure, 19093 } }; //, { ConnectionProtocol.RHttp, 6063 } };
|
|||
|
|||
/// <summary>Name Server Address for Photon Cloud (based on current protocol). You can use the default values and usually won't have to set this value.</summary>
|
|||
public string NameServerAddress { get { return this.GetNameServerAddress(); } } |
|||
|
|||
virtual internal bool IsProtocolSecure { get { return this.UsedProtocol == ConnectionProtocol.WebSocketSecure; } } |
|||
|
|||
/// <summary> Chat Peer constructor. </summary>
|
|||
/// <param name="listener">Chat listener implementation.</param>
|
|||
/// <param name="protocol">Protocol to be used by the peer.</param>
|
|||
public ChatPeer(IPhotonPeerListener listener, ConnectionProtocol protocol) : base(listener, protocol) |
|||
{ |
|||
this.ConfigUnitySockets(); |
|||
} |
|||
|
|||
|
|||
|
|||
// Sets up the socket implementations to use, depending on platform
|
|||
[Conditional("SUPPORTED_UNITY")] |
|||
private void ConfigUnitySockets() |
|||
{ |
|||
Type websocketType = null; |
|||
#if UNITY_XBOXONE && !UNITY_EDITOR
|
|||
websocketType = Type.GetType("ExitGames.Client.Photon.SocketWebTcpNativeDynamic, PhotonWebSocket", false); |
|||
if (websocketType == null) |
|||
{ |
|||
websocketType = Type.GetType("ExitGames.Client.Photon.SocketWebTcpNativeDynamic, Assembly-CSharp-firstpass", false); |
|||
} |
|||
if (websocketType == null) |
|||
{ |
|||
websocketType = Type.GetType("ExitGames.Client.Photon.SocketWebTcpNativeDynamic, Assembly-CSharp", false); |
|||
} |
|||
if (websocketType == null) |
|||
{ |
|||
UnityEngine.Debug.LogError("UNITY_XBOXONE is defined but peer could not find SocketWebTcpNativeDynamic. Check your project files to make sure the native WSS implementation is available. Won't connect."); |
|||
} |
|||
#else
|
|||
// to support WebGL export in Unity, we find and assign the SocketWebTcp class (if it's in the project).
|
|||
// alternatively class SocketWebTcp might be in the Photon3Unity3D.dll
|
|||
websocketType = Type.GetType("ExitGames.Client.Photon.SocketWebTcp, PhotonWebSocket", false); |
|||
if (websocketType == null) |
|||
{ |
|||
websocketType = Type.GetType("ExitGames.Client.Photon.SocketWebTcp, Assembly-CSharp-firstpass", false); |
|||
} |
|||
if (websocketType == null) |
|||
{ |
|||
websocketType = Type.GetType("ExitGames.Client.Photon.SocketWebTcp, Assembly-CSharp", false); |
|||
} |
|||
#endif
|
|||
|
|||
if (websocketType != null) |
|||
{ |
|||
this.SocketImplementationConfig[ConnectionProtocol.WebSocket] = websocketType; |
|||
this.SocketImplementationConfig[ConnectionProtocol.WebSocketSecure] = websocketType; |
|||
} |
|||
|
|||
#if NET_4_6 && (UNITY_EDITOR || !ENABLE_IL2CPP)
|
|||
this.SocketImplementationConfig[ConnectionProtocol.Udp] = typeof(SocketUdpAsync); |
|||
this.SocketImplementationConfig[ConnectionProtocol.Tcp] = typeof(SocketTcpAsync); |
|||
#endif
|
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// Gets the NameServer Address (with prefix and port), based on the set protocol (this.UsedProtocol).
|
|||
/// </summary>
|
|||
/// <returns>NameServer Address (with prefix and port).</returns>
|
|||
private string GetNameServerAddress() |
|||
{ |
|||
var protocolPort = 0; |
|||
ProtocolToNameServerPort.TryGetValue(this.TransportProtocol, out protocolPort); |
|||
|
|||
switch (this.TransportProtocol) |
|||
{ |
|||
case ConnectionProtocol.Udp: |
|||
case ConnectionProtocol.Tcp: |
|||
return string.Format("{0}:{1}", NameServerHost, protocolPort); |
|||
#if RHTTP
|
|||
case ConnectionProtocol.RHttp: |
|||
return NameServerHttp; |
|||
#endif
|
|||
case ConnectionProtocol.WebSocket: |
|||
return string.Format("ws://{0}:{1}", NameServerHost, protocolPort); |
|||
case ConnectionProtocol.WebSocketSecure: |
|||
return string.Format("wss://{0}:{1}", NameServerHost, protocolPort); |
|||
default: |
|||
throw new ArgumentOutOfRangeException(); |
|||
} |
|||
} |
|||
|
|||
/// <summary> Connects to NameServer. </summary>
|
|||
/// <returns>If the connection attempt could be sent.</returns>
|
|||
public bool Connect() |
|||
{ |
|||
if (this.DebugOut >= DebugLevel.INFO) |
|||
{ |
|||
this.Listener.DebugReturn(DebugLevel.INFO, "Connecting to nameserver " + this.NameServerAddress); |
|||
} |
|||
|
|||
return this.Connect(this.NameServerAddress, "NameServer"); |
|||
} |
|||
|
|||
/// <summary> Authenticates on NameServer. </summary>
|
|||
/// <returns>If the authentication operation request could be sent.</returns>
|
|||
public bool AuthenticateOnNameServer(string appId, string appVersion, string region, AuthenticationValues authValues) |
|||
{ |
|||
if (this.DebugOut >= DebugLevel.INFO) |
|||
{ |
|||
this.Listener.DebugReturn(DebugLevel.INFO, "OpAuthenticate()"); |
|||
} |
|||
|
|||
var opParameters = new Dictionary<byte, object>(); |
|||
|
|||
opParameters[ParameterCode.AppVersion] = appVersion; |
|||
opParameters[ParameterCode.ApplicationId] = appId; |
|||
opParameters[ParameterCode.Region] = region; |
|||
|
|||
if (authValues != null) |
|||
{ |
|||
if (!string.IsNullOrEmpty(authValues.UserId)) |
|||
{ |
|||
opParameters[ParameterCode.UserId] = authValues.UserId; |
|||
} |
|||
|
|||
if (authValues != null && authValues.AuthType != CustomAuthenticationType.None) |
|||
{ |
|||
opParameters[ParameterCode.ClientAuthenticationType] = (byte) authValues.AuthType; |
|||
if (!string.IsNullOrEmpty(authValues.Token)) |
|||
{ |
|||
opParameters[ParameterCode.Secret] = authValues.Token; |
|||
} |
|||
else |
|||
{ |
|||
if (!string.IsNullOrEmpty(authValues.AuthGetParameters)) |
|||
{ |
|||
opParameters[ParameterCode.ClientAuthenticationParams] = authValues.AuthGetParameters; |
|||
} |
|||
if (authValues.AuthPostData != null) |
|||
{ |
|||
opParameters[ParameterCode.ClientAuthenticationData] = authValues.AuthPostData; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
return this.SendOperation(ChatOperationCode.Authenticate, opParameters, new SendOptions() { Reliability = true, Encrypt = this.IsEncryptionAvailable }); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Options for optional "Custom Authentication" services used with Photon. Used by OpAuthenticate after connecting to Photon.
|
|||
/// </summary>
|
|||
public enum CustomAuthenticationType : byte |
|||
{ |
|||
/// <summary>Use a custom authentification service. Currently the only implemented option.</summary>
|
|||
Custom = 0, |
|||
|
|||
/// <summary>Authenticates users by their Steam Account. Set auth values accordingly!</summary>
|
|||
Steam = 1, |
|||
|
|||
/// <summary>Authenticates users by their Facebook Account. Set auth values accordingly!</summary>
|
|||
Facebook = 2, |
|||
|
|||
/// <summary>Authenticates users by their Oculus Account and token.</summary>
|
|||
Oculus = 3, |
|||
|
|||
/// <summary>Authenticates users by their PSN Account and token.</summary>
|
|||
PlayStation = 4, |
|||
|
|||
/// <summary>Authenticates users by their Xbox Account and XSTS token.</summary>
|
|||
Xbox = 5, |
|||
|
|||
/// <summary>Authenticates users by their HTC VIVEPORT Account and user token.</summary>
|
|||
Viveport = 10, |
|||
|
|||
/// <summary>Disables custom authentification. Same as not providing any AuthenticationValues for connect (more precisely for: OpAuthenticate).</summary>
|
|||
None = byte.MaxValue |
|||
} |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// Container for user authentication in Photon. Set AuthValues before you connect - all else is handled.
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// On Photon, user authentication is optional but can be useful in many cases.
|
|||
/// If you want to FindFriends, a unique ID per user is very practical.
|
|||
///
|
|||
/// There are basically three options for user authentification: None at all, the client sets some UserId
|
|||
/// or you can use some account web-service to authenticate a user (and set the UserId server-side).
|
|||
///
|
|||
/// Custom Authentication lets you verify end-users by some kind of login or token. It sends those
|
|||
/// values to Photon which will verify them before granting access or disconnecting the client.
|
|||
///
|
|||
/// The Photon Cloud Dashboard will let you enable this feature and set important server values for it.
|
|||
/// https://dashboard.photonengine.com
|
|||
/// </remarks>
|
|||
public class AuthenticationValues |
|||
{ |
|||
/// <summary>See AuthType.</summary>
|
|||
private CustomAuthenticationType authType = CustomAuthenticationType.None; |
|||
|
|||
/// <summary>The type of custom authentication provider that should be used. Currently only "Custom" or "None" (turns this off).</summary>
|
|||
public CustomAuthenticationType AuthType |
|||
{ |
|||
get { return authType; } |
|||
set { authType = value; } |
|||
} |
|||
|
|||
/// <summary>This string must contain any (http get) parameters expected by the used authentication service. By default, username and token.</summary>
|
|||
/// <remarks>
|
|||
/// Maps to operation parameter 216.
|
|||
/// Standard http get parameters are used here and passed on to the service that's defined in the server (Photon Cloud Dashboard).</remarks>
|
|||
public string AuthGetParameters { get; set; } |
|||
|
|||
/// <summary>Data to be passed-on to the auth service via POST. Default: null (not sent). Either string or byte[] (see setters).</summary>
|
|||
/// <remarks>Maps to operation parameter 214.</remarks>
|
|||
public object AuthPostData { get; private set; } |
|||
|
|||
/// <summary>After initial authentication, Photon provides a token for this client / user, which is subsequently used as (cached) validation.</summary>
|
|||
public string Token { get; set; } |
|||
|
|||
/// <summary>The UserId should be a unique identifier per user. This is for finding friends, etc..</summary>
|
|||
public string UserId { get; set; } |
|||
|
|||
|
|||
/// <summary>Creates empty auth values without any info.</summary>
|
|||
public AuthenticationValues() |
|||
{ |
|||
} |
|||
|
|||
/// <summary>Creates minimal info about the user. If this is authenticated or not, depends on the set AuthType.</summary>
|
|||
/// <param name="userId">Some UserId to set in Photon.</param>
|
|||
public AuthenticationValues(string userId) |
|||
{ |
|||
this.UserId = userId; |
|||
} |
|||
|
|||
/// <summary>Sets the data to be passed-on to the auth service via POST.</summary>
|
|||
/// <param name="stringData">String data to be used in the body of the POST request. Null or empty string will set AuthPostData to null.</param>
|
|||
public virtual void SetAuthPostData(string stringData) |
|||
{ |
|||
this.AuthPostData = (string.IsNullOrEmpty(stringData)) ? null : stringData; |
|||
} |
|||
|
|||
/// <summary>Sets the data to be passed-on to the auth service via POST.</summary>
|
|||
/// <param name="byteData">Binary token / auth-data to pass on.</param>
|
|||
public virtual void SetAuthPostData(byte[] byteData) |
|||
{ |
|||
this.AuthPostData = byteData; |
|||
} |
|||
|
|||
/// <summary>Adds a key-value pair to the get-parameters used for Custom Auth (AuthGetParameters).</summary>
|
|||
/// <remarks>This method does uri-encoding for you.</remarks>
|
|||
/// <param name="key">Key for the value to set.</param>
|
|||
/// <param name="value">Some value relevant for Custom Authentication.</param>
|
|||
public virtual void AddAuthParameter(string key, string value) |
|||
{ |
|||
string ampersand = string.IsNullOrEmpty(this.AuthGetParameters) ? string.Empty : "&"; |
|||
this.AuthGetParameters = string.Format("{0}{1}{2}={3}", this.AuthGetParameters, ampersand, System.Uri.EscapeDataString(key), System.Uri.EscapeDataString(value)); |
|||
} |
|||
/// <summary>
|
|||
/// Transform this object into string.
|
|||
/// </summary>
|
|||
/// <returns>string representation of this object.</returns>
|
|||
public override string ToString() |
|||
{ |
|||
return string.Format("AuthenticationValues UserId: {0}, GetParameters: {1} Token available: {2}", UserId, this.AuthGetParameters, Token != null); |
|||
} |
|||
} |
|||
|
|||
/// <summary>Class for constants. Codes for parameters of Operations and Events.</summary>
|
|||
public class ParameterCode |
|||
{ |
|||
/// <summary>(224) Your application's ID: a name on your own Photon or a GUID on the Photon Cloud</summary>
|
|||
public const byte ApplicationId = 224; |
|||
/// <summary>(221) Internally used to establish encryption</summary>
|
|||
public const byte Secret = 221; |
|||
/// <summary>(220) Version of your application</summary>
|
|||
public const byte AppVersion = 220; |
|||
/// <summary>(217) This key's (byte) value defines the target custom authentication type/service the client connects with. Used in OpAuthenticate</summary>
|
|||
public const byte ClientAuthenticationType = 217; |
|||
/// <summary>(216) This key's (string) value provides parameters sent to the custom authentication type/service the client connects with. Used in OpAuthenticate</summary>
|
|||
public const byte ClientAuthenticationParams = 216; |
|||
/// <summary>(214) This key's (string or byte[]) value provides parameters sent to the custom authentication service setup in Photon Dashboard. Used in OpAuthenticate</summary>
|
|||
public const byte ClientAuthenticationData = 214; |
|||
/// <summary>(210) Used for region values in OpAuth and OpGetRegions.</summary>
|
|||
public const byte Region = 210; |
|||
/// <summary>(230) Address of a (game) server to use.</summary>
|
|||
public const byte Address = 230; |
|||
/// <summary>(225) User's ID</summary>
|
|||
public const byte UserId = 225; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// ErrorCode defines the default codes associated with Photon client/server communication.
|
|||
/// </summary>
|
|||
public class ErrorCode |
|||
{ |
|||
/// <summary>(0) is always "OK", anything else an error or specific situation.</summary>
|
|||
public const int Ok = 0; |
|||
|
|||
// server - Photon low(er) level: <= 0
|
|||
|
|||
/// <summary>
|
|||
/// (-3) Operation can't be executed yet (e.g. OpJoin can't be called before being authenticated, RaiseEvent cant be used before getting into a room).
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// Before you call any operations on the Cloud servers, the automated client workflow must complete its authorization.
|
|||
/// In PUN, wait until State is: JoinedLobby or ConnectedToMaster
|
|||
/// </remarks>
|
|||
public const int OperationNotAllowedInCurrentState = -3; |
|||
|
|||
/// <summary>(-2) The operation you called is not implemented on the server (application) you connect to. Make sure you run the fitting applications.</summary>
|
|||
public const int InvalidOperationCode = -2; |
|||
|
|||
/// <summary>(-1) Something went wrong in the server. Try to reproduce and contact Exit Games.</summary>
|
|||
public const int InternalServerError = -1; |
|||
|
|||
// server - PhotonNetwork: 0x7FFF and down
|
|||
// logic-level error codes start with short.max
|
|||
|
|||
/// <summary>(32767) Authentication failed. Possible cause: AppId is unknown to Photon (in cloud service).</summary>
|
|||
public const int InvalidAuthentication = 0x7FFF; |
|||
|
|||
/// <summary>(32766) GameId (name) already in use (can't create another). Change name.</summary>
|
|||
public const int GameIdAlreadyExists = 0x7FFF - 1; |
|||
|
|||
/// <summary>(32765) Game is full. This rarely happens when some player joined the room before your join completed.</summary>
|
|||
public const int GameFull = 0x7FFF - 2; |
|||
|
|||
/// <summary>(32764) Game is closed and can't be joined. Join another game.</summary>
|
|||
public const int GameClosed = 0x7FFF - 3; |
|||
|
|||
/// <summary>(32762) Not in use currently.</summary>
|
|||
public const int ServerFull = 0x7FFF - 5; |
|||
|
|||
/// <summary>(32761) Not in use currently.</summary>
|
|||
public const int UserBlocked = 0x7FFF - 6; |
|||
|
|||
/// <summary>(32760) Random matchmaking only succeeds if a room exists that is neither closed nor full. Repeat in a few seconds or create a new room.</summary>
|
|||
public const int NoRandomMatchFound = 0x7FFF - 7; |
|||
|
|||
/// <summary>(32758) Join can fail if the room (name) is not existing (anymore). This can happen when players leave while you join.</summary>
|
|||
public const int GameDoesNotExist = 0x7FFF - 9; |
|||
|
|||
/// <summary>(32757) Authorization on the Photon Cloud failed because the concurrent users (CCU) limit of the app's subscription is reached.</summary>
|
|||
/// <remarks>
|
|||
/// Unless you have a plan with "CCU Burst", clients might fail the authentication step during connect.
|
|||
/// Affected client are unable to call operations. Please note that players who end a game and return
|
|||
/// to the master server will disconnect and re-connect, which means that they just played and are rejected
|
|||
/// in the next minute / re-connect.
|
|||
/// This is a temporary measure. Once the CCU is below the limit, players will be able to connect an play again.
|
|||
///
|
|||
/// OpAuthorize is part of connection workflow but only on the Photon Cloud, this error can happen.
|
|||
/// Self-hosted Photon servers with a CCU limited license won't let a client connect at all.
|
|||
/// </remarks>
|
|||
public const int MaxCcuReached = 0x7FFF - 10; |
|||
|
|||
/// <summary>(32756) Authorization on the Photon Cloud failed because the app's subscription does not allow to use a particular region's server.</summary>
|
|||
/// <remarks>
|
|||
/// Some subscription plans for the Photon Cloud are region-bound. Servers of other regions can't be used then.
|
|||
/// Check your master server address and compare it with your Photon Cloud Dashboard's info.
|
|||
/// https://cloud.photonengine.com/dashboard
|
|||
///
|
|||
/// OpAuthorize is part of connection workflow but only on the Photon Cloud, this error can happen.
|
|||
/// Self-hosted Photon servers with a CCU limited license won't let a client connect at all.
|
|||
/// </remarks>
|
|||
public const int InvalidRegion = 0x7FFF - 11; |
|||
|
|||
/// <summary>
|
|||
/// (32755) Custom Authentication of the user failed due to setup reasons (see Cloud Dashboard) or the provided user data (like username or token). Check error message for details.
|
|||
/// </summary>
|
|||
public const int CustomAuthenticationFailed = 0x7FFF - 12; |
|||
} |
|||
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: dfc4187da281ad0449182289897fafab |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
// ----------------------------------------------------------------------------------------------------------------------
|
|||
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
|
|||
// <remarks>ChatClient is the main class of this api.</remarks>
|
|||
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
|
|||
// ----------------------------------------------------------------------------------------------------------------------
|
|||
|
|||
namespace Photon.Chat |
|||
{ |
|||
/// <summary>Possible states for a Chat Client.</summary>
|
|||
public enum ChatState |
|||
{ |
|||
/// <summary>Peer is created but not used yet.</summary>
|
|||
Uninitialized, |
|||
/// <summary>Connecting to name server.</summary>
|
|||
ConnectingToNameServer, |
|||
/// <summary>Connected to name server.</summary>
|
|||
ConnectedToNameServer, |
|||
/// <summary>Authenticating on current server.</summary>
|
|||
Authenticating, |
|||
/// <summary>Finished authentication on current server.</summary>
|
|||
Authenticated, |
|||
/// <summary>Disconnecting from name server. This is usually a transition from name server to frontend server.</summary>
|
|||
DisconnectingFromNameServer, |
|||
/// <summary>Connecting to frontend server.</summary>
|
|||
ConnectingToFrontEnd, |
|||
/// <summary>Connected to frontend server.</summary>
|
|||
ConnectedToFrontEnd, |
|||
/// <summary>Disconnecting from frontend server.</summary>
|
|||
DisconnectingFromFrontEnd, |
|||
/// <summary>Currently not used.</summary>
|
|||
QueuedComingFromFrontEnd, |
|||
/// <summary>The client disconnects (from any server).</summary>
|
|||
Disconnecting, |
|||
/// <summary>The client is no longer connected (to any server).</summary>
|
|||
Disconnected, |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: ab9e4dd4ddc26d442b893662400bd937 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
// ----------------------------------------------------------------------------------------------------------------------
|
|||
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
|
|||
// <remarks>ChatClient is the main class of this api.</remarks>
|
|||
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
|
|||
// ----------------------------------------------------------------------------------------------------------------------
|
|||
|
|||
namespace Photon.Chat |
|||
{ |
|||
/// <summary>Contains commonly used status values for SetOnlineStatus. You can define your own.</summary>
|
|||
/// <remarks>
|
|||
/// While "online" (value 2 and up), the status message will be sent to anyone who has you on his friend list.
|
|||
///
|
|||
/// Define custom online status values as you like with these rules:
|
|||
/// 0: Means "offline". It will be used when you are not connected. In this status, there is no status message.
|
|||
/// 1: Means "invisible" and is sent to friends as "offline". They see status 0, no message but you can chat.
|
|||
/// 2: And any higher value will be treated as "online". Status can be set.
|
|||
/// </remarks>
|
|||
public static class ChatUserStatus |
|||
{ |
|||
/// <summary>(0) Offline.</summary>
|
|||
public const int Offline = 0; |
|||
/// <summary>(1) Be invisible to everyone. Sends no message.</summary>
|
|||
public const int Invisible = 1; |
|||
/// <summary>(2) Online and available.</summary>
|
|||
public const int Online = 2; |
|||
/// <summary>(3) Online but not available.</summary>
|
|||
public const int Away = 3; |
|||
/// <summary>(4) Do not disturb.</summary>
|
|||
public const int DND = 4; |
|||
/// <summary>(5) Looking For Game/Group. Could be used when you want to be invited or do matchmaking.</summary>
|
|||
public const int LFG = 5; |
|||
/// <summary>(6) Could be used when in a room, playing.</summary>
|
|||
public const int Playing = 6; |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 9260d436aa141e94cb520a09cd33bb86 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
// ----------------------------------------------------------------------------------------------------------------------
|
|||
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
|
|||
// <remarks>ChatClient is the main class of this api.</remarks>
|
|||
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
|
|||
// ----------------------------------------------------------------------------------------------------------------------
|
|||
|
|||
|
|||
namespace Photon.Chat |
|||
{ |
|||
using ExitGames.Client.Photon; |
|||
|
|||
/// <summary>
|
|||
/// Callback interface for Chat client side. Contains callback methods to notify your app about updates.
|
|||
/// Must be provided to new ChatClient in constructor
|
|||
/// </summary>
|
|||
public interface IChatClientListener |
|||
{ |
|||
/// <summary>
|
|||
/// All debug output of the library will be reported through this method. Print it or put it in a
|
|||
/// buffer to use it on-screen.
|
|||
/// </summary>
|
|||
/// <param name="level">DebugLevel (severity) of the message.</param>
|
|||
/// <param name="message">Debug text. Print to System.Console or screen.</param>
|
|||
void DebugReturn(DebugLevel level, string message); |
|||
|
|||
/// <summary>
|
|||
/// Disconnection happened.
|
|||
/// </summary>
|
|||
void OnDisconnected(); |
|||
|
|||
/// <summary>
|
|||
/// Client is connected now.
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// Clients have to be connected before they can send their state, subscribe to channels and send any messages.
|
|||
/// </remarks>
|
|||
void OnConnected(); |
|||
|
|||
/// <summary>The ChatClient's state changed. Usually, OnConnected and OnDisconnected are the callbacks to react to.</summary>
|
|||
/// <param name="state">The new state.</param>
|
|||
void OnChatStateChange(ChatState state); |
|||
|
|||
/// <summary>
|
|||
/// Notifies app that client got new messages from server
|
|||
/// Number of senders is equal to number of messages in 'messages'. Sender with number '0' corresponds to message with
|
|||
/// number '0', sender with number '1' corresponds to message with number '1' and so on
|
|||
/// </summary>
|
|||
/// <param name="channelName">channel from where messages came</param>
|
|||
/// <param name="senders">list of users who sent messages</param>
|
|||
/// <param name="messages">list of messages it self</param>
|
|||
void OnGetMessages(string channelName, string[] senders, object[] messages); |
|||
|
|||
/// <summary>
|
|||
/// Notifies client about private message
|
|||
/// </summary>
|
|||
/// <param name="sender">user who sent this message</param>
|
|||
/// <param name="message">message it self</param>
|
|||
/// <param name="channelName">channelName for private messages (messages you sent yourself get added to a channel per target username)</param>
|
|||
void OnPrivateMessage(string sender, object message, string channelName); |
|||
|
|||
/// <summary>
|
|||
/// Result of Subscribe operation. Returns subscription result for every requested channel name.
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// If multiple channels sent in Subscribe operation, OnSubscribed may be called several times, each call with part of sent array or with single channel in "channels" parameter.
|
|||
/// Calls order and order of channels in "channels" parameter may differ from order of channels in "channels" parameter of Subscribe operation.
|
|||
/// </remarks>
|
|||
/// <param name="channels">Array of channel names.</param>
|
|||
/// <param name="results">Per channel result if subscribed.</param>
|
|||
void OnSubscribed(string[] channels, bool[] results); |
|||
|
|||
/// <summary>
|
|||
/// Result of Unsubscribe operation. Returns for channel name if the channel is now unsubscribed.
|
|||
/// </summary>
|
|||
/// If multiple channels sent in Unsubscribe operation, OnUnsubscribed may be called several times, each call with part of sent array or with single channel in "channels" parameter.
|
|||
/// Calls order and order of channels in "channels" parameter may differ from order of channels in "channels" parameter of Unsubscribe operation.
|
|||
/// <param name="channels">Array of channel names that are no longer subscribed.</param>
|
|||
void OnUnsubscribed(string[] channels); |
|||
|
|||
/// <summary>
|
|||
/// New status of another user (you get updates for users set in your friends list).
|
|||
/// </summary>
|
|||
/// <param name="user">Name of the user.</param>
|
|||
/// <param name="status">New status of that user.</param>
|
|||
/// <param name="gotMessage">True if the status contains a message you should cache locally. False: This status update does not include a message (keep any you have).</param>
|
|||
/// <param name="message">Message that user set.</param>
|
|||
void OnStatusUpdate(string user, int status, bool gotMessage, object message); |
|||
|
|||
/// <summary>
|
|||
/// A user has subscribed to a public chat channel
|
|||
/// </summary>
|
|||
/// <param name="channel">Name of the chat channel</param>
|
|||
/// <param name="user">UserId of the user who subscribed</param>
|
|||
void OnUserSubscribed(string channel, string user); |
|||
|
|||
/// <summary>
|
|||
/// A user has unsubscribed from a public chat channel
|
|||
/// </summary>
|
|||
/// <param name="channel">Name of the chat channel</param>
|
|||
/// <param name="user">UserId of the user who unsubscribed</param>
|
|||
void OnUserUnsubscribed(string channel, string user); |
|||
|
|||
/// <summary>
|
|||
/// Received a broadcast message
|
|||
/// </summary>
|
|||
/// <param name="channel">Name of the chat channel</param>
|
|||
/// <param name="message">Message data</param>
|
|||
void OnReceiveBroadcastMessage(string channel, byte[] message); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: e1cca82d8945e624e8a26de10025586b |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
|
|||
Photon Chat C# Client - Changelog |
|||
Exit Games GmbH - www.photonengine.com - forum.photonengine.com |
|||
|
|||
|
|||
|
|||
Version 4.1.4.2 (8. May 2020 - rev5519) |
|||
Added: Broadcast receive and read channel using UniqueRoomID UniqueRoomID read from SubscribeChannel response |
|||
|
|||
Version 4.1.2.14 (6. May 2019 - rev5097) |
|||
Changed: Chat API changes are now listed in a separate changes file. |
|||
|
|||
Version 4.1.2.13 (3. May 2019 - rev5086) |
|||
Fixed: properly add local client's UserId to public channels' Subscribers list when applicable. |
|||
|
|||
Version 4.1.2.11 (15. April 2019 - rev5043) |
|||
Added: Feature: PublishSubscribers. Per channel, you can now define if the server broadcasts users joining and leaving. |
|||
Fixed: proper way to handle Subscribe event when channel properties are returned. |
|||
Added: Viveport Auth Provider enum value. |
|||
Added: Switch-related workaround. Setting a Thread.Name was causing a crash in some exports on console. This affects Unity to Nintendo Switch exports. |
|||
Added: ChannelCreationOptions class to be used in the new Subscribe overload method. |
|||
Changed: Chat to use the same 1.8 serialization as Realtime/PUN. This also now matches the SocketWebTcp.SerializationProtocol default. |
|||
|
|||
Version 4.1.2.1 (31. July 2018 - rev4787) |
|||
Changed: Namespace from "ExitGames.Client.Photon.Chat" to "Photon.Chat". |
|||
Added: ConnectAndSetStatus method. |
|||
|
|||
Version 4.1.1.17 (11. October 2017 - rev4465) |
|||
Fixed: Unity "6" compile define is now UNITY_2017. |
|||
|
|||
Version 4.1.1.15 (17. July 2017 - rev4232) |
|||
Added: ChatClient.TransportProtocol as shortcut to the use PhotonPeer's TransportProtocol value. This enables setting the protocol easily while not connected. |
|||
Added: ChatClient.SocketImplementationConfig as shortcut to modify PhotonPeer's SocketImplementationConfig. This enables you to setup which IPhotonSocket implementation to use for which network protocol. |
|||
Changed: ChatPeer.ConfigUnitySockets() to try to find our websocket implementations in the assembly, making the SocketWebTcpCoroutine and SocketWebTcpThread classes optional. |
|||
Removed: Class "SocketWebTcp" is no longer found by ConfigUnitySockets(). |
|||
|
|||
Version 4.1.1.2 (13. September 2016 - rev3652) |
|||
Changed: ChatPeer now has ConfigUnitySockets(), which defines the SocketImplementationConfig. It's only used in Unity (using UNITY define). |
|||
Changed: ChatClient is not setting socket implementations anymore. |
|||
Added: Hashtable definition to use Photon's own implementation for Windows Store builds (NETFX_CORE). This must be used but it means you to use the same Hashtable definition in all builds (no matter if 8.1 or 10). |
|||
Added: Support for WebGL export in Unity. |
|||
|
|||
Version 4.0.5.0 (3. December 2015 - rev3144) |
|||
Added: A MessageLimit field for ChatClient and ChatChannel to limit the number of messages the client keeps locally. It might be useful to limit memory usage in long running chats. Set ChatClient.MessageLimit to apply the limit to any channel subscribed afterwards or apply a limit individually. |
|||
|
|||
Version 4.0.0.11 (28. October 2015 - rev3093) |
|||
Added: More sanity checks on operations (empty userId or secret, max friends). |
|||
Added: Special debug logging when the server returns an error for "Operation Unknown". In this case, it's highly likely that you don't use a Chat AppId. |
|||
Added: More helpful error logging. |
|||
|
|||
Version 4.0.0.10 (14. July 2015 - rev2988) |
|||
Added: A Unity 4.6 demo with uGUI. It's missing a few features but should give you a good start to making your own. |
|||
Added: Unity/WebGL support (merged from PUN). |
|||
Added: Breaking! IChatClientListener.DebugReturn(). Photon lib and chat client log via this method (no logging to console by default). |
|||
Changed: ChatClient.CustomAuthenticationValues is now .AuthValues. You can use those values to identify a user, even if you don't setup an external, custom authentication service. |
|||
Changed: ChatClient.UserId no longer directly stores the id but puts it into AuthValues. This means, the UserId could also be set via setting AuthValues. |
|||
Changed: The API of AuthenticationValues. There is now the UserId and AddAuthParameter() replaces the less general SetAuthParameters() (which only set specific key/values). |
|||
Note: All users should have a UserId. You can set chatClient.UserId before you connect, or you can set the AuthenticationValues in Connect(..., authValues) to set a UserId. |
|||
Added: ChatChannel.ToStringMessages(), which gets all messages in a single string, line by line. The format is "Sender:Message". |
|||
Added: ChatClient.TryGetChannel() to find a channel only by name, no matter if public or private. |
|||
|
|||
Version 4.0.0.7 (12. January 2015 - rev2763) |
|||
Internal: Changed code for UserID from 7 to 225. The latter is used in LoadBalancing, too, so we want to re-use the code here. |
|||
|
|||
Version 4.0.0.1 (17. June 2014 - rev2663) |
|||
Changed: How the server responds to Subscribe and Unsubscribe. Events will now contain success/failure of those. This allows us to send the answer after calling a WebHook if needed and we can even send it to multiple clients (which authenticated with the same userID). |
|||
Changed: Handling of subscription responsed. This is done to allow web services to subscribe a client remotely and to be able to prevent joining some channel that a user should not join (the channel of some guild or another team, e.g.). |
|||
Changed: Debug loggging. In Unity we can't use Debug.Assert, etc. So we have to log more cleanly. This works in Editor and several platforms (but not all). |
|||
Changed: Folder for Chat API. It now begins with "Photon" which provides some context no matter where you copy the files. Easier to find in Unity projects. |
|||
Changed: Operation FriendList and method SendFriendList renamed to AddFriends |
|||
Added: Operation RemoveFriends and corresponding method in ChatClient.cs |
|||
Added: Console Demo has new command 'fr' to remove friends |
|||
|
|||
Version 4.0.0.0 (23. May 2014 - rev2614) |
|||
Added: SendPrivateMessage() overload that has option to encrypt private messages. Public messages don't need encryption. |
|||
Removed: lastId and LastMessageIndex from channels. Those were impractical and should be removed from the API. |
|||
Changed: UserStatus class to ChatUserStatus. |
|||
Changed: Most classes are defined in their own file now. |
|||
Removed: Folders "Shared" and their subfolders. This gives a much better overview. |
|||
Added: Handling for event SubscribeResponse. This is not actually a response but gives you info about channels that got subscribed (e.g. when you re-login quickly or when a user is logged in in multiple clients). |
|||
Added: HandleSubscriptionResults() method to handle the event and proper responses. |
|
|||
fileFormatVersion: 2 |
|||
guid: 4b1b7c7ca29327d48b0172f7cbfd7491 |
|||
TextScriptImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 1bfec6f6ef56ba64097eca90791237af |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 887ac71c799552346b6cf7654fb699cb |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
userData: |
1001
Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/Metro/Photon3Unity3D.dll
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 3b5a0a7dce46a13459199d174ad3db3f |
|||
PluginImporter: |
|||
serializedVersion: 1 |
|||
iconMap: {} |
|||
executionOrder: {} |
|||
isPreloaded: 0 |
|||
platformData: |
|||
Android: |
|||
enabled: 0 |
|||
settings: |
|||
CPU: AnyCPU |
|||
Any: |
|||
enabled: 0 |
|||
settings: {} |
|||
Editor: |
|||
enabled: 0 |
|||
settings: |
|||
CPU: AnyCPU |
|||
DefaultValueInitialized: true |
|||
OS: AnyOS |
|||
Linux: |
|||
enabled: 0 |
|||
settings: |
|||
CPU: x86 |
|||
Linux64: |
|||
enabled: 0 |
|||
settings: |
|||
CPU: x86_64 |
|||
OSXIntel: |
|||
enabled: 0 |
|||
settings: |
|||
CPU: AnyCPU |
|||
OSXIntel64: |
|||
enabled: 0 |
|||
settings: |
|||
CPU: AnyCPU |
|||
WP8: |
|||
enabled: 1 |
|||
settings: |
|||
CPU: AnyCPU |
|||
DontProcess: False |
|||
PlaceholderPath: Assets/Photon/PhotonLibs/Photon3Unity3D.dll |
|||
SDK: AnySDK |
|||
ScriptingBackend: DotNet |
|||
Win: |
|||
enabled: 0 |
|||
settings: |
|||
CPU: AnyCPU |
|||
Win64: |
|||
enabled: 0 |
|||
settings: |
|||
CPU: AnyCPU |
|||
WindowsStoreApps: |
|||
enabled: 1 |
|||
settings: |
|||
CPU: AnyCPU |
|||
DontProcess: False |
|||
PlaceholderPath: Assets/Photon/PhotonLibs/Photon3Unity3D.dll |
|||
SDK: AnySDK |
|||
ScriptingBackend: DotNet |
|||
iOS: |
|||
enabled: 0 |
|||
settings: |
|||
CompileFlags: |
|||
FrameworkDependencies: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
mrm_pri2 � � �� [mrm_decn_info] X [mrm_pridescex] X H [mrm_hschemaex] � � [mrm_res_map2_] x � [mrm_decn_info] X ����X [mrm_pridescex] H �� ����H [mrm_hschemaex] � [def_hnames] s��� m s - a p p x : / / P h o t o n 3 U n i t y 3 D / P h o t o n 3 U n i t y 3 D 0 ����� [mrm_res_map2_] � ���ހ ���ި mrm_pri2 |
|
|||
fileFormatVersion: 2 |
|||
guid: 3439a9e4030efca45b6cc06240106c02 |
|||
timeCreated: 1460035811 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
1001
Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/Photon3Unity3D.dll
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: aadb37a20a33632429047acaef43658a |
|||
labels: |
|||
- ExitGames |
|||
- PUN |
|||
- Photon |
|||
- Networking |
|||
PluginImporter: |
|||
serializedVersion: 1 |
|||
iconMap: {} |
|||
executionOrder: {} |
|||
isPreloaded: 0 |
|||
platformData: |
|||
Android: |
|||
enabled: 1 |
|||
settings: |
|||
CPU: AnyCPU |
|||
Any: |
|||
enabled: 0 |
|||
settings: {} |
|||
Editor: |
|||
enabled: 1 |
|||
settings: |
|||
CPU: AnyCPU |
|||
DefaultValueInitialized: true |
|||
OS: AnyOS |
|||
Linux: |
|||
enabled: 1 |
|||
settings: |
|||
CPU: x86 |
|||
Linux64: |
|||
enabled: 1 |
|||
settings: |
|||
CPU: x86_64 |
|||
LinuxUniversal: |
|||
enabled: 1 |
|||
settings: {} |
|||
OSXIntel: |
|||
enabled: 1 |
|||
settings: |
|||
CPU: AnyCPU |
|||
OSXIntel64: |
|||
enabled: 1 |
|||
settings: |
|||
CPU: AnyCPU |
|||
OSXUniversal: |
|||
enabled: 1 |
|||
settings: {} |
|||
WP8: |
|||
enabled: 1 |
|||
settings: |
|||
CPU: AnyCPU |
|||
DontProcess: False |
|||
PlaceholderPath: |
|||
SDK: AnySDK |
|||
ScriptingBackend: Il2Cpp |
|||
Web: |
|||
enabled: 1 |
|||
settings: {} |
|||
WebGL: |
|||
enabled: 1 |
|||
settings: {} |
|||
WebStreamed: |
|||
enabled: 1 |
|||
settings: {} |
|||
Win: |
|||
enabled: 1 |
|||
settings: |
|||
CPU: AnyCPU |
|||
Win64: |
|||
enabled: 1 |
|||
settings: |
|||
CPU: AnyCPU |
|||
WindowsStoreApps: |
|||
enabled: 1 |
|||
settings: |
|||
CPU: AnyCPU |
|||
DontProcess: False |
|||
PlaceholderPath: |
|||
SDK: AnySDK |
|||
ScriptingBackend: Il2Cpp |
|||
iOS: |
|||
enabled: 1 |
|||
settings: |
|||
CompileFlags: |
|||
FrameworkDependencies: |
|||
tvOS: |
|||
enabled: 1 |
|||
settings: |
|||
CompileFlags: |
|||
FrameworkDependencies: |
|||
PS4: |
|||
enabled: 1 |
|||
settings: {} |
|||
Switch: |
|||
enabled: 1 |
|||
settings: {} |
|||
XboxOne: |
|||
enabled: 1 |
|||
settings: {} |
|||
Lumin: |
|||
enabled: 1 |
|||
settings: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
1001
Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonLibs/Photon3Unity3D.xml
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 8d4f08d435c4b6343969d8af249460ff |
|||
labels: |
|||
- ExitGames |
|||
- PUN |
|||
- Photon |
|||
- Networking |
|||
TextScriptImporter: |
|||
userData: |
|
|||
fileFormatVersion: 2 |
|||
guid: 2f243ce0406bd1c40a9ff5fc2d78d905 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
userData: |
|
|||
#if UNITY_WEBGL || WEBSOCKET || (UNITY_XBOXONE && UNITY_EDITOR)
|
|||
|
|||
// --------------------------------------------------------------------------------------------------------------------
|
|||
// <copyright file="SocketWebTcp.cs" company="Exit Games GmbH">
|
|||
// Copyright (c) Exit Games GmbH. All rights reserved.
|
|||
// </copyright>
|
|||
// <summary>
|
|||
// Internal class to encapsulate the network i/o functionality for the realtime library.
|
|||
// </summary>
|
|||
// <author>developer@exitgames.com</author>
|
|||
// --------------------------------------------------------------------------------------------------------------------
|
|||
|
|||
|
|||
namespace ExitGames.Client.Photon |
|||
{ |
|||
using System; |
|||
using System.Collections; |
|||
using UnityEngine; |
|||
using SupportClassPun = ExitGames.Client.Photon.SupportClass; |
|||
|
|||
|
|||
/// <summary>
|
|||
/// Yield Instruction to Wait for real seconds. Very important to keep connection working if Time.TimeScale is altered, we still want accurate network events
|
|||
/// </summary>
|
|||
public sealed class WaitForRealSeconds : CustomYieldInstruction |
|||
{ |
|||
private readonly float _endTime; |
|||
|
|||
public override bool keepWaiting |
|||
{ |
|||
get { return this._endTime > Time.realtimeSinceStartup; } |
|||
} |
|||