diff --git a/Assets/Photon.meta b/Assets/Photon.meta
new file mode 100644
index 00000000..06f81093
--- /dev/null
+++ b/Assets/Photon.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 98951132346795f438babe7a3183da43
+folderAsset: yes
+timeCreated: 1523536679
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat.meta b/Assets/Photon/PhotonChat.meta
new file mode 100644
index 00000000..ba251119
--- /dev/null
+++ b/Assets/Photon/PhotonChat.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: ea05e6479d592944d955c2a5e1a6d6f1
+folderAsset: yes
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Code.meta b/Assets/Photon/PhotonChat/Code.meta
new file mode 100644
index 00000000..514db0b5
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: af83a98aaa4f7b64eb7fcec95ee7b1ed
+folderAsset: yes
+timeCreated: 1523525757
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Code/ChannelCreationOptions.cs b/Assets/Photon/PhotonChat/Code/ChannelCreationOptions.cs
new file mode 100644
index 00000000..50c791b5
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChannelCreationOptions.cs
@@ -0,0 +1,22 @@
+// ----------------------------------------------------------------------------------------------------------------------
+// The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.
+// ChannelCreationOptions is a parameter used when subscribing to a public channel for the first time.
+// Photon Chat Api - Copyright (C) 2018 Exit Games GmbH
+// ----------------------------------------------------------------------------------------------------------------------
+
+namespace Photon.Chat
+{
+ public class ChannelCreationOptions
+ {
+ /// Default values of channel creation options.
+ public static ChannelCreationOptions Default = new ChannelCreationOptions();
+ /// Whether or not the channel to be created will allow client to keep a list of users.
+ public bool PublishSubscribers { get; set; }
+ /// Limit of the number of users subscribed to the channel to be created.
+ public int MaxSubscribers { get; set; }
+
+ #if CHAT_EXTENDED
+ public System.Collections.Generic.Dictionary CustomProperties { get; set; }
+ #endif
+ }
+}
diff --git a/Assets/Photon/PhotonChat/Code/ChannelCreationOptions.cs.meta b/Assets/Photon/PhotonChat/Code/ChannelCreationOptions.cs.meta
new file mode 100644
index 00000000..5650cd32
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChannelCreationOptions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 6c1aa0fceaa2bc14eabdf85976f4e2c8
+timeCreated: 1549546375
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Code/ChannelWellKnownProperties.cs b/Assets/Photon/PhotonChat/Code/ChannelWellKnownProperties.cs
new file mode 100644
index 00000000..2627e7ac
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChannelWellKnownProperties.cs
@@ -0,0 +1,14 @@
+// ----------------------------------------------------------------------------------------------------------------------
+// The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.
+// ChannelWellKnownProperties contains the list of well-known channel properties.
+// Photon Chat Api - Copyright (C) 2018 Exit Games GmbH
+// ----------------------------------------------------------------------------------------------------------------------
+
+namespace Photon.Chat
+{
+ public class ChannelWellKnownProperties
+ {
+ public const byte MaxSubscribers = 255;
+ public const byte PublishSubscribers = 254;
+ }
+}
diff --git a/Assets/Photon/PhotonChat/Code/ChannelWellKnownProperties.cs.meta b/Assets/Photon/PhotonChat/Code/ChannelWellKnownProperties.cs.meta
new file mode 100644
index 00000000..2c88cb10
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChannelWellKnownProperties.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 5eb508ffb7b7b0f47882f0087a668283
+timeCreated: 1547826678
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Code/ChatAppSettings.cs b/Assets/Photon/PhotonChat/Code/ChatAppSettings.cs
new file mode 100644
index 00000000..a2255d54
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChatAppSettings.cs
@@ -0,0 +1,64 @@
+// -----------------------------------------------------------------------
+//
+// Chat API for Photon - Copyright (C) 2018 Exit Games GmbH
+//
+// Settings for Photon Chat application and the server to connect to.
+// developer@photonengine.com
+// ----------------------------------------------------------------------------
+
+#if UNITY_4_7 || UNITY_5 || UNITY_5_3_OR_NEWER
+#define SUPPORTED_UNITY
+#endif
+
+
+namespace Photon.Chat
+{
+ using System;
+ using ExitGames.Client.Photon;
+ #if SUPPORTED_UNITY
+ using UnityEngine.Serialization;
+ #endif
+
+ ///
+ /// Settings for Photon application(s) and the server to connect to.
+ ///
+ ///
+ /// This is Serializable for Unity, so it can be included in ScriptableObject instances.
+ ///
+ #if !NETFX_CORE || SUPPORTED_UNITY
+ [Serializable]
+ #endif
+ public class ChatAppSettings
+ {
+ /// AppId for the Chat Api.
+ public string AppIdChat;
+
+ /// The AppVersion can be used to identify builds and will split the AppId distinct "Virtual AppIds" (important for the users to find each other).
+ public string AppVersion;
+
+ /// Can be set to any of the Photon Cloud's region names to directly connect to that region.
+ public string FixedRegion;
+
+ /// The address (hostname or IP) of the server to connect to.
+ public string Server;
+
+ /// If not null, this sets the port of the first Photon server to connect to (that will "forward" the client as needed).
+ public ushort Port;
+
+ /// The address (hostname or IP and port) of the proxy server.
+ public string ProxyServer;
+
+ /// The network level protocol to use.
+ public ConnectionProtocol Protocol = ConnectionProtocol.Udp;
+
+ /// Enables a fallback to another protocol in case a connect to the Name Server fails.
+ /// See: LoadBalancingClient.EnableProtocolFallback.
+ public bool EnableProtocolFallback = true;
+
+ /// Log level for the network lib.
+ public DebugLevel NetworkLogging = DebugLevel.ERROR;
+
+ /// If true, the default nameserver address for the Photon Cloud should be used.
+ public bool IsDefaultNameServer { get { return string.IsNullOrEmpty(this.Server); } }
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonChat/Code/ChatAppSettings.cs.meta b/Assets/Photon/PhotonChat/Code/ChatAppSettings.cs.meta
new file mode 100644
index 00000000..479680ba
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChatAppSettings.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 87776a9b1f405644abcc38ecd70c37fb
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Code/ChatChannel.cs b/Assets/Photon/PhotonChat/Code/ChatChannel.cs
new file mode 100644
index 00000000..6d0885e8
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChatChannel.cs
@@ -0,0 +1,255 @@
+// ----------------------------------------------------------------------------------------------------------------------
+// The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.
+// ChatClient is the main class of this api.
+// Photon Chat Api - Copyright (C) 2014 Exit Games GmbH
+// ----------------------------------------------------------------------------------------------------------------------
+
+#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
+
+
+ ///
+ /// A channel of communication in Photon Chat, updated by ChatClient and provided as READ ONLY.
+ ///
+ ///
+ /// Contains messages and senders to use (read!) and display by your GUI.
+ /// Access these by:
+ /// ChatClient.PublicChannels
+ /// ChatClient.PrivateChannels
+ ///
+ public class ChatChannel
+ {
+ /// Name of the channel (used to subscribe and unsubscribe).
+ public readonly string Name;
+
+ /// Senders of messages in chronological order. Senders and Messages refer to each other by index. Senders[x] is the sender of Messages[x].
+ public readonly List Senders = new List();
+
+ /// Messages in chronological order. Senders and Messages refer to each other by index. Senders[x] is the sender of Messages[x].
+ public readonly List Messages = new List();
+
+ /// If greater than 0, this channel will limit the number of messages, that it caches locally.
+ public int MessageLimit;
+
+ /// Unique channel ID.
+ public int ChannelID;
+
+ /// Is this a private 1:1 channel?
+ public bool IsPrivate { get; protected internal set; }
+
+ /// Count of messages this client still buffers/knows for this channel.
+ public int MessageCount { get { return this.Messages.Count; } }
+
+ ///
+ /// ID of the last message received.
+ ///
+ public int LastMsgId { get; protected set; }
+
+ private Dictionary properties;
+
+ /// Whether or not this channel keeps track of the list of its subscribers.
+ public bool PublishSubscribers { get; protected set; }
+
+ /// Maximum number of channel subscribers. 0 means infinite.
+ public int MaxSubscribers { get; protected set; }
+
+ /// Subscribed users.
+ public readonly HashSet Subscribers = new HashSet();
+
+ /// Properties of subscribers
+ private Dictionary> usersProperties;
+
+ /// Used internally to create new channels. This does NOT create a channel on the server! Use ChatClient.Subscribe.
+ public ChatChannel(string name)
+ {
+ this.Name = name;
+ }
+
+ /// Used internally to add messages to this channel.
+ public void Add(string sender, object message, int msgId)
+ {
+ this.Senders.Add(sender);
+ this.Messages.Add(message);
+ this.LastMsgId = msgId;
+ this.TruncateMessages();
+ }
+
+ /// Used internally to add messages to this channel.
+ public void Add(string[] senders, object[] messages, int lastMsgId)
+ {
+ this.Senders.AddRange(senders);
+ this.Messages.AddRange(messages);
+ this.LastMsgId = lastMsgId;
+ this.TruncateMessages();
+ }
+
+ /// Reduces the number of locally cached messages in this channel to the MessageLimit (if set).
+ 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);
+ }
+
+ /// Clear the local cache of messages currently stored. This frees memory but doesn't affect the server.
+ public void ClearMessages()
+ {
+ this.Senders.Clear();
+ this.Messages.Clear();
+ }
+
+ /// Provides a string-representation of all messages in this channel.
+ /// All known messages in format "Sender: Message", line by line.
+ 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 ReadChannelProperties(Dictionary newProperties)
+ {
+ if (newProperties != null && newProperties.Count > 0)
+ {
+ if (this.properties == null)
+ {
+ this.properties = new Dictionary(newProperties.Count);
+ }
+ foreach (var pair in newProperties)
+ {
+ if (pair.Value == null)
+ {
+ this.properties.Remove(pair.Key);
+ }
+ else
+ {
+ this.properties[pair.Key] = pair.Value;
+ }
+ }
+ 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 bool AddSubscribers(string[] users)
+ {
+ if (users == null)
+ {
+ return false;
+ }
+ bool result = true;
+ for (int i = 0; i < users.Length; i++)
+ {
+ if (!this.Subscribers.Add(users[i]))
+ {
+ result = false;
+ }
+ }
+ return result;
+ }
+
+ internal bool AddSubscriber(string userId)
+ {
+ return this.Subscribers.Add(userId);
+ }
+
+ internal bool RemoveSubscriber(string userId)
+ {
+ if (this.usersProperties != null)
+ {
+ this.usersProperties.Remove(userId);
+ }
+ return this.Subscribers.Remove(userId);
+ }
+
+
+ #if CHAT_EXTENDED
+ internal void ReadUserProperties(string userId, Dictionary changedProperties)
+ {
+ if (this.usersProperties == null)
+ {
+ this.usersProperties = new Dictionary>();
+ }
+ Dictionary userProperties;
+ if (!this.usersProperties.TryGetValue(userId, out userProperties))
+ {
+ userProperties = new Dictionary();
+ this.usersProperties.Add(userId, userProperties);
+ }
+ foreach (var property in changedProperties)
+ {
+ //UnityEngine.Debug.LogFormat("User {0} property {1} = {2}", userId, property.Key, property.Value);
+ if (property.Value == null)
+ {
+ userProperties.Remove(property.Key);
+ }
+ else
+ {
+ userProperties[property.Key] = property.Value;
+ }
+ }
+ }
+
+ internal bool TryGetChannelProperty(object propertyKey, out T propertyValue)
+ {
+ propertyValue = default;
+ object temp;
+ if (properties != null && properties.TryGetValue(propertyKey, out temp) && temp is T)
+ {
+ propertyValue = (T)temp;
+ return true;
+ }
+ return false;
+ }
+
+ internal bool TryGetUserProperty(string userId, object propertyKey, out T propertyValue)
+ {
+ propertyValue = default;
+ object temp;
+ Dictionary userProperties;
+ if (this.usersProperties != null && usersProperties.TryGetValue(userId, out userProperties) && userProperties.TryGetValue(propertyKey, out temp) && temp is T)
+ {
+ propertyValue = (T)temp;
+ return true;
+ }
+ return false;
+ }
+
+ public bool TryGetCustomChannelProperty(string propertyKey, out T propertyValue)
+ {
+ return this.TryGetChannelProperty(propertyKey, out propertyValue);
+ }
+
+ public bool TryGetCustomUserProperty(string userId, string propertyKey, out T propertyValue)
+ {
+ return this.TryGetUserProperty(userId, propertyKey, out propertyValue);
+ }
+ #endif
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonChat/Code/ChatChannel.cs.meta b/Assets/Photon/PhotonChat/Code/ChatChannel.cs.meta
new file mode 100644
index 00000000..0d739656
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChatChannel.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 35b2a4878e5e99e438c97fbe8dbbd863
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/Photon/PhotonChat/Code/ChatClient.cs b/Assets/Photon/PhotonChat/Code/ChatClient.cs
new file mode 100644
index 00000000..c65cb3e0
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChatClient.cs
@@ -0,0 +1,1856 @@
+// ----------------------------------------------------------------------------------------------------------------------
+// The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.
+// ChatClient is the main class of this api.
+// Photon Chat Api - Copyright (C) 2014 Exit Games GmbH
+// ----------------------------------------------------------------------------------------------------------------------
+
+#if UNITY_4_7 || UNITY_5 || UNITY_5_3_OR_NEWER
+#define SUPPORTED_UNITY
+#endif
+
+namespace Photon.Chat
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Diagnostics;
+ using ExitGames.Client.Photon;
+
+ #if SUPPORTED_UNITY || NETFX_CORE
+ using Hashtable = ExitGames.Client.Photon.Hashtable;
+ using SupportClass = ExitGames.Client.Photon.SupportClass;
+ #endif
+
+
+ /// Central class of the Photon Chat API to connect, handle channels and messages.
+ ///
+ /// This class must be instantiated with a IChatClientListener instance to get the callbacks.
+ /// Integrate it into your game loop by calling Service regularly. If the target platform supports Threads/Tasks,
+ /// set UseBackgroundWorkerForSending = true, to let the ChatClient keep the connection by sending from
+ /// an independent thread.
+ ///
+ /// Call Connect with an AppId that is setup as Photon Chat application. Note: Connect covers multiple
+ /// messages between this client and the servers. A short workflow will connect you to a chat server.
+ ///
+ /// Each ChatClient resembles a user in chat (set in Connect). Each user automatically subscribes a channel
+ /// for incoming private messages and can message any other user privately.
+ /// Before you publish messages in any non-private channel, that channel must be subscribed.
+ ///
+ /// PublicChannels is a list of subscribed channels, containing messages and senders.
+ /// PrivateChannels contains all incoming and sent private messages.
+ ///
+ public class ChatClient : IPhotonPeerListener
+ {
+ const int FriendRequestListMax = 1024;
+
+ /// Default maximum value possible for when is enabled
+ public const int DefaultMaxSubscribers = 100;
+
+ private const byte HttpForwardWebFlag = 0x01;
+
+ /// Enables a fallback to another protocol in case a connect to the Name Server fails.
+ ///
+ /// When connecting to the Name Server fails for a first time, the client will select an alternative
+ /// network protocol and re-try to connect.
+ ///
+ /// The fallback will use the default Name Server port as defined by ProtocolToNameServerPort.
+ ///
+ /// The fallback for TCP is UDP. All other protocols fallback to TCP.
+ ///
+ public bool EnableProtocolFallback { get; set; }
+
+ /// The address of last connected Name Server.
+ public string NameServerAddress { get; private set; }
+
+ /// The address of the actual chat server assigned from NameServer. Public for read only.
+ public string FrontendAddress { get; private set; }
+
+ /// Region used to connect to. Currently all chat is done in EU. It can make sense to use only one region for the whole game.
+ private string chatRegion = "EU";
+
+ /// Settable only before you connect! Defaults to "EU".
+ public string ChatRegion
+ {
+ get { return this.chatRegion; }
+ set { this.chatRegion = value; }
+ }
+
+ ///
+ /// Defines a proxy URL for WebSocket connections. Can be the proxy or point to a .pac file.
+ ///
+ ///
+ /// This URL supports various definitions:
+ ///
+ /// "user:pass@proxyaddress:port"
+ /// "proxyaddress:port"
+ /// "system:"
+ /// "pac:"
+ /// "pac:http://host/path/pacfile.pac"
+ ///
+ /// Important: Don't define a protocol, except to point to a pac file. the proxy address should not begin with http:// or https://.
+ ///
+ public string ProxyServerAddress;
+
+ /// Current state of the ChatClient. Also use CanChat.
+ public ChatState State { get; private set; }
+
+ /// Disconnection cause. Check this inside .
+ public ChatDisconnectCause DisconnectedCause { get; private set; }
+ ///
+ /// Checks if this client is ready to send messages.
+ ///
+ public bool CanChat
+ {
+ get { return this.State == ChatState.ConnectedToFrontEnd && this.HasPeer; }
+ }
+ ///
+ /// Checks if this client is ready to publish messages inside a public channel.
+ ///
+ /// The channel to do the check with.
+ /// Whether or not this client is ready to publish messages inside the public channel with the specified channelName.
+ public bool CanChatInChannel(string channelName)
+ {
+ return this.CanChat && this.PublicChannels.ContainsKey(channelName) && !this.PublicChannelsUnsubscribing.Contains(channelName);
+ }
+
+ private bool HasPeer
+ {
+ get { return this.chatPeer != null; }
+ }
+
+ /// The version of your client. A new version also creates a new "virtual app" to separate players from older client versions.
+ public string AppVersion { get; private set; }
+
+ /// The AppID as assigned from the Photon Cloud.
+ public string AppId { get; private set; }
+
+
+ /// Settable only before you connect!
+ public AuthenticationValues AuthValues { get; set; }
+
+ /// The unique ID of a user/person, stored in AuthValues.UserId. Set it before you connect.
+ ///
+ /// This value wraps AuthValues.UserId.
+ /// It's not a nickname and we assume users with the same userID are the same person.
+ public string UserId
+ {
+ get
+ {
+ return (this.AuthValues != null) ? this.AuthValues.UserId : null;
+ }
+ private set
+ {
+ if (this.AuthValues == null)
+ {
+ this.AuthValues = new AuthenticationValues();
+ }
+ this.AuthValues.UserId = value;
+ }
+ }
+
+ /// If greater than 0, new channels will limit the number of messages they cache locally.
+ ///
+ /// This can be useful to limit the amount of memory used by chats.
+ /// You can set a MessageLimit per channel but this value gets applied to new ones.
+ ///
+ /// Note:
+ /// Changing this value, does not affect ChatChannels that are already in use!
+ ///
+ public int MessageLimit;
+
+ /// Limits the number of messages from private channel histories.
+ ///
+ /// This is applied to all private channels on reconnect, as there is no explicit re-joining private channels.
+ /// Default is -1, which gets available messages up to a maximum set by the server.
+ /// A value of 0 gets you zero messages.
+ /// The server's limit of messages may be lower. If so, the server's value will overrule this.
+ ///
+ public int PrivateChatHistoryLength = -1;
+
+ /// Public channels this client is subscribed to.
+ public readonly Dictionary PublicChannels;
+ /// Private channels in which this client has exchanged messages.
+ public readonly Dictionary PrivateChannels;
+
+ // channels being in unsubscribing process
+ // items will be removed on successful unsubscription or subscription (the latter required after attempt to unsubscribe from not existing channel)
+ private readonly HashSet PublicChannelsUnsubscribing;
+
+ private readonly IChatClientListener listener = null;
+ /// The Chat Peer used by this client.
+ public ChatPeer chatPeer = null;
+ private const string ChatAppName = "chat";
+ private bool didAuthenticate;
+
+ private int? statusToSetWhenConnected;
+ private object messageToSetWhenConnected;
+
+ private int msDeltaForServiceCalls = 50;
+ private int msTimestampOfLastServiceCall;
+
+ /// Defines if a background thread will call SendOutgoingCommands, while your code calls Service to dispatch received messages.
+ ///
+ /// The benefit of using a background thread to call SendOutgoingCommands is this:
+ ///
+ /// Even if your game logic is being paused, the background thread will keep the connection to the server up.
+ /// On a lower level, acknowledgements and pings will prevent a server-side timeout while (e.g.) Unity loads assets.
+ ///
+ /// Your game logic still has to call Service regularly, or else incoming messages are not dispatched.
+ /// As this typically triggers UI updates, it's easier to call Service from the main/UI thread.
+ ///
+ public bool UseBackgroundWorkerForSending { get; set; }
+
+ /// Exposes the TransportProtocol of the used PhotonPeer. Settable while not connected.
+ public ConnectionProtocol TransportProtocol
+ {
+ get { return this.chatPeer.TransportProtocol; }
+ set
+ {
+ if (this.chatPeer == null || this.chatPeer.PeerState != PeerStateValue.Disconnected)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, "Can't set TransportProtocol. Disconnect first! " + ((this.chatPeer != null) ? "PeerState: " + this.chatPeer.PeerState : "The chatPeer is null."));
+ return;
+ }
+ this.chatPeer.TransportProtocol = value;
+ }
+ }
+
+ /// Defines which IPhotonSocket class to use per ConnectionProtocol.
+ ///
+ /// Several platforms have special Socket implementations and slightly different APIs.
+ /// To accomodate this, switching the socket implementation for a network protocol was made available.
+ /// By default, UDP and TCP have socket implementations assigned.
+ ///
+ /// You only need to set the SocketImplementationConfig once, after creating a PhotonPeer
+ /// and before connecting. If you switch the TransportProtocol, the correct implementation is being used.
+ ///
+ public Dictionary SocketImplementationConfig
+ {
+ get { return this.chatPeer.SocketImplementationConfig; }
+ }
+
+ ///
+ /// Chat client constructor.
+ ///
+ /// The chat listener implementation.
+ /// Connection protocol to be used by this client. Default is .
+ public ChatClient(IChatClientListener listener, ConnectionProtocol protocol = ConnectionProtocol.Udp)
+ {
+ this.listener = listener;
+ this.State = ChatState.Uninitialized;
+
+ this.chatPeer = new ChatPeer(this, protocol);
+ this.chatPeer.SerializationProtocolType = SerializationProtocol.GpBinaryV18;
+
+ this.PublicChannels = new Dictionary();
+ this.PrivateChannels = new Dictionary();
+
+ this.PublicChannelsUnsubscribing = new HashSet();
+ }
+
+
+ public bool ConnectUsingSettings(ChatAppSettings appSettings)
+ {
+ if (appSettings == null)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, "ConnectUsingSettings failed. The appSettings can't be null.'");
+ return false;
+ }
+
+ if (!string.IsNullOrEmpty(appSettings.FixedRegion))
+ {
+ this.ChatRegion = appSettings.FixedRegion;
+ }
+
+ this.DebugOut = appSettings.NetworkLogging;
+
+ this.TransportProtocol = appSettings.Protocol;
+ this.EnableProtocolFallback = appSettings.EnableProtocolFallback;
+
+ if (!appSettings.IsDefaultNameServer)
+ {
+ this.chatPeer.NameServerHost = appSettings.Server;
+ this.chatPeer.NameServerPortOverride = appSettings.Port;
+ }
+
+ this.ProxyServerAddress = appSettings.ProxyServer;
+
+ return this.Connect(appSettings.AppIdChat, appSettings.AppVersion, this.AuthValues);
+ }
+
+ ///
+ /// Connects this client to the Photon Chat Cloud service, which will also authenticate the user (and set a UserId).
+ ///
+ ///
+ /// The ProxyServerAddress is used to connect. Set it before calling this method or use ConnectUsingSettings.
+ ///
+ /// Get your Photon Chat AppId from the Dashboard .
+ /// Any version string you make up. Used to separate users and variants of your clients, which might be incompatible.
+ /// Values for authentication. You can leave this null, if you set a UserId before. If you set authValues, they will override any UserId set before.
+ ///
+ public bool Connect(string appId, string appVersion, AuthenticationValues authValues)
+ {
+ this.chatPeer.TimePingInterval = 3000;
+ this.DisconnectedCause = ChatDisconnectCause.None;
+
+ if (authValues != null)
+ {
+ this.AuthValues = authValues;
+ }
+
+ this.AppId = appId;
+ this.AppVersion = appVersion;
+ this.didAuthenticate = false;
+ this.chatPeer.QuickResendAttempts = 2;
+ this.chatPeer.SentCountAllowance = 7;
+
+ // clean all channels
+ this.PublicChannels.Clear();
+ this.PrivateChannels.Clear();
+ this.PublicChannelsUnsubscribing.Clear();
+
+ #if UNITY_WEBGL
+ if (this.TransportProtocol == ConnectionProtocol.Tcp || this.TransportProtocol == ConnectionProtocol.Udp)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, "WebGL requires WebSockets. Switching TransportProtocol to WebSocketSecure.");
+ this.TransportProtocol = ConnectionProtocol.WebSocketSecure;
+ }
+ #endif
+
+ this.NameServerAddress = this.chatPeer.NameServerAddress;
+
+ bool isConnecting = this.chatPeer.Connect(this.NameServerAddress, this.ProxyServerAddress, "NameServer", null);
+ if (isConnecting)
+ {
+ this.State = ChatState.ConnectingToNameServer;
+ }
+
+ if (this.UseBackgroundWorkerForSending)
+ {
+ #if UNITY_SWITCH
+ SupportClass.StartBackgroundCalls(this.SendOutgoingInBackground, this.msDeltaForServiceCalls); // as workaround, we don't name the Thread.
+ #else
+ SupportClass.StartBackgroundCalls(this.SendOutgoingInBackground, this.msDeltaForServiceCalls, "ChatClient Service Thread");
+ #endif
+ }
+
+ return isConnecting;
+ }
+
+ ///
+ /// Connects this client to the Photon Chat Cloud service, which will also authenticate the user (and set a UserId).
+ /// This also sets an online status once connected. By default it will set user status to .
+ /// See for more information.
+ ///
+ /// Get your Photon Chat AppId from the Dashboard .
+ /// Any version string you make up. Used to separate users and variants of your clients, which might be incompatible.
+ /// Values for authentication. You can leave this null, if you set a UserId before. If you set authValues, they will override any UserId set before.
+ /// User status to set when connected. Predefined states are in class . Other values can be used at will.
+ /// Optional status Also sets a status-message which your friends can get.
+ /// If the connection attempt could be sent at all.
+ public bool ConnectAndSetStatus(string appId, string appVersion, AuthenticationValues authValues,
+ int status = ChatUserStatus.Online, object message = null)
+ {
+ statusToSetWhenConnected = status;
+ messageToSetWhenConnected = message;
+ return Connect(appId, appVersion, authValues);
+ }
+
+ ///
+ /// Must be called regularly to keep connection between client and server alive and to process incoming messages.
+ ///
+ ///
+ /// This method limits the effort it does automatically using the private variable msDeltaForServiceCalls.
+ /// That value is lower for connect and multiplied by 4 when chat-server connection is ready.
+ ///
+ public void Service()
+ {
+ // Dispatch until every already-received message got dispatched
+ while (this.HasPeer && this.chatPeer.DispatchIncomingCommands())
+ {
+ }
+
+ // if there is no background thread for sending, Service() will do that as well, in intervals
+ if (!this.UseBackgroundWorkerForSending)
+ {
+ if (Environment.TickCount - this.msTimestampOfLastServiceCall > this.msDeltaForServiceCalls || this.msTimestampOfLastServiceCall == 0)
+ {
+ this.msTimestampOfLastServiceCall = Environment.TickCount;
+
+ while (this.HasPeer && this.chatPeer.SendOutgoingCommands())
+ {
+ }
+ }
+ }
+ }
+
+ ///
+ /// Called by a separate thread, this sends outgoing commands of this peer, as long as it's connected.
+ ///
+ /// True as long as the client is not disconnected.
+ private bool SendOutgoingInBackground()
+ {
+ while (this.HasPeer && this.chatPeer.SendOutgoingCommands())
+ {
+ }
+
+ return this.State != ChatState.Disconnected;
+ }
+
+ /// Obsolete: Better use UseBackgroundWorkerForSending and Service().
+ [Obsolete("Better use UseBackgroundWorkerForSending and Service().")]
+ public void SendAcksOnly()
+ {
+ if (this.HasPeer) this.chatPeer.SendAcksOnly();
+ }
+
+
+ ///
+ /// Disconnects from the Chat Server by sending a "disconnect command", which prevents a timeout server-side.
+ ///
+ public void Disconnect(ChatDisconnectCause cause = ChatDisconnectCause.DisconnectByClientLogic)
+ {
+ if (this.HasPeer && this.chatPeer.PeerState != PeerStateValue.Disconnected)
+ {
+ this.State = ChatState.Disconnecting;
+ this.DisconnectedCause = cause;
+ this.chatPeer.Disconnect();
+ }
+ }
+
+ ///
+ /// Locally shuts down the connection to the Chat Server. This resets states locally but the server will have to timeout this peer.
+ ///
+ public void StopThread()
+ {
+ if (this.HasPeer)
+ {
+ this.chatPeer.StopThread();
+ }
+ }
+
+ /// Sends operation to subscribe to a list of channels by name.
+ /// List of channels to subscribe to. Avoid null or empty values.
+ /// If the operation could be sent at all (Example: Fails if not connected to Chat Server).
+ public bool Subscribe(string[] channels)
+ {
+ return this.Subscribe(channels, 0);
+ }
+
+ ///
+ /// Sends operation to subscribe to a list of channels by name and possibly retrieve messages we did not receive while unsubscribed.
+ ///
+ /// List of channels to subscribe to. Avoid null or empty values.
+ /// ID of last message received per channel. Useful when re subscribing to receive only messages we missed.
+ /// If the operation could be sent at all (Example: Fails if not connected to Chat Server).
+ public bool Subscribe(string[] channels, int[] lastMsgIds)
+ {
+ if (!this.CanChat)
+ {
+ if (this.DebugOut >= DebugLevel.ERROR)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, "Subscribe called while not connected to front end server.");
+ }
+ return false;
+ }
+
+ if (channels == null || channels.Length == 0)
+ {
+ if (this.DebugOut >= DebugLevel.WARNING)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, "Subscribe can't be called for empty or null channels-list.");
+ }
+ return false;
+ }
+
+ for (int i = 0; i < channels.Length; i++)
+ {
+ if (string.IsNullOrEmpty(channels[i]))
+ {
+ if (this.DebugOut >= DebugLevel.ERROR)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, string.Format("Subscribe can't be called with a null or empty channel name at index {0}.", i));
+ }
+ return false;
+ }
+ }
+
+ if (lastMsgIds == null || lastMsgIds.Length != channels.Length)
+ {
+ if (this.DebugOut >= DebugLevel.ERROR)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, "Subscribe can't be called when \"lastMsgIds\" array is null or does not have the same length as \"channels\" array.");
+ }
+ return false;
+ }
+
+ Dictionary opParameters = new Dictionary
+ {
+ { ChatParameterCode.Channels, channels },
+ { ChatParameterCode.MsgIds, lastMsgIds},
+ { ChatParameterCode.HistoryLength, -1 } // server will decide how many messages to send to client
+ };
+
+ return this.chatPeer.SendOperation(ChatOperationCode.Subscribe, opParameters, SendOptions.SendReliable);
+ }
+
+ ///
+ /// Sends operation to subscribe client to channels, optionally fetching a number of messages from the cache.
+ ///
+ ///
+ /// Subscribes channels will forward new messages to this user. Use PublishMessage to do so.
+ /// The messages cache is limited but can be useful to get into ongoing conversations, if that's needed.
+ ///
+ /// List of channels to subscribe to. Avoid null or empty values.
+ /// 0: no history. 1 and higher: number of messages in history. -1: all available history.
+ /// If the operation could be sent at all (Example: Fails if not connected to Chat Server).
+ public bool Subscribe(string[] channels, int messagesFromHistory)
+ {
+ if (!this.CanChat)
+ {
+ if (this.DebugOut >= DebugLevel.ERROR)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, "Subscribe called while not connected to front end server.");
+ }
+ return false;
+ }
+
+ if (channels == null || channels.Length == 0)
+ {
+ if (this.DebugOut >= DebugLevel.WARNING)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, "Subscribe can't be called for empty or null channels-list.");
+ }
+ return false;
+ }
+
+ return this.SendChannelOperation(channels, (byte)ChatOperationCode.Subscribe, messagesFromHistory);
+ }
+
+ /// Unsubscribes from a list of channels, which stops getting messages from those.
+ ///
+ /// The client will remove these channels from the PublicChannels dictionary once the server sent a response to this request.
+ ///
+ /// The request will be sent to the server and IChatClientListener.OnUnsubscribed gets called when the server
+ /// actually removed the channel subscriptions.
+ ///
+ /// Unsubscribe will fail if you include null or empty channel names.
+ ///
+ /// Names of channels to unsubscribe.
+ /// False, if not connected to a chat server.
+ public bool Unsubscribe(string[] channels)
+ {
+ if (!this.CanChat)
+ {
+ if (this.DebugOut >= DebugLevel.ERROR)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, "Unsubscribe called while not connected to front end server.");
+ }
+ return false;
+ }
+
+ if (channels == null || channels.Length == 0)
+ {
+ if (this.DebugOut >= DebugLevel.WARNING)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, "Unsubscribe can't be called for empty or null channels-list.");
+ }
+ return false;
+ }
+
+ foreach (string ch in channels)
+ {
+ this.PublicChannelsUnsubscribing.Add(ch);
+ }
+ return this.SendChannelOperation(channels, ChatOperationCode.Unsubscribe, 0);
+ }
+
+ /// Sends a message to a public channel which this client subscribed to.
+ ///
+ /// Before you publish to a channel, you have to subscribe it.
+ /// Everyone in that channel will get the message.
+ ///
+ /// Name of the channel to publish to.
+ /// Your message (string or any serializable data).
+ /// Optionally, public messages can be forwarded as webhooks. Configure webhooks for your Chat app to use this.
+ /// False if the client is not yet ready to send messages.
+ public bool PublishMessage(string channelName, object message, bool forwardAsWebhook = false)
+ {
+ return this.publishMessage(channelName, message, true, forwardAsWebhook);
+ }
+
+ internal bool PublishMessageUnreliable(string channelName, object message, bool forwardAsWebhook = false)
+ {
+ return this.publishMessage(channelName, message, false, forwardAsWebhook);
+ }
+
+ private bool publishMessage(string channelName, object message, bool reliable, bool forwardAsWebhook = false)
+ {
+ if (!this.CanChat)
+ {
+ if (this.DebugOut >= DebugLevel.ERROR)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, "PublishMessage called while not connected to front end server.");
+ }
+ return false;
+ }
+
+ if (string.IsNullOrEmpty(channelName) || message == null)
+ {
+ if (this.DebugOut >= DebugLevel.WARNING)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, "PublishMessage parameters must be non-null and not empty.");
+ }
+ return false;
+ }
+
+ Dictionary parameters = new Dictionary
+ {
+ { (byte)ChatParameterCode.Channel, channelName },
+ { (byte)ChatParameterCode.Message, message }
+ };
+ if (forwardAsWebhook)
+ {
+ parameters.Add(ChatParameterCode.WebFlags, (byte)0x1);
+ }
+
+ return this.chatPeer.SendOperation(ChatOperationCode.Publish, parameters, new SendOptions() { Reliability = reliable });
+ }
+
+ ///
+ /// Sends a private message to a single target user. Calls OnPrivateMessage on the receiving client.
+ ///
+ /// Username to send this message to.
+ /// The message you want to send. Can be a simple string or anything serializable.
+ /// Optionally, private messages can be forwarded as webhooks. Configure webhooks for your Chat app to use this.
+ /// True if this clients can send the message to the server.
+ public bool SendPrivateMessage(string target, object message, bool forwardAsWebhook = false)
+ {
+ return this.SendPrivateMessage(target, message, false, forwardAsWebhook);
+ }
+
+ ///
+ /// Sends a private message to a single target user. Calls OnPrivateMessage on the receiving client.
+ ///
+ /// Username to send this message to.
+ /// The message you want to send. Can be a simple string or anything serializable.
+ /// Optionally, private messages can be encrypted. Encryption is not end-to-end as the server decrypts the message.
+ /// Optionally, private messages can be forwarded as webhooks. Configure webhooks for your Chat app to use this.
+ /// True if this clients can send the message to the server.
+ public bool SendPrivateMessage(string target, object message, bool encrypt, bool forwardAsWebhook)
+ {
+ return this.sendPrivateMessage(target, message, encrypt, true, forwardAsWebhook);
+ }
+
+ internal bool SendPrivateMessageUnreliable(string target, object message, bool encrypt, bool forwardAsWebhook = false)
+ {
+ return this.sendPrivateMessage(target, message, encrypt, false, forwardAsWebhook);
+ }
+
+ private bool sendPrivateMessage(string target, object message, bool encrypt, bool reliable, bool forwardAsWebhook = false)
+ {
+ if (!this.CanChat)
+ {
+ if (this.DebugOut >= DebugLevel.ERROR)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, "SendPrivateMessage called while not connected to front end server.");
+ }
+ return false;
+ }
+
+ if (string.IsNullOrEmpty(target) || message == null)
+ {
+ if (this.DebugOut >= DebugLevel.WARNING)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, "SendPrivateMessage parameters must be non-null and not empty.");
+ }
+ return false;
+ }
+
+ Dictionary parameters = new Dictionary
+ {
+ { ChatParameterCode.UserId, target },
+ { ChatParameterCode.Message, message }
+ };
+ if (forwardAsWebhook)
+ {
+ parameters.Add(ChatParameterCode.WebFlags, (byte)0x1);
+ }
+
+ return this.chatPeer.SendOperation(ChatOperationCode.SendPrivate, parameters, new SendOptions() { Reliability = reliable, Encrypt = encrypt });
+ }
+
+ /// Sets the user's status (pre-defined or custom) and an optional message.
+ ///
+ /// The predefined status values can be found in class ChatUserStatus.
+ /// State ChatUserStatus.Invisible will make you offline for everyone and send no message.
+ ///
+ /// You can set custom values in the status integer. Aside from the pre-configured ones,
+ /// all states will be considered visible and online. Else, no one would see the custom state.
+ ///
+ /// The message object can be anything that Photon can serialize, including (but not limited to)
+ /// Hashtable, object[] and string. This value is defined by your own conventions.
+ ///
+ /// Predefined states are in class ChatUserStatus. Other values can be used at will.
+ /// Optional string message or null.
+ /// If true, the message gets ignored. It can be null but won't replace any current message.
+ /// True if the operation gets called on the server.
+ private bool SetOnlineStatus(int status, object message, bool skipMessage)
+ {
+ if (!this.CanChat)
+ {
+ if (this.DebugOut >= DebugLevel.ERROR)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, "SetOnlineStatus called while not connected to front end server.");
+ }
+ return false;
+ }
+
+ Dictionary parameters = new Dictionary
+ {
+ { ChatParameterCode.Status, status },
+ };
+
+ if (skipMessage)
+ {
+ parameters[ChatParameterCode.SkipMessage] = true;
+ }
+ else
+ {
+ parameters[ChatParameterCode.Message] = message;
+ }
+
+ return this.chatPeer.SendOperation(ChatOperationCode.UpdateStatus, parameters, SendOptions.SendReliable);
+ }
+
+ /// Sets the user's status without changing your status-message.
+ ///
+ /// The predefined status values can be found in class ChatUserStatus.
+ /// State ChatUserStatus.Invisible will make you offline for everyone and send no message.
+ ///
+ /// You can set custom values in the status integer. Aside from the pre-configured ones,
+ /// all states will be considered visible and online. Else, no one would see the custom state.
+ ///
+ /// This overload does not change the set message.
+ ///
+ /// Predefined states are in class ChatUserStatus. Other values can be used at will.
+ /// True if the operation gets called on the server.
+ public bool SetOnlineStatus(int status)
+ {
+ return this.SetOnlineStatus(status, null, true);
+ }
+
+ /// Sets the user's status without changing your status-message.
+ ///
+ /// The predefined status values can be found in class ChatUserStatus.
+ /// State ChatUserStatus.Invisible will make you offline for everyone and send no message.
+ ///
+ /// You can set custom values in the status integer. Aside from the pre-configured ones,
+ /// all states will be considered visible and online. Else, no one would see the custom state.
+ ///
+ /// The message object can be anything that Photon can serialize, including (but not limited to)
+ /// Hashtable, object[] and string. This value is defined by your own conventions.
+ ///
+ /// Predefined states are in class ChatUserStatus. Other values can be used at will.
+ /// Also sets a status-message which your friends can get.
+ /// True if the operation gets called on the server.
+ public bool SetOnlineStatus(int status, object message)
+ {
+ return this.SetOnlineStatus(status, message, false);
+ }
+
+ ///
+ /// Adds friends to a list on the Chat Server which will send you status updates for those.
+ ///
+ ///
+ /// AddFriends and RemoveFriends enable clients to handle their friend list
+ /// in the Photon Chat server. Having users on your friends list gives you access
+ /// to their current online status (and whatever info your client sets in it).
+ ///
+ /// Each user can set an online status consisting of an integer and an arbitrary
+ /// (serializable) object. The object can be null, Hashtable, object[] or anything
+ /// else Photon can serialize.
+ ///
+ /// The status is published automatically to friends (anyone who set your user ID
+ /// with AddFriends).
+ ///
+ /// Photon flushes friends-list when a chat client disconnects, so it has to be
+ /// set each time. If your community API gives you access to online status already,
+ /// you could filter and set online friends in AddFriends.
+ ///
+ /// Actual friend relations are not persistent and have to be stored outside
+ /// of Photon.
+ ///
+ /// Array of friend userIds.
+ /// If the operation could be sent.
+ public bool AddFriends(string[] friends)
+ {
+ if (!this.CanChat)
+ {
+ if (this.DebugOut >= DebugLevel.ERROR)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, "AddFriends called while not connected to front end server.");
+ }
+ return false;
+ }
+
+ if (friends == null || friends.Length == 0)
+ {
+ if (this.DebugOut >= DebugLevel.WARNING)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, "AddFriends can't be called for empty or null list.");
+ }
+ return false;
+ }
+ if (friends.Length > FriendRequestListMax)
+ {
+ if (this.DebugOut >= DebugLevel.WARNING)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, "AddFriends max list size exceeded: " + friends.Length + " > " + FriendRequestListMax);
+ }
+ return false;
+ }
+
+ Dictionary parameters = new Dictionary
+ {
+ { ChatParameterCode.Friends, friends },
+ };
+
+ return this.chatPeer.SendOperation(ChatOperationCode.AddFriends, parameters, SendOptions.SendReliable);
+ }
+
+ ///
+ /// Removes the provided entries from the list on the Chat Server and stops their status updates.
+ ///
+ ///
+ /// Photon flushes friends-list when a chat client disconnects. Unless you want to
+ /// remove individual entries, you don't have to RemoveFriends.
+ ///
+ /// AddFriends and RemoveFriends enable clients to handle their friend list
+ /// in the Photon Chat server. Having users on your friends list gives you access
+ /// to their current online status (and whatever info your client sets in it).
+ ///
+ /// Each user can set an online status consisting of an integer and an arbitratry
+ /// (serializable) object. The object can be null, Hashtable, object[] or anything
+ /// else Photon can serialize.
+ ///
+ /// The status is published automatically to friends (anyone who set your user ID
+ /// with AddFriends).
+ ///
+ /// Photon flushes friends-list when a chat client disconnects, so it has to be
+ /// set each time. If your community API gives you access to online status already,
+ /// you could filter and set online friends in AddFriends.
+ ///
+ /// Actual friend relations are not persistent and have to be stored outside
+ /// of Photon.
+ ///
+ /// AddFriends and RemoveFriends enable clients to handle their friend list
+ /// in the Photon Chat server. Having users on your friends list gives you access
+ /// to their current online status (and whatever info your client sets in it).
+ ///
+ /// Each user can set an online status consisting of an integer and an arbitratry
+ /// (serializable) object. The object can be null, Hashtable, object[] or anything
+ /// else Photon can serialize.
+ ///
+ /// The status is published automatically to friends (anyone who set your user ID
+ /// with AddFriends).
+ ///
+ ///
+ /// Actual friend relations are not persistent and have to be stored outside
+ /// of Photon.
+ ///
+ /// Array of friend userIds.
+ /// If the operation could be sent.
+ public bool RemoveFriends(string[] friends)
+ {
+ if (!this.CanChat)
+ {
+ if (this.DebugOut >= DebugLevel.ERROR)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, "RemoveFriends called while not connected to front end server.");
+ }
+ return false;
+ }
+
+ if (friends == null || friends.Length == 0)
+ {
+ if (this.DebugOut >= DebugLevel.WARNING)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, "RemoveFriends can't be called for empty or null list.");
+ }
+ return false;
+ }
+ if (friends.Length > FriendRequestListMax)
+ {
+ if (this.DebugOut >= DebugLevel.WARNING)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, "RemoveFriends max list size exceeded: " + friends.Length + " > " + FriendRequestListMax);
+ }
+ return false;
+ }
+
+ Dictionary parameters = new Dictionary
+ {
+ { ChatParameterCode.Friends, friends },
+ };
+
+ return this.chatPeer.SendOperation(ChatOperationCode.RemoveFriends, parameters, SendOptions.SendReliable);
+ }
+
+ ///
+ /// Get you the (locally used) channel name for the chat between this client and another user.
+ ///
+ /// Remote user's name or UserId.
+ /// The (locally used) channel name for a private channel.
+ /// Do not subscribe to this channel.
+ /// Private channels do not need to be explicitly subscribed to.
+ /// Use this for debugging purposes mainly.
+ public string GetPrivateChannelNameByUser(string userName)
+ {
+ return string.Format("{0}:{1}", this.UserId, userName);
+ }
+
+ ///
+ /// Simplified access to either private or public channels by name.
+ ///
+ /// Name of the channel to get. For private channels, the channel-name is composed of both user's names.
+ /// Define if you expect a private or public channel.
+ /// Out parameter gives you the found channel, if any.
+ /// True if the channel was found.
+ /// Public channels exist only when subscribed to them.
+ /// Private channels exist only when at least one message is exchanged with the target user privately.
+ public bool TryGetChannel(string channelName, bool isPrivate, out ChatChannel channel)
+ {
+ if (!isPrivate)
+ {
+ return this.PublicChannels.TryGetValue(channelName, out channel);
+ }
+ else
+ {
+ return this.PrivateChannels.TryGetValue(channelName, out channel);
+ }
+ }
+
+ ///
+ /// Simplified access to all channels by name. Checks public channels first, then private ones.
+ ///
+ /// Name of the channel to get.
+ /// Out parameter gives you the found channel, if any.
+ /// True if the channel was found.
+ /// Public channels exist only when subscribed to them.
+ /// Private channels exist only when at least one message is exchanged with the target user privately.
+ public bool TryGetChannel(string channelName, out ChatChannel channel)
+ {
+ bool found = false;
+ found = this.PublicChannels.TryGetValue(channelName, out channel);
+ if (found) return true;
+
+ found = this.PrivateChannels.TryGetValue(channelName, out channel);
+ return found;
+ }
+
+ ///
+ /// Simplified access to private channels by target user.
+ ///
+ /// UserId of the target user in the private channel.
+ /// Out parameter gives you the found channel, if any.
+ /// True if the channel was found.
+ public bool TryGetPrivateChannelByUser(string userId, out ChatChannel channel)
+ {
+ channel = null;
+ if (string.IsNullOrEmpty(userId))
+ {
+ return false;
+ }
+ string channelName = this.GetPrivateChannelNameByUser(userId);
+ return this.TryGetChannel(channelName, true, out channel);
+ }
+
+ ///
+ /// Sets the level (and amount) of debug output provided by the library.
+ ///
+ ///
+ /// This affects the callbacks to IChatClientListener.DebugReturn.
+ /// Default Level: Error.
+ ///
+ public DebugLevel DebugOut
+ {
+ set { this.chatPeer.DebugOut = value; }
+ get { return this.chatPeer.DebugOut; }
+ }
+
+ #region Private methods area
+
+ #region IPhotonPeerListener implementation
+
+ void IPhotonPeerListener.DebugReturn(DebugLevel level, string message)
+ {
+ this.listener.DebugReturn(level, message);
+ }
+
+ void IPhotonPeerListener.OnEvent(EventData eventData)
+ {
+ switch (eventData.Code)
+ {
+ case ChatEventCode.ChatMessages:
+ this.HandleChatMessagesEvent(eventData);
+ break;
+ case ChatEventCode.PrivateMessage:
+ this.HandlePrivateMessageEvent(eventData);
+ break;
+ case ChatEventCode.StatusUpdate:
+ this.HandleStatusUpdate(eventData);
+ break;
+ case ChatEventCode.Subscribe:
+ this.HandleSubscribeEvent(eventData);
+ break;
+ case ChatEventCode.Unsubscribe:
+ this.HandleUnsubscribeEvent(eventData);
+ break;
+ case ChatEventCode.UserSubscribed:
+ this.HandleUserSubscribedEvent(eventData);
+ break;
+ case ChatEventCode.UserUnsubscribed:
+ this.HandleUserUnsubscribedEvent(eventData);
+ break;
+ #if CHAT_EXTENDED
+ case ChatEventCode.PropertiesChanged:
+ this.HandlePropertiesChanged(eventData);
+ break;
+ case ChatEventCode.ErrorInfo:
+ this.HandleErrorInfoEvent(eventData);
+ break;
+ #endif
+ }
+ }
+
+ void IPhotonPeerListener.OnOperationResponse(OperationResponse operationResponse)
+ {
+ switch (operationResponse.OperationCode)
+ {
+ case (byte)ChatOperationCode.Authenticate:
+ this.HandleAuthResponse(operationResponse);
+ break;
+
+ // the following operations usually don't return useful data and no error.
+ case (byte)ChatOperationCode.Subscribe:
+ case (byte)ChatOperationCode.Unsubscribe:
+ case (byte)ChatOperationCode.Publish:
+ case (byte)ChatOperationCode.SendPrivate:
+ default:
+ if ((operationResponse.ReturnCode != 0) && (this.DebugOut >= DebugLevel.ERROR))
+ {
+ if (operationResponse.ReturnCode == -2)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, string.Format("Chat Operation {0} unknown on server. Check your AppId and make sure it's for a Chat application.", operationResponse.OperationCode));
+ }
+ else
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, string.Format("Chat Operation {0} failed (Code: {1}). Debug Message: {2}", operationResponse.OperationCode, operationResponse.ReturnCode, operationResponse.DebugMessage));
+ }
+ }
+ break;
+ }
+ }
+
+ void IPhotonPeerListener.OnStatusChanged(StatusCode statusCode)
+ {
+ switch (statusCode)
+ {
+ case StatusCode.Connect:
+ if (!this.chatPeer.IsProtocolSecure)
+ {
+ if (!this.chatPeer.EstablishEncryption())
+ {
+ if (this.DebugOut >= DebugLevel.ERROR)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, "Error establishing encryption");
+ }
+ }
+ }
+ else
+ {
+ this.TryAuthenticateOnNameServer();
+ }
+
+ if (this.State == ChatState.ConnectingToNameServer)
+ {
+ this.State = ChatState.ConnectedToNameServer;
+ this.listener.OnChatStateChange(this.State);
+ }
+ else if (this.State == ChatState.ConnectingToFrontEnd)
+ {
+ if (!this.AuthenticateOnFrontEnd())
+ {
+ if (this.DebugOut >= DebugLevel.ERROR)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, string.Format("Error authenticating on frontend! Check log output, AuthValues and if you're connected. State: {0}", this.State));
+ }
+ }
+ }
+ break;
+ case StatusCode.EncryptionEstablished:
+ // once encryption is available, the client should send one (secure) authenticate. it includes the AppId (which identifies your app on the Photon Cloud)
+ this.TryAuthenticateOnNameServer();
+ break;
+ case StatusCode.Disconnect:
+ switch (this.State)
+ {
+ case ChatState.ConnectWithFallbackProtocol:
+ this.EnableProtocolFallback = false; // the client does a fallback only one time
+ this.chatPeer.NameServerPortOverride = 0; // resets a value in the peer only (as we change the protocol, the port has to change, too)
+ this.chatPeer.TransportProtocol = (this.chatPeer.TransportProtocol == ConnectionProtocol.Tcp) ? ConnectionProtocol.Udp : ConnectionProtocol.Tcp;
+ this.Connect(this.AppId, this.AppVersion, null);
+
+ // the client now has to return, instead of break, to avoid further processing of the disconnect call
+ return;
+
+ case ChatState.Authenticated:
+ this.ConnectToFrontEnd();
+ // client disconnected from nameserver after authentication
+ // to switch to frontend
+ return;
+ case ChatState.Disconnecting:
+ // expected disconnect
+ break;
+ default:
+ // unexpected disconnect, we log warning and stacktrace
+ string stacktrace = string.Empty;
+ #if DEBUG && !NETFX_CORE
+ stacktrace = new System.Diagnostics.StackTrace(true).ToString();
+ #endif
+ this.listener.DebugReturn(DebugLevel.WARNING, string.Format("Got a unexpected Disconnect in ChatState: {0}. Server: {1} Trace: {2}", this.State, this.chatPeer.ServerAddress, stacktrace));
+ break;
+ }
+ if (this.AuthValues != null)
+ {
+ this.AuthValues.Token = null; // when leaving the server, invalidate the secret (but not the auth values)
+ }
+ this.State = ChatState.Disconnected;
+ this.listener.OnChatStateChange(ChatState.Disconnected);
+ this.listener.OnDisconnected();
+ break;
+ case StatusCode.DisconnectByServerUserLimit:
+ this.listener.DebugReturn(DebugLevel.ERROR, "This connection was rejected due to the apps CCU limit.");
+ this.Disconnect(ChatDisconnectCause.MaxCcuReached);
+ break;
+ case StatusCode.ExceptionOnConnect:
+ case StatusCode.SecurityExceptionOnConnect:
+ case StatusCode.EncryptionFailedToEstablish:
+ this.DisconnectedCause = ChatDisconnectCause.ExceptionOnConnect;
+
+ // if enabled, the client can attempt to connect with another networking-protocol to check if that connects
+ if (this.EnableProtocolFallback && this.State == ChatState.ConnectingToNameServer)
+ {
+ this.State = ChatState.ConnectWithFallbackProtocol;
+ }
+ else
+ {
+ this.Disconnect(ChatDisconnectCause.ExceptionOnConnect);
+ }
+
+ break;
+ case StatusCode.Exception:
+ case StatusCode.ExceptionOnReceive:
+ this.Disconnect(ChatDisconnectCause.Exception);
+ break;
+ case StatusCode.DisconnectByServerTimeout:
+ this.Disconnect(ChatDisconnectCause.ServerTimeout);
+ break;
+ case StatusCode.DisconnectByServerLogic:
+ this.Disconnect(ChatDisconnectCause.DisconnectByServerLogic);
+ break;
+ case StatusCode.DisconnectByServerReasonUnknown:
+ this.Disconnect(ChatDisconnectCause.DisconnectByServerReasonUnknown);
+ break;
+ case StatusCode.TimeoutDisconnect:
+ this.DisconnectedCause = ChatDisconnectCause.ClientTimeout;
+
+ // if enabled, the client can attempt to connect with another networking-protocol to check if that connects
+ if (this.EnableProtocolFallback && this.State == ChatState.ConnectingToNameServer)
+ {
+ this.State = ChatState.ConnectWithFallbackProtocol;
+ }
+ else
+ {
+ this.Disconnect(ChatDisconnectCause.ClientTimeout);
+ }
+ break;
+ }
+ }
+
+ #if SDK_V4
+ void IPhotonPeerListener.OnMessage(object msg)
+ {
+ string channelName = null;
+ var receivedBytes = (byte[])msg;
+ var channelId = BitConverter.ToInt32(receivedBytes, 0);
+ var messageBytes = new byte[receivedBytes.Length - 4];
+ Array.Copy(receivedBytes, 4, messageBytes, 0, receivedBytes.Length - 4);
+
+ foreach (var channel in this.PublicChannels)
+ {
+ if (channel.Value.ChannelID == channelId)
+ {
+ channelName = channel.Key;
+ break;
+ }
+ }
+
+ if (channelName != null)
+ {
+ this.listener.DebugReturn(DebugLevel.ALL, string.Format("got OnMessage in channel {0}", channelName));
+ }
+ else
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, string.Format("got OnMessage in unknown channel {0}", channelId));
+ }
+
+ this.listener.OnReceiveBroadcastMessage(channelName, messageBytes);
+ }
+ #endif
+
+ #endregion
+
+ private void TryAuthenticateOnNameServer()
+ {
+ if (!this.didAuthenticate)
+ {
+ this.didAuthenticate = this.chatPeer.AuthenticateOnNameServer(this.AppId, this.AppVersion, this.ChatRegion, this.AuthValues);
+ if (!this.didAuthenticate)
+ {
+ if (this.DebugOut >= DebugLevel.ERROR)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, string.Format("Error calling OpAuthenticate! Did not work on NameServer. Check log output, AuthValues and if you're connected. State: {0}", this.State));
+ }
+ }
+ }
+ }
+
+ private bool SendChannelOperation(string[] channels, byte operation, int historyLength)
+ {
+ Dictionary opParameters = new Dictionary { { (byte)ChatParameterCode.Channels, channels } };
+
+ if (historyLength != 0)
+ {
+ opParameters.Add((byte)ChatParameterCode.HistoryLength, historyLength);
+ }
+
+ return this.chatPeer.SendOperation(operation, opParameters, SendOptions.SendReliable);
+ }
+
+ private void HandlePrivateMessageEvent(EventData eventData)
+ {
+ //Console.WriteLine(SupportClass.DictionaryToString(eventData.Parameters));
+
+ object message = (object)eventData.Parameters[(byte)ChatParameterCode.Message];
+ string sender = (string)eventData.Parameters[(byte)ChatParameterCode.Sender];
+ int msgId = (int)eventData.Parameters[ChatParameterCode.MsgId];
+
+ string channelName;
+ if (this.UserId != null && this.UserId.Equals(sender))
+ {
+ string target = (string)eventData.Parameters[(byte)ChatParameterCode.UserId];
+ channelName = this.GetPrivateChannelNameByUser(target);
+ }
+ else
+ {
+ channelName = this.GetPrivateChannelNameByUser(sender);
+ }
+
+ ChatChannel channel;
+ if (!this.PrivateChannels.TryGetValue(channelName, out channel))
+ {
+ channel = new ChatChannel(channelName);
+ channel.IsPrivate = true;
+ channel.MessageLimit = this.MessageLimit;
+ this.PrivateChannels.Add(channel.Name, channel);
+ }
+
+ channel.Add(sender, message, msgId);
+ this.listener.OnPrivateMessage(sender, message, channelName);
+ }
+
+ private void HandleChatMessagesEvent(EventData eventData)
+ {
+ object[] messages = (object[])eventData.Parameters[(byte)ChatParameterCode.Messages];
+ string[] senders = (string[])eventData.Parameters[(byte)ChatParameterCode.Senders];
+ string channelName = (string)eventData.Parameters[(byte)ChatParameterCode.Channel];
+ int lastMsgId = (int)eventData.Parameters[ChatParameterCode.MsgId];
+
+ ChatChannel channel;
+ if (!this.PublicChannels.TryGetValue(channelName, out channel))
+ {
+ if (this.DebugOut >= DebugLevel.WARNING)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, "Channel " + channelName + " for incoming message event not found.");
+ }
+ return;
+ }
+
+ channel.Add(senders, messages, lastMsgId);
+ this.listener.OnGetMessages(channelName, senders, messages);
+ }
+
+ private void HandleSubscribeEvent(EventData eventData)
+ {
+ string[] channelsInResponse = (string[])eventData.Parameters[ChatParameterCode.Channels];
+ bool[] results = (bool[])eventData.Parameters[ChatParameterCode.SubscribeResults];
+ for (int i = 0; i < channelsInResponse.Length; i++)
+ {
+ if (results[i])
+ {
+ string channelName = channelsInResponse[i];
+ ChatChannel channel;
+ if (!this.PublicChannels.TryGetValue(channelName, out channel))
+ {
+ channel = new ChatChannel(channelName);
+ channel.MessageLimit = this.MessageLimit;
+ this.PublicChannels.Add(channel.Name, channel);
+ }
+ object temp;
+ if (eventData.Parameters.TryGetValue(ChatParameterCode.Properties, out temp))
+ {
+ Dictionary channelProperties = temp as Dictionary;
+ channel.ReadChannelProperties(channelProperties);
+ }
+ if (channel.PublishSubscribers) // or maybe remove check & always add anyway?
+ {
+ channel.AddSubscriber(this.UserId);
+ }
+ if (eventData.Parameters.TryGetValue(ChatParameterCode.ChannelSubscribers, out temp))
+ {
+ string[] subscribers = temp as string[];
+ channel.AddSubscribers(subscribers);
+ }
+ #if CHAT_EXTENDED
+ if (eventData.Parameters.TryGetValue(ChatParameterCode.UserProperties, out temp))
+ {
+ //UnityEngine.Debug.LogFormat("temp = {0}", temp);
+ Dictionary userProperties = temp as Dictionary;
+ foreach (var pair in userProperties)
+ {
+ channel.ReadUserProperties(pair.Key, pair.Value as Dictionary);
+ }
+ }
+ #endif
+ }
+ }
+
+ this.listener.OnSubscribed(channelsInResponse, results);
+ }
+
+
+ private void HandleUnsubscribeEvent(EventData eventData)
+ {
+ string[] channelsInRequest = (string[])eventData[ChatParameterCode.Channels];
+ for (int i = 0; i < channelsInRequest.Length; i++)
+ {
+ string channelName = channelsInRequest[i];
+ this.PublicChannels.Remove(channelName);
+ this.PublicChannelsUnsubscribing.Remove(channelName);
+ }
+
+ this.listener.OnUnsubscribed(channelsInRequest);
+ }
+
+ private void HandleAuthResponse(OperationResponse operationResponse)
+ {
+ if (this.DebugOut >= DebugLevel.INFO)
+ {
+ this.listener.DebugReturn(DebugLevel.INFO, operationResponse.ToStringFull() + " on: " + this.chatPeer.NameServerAddress);
+ }
+
+ if (operationResponse.ReturnCode == 0)
+ {
+ if (this.State == ChatState.ConnectedToNameServer)
+ {
+ this.State = ChatState.Authenticated;
+ this.listener.OnChatStateChange(this.State);
+
+ if (operationResponse.Parameters.ContainsKey(ParameterCode.Secret))
+ {
+ if (this.AuthValues == null)
+ {
+ this.AuthValues = new AuthenticationValues();
+ }
+ this.AuthValues.Token = operationResponse[ParameterCode.Secret] as string;
+
+ this.FrontendAddress = (string)operationResponse[ParameterCode.Address];
+
+ // we disconnect and status handler starts to connect to front end
+ this.chatPeer.Disconnect();
+ }
+ else
+ {
+ if (this.DebugOut >= DebugLevel.ERROR)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, "No secret in authentication response.");
+ }
+ }
+ if (operationResponse.Parameters.ContainsKey(ParameterCode.UserId))
+ {
+ string incomingId = operationResponse.Parameters[ParameterCode.UserId] as string;
+ if (!string.IsNullOrEmpty(incomingId))
+ {
+ this.UserId = incomingId;
+ this.listener.DebugReturn(DebugLevel.INFO, string.Format("Received your UserID from server. Updating local value to: {0}", this.UserId));
+ }
+ }
+ }
+ else if (this.State == ChatState.ConnectingToFrontEnd)
+ {
+ this.State = ChatState.ConnectedToFrontEnd;
+ this.listener.OnChatStateChange(this.State);
+ this.listener.OnConnected();
+ if (statusToSetWhenConnected.HasValue)
+ {
+ SetOnlineStatus(statusToSetWhenConnected.Value, messageToSetWhenConnected);
+ statusToSetWhenConnected = null;
+ }
+ }
+ }
+ else
+ {
+ //this.listener.DebugReturn(DebugLevel.INFO, operationResponse.ToStringFull() + " NS: " + this.NameServerAddress + " FrontEnd: " + this.frontEndAddress);
+
+ switch (operationResponse.ReturnCode)
+ {
+ case ErrorCode.InvalidAuthentication:
+ this.DisconnectedCause = ChatDisconnectCause.InvalidAuthentication;
+ break;
+ case ErrorCode.CustomAuthenticationFailed:
+ this.DisconnectedCause = ChatDisconnectCause.CustomAuthenticationFailed;
+ break;
+ case ErrorCode.InvalidRegion:
+ this.DisconnectedCause = ChatDisconnectCause.InvalidRegion;
+ break;
+ case ErrorCode.MaxCcuReached:
+ this.DisconnectedCause = ChatDisconnectCause.MaxCcuReached;
+ break;
+ case ErrorCode.OperationNotAllowedInCurrentState:
+ this.DisconnectedCause = ChatDisconnectCause.OperationNotAllowedInCurrentState;
+ break;
+ case ErrorCode.AuthenticationTicketExpired:
+ this.DisconnectedCause = ChatDisconnectCause.AuthenticationTicketExpired;
+ break;
+ }
+
+ if (this.DebugOut >= DebugLevel.ERROR)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, string.Format("{0} ClientState: {1} ServerAddress: {2}", operationResponse.ToStringFull(), this.State, this.chatPeer.ServerAddress));
+ }
+
+
+ this.Disconnect(this.DisconnectedCause);
+ }
+ }
+
+ private void HandleStatusUpdate(EventData eventData)
+ {
+ string user = (string)eventData.Parameters[ChatParameterCode.Sender];
+ int status = (int)eventData.Parameters[ChatParameterCode.Status];
+
+ object message = null;
+ bool gotMessage = eventData.Parameters.ContainsKey(ChatParameterCode.Message);
+ if (gotMessage)
+ {
+ message = eventData.Parameters[ChatParameterCode.Message];
+ }
+
+ this.listener.OnStatusUpdate(user, status, gotMessage, message);
+ }
+
+ private bool ConnectToFrontEnd()
+ {
+ this.State = ChatState.ConnectingToFrontEnd;
+
+ if (this.DebugOut >= DebugLevel.INFO)
+ {
+ this.listener.DebugReturn(DebugLevel.INFO, "Connecting to frontend " + this.FrontendAddress);
+ }
+
+ #if UNITY_WEBGL
+ if (this.TransportProtocol == ConnectionProtocol.Tcp || this.TransportProtocol == ConnectionProtocol.Udp)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, "WebGL requires WebSockets. Switching TransportProtocol to WebSocketSecure.");
+ this.TransportProtocol = ConnectionProtocol.WebSocketSecure;
+ }
+ #endif
+
+ if (!this.chatPeer.Connect(this.FrontendAddress, this.ProxyServerAddress, ChatAppName, null))
+ {
+ if (this.DebugOut >= DebugLevel.ERROR)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, string.Format("Connecting to frontend {0} failed.", this.FrontendAddress));
+ }
+ return false;
+ }
+
+ return true;
+ }
+
+ private bool AuthenticateOnFrontEnd()
+ {
+ if (this.AuthValues != null)
+ {
+ if (this.AuthValues.Token == null)
+ {
+ if (this.DebugOut >= DebugLevel.ERROR)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, "Can't authenticate on front end server. Secret (AuthValues.Token) is not set");
+ }
+ return false;
+ }
+ else
+ {
+ Dictionary opParameters = new Dictionary { { (byte)ChatParameterCode.Secret, this.AuthValues.Token } };
+ if (this.PrivateChatHistoryLength > -1)
+ {
+ opParameters[(byte)ChatParameterCode.HistoryLength] = this.PrivateChatHistoryLength;
+ }
+
+ return this.chatPeer.SendOperation(ChatOperationCode.Authenticate, opParameters, SendOptions.SendReliable);
+ }
+ }
+ else
+ {
+ if (this.DebugOut >= DebugLevel.ERROR)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, "Can't authenticate on front end server. Authentication Values are not set");
+ }
+ return false;
+ }
+ }
+
+ private void HandleUserUnsubscribedEvent(EventData eventData)
+ {
+ string channelName = eventData.Parameters[ChatParameterCode.Channel] as string;
+ string userId = eventData.Parameters[ChatParameterCode.UserId] as string;
+ ChatChannel channel;
+ if (this.PublicChannels.TryGetValue(channelName, out channel))
+ {
+ if (!channel.PublishSubscribers)
+ {
+ if (this.DebugOut >= DebugLevel.WARNING)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, string.Format("Channel \"{0}\" for incoming UserUnsubscribed (\"{1}\") event does not have PublishSubscribers enabled.", channelName, userId));
+ }
+ }
+ if (!channel.RemoveSubscriber(userId)) // user not found!
+ {
+ if (this.DebugOut >= DebugLevel.WARNING)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, string.Format("Channel \"{0}\" does not contain unsubscribed user \"{1}\".", channelName, userId));
+ }
+ }
+ }
+ else
+ {
+ if (this.DebugOut >= DebugLevel.WARNING)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, string.Format("Channel \"{0}\" not found for incoming UserUnsubscribed (\"{1}\") event.", channelName, userId));
+ }
+ }
+ this.listener.OnUserUnsubscribed(channelName, userId);
+ }
+
+ private void HandleUserSubscribedEvent(EventData eventData)
+ {
+ string channelName = eventData.Parameters[ChatParameterCode.Channel] as string;
+ string userId = eventData.Parameters[ChatParameterCode.UserId] as string;
+ ChatChannel channel;
+ if (this.PublicChannels.TryGetValue(channelName, out channel))
+ {
+ if (!channel.PublishSubscribers)
+ {
+ if (this.DebugOut >= DebugLevel.WARNING)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, string.Format("Channel \"{0}\" for incoming UserSubscribed (\"{1}\") event does not have PublishSubscribers enabled.", channelName, userId));
+ }
+ }
+ if (!channel.AddSubscriber(userId)) // user came back from the dead ?
+ {
+ if (this.DebugOut >= DebugLevel.WARNING)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, string.Format("Channel \"{0}\" already contains newly subscribed user \"{1}\".", channelName, userId));
+ }
+ }
+ else if (channel.MaxSubscribers > 0 && channel.Subscribers.Count > channel.MaxSubscribers)
+ {
+ if (this.DebugOut >= DebugLevel.WARNING)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, string.Format("Channel \"{0}\"'s MaxSubscribers exceeded. count={1} > MaxSubscribers={2}.", channelName, channel.Subscribers.Count, channel.MaxSubscribers));
+ }
+ }
+ #if CHAT_EXTENDED
+ object temp;
+ if (eventData.Parameters.TryGetValue(ChatParameterCode.UserProperties, out temp))
+ {
+ Dictionary userProperties = temp as Dictionary;
+ channel.ReadUserProperties(userId, userProperties);
+ }
+ #endif
+ }
+ else
+ {
+ if (this.DebugOut >= DebugLevel.WARNING)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, string.Format("Channel \"{0}\" not found for incoming UserSubscribed (\"{1}\") event.", channelName, userId));
+ }
+ }
+ this.listener.OnUserSubscribed(channelName, userId);
+ }
+
+ #endregion
+
+ ///
+ /// Subscribe to a single channel and optionally sets its well-know channel properties in case the channel is created.
+ ///
+ /// name of the channel to subscribe to
+ /// ID of the last received message from this channel when re subscribing to receive only missed messages, default is 0
+ /// how many missed messages to receive from history, default is -1 (available history). 0 will get you no items. Positive values are capped by a server side limit.
+ /// options to be used in case the channel to subscribe to will be created.
+ ///
+ public bool Subscribe(string channel, int lastMsgId = 0, int messagesFromHistory = -1, ChannelCreationOptions creationOptions = null)
+ {
+ if (creationOptions == null)
+ {
+ creationOptions = ChannelCreationOptions.Default;
+ }
+ int maxSubscribers = creationOptions.MaxSubscribers;
+ bool publishSubscribers = creationOptions.PublishSubscribers;
+ if (maxSubscribers < 0)
+ {
+ if (this.DebugOut >= DebugLevel.ERROR)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, "Cannot set MaxSubscribers < 0.");
+ }
+ return false;
+ }
+ if (lastMsgId < 0)
+ {
+ if (this.DebugOut >= DebugLevel.ERROR)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, "lastMsgId cannot be < 0.");
+ }
+ return false;
+ }
+ if (messagesFromHistory < -1)
+ {
+ if (this.DebugOut >= DebugLevel.WARNING)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, "messagesFromHistory < -1, setting it to -1");
+ }
+ messagesFromHistory = -1;
+ }
+ if (lastMsgId > 0 && messagesFromHistory == 0)
+ {
+ if (this.DebugOut >= DebugLevel.WARNING)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, "lastMsgId will be ignored because messagesFromHistory == 0");
+ }
+ lastMsgId = 0;
+ }
+ Dictionary properties = null;
+ if (publishSubscribers)
+ {
+ if (maxSubscribers > DefaultMaxSubscribers)
+ {
+ if (this.DebugOut >= DebugLevel.ERROR)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR,
+ string.Format("Cannot set MaxSubscribers > {0} when PublishSubscribers == true.", DefaultMaxSubscribers));
+ }
+ return false;
+ }
+ properties = new Dictionary();
+ properties[ChannelWellKnownProperties.PublishSubscribers] = true;
+ }
+ if (maxSubscribers > 0)
+ {
+ if (properties == null)
+ {
+ properties = new Dictionary();
+ }
+ properties[ChannelWellKnownProperties.MaxSubscribers] = maxSubscribers;
+ }
+ #if CHAT_EXTENDED
+ if (creationOptions.CustomProperties != null && creationOptions.CustomProperties.Count > 0)
+ {
+ foreach (var pair in creationOptions.CustomProperties)
+ {
+ properties.Add(pair.Key, pair.Value);
+ }
+ }
+ #endif
+ Dictionary opParameters = new Dictionary { { ChatParameterCode.Channels, new[] { channel } } };
+ if (messagesFromHistory != 0)
+ {
+ opParameters.Add(ChatParameterCode.HistoryLength, messagesFromHistory);
+ }
+ if (lastMsgId > 0)
+ {
+ opParameters.Add(ChatParameterCode.MsgIds, new[] { lastMsgId });
+ }
+ if (properties != null && properties.Count > 0)
+ {
+ opParameters.Add(ChatParameterCode.Properties, properties);
+ }
+
+ return this.chatPeer.SendOperation(ChatOperationCode.Subscribe, opParameters, SendOptions.SendReliable);
+ }
+
+ #if CHAT_EXTENDED
+
+ internal bool SetChannelProperties(string channelName, Dictionary channelProperties, Dictionary expectedProperties = null, bool httpForward = false)
+ {
+ if (!this.CanChat)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, "SetChannelProperties called while not connected to front end server.");
+ return false;
+ }
+
+ if (string.IsNullOrEmpty(channelName) || channelProperties == null || channelProperties.Count == 0)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, "SetChannelProperties parameters must be non-null and not empty.");
+ return false;
+ }
+ Dictionary parameters = new Dictionary
+ {
+ { ChatParameterCode.Channel, channelName },
+ { ChatParameterCode.Properties, channelProperties },
+ { ChatParameterCode.Broadcast, true }
+ };
+ if (httpForward)
+ {
+ parameters.Add(ChatParameterCode.WebFlags, HttpForwardWebFlag);
+ }
+ if (expectedProperties != null && expectedProperties.Count > 0)
+ {
+ parameters.Add(ChatParameterCode.ExpectedValues, expectedProperties);
+ }
+ return this.chatPeer.SendOperation(ChatOperationCode.SetProperties, parameters, SendOptions.SendReliable);
+ }
+
+ public bool SetCustomChannelProperties(string channelName, Dictionary channelProperties, Dictionary expectedProperties = null, bool httpForward = false)
+ {
+ if (channelProperties != null && channelProperties.Count > 0)
+ {
+ Dictionary properties = new Dictionary(channelProperties.Count);
+ foreach (var pair in channelProperties)
+ {
+ properties.Add(pair.Key, pair.Value);
+ }
+ Dictionary expected = null;
+ if (expectedProperties != null && expectedProperties.Count > 0)
+ {
+ expected = new Dictionary(expectedProperties.Count);
+ foreach (var pair in expectedProperties)
+ {
+ expected.Add(pair.Key, pair.Value);
+ }
+ }
+ return this.SetChannelProperties(channelName, properties, expected, httpForward);
+ }
+ return this.SetChannelProperties(channelName, null);
+ }
+
+ public bool SetCustomUserProperties(string channelName, string userId, Dictionary userProperties, Dictionary expectedProperties = null, bool httpForward = false)
+ {
+ if (userProperties != null && userProperties.Count > 0)
+ {
+ Dictionary properties = new Dictionary(userProperties.Count);
+ foreach (var pair in userProperties)
+ {
+ properties.Add(pair.Key, pair.Value);
+ }
+ Dictionary expected = null;
+ if (expectedProperties != null && expectedProperties.Count > 0)
+ {
+ expected = new Dictionary(expectedProperties.Count);
+ foreach (var pair in expectedProperties)
+ {
+ expected.Add(pair.Key, pair.Value);
+ }
+ }
+ return this.SetUserProperties(channelName, userId, properties, expected, httpForward);
+ }
+ return this.SetUserProperties(channelName, userId, null);
+ }
+
+ internal bool SetUserProperties(string channelName, string userId, Dictionary channelProperties, Dictionary expectedProperties = null, bool httpForward = false)
+ {
+ if (!this.CanChat)
+ {
+ this.listener.DebugReturn(DebugLevel.ERROR, "SetUserProperties called while not connected to front end server.");
+ return false;
+ }
+ if (string.IsNullOrEmpty(channelName))
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, "SetUserProperties \"channelName\" parameter must be non-null and not empty.");
+ return false;
+ }
+ if (channelProperties == null || channelProperties.Count == 0)
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, "SetUserProperties \"channelProperties\" parameter must be non-null and not empty.");
+ return false;
+ }
+ if (string.IsNullOrEmpty(userId))
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, "SetUserProperties \"userId\" parameter must be non-null and not empty.");
+ return false;
+ }
+ Dictionary parameters = new Dictionary
+ {
+ { ChatParameterCode.Channel, channelName },
+ { ChatParameterCode.Properties, channelProperties },
+ { ChatParameterCode.UserId, userId },
+ { ChatParameterCode.Broadcast, true }
+ };
+ if (httpForward)
+ {
+ parameters.Add(ChatParameterCode.WebFlags, HttpForwardWebFlag);
+ }
+ if (expectedProperties != null && expectedProperties.Count > 0)
+ {
+ parameters.Add(ChatParameterCode.ExpectedValues, expectedProperties);
+ }
+ return this.chatPeer.SendOperation(ChatOperationCode.SetProperties, parameters, SendOptions.SendReliable);
+ }
+
+ private void HandlePropertiesChanged(EventData eventData)
+ {
+ string channelName = eventData.Parameters[ChatParameterCode.Channel] as string;
+ ChatChannel channel;
+ if (!this.PublicChannels.TryGetValue(channelName, out channel))
+ {
+ this.listener.DebugReturn(DebugLevel.WARNING, string.Format("Channel {0} for incoming ChannelPropertiesUpdated event not found.", channelName));
+ return;
+ }
+ string senderId = eventData.Parameters[ChatParameterCode.Sender] as string;
+ Dictionary changedProperties = eventData.Parameters[ChatParameterCode.Properties] as Dictionary;
+ object temp;
+ if (eventData.Parameters.TryGetValue(ChatParameterCode.UserId, out temp))
+ {
+ string targetUserId = temp as string;
+ channel.ReadUserProperties(targetUserId, changedProperties);
+ this.listener.OnUserPropertiesChanged(channelName, targetUserId, senderId, changedProperties);
+ }
+ else
+ {
+ channel.ReadChannelProperties(changedProperties);
+ this.listener.OnChannelPropertiesChanged(channelName, senderId, changedProperties);
+ }
+ }
+
+ private void HandleErrorInfoEvent(EventData eventData)
+ {
+ string channel = eventData.Parameters[ChatParameterCode.Channel] as string;
+ string msg = eventData.Parameters[ChatParameterCode.DebugMessage] as string;
+ object data = eventData.Parameters[ChatParameterCode.DebugData];
+ this.listener.OnErrorInfo(channel, msg, data);
+ }
+
+ #endif
+ }
+}
diff --git a/Assets/Photon/PhotonChat/Code/ChatClient.cs.meta b/Assets/Photon/PhotonChat/Code/ChatClient.cs.meta
new file mode 100644
index 00000000..0a1bea9c
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChatClient.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 692e391fa2a297c45b3d530aa85be610
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/Photon/PhotonChat/Code/ChatDisconnectCause.cs b/Assets/Photon/PhotonChat/Code/ChatDisconnectCause.cs
new file mode 100644
index 00000000..47200cfd
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChatDisconnectCause.cs
@@ -0,0 +1,43 @@
+// ----------------------------------------------------------------------------------------------------------------------
+// The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.
+// ChatClient is the main class of this api.
+// Photon Chat Api - Copyright (C) 2014 Exit Games GmbH
+// ----------------------------------------------------------------------------------------------------------------------
+
+namespace Photon.Chat
+{
+ /// Enumeration of causes for Disconnects (used in ).
+ /// Read the individual descriptions to find out what to do about this type of disconnect.
+ public enum ChatDisconnectCause
+ {
+ /// No error was tracked.
+ None,
+ /// OnStatusChanged: The server is not available or the address is wrong. Make sure the port is provided and the server is up.
+ ExceptionOnConnect,
+ /// OnStatusChanged: The server disconnected this client from within the room's logic (the C# code).
+ DisconnectByServerLogic,
+ /// OnStatusChanged: The server disconnected this client for unknown reasons.
+ DisconnectByServerReasonUnknown,
+ /// OnStatusChanged: The server disconnected this client due to timing out (missing acknowledgement from the client).
+ ServerTimeout,
+
+ /// OnStatusChanged: This client detected that the server's responses are not received in due time.
+ ClientTimeout,
+ /// OnStatusChanged: Some internal exception caused the socket code to fail. Contact Exit Games.
+ Exception,
+ /// OnOperationResponse: Authenticate in the Photon Cloud with invalid AppId. Update your subscription or contact Exit Games.
+ InvalidAuthentication,
+ /// OnOperationResponse: Authenticate (temporarily) failed when using a Photon Cloud subscription without CCU Burst. Update your subscription.
+ MaxCcuReached,
+ /// OnOperationResponse: Authenticate when the app's Photon Cloud subscription is locked to some (other) region(s). Update your subscription or change region.
+ InvalidRegion,
+ /// OnOperationResponse: Operation that's (currently) not available for this client (not authorized usually). Only tracked for op Authenticate.
+ OperationNotAllowedInCurrentState,
+ /// OnOperationResponse: Authenticate in the Photon Cloud with invalid client values or custom authentication setup in Cloud Dashboard.
+ CustomAuthenticationFailed,
+ /// The authentication ticket should provide access to any Photon Cloud server without doing another authentication-service call. However, the ticket expired.
+ AuthenticationTicketExpired,
+ /// OnStatusChanged: The client disconnected from within the logic (the C# code).
+ DisconnectByClientLogic
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonChat/Code/ChatDisconnectCause.cs.meta b/Assets/Photon/PhotonChat/Code/ChatDisconnectCause.cs.meta
new file mode 100644
index 00000000..c1f0c5bf
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChatDisconnectCause.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b90b85043f1857f43b94fd00edfc1ef1
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/Photon/PhotonChat/Code/ChatEventCode.cs b/Assets/Photon/PhotonChat/Code/ChatEventCode.cs
new file mode 100644
index 00000000..07e803e7
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChatEventCode.cs
@@ -0,0 +1,39 @@
+// ----------------------------------------------------------------------------------------------------------------------
+// The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.
+// ChatClient is the main class of this api.
+// Photon Chat Api - Copyright (C) 2014 Exit Games GmbH
+// ----------------------------------------------------------------------------------------------------------------------
+
+namespace Photon.Chat
+{
+ ///
+ /// Wraps up internally used constants in Photon Chat events. You don't have to use them directly usually.
+ ///
+ public class ChatEventCode
+ {
+ /// (0) Event code for messages published in public channels.
+ public const byte ChatMessages = 0;
+ /// (1) Not Used.
+ public const byte Users = 1;// List of users or List of changes for List of users
+ /// (2) Event code for messages published in private channels
+ public const byte PrivateMessage = 2;
+ /// (3) Not Used.
+ public const byte FriendsList = 3;
+ /// (4) Event code for status updates.
+ public const byte StatusUpdate = 4;
+ /// (5) Event code for subscription acks.
+ public const byte Subscribe = 5;
+ /// (6) Event code for unsubscribe acks.
+ public const byte Unsubscribe = 6;
+ /// (7) Event code for properties update.
+ public const byte PropertiesChanged = 7;
+
+ /// (8) Event code for new user subscription to a channel where is enabled.
+ public const byte UserSubscribed = 8;
+ /// (9) Event code for when user unsubscribes from a channel where is enabled.
+ public const byte UserUnsubscribed = 9;
+ /// (10) Event code for when the server sends an error to the client.
+ /// This is currently only used by Chat WebHooks.
+ public const byte ErrorInfo = 10;
+ }
+}
diff --git a/Assets/Photon/PhotonChat/Code/ChatEventCode.cs.meta b/Assets/Photon/PhotonChat/Code/ChatEventCode.cs.meta
new file mode 100644
index 00000000..4c0b2e68
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChatEventCode.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 188e4a680bce12d4cbad8d57a24f7d44
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/Photon/PhotonChat/Code/ChatOperationCode.cs b/Assets/Photon/PhotonChat/Code/ChatOperationCode.cs
new file mode 100644
index 00000000..588bc2bb
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChatOperationCode.cs
@@ -0,0 +1,38 @@
+// ----------------------------------------------------------------------------------------------------------------------
+// The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.
+// ChatClient is the main class of this api.
+// Photon Chat Api - Copyright (C) 2014 Exit Games GmbH
+// ----------------------------------------------------------------------------------------------------------------------
+
+namespace Photon.Chat
+{
+ ///
+ /// Wraps up codes for operations used internally in Photon Chat. You don't have to use them directly usually.
+ ///
+ public class ChatOperationCode
+ {
+ /// (230) Operation Authenticate.
+ public const byte Authenticate = 230;
+
+ /// (0) Operation to subscribe to chat channels.
+ public const byte Subscribe = 0;
+ /// (1) Operation to unsubscribe from chat channels.
+ public const byte Unsubscribe = 1;
+ /// (2) Operation to publish a message in a chat channel.
+ public const byte Publish = 2;
+ /// (3) Operation to send a private message to some other user.
+ public const byte SendPrivate = 3;
+
+ /// (4) Not used yet.
+ public const byte ChannelHistory = 4;
+
+ /// (5) Set your (client's) status.
+ public const byte UpdateStatus = 5;
+ /// (6) Add friends the list of friends that should update you of their status.
+ public const byte AddFriends = 6;
+ /// (7) Remove friends from list of friends that should update you of their status.
+ public const byte RemoveFriends = 7;
+ /// (8) Operation to set properties of public chat channel or users in public chat channels.
+ public const byte SetProperties = 8;
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonChat/Code/ChatOperationCode.cs.meta b/Assets/Photon/PhotonChat/Code/ChatOperationCode.cs.meta
new file mode 100644
index 00000000..03756886
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChatOperationCode.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c90a2a73f3ce648409739c724d3e6cef
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/Photon/PhotonChat/Code/ChatParameterCode.cs b/Assets/Photon/PhotonChat/Code/ChatParameterCode.cs
new file mode 100644
index 00000000..7a56e6bc
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChatParameterCode.cs
@@ -0,0 +1,85 @@
+// ----------------------------------------------------------------------------------------------------------------------
+// The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.
+// ChatClient is the main class of this api.
+// Photon Chat Api - Copyright (C) 2014 Exit Games GmbH
+// ----------------------------------------------------------------------------------------------------------------------
+
+namespace Photon.Chat
+{
+ ///
+ /// Wraps up codes for parameters (in operations and events) used internally in Photon Chat. You don't have to use them directly usually.
+ ///
+ public class ChatParameterCode
+ {
+ /// (0) Array of chat channels.
+ public const byte Channels = 0;
+ /// (1) Name of a single chat channel.
+ public const byte Channel = 1;
+ /// (2) Array of chat messages.
+ public const byte Messages = 2;
+ /// (3) A single chat message.
+ public const byte Message = 3;
+ /// (4) Array of names of the users who sent the array of chat messages.
+ public const byte Senders = 4;
+ /// (5) Name of a the user who sent a chat message.
+ public const byte Sender = 5;
+ /// (6) Not used.
+ public const byte ChannelUserCount = 6;
+ /// (225) Name of user to send a (private) message to. The code is used in LoadBalancing and copied over here.
+ public const byte UserId = 225;
+ /// (8) Id of a message.
+ public const byte MsgId = 8;
+ /// (9) Not used.
+ public const byte MsgIds = 9;
+ /// (221) Secret token to identify an authorized user. The code is used in LoadBalancing and copied over here.
+ public const byte Secret = 221;
+ /// (15) Subscribe operation result parameter. A bool[] with result per channel.
+ public const byte SubscribeResults = 15;
+
+ /// (10) Status
+ public const byte Status = 10;
+ /// (11) Friends
+ public const byte Friends = 11;
+ /// (12) SkipMessage is used in SetOnlineStatus and if true, the message is not being broadcast.
+ public const byte SkipMessage = 12;
+
+ /// (14) Number of message to fetch from history. 0: no history. 1 and higher: number of messages in history. -1: all history.
+ public const byte HistoryLength = 14;
+
+ public const byte DebugMessage = 17;
+
+ /// (21) WebFlags object for changing behaviour of webhooks from client.
+ public const byte WebFlags = 21;
+
+ /// (22) WellKnown or custom properties of channel or user.
+ ///
+ /// In event it's always channel properties,
+ /// in event it's always user properties,
+ /// in event it's channel properties unless parameter value is not null
+ ///
+ public const byte Properties = 22;
+ /// (23) Array of UserIds of users already subscribed to a channel.
+ /// Used in Subscribe event when PublishSubscribers is enabled.
+ /// Does not include local user who just subscribed.
+ /// Maximum length is ( - 1).
+ public const byte ChannelSubscribers = 23;
+ /// (24) Optional data sent in ErrorInfo event from Chat WebHooks.
+ public const byte DebugData = 24;
+ /// (25) Code for values to be used for "Check And Swap" (CAS) when changing properties.
+ public const byte ExpectedValues = 25;
+ /// (26) Code for broadcast parameter of method.
+ public const byte Broadcast = 26;
+ ///
+ /// WellKnown and custom user properties.
+ ///
+ ///
+ /// Used only in event
+ ///
+ public const byte UserProperties = 28;
+
+ ///
+ /// Generated unique reusable room id
+ ///
+ public const byte UniqueRoomId = 29;
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonChat/Code/ChatParameterCode.cs.meta b/Assets/Photon/PhotonChat/Code/ChatParameterCode.cs.meta
new file mode 100644
index 00000000..b0d8707e
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChatParameterCode.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: d7a17b60c85fb30448492e397c58c7ce
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/Photon/PhotonChat/Code/ChatPeer.cs b/Assets/Photon/PhotonChat/Code/ChatPeer.cs
new file mode 100644
index 00000000..6f437718
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChatPeer.cs
@@ -0,0 +1,454 @@
+// ----------------------------------------------------------------------------------------------------------------------
+// The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.
+// ChatClient is the main class of this api.
+// Photon Chat Api - Copyright (C) 2014 Exit Games GmbH
+// ----------------------------------------------------------------------------------------------------------------------
+
+#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
+
+
+ ///
+ /// Provides basic operations of the Photon Chat server. This internal class is used by public ChatClient.
+ ///
+ public class ChatPeer : PhotonPeer
+ {
+ /// Name Server Host Name for Photon Cloud. Without port and without any prefix.
+ public string NameServerHost = "ns.photonengine.io";
+
+ /// Name Server port per protocol (the UDP port is different than TCP, etc).
+ private static readonly Dictionary ProtocolToNameServerPort = new Dictionary() { { ConnectionProtocol.Udp, 5058 }, { ConnectionProtocol.Tcp, 4533 }, { ConnectionProtocol.WebSocket, 9093 }, { ConnectionProtocol.WebSocketSecure, 19093 } }; //, { ConnectionProtocol.RHttp, 6063 } };
+
+ /// 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.
+ public string NameServerAddress { get { return this.GetNameServerAddress(); } }
+
+ virtual internal bool IsProtocolSecure { get { return this.UsedProtocol == ConnectionProtocol.WebSocketSecure; } }
+
+ /// Chat Peer constructor.
+ /// Chat listener implementation.
+ /// Protocol to be used by the peer.
+ public ChatPeer(IPhotonPeerListener listener, ConnectionProtocol protocol) : base(listener, protocol)
+ {
+ this.ConfigUnitySockets();
+ }
+
+
+
+ // Sets up the socket implementations to use, depending on platform
+ [System.Diagnostics.Conditional("SUPPORTED_UNITY")]
+ private void ConfigUnitySockets()
+ {
+ Type websocketType = null;
+ #if (UNITY_XBOXONE || UNITY_GAMECORE) && !UNITY_EDITOR
+ websocketType = Type.GetType("ExitGames.Client.Photon.SocketNativeSource, Assembly-CSharp", false);
+ if (websocketType == null)
+ {
+ websocketType = Type.GetType("ExitGames.Client.Photon.SocketNativeSource, Assembly-CSharp-firstpass", false);
+ }
+ if (websocketType == null)
+ {
+ websocketType = Type.GetType("ExitGames.Client.Photon.SocketNativeSource, PhotonRealtime", false);
+ }
+ if (websocketType != null)
+ {
+ this.SocketImplementationConfig[ConnectionProtocol.Udp] = websocketType; // on Xbox, the native socket plugin supports UDP as well
+ }
+ #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) && !NETFX_CORE
+ this.SocketImplementationConfig[ConnectionProtocol.Udp] = typeof(SocketUdpAsync);
+ this.SocketImplementationConfig[ConnectionProtocol.Tcp] = typeof(SocketTcpAsync);
+ #endif
+ }
+
+ /// If not zero, this is used for the name server port on connect. Independent of protocol (so this better matches). Set by ChatClient.ConnectUsingSettings.
+ /// This is reset when the protocol fallback is used.
+ public ushort NameServerPortOverride;
+
+ ///
+ /// Gets the NameServer Address (with prefix and port), based on the set protocol (this.UsedProtocol).
+ ///
+ /// NameServer Address (with prefix and port).
+ private string GetNameServerAddress()
+ {
+ var protocolPort = 0;
+ ProtocolToNameServerPort.TryGetValue(this.TransportProtocol, out protocolPort);
+
+ if (this.NameServerPortOverride != 0)
+ {
+ this.Listener.DebugReturn(DebugLevel.INFO, string.Format("Using NameServerPortInAppSettings as port for Name Server: {0}", this.NameServerPortOverride));
+ protocolPort = this.NameServerPortOverride;
+ }
+
+ switch (this.TransportProtocol)
+ {
+ case ConnectionProtocol.Udp:
+ case ConnectionProtocol.Tcp:
+ return string.Format("{0}:{1}", NameServerHost, protocolPort);
+ 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();
+ }
+ }
+
+
+ /// Authenticates on NameServer.
+ /// If the authentication operation request could be sent.
+ 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();
+
+ 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.AuthType != CustomAuthenticationType.None)
+ {
+ opParameters[ParameterCode.ClientAuthenticationType] = (byte) authValues.AuthType;
+ if (authValues.Token != null)
+ {
+ 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 });
+ }
+ }
+
+ ///
+ /// Options for optional "Custom Authentication" services used with Photon. Used by OpAuthenticate after connecting to Photon.
+ ///
+ public enum CustomAuthenticationType : byte
+ {
+ /// Use a custom authentication service. Currently the only implemented option.
+ Custom = 0,
+
+ /// Authenticates users by their Steam Account. Set Steam's ticket as "ticket" via AddAuthParameter().
+ Steam = 1,
+
+ /// Authenticates users by their Facebook Account. Set Facebooks's tocken as "token" via AddAuthParameter().
+ Facebook = 2,
+
+ /// Authenticates users by their Oculus Account and token. Set Oculus' userid as "userid" and nonce as "nonce" via AddAuthParameter().
+ Oculus = 3,
+
+ /// Authenticates users by their PSN Account and token on PS4. Set token as "token", env as "env" and userName as "userName" via AddAuthParameter().
+ PlayStation4 = 4,
+ [Obsolete("Use PlayStation4 or PlayStation5 as needed")]
+ PlayStation = 4,
+
+ /// Authenticates users by their Xbox Account. Pass the XSTS token via SetAuthPostData().
+ Xbox = 5,
+
+ /// Authenticates users by their HTC Viveport Account. Set userToken as "userToken" via AddAuthParameter().
+ Viveport = 10,
+
+ /// Authenticates users by their NSA ID. Set token as "token" and appversion as "appversion" via AddAuthParameter(). The appversion is optional.
+ NintendoSwitch = 11,
+
+ /// Authenticates users by their PSN Account and token on PS5. Set token as "token", env as "env" and userName as "userName" via AddAuthParameter().
+ PlayStation5 = 12,
+ [Obsolete("Use PlayStation4 or PlayStation5 as needed")]
+ Playstation5 = 12,
+
+ /// Authenticates users with Epic Online Services (EOS). Set token as "token" and ownershipToken as "ownershipToken" via AddAuthParameter(). The ownershipToken is optional.
+ Epic = 13,
+
+ /// Authenticates users with Facebook Gaming api. Set token as "token" via AddAuthParameter().
+ FacebookGaming = 15,
+
+ /// Disables custom authentication. Same as not providing any AuthenticationValues for connect (more precisely for: OpAuthenticate).
+ None = byte.MaxValue
+ }
+
+
+ ///
+ /// Container for user authentication in Photon. Set AuthValues before you connect - all else is handled.
+ ///
+ ///
+ /// 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 authentication: 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 AuthValues are sent in OpAuthenticate when you connect, so they must be set before you connect.
+ /// If the AuthValues.UserId is null or empty when it's sent to the server, then the Photon Server assigns a UserId!
+ ///
+ /// The Photon Cloud Dashboard will let you enable this feature and set important server values for it.
+ /// https://dashboard.photonengine.com
+ ///
+ public class AuthenticationValues
+ {
+ /// See AuthType.
+ private CustomAuthenticationType authType = CustomAuthenticationType.None;
+
+ /// The type of authentication provider that should be used. Defaults to None (no auth whatsoever).
+ /// Several auth providers are available and CustomAuthenticationType.Custom can be used if you build your own service.
+ public CustomAuthenticationType AuthType
+ {
+ get { return authType; }
+ set { authType = value; }
+ }
+
+ /// This string must contain any (http get) parameters expected by the used authentication service. By default, username and token.
+ ///
+ /// 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).
+ ///
+ public string AuthGetParameters { get; set; }
+
+ /// Data to be passed-on to the auth service via POST. Default: null (not sent). Either string or byte[] (see setters).
+ /// Maps to operation parameter 214.
+ public object AuthPostData { get; private set; }
+
+ /// Internal Photon token . After initial authentication, Photon provides a token for this client, subsequently used as (cached) validation.
+ /// Any token for custom authentication should be set via SetAuthPostData or AddAuthParameter.
+ public object Token { get; protected internal set; }
+
+ /// The UserId should be a unique identifier per user. This is for finding friends, etc..
+ /// See remarks of AuthValues for info about how this is set and used.
+ public string UserId { get; set; }
+
+
+ /// Creates empty auth values without any info.
+ public AuthenticationValues()
+ {
+ }
+
+ /// Creates minimal info about the user. If this is authenticated or not, depends on the set AuthType.
+ /// Some UserId to set in Photon.
+ public AuthenticationValues(string userId)
+ {
+ this.UserId = userId;
+ }
+
+ /// Sets the data to be passed-on to the auth service via POST.
+ /// AuthPostData is just one value. Each SetAuthPostData replaces any previous value. It can be either a string, a byte[] or a dictionary.
+ /// String data to be used in the body of the POST request. Null or empty string will set AuthPostData to null.
+ public virtual void SetAuthPostData(string stringData)
+ {
+ this.AuthPostData = (string.IsNullOrEmpty(stringData)) ? null : stringData;
+ }
+
+ /// Sets the data to be passed-on to the auth service via POST.
+ /// AuthPostData is just one value. Each SetAuthPostData replaces any previous value. It can be either a string, a byte[] or a dictionary.
+ /// Binary token / auth-data to pass on.
+ public virtual void SetAuthPostData(byte[] byteData)
+ {
+ this.AuthPostData = byteData;
+ }
+
+ /// Sets data to be passed-on to the auth service as Json (Content-Type: "application/json") via Post.
+ /// AuthPostData is just one value. Each SetAuthPostData replaces any previous value. It can be either a string, a byte[] or a dictionary.
+ /// A authentication-data dictionary will be converted to Json and passed to the Auth webservice via HTTP Post.
+ public virtual void SetAuthPostData(Dictionary dictData)
+ {
+ this.AuthPostData = dictData;
+ }
+
+ /// Adds a key-value pair to the get-parameters used for Custom Auth (AuthGetParameters).
+ /// This method does uri-encoding for you.
+ /// Key for the value to set.
+ /// Some value relevant for Custom Authentication.
+ public virtual void AddAuthParameter(string key, string value)
+ {
+ string ampersand = string.IsNullOrEmpty(this.AuthGetParameters) ? "" : "&";
+ this.AuthGetParameters = string.Format("{0}{1}{2}={3}", this.AuthGetParameters, ampersand, System.Uri.EscapeDataString(key), System.Uri.EscapeDataString(value));
+ }
+
+ ///
+ /// Transform this object into string.
+ ///
+ /// string representation of this object.
+ public override string ToString()
+ {
+ return string.Format("AuthenticationValues Type: {3} UserId: {0}, GetParameters: {1} Token available: {2}", this.UserId, this.AuthGetParameters, this.Token != null, this.AuthType);
+ }
+
+ ///
+ /// Make a copy of the current object.
+ ///
+ /// The object to be copied into.
+ /// The copied object.
+ public AuthenticationValues CopyTo(AuthenticationValues copy)
+ {
+ copy.AuthType = this.AuthType;
+ copy.AuthGetParameters = this.AuthGetParameters;
+ copy.AuthPostData = this.AuthPostData;
+ copy.UserId = this.UserId;
+ return copy;
+ }
+ }
+
+
+ /// Class for constants. Codes for parameters of Operations and Events.
+ public class ParameterCode
+ {
+ /// (224) Your application's ID: a name on your own Photon or a GUID on the Photon Cloud
+ public const byte ApplicationId = 224;
+ /// (221) Internally used to establish encryption
+ public const byte Secret = 221;
+ /// (220) Version of your application
+ public const byte AppVersion = 220;
+ /// (217) This key's (byte) value defines the target custom authentication type/service the client connects with. Used in OpAuthenticate
+ public const byte ClientAuthenticationType = 217;
+ /// (216) This key's (string) value provides parameters sent to the custom authentication type/service the client connects with. Used in OpAuthenticate
+ public const byte ClientAuthenticationParams = 216;
+ /// (214) This key's (string or byte[]) value provides parameters sent to the custom authentication service setup in Photon Dashboard. Used in OpAuthenticate
+ public const byte ClientAuthenticationData = 214;
+ /// (210) Used for region values in OpAuth and OpGetRegions.
+ public const byte Region = 210;
+ /// (230) Address of a (game) server to use.
+ public const byte Address = 230;
+ /// (225) User's ID
+ public const byte UserId = 225;
+ }
+
+ ///
+ /// ErrorCode defines the default codes associated with Photon client/server communication.
+ ///
+ public class ErrorCode
+ {
+ /// (0) is always "OK", anything else an error or specific situation.
+ public const int Ok = 0;
+
+ // server - Photon low(er) level: <= 0
+
+ ///
+ /// (-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).
+ ///
+ ///
+ /// 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
+ ///
+ public const int OperationNotAllowedInCurrentState = -3;
+
+ /// (-2) The operation you called is not implemented on the server (application) you connect to. Make sure you run the fitting applications.
+ public const int InvalidOperationCode = -2;
+
+ /// (-1) Something went wrong in the server. Try to reproduce and contact Exit Games.
+ public const int InternalServerError = -1;
+
+ // server - PhotonNetwork: 0x7FFF and down
+ // logic-level error codes start with short.max
+
+ /// (32767) Authentication failed. Possible cause: AppId is unknown to Photon (in cloud service).
+ public const int InvalidAuthentication = 0x7FFF;
+
+ /// (32766) GameId (name) already in use (can't create another). Change name.
+ public const int GameIdAlreadyExists = 0x7FFF - 1;
+
+ /// (32765) Game is full. This rarely happens when some player joined the room before your join completed.
+ public const int GameFull = 0x7FFF - 2;
+
+ /// (32764) Game is closed and can't be joined. Join another game.
+ public const int GameClosed = 0x7FFF - 3;
+
+ /// (32762) Not in use currently.
+ public const int ServerFull = 0x7FFF - 5;
+
+ /// (32761) Not in use currently.
+ public const int UserBlocked = 0x7FFF - 6;
+
+ /// (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.
+ public const int NoRandomMatchFound = 0x7FFF - 7;
+
+ /// (32758) Join can fail if the room (name) is not existing (anymore). This can happen when players leave while you join.
+ public const int GameDoesNotExist = 0x7FFF - 9;
+
+ /// (32757) Authorization on the Photon Cloud failed because the concurrent users (CCU) limit of the app's subscription is reached.
+ ///
+ /// 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.
+ ///
+ public const int MaxCcuReached = 0x7FFF - 10;
+
+ /// (32756) Authorization on the Photon Cloud failed because the app's subscription does not allow to use a particular region's server.
+ ///
+ /// 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.
+ ///
+ public const int InvalidRegion = 0x7FFF - 11;
+
+ ///
+ /// (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.
+ ///
+ public const int CustomAuthenticationFailed = 0x7FFF - 12;
+
+ /// (32753) The Authentication ticket expired. Usually, this is refreshed behind the scenes. Connect (and authorize) again.
+ public const int AuthenticationTicketExpired = 0x7FF1;
+ }
+
+}
diff --git a/Assets/Photon/PhotonChat/Code/ChatPeer.cs.meta b/Assets/Photon/PhotonChat/Code/ChatPeer.cs.meta
new file mode 100644
index 00000000..a002c43c
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChatPeer.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 3f712805dec728943a668b3bf19dc422
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/Photon/PhotonChat/Code/ChatState.cs b/Assets/Photon/PhotonChat/Code/ChatState.cs
new file mode 100644
index 00000000..2c879747
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChatState.cs
@@ -0,0 +1,39 @@
+// ----------------------------------------------------------------------------------------------------------------------
+// The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.
+// ChatClient is the main class of this api.
+// Photon Chat Api - Copyright (C) 2014 Exit Games GmbH
+// ----------------------------------------------------------------------------------------------------------------------
+
+namespace Photon.Chat
+{
+ /// Possible states for a Chat Client.
+ public enum ChatState
+ {
+ /// Peer is created but not used yet.
+ Uninitialized,
+ /// Connecting to name server.
+ ConnectingToNameServer,
+ /// Connected to name server.
+ ConnectedToNameServer,
+ /// Authenticating on current server.
+ Authenticating,
+ /// Finished authentication on current server.
+ Authenticated,
+ /// Disconnecting from name server. This is usually a transition from name server to frontend server.
+ DisconnectingFromNameServer,
+ /// Connecting to frontend server.
+ ConnectingToFrontEnd,
+ /// Connected to frontend server.
+ ConnectedToFrontEnd,
+ /// Disconnecting from frontend server.
+ DisconnectingFromFrontEnd,
+ /// Currently not used.
+ QueuedComingFromFrontEnd,
+ /// The client disconnects (from any server).
+ Disconnecting,
+ /// The client is no longer connected (to any server).
+ Disconnected,
+ /// Client was unable to connect to Name Server and will attempt to connect with an alternative network protocol (TCP).
+ ConnectWithFallbackProtocol
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonChat/Code/ChatState.cs.meta b/Assets/Photon/PhotonChat/Code/ChatState.cs.meta
new file mode 100644
index 00000000..e862818d
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChatState.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 8f482d8c4fe7ade4cbb08eb4a2d83b39
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/Photon/PhotonChat/Code/ChatUserStatus.cs b/Assets/Photon/PhotonChat/Code/ChatUserStatus.cs
new file mode 100644
index 00000000..08d6ef12
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChatUserStatus.cs
@@ -0,0 +1,35 @@
+// ----------------------------------------------------------------------------------------------------------------------
+// The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.
+// ChatClient is the main class of this api.
+// Photon Chat Api - Copyright (C) 2014 Exit Games GmbH
+// ----------------------------------------------------------------------------------------------------------------------
+
+namespace Photon.Chat
+{
+ /// Contains commonly used status values for SetOnlineStatus. You can define your own.
+ ///
+ /// 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.
+ ///
+ public static class ChatUserStatus
+ {
+ /// (0) Offline.
+ public const int Offline = 0;
+ /// (1) Be invisible to everyone. Sends no message.
+ public const int Invisible = 1;
+ /// (2) Online and available.
+ public const int Online = 2;
+ /// (3) Online but not available.
+ public const int Away = 3;
+ /// (4) Do not disturb.
+ public const int DND = 4;
+ /// (5) Looking For Game/Group. Could be used when you want to be invited or do matchmaking.
+ public const int LFG = 5;
+ /// (6) Could be used when in a room, playing.
+ public const int Playing = 6;
+ }
+}
diff --git a/Assets/Photon/PhotonChat/Code/ChatUserStatus.cs.meta b/Assets/Photon/PhotonChat/Code/ChatUserStatus.cs.meta
new file mode 100644
index 00000000..bfd0c529
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/ChatUserStatus.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 7db67e7f5face2e42b6daafcaf4e6c82
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/Photon/PhotonChat/Code/IChatClientListener.cs b/Assets/Photon/PhotonChat/Code/IChatClientListener.cs
new file mode 100644
index 00000000..c711e59e
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/IChatClientListener.cs
@@ -0,0 +1,148 @@
+// ----------------------------------------------------------------------------------------------------------------------
+// The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.
+// ChatClient is the main class of this api.
+// Photon Chat Api - Copyright (C) 2014 Exit Games GmbH
+// ----------------------------------------------------------------------------------------------------------------------
+
+
+namespace Photon.Chat
+{
+ using System.Collections.Generic;
+ using ExitGames.Client.Photon;
+
+ ///
+ /// Callback interface for Chat client side. Contains callback methods to notify your app about updates.
+ /// Must be provided to new ChatClient in constructor
+ ///
+ public interface IChatClientListener
+ {
+ ///
+ /// 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.
+ ///
+ /// DebugLevel (severity) of the message.
+ /// Debug text. Print to System.Console or screen.
+ void DebugReturn(DebugLevel level, string message);
+
+ ///
+ /// Disconnection happened.
+ ///
+ void OnDisconnected();
+
+ ///
+ /// Client is connected now.
+ ///
+ ///
+ /// Clients have to be connected before they can send their state, subscribe to channels and send any messages.
+ ///
+ void OnConnected();
+
+ /// The ChatClient's state changed. Usually, OnConnected and OnDisconnected are the callbacks to react to.
+ /// The new state.
+ void OnChatStateChange(ChatState state);
+
+ ///
+ /// 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
+ ///
+ /// channel from where messages came
+ /// list of users who sent messages
+ /// list of messages it self
+ void OnGetMessages(string channelName, string[] senders, object[] messages);
+
+ ///
+ /// Notifies client about private message
+ ///
+ /// user who sent this message
+ /// message it self
+ /// channelName for private messages (messages you sent yourself get added to a channel per target username)
+ void OnPrivateMessage(string sender, object message, string channelName);
+
+ ///
+ /// Result of Subscribe operation. Returns subscription result for every requested channel name.
+ ///
+ ///
+ /// 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.
+ ///
+ /// Array of channel names.
+ /// Per channel result if subscribed.
+ void OnSubscribed(string[] channels, bool[] results);
+
+ ///
+ /// Result of Unsubscribe operation. Returns for channel name if the channel is now unsubscribed.
+ ///
+ /// 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.
+ /// Array of channel names that are no longer subscribed.
+ void OnUnsubscribed(string[] channels);
+
+ ///
+ /// New status of another user (you get updates for users set in your friends list).
+ ///
+ /// Name of the user.
+ /// New status of that user.
+ /// True if the status contains a message you should cache locally. False: This status update does not include a message (keep any you have).
+ /// Message that user set.
+ void OnStatusUpdate(string user, int status, bool gotMessage, object message);
+
+ ///
+ /// A user has subscribed to a public chat channel
+ ///
+ /// Name of the chat channel
+ /// UserId of the user who subscribed
+ void OnUserSubscribed(string channel, string user);
+
+ ///
+ /// A user has unsubscribed from a public chat channel
+ ///
+ /// Name of the chat channel
+ /// UserId of the user who unsubscribed
+ void OnUserUnsubscribed(string channel, string user);
+
+
+ #if CHAT_EXTENDED
+
+ ///
+ /// Properties of a public channel has been changed
+ ///
+ /// Channel name in which the properties have changed
+ /// The UserID of the user who changed the properties
+ /// The properties that have changed
+ void OnChannelPropertiesChanged(string channel, string senderUserId, Dictionary properties);
+
+ ///
+ /// Properties of a user in a public channel has been changed
+ ///
+ /// Channel name in which the properties have changed
+ /// The UserID whom properties have changed
+ /// The UserID of the user who changed the properties
+ /// The properties that have changed
+ void OnUserPropertiesChanged(string channel, string targetUserId, string senderUserId, Dictionary properties);
+
+ ///
+ /// The server uses error events to make the client aware of some issues.
+ ///
+ ///
+ /// This is currently used only in Chat WebHooks.
+ ///
+ /// The name of the channel in which this error info has been received
+ /// The text message of the error info
+ /// Optional error data
+ void OnErrorInfo(string channel, string error, object data);
+
+ #endif
+
+
+ #if SDK_V4
+ ///
+ /// Received a broadcast message
+ ///
+ /// Name of the chat channel
+ /// Message data
+ void OnReceiveBroadcastMessage(string channel, byte[] message);
+ #endif
+
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonChat/Code/IChatClientListener.cs.meta b/Assets/Photon/PhotonChat/Code/IChatClientListener.cs.meta
new file mode 100644
index 00000000..797bdea7
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/IChatClientListener.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: bab7c8053b486e34aa0d4ca99dcbec80
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/Photon/PhotonChat/Code/PhotonChat.asmdef b/Assets/Photon/PhotonChat/Code/PhotonChat.asmdef
new file mode 100644
index 00000000..bcabffe9
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/PhotonChat.asmdef
@@ -0,0 +1,12 @@
+{
+ "name": "PhotonChat",
+ "references": [],
+ "optionalUnityReferences": [],
+ "includePlatforms": [],
+ "excludePlatforms": [],
+ "allowUnsafeCode": false,
+ "overrideReferences": false,
+ "precompiledReferences": [],
+ "autoReferenced": true,
+ "defineConstraints": []
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonChat/Code/PhotonChat.asmdef.meta b/Assets/Photon/PhotonChat/Code/PhotonChat.asmdef.meta
new file mode 100644
index 00000000..99f00af5
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/PhotonChat.asmdef.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 08a110bd598f7604f9519c2d7e1fb3cc
+timeCreated: 1537459565
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Code/changes-chat.txt b/Assets/Photon/PhotonChat/Code/changes-chat.txt
new file mode 100644
index 00000000..0db7b6fe
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/changes-chat.txt
@@ -0,0 +1,146 @@
+
+Photon Chat C# Client - Changelog
+Exit Games GmbH - www.photonengine.com - forum.photonengine.com
+
+
+Version 4.1.6.17 (02. August 2022)
+ Note: No notable changes.
+
+Version 4.1.6.16 (20. June 2022)
+ Fixed: The ProxyServerAddress is also applied when connecting to the Frontend Server (was missing in previous update).
+
+Version 4.1.6.15 (02. June 2022)
+ Added: Proxy support (with WS/WSS) to Chat API. This can be used via ConnectUsingSettings() or by setting ChatClient.ProxyServerAddress before connecting.
+
+Version 4.1.6.11 (22. November 2021)
+ Added: CustomAuthenticationType.Epic to authenticate via Epic Online Services (EOS).
+ Added: CustomAuthenticationType.FacebookGaming to authenticate via Facebook Gaming services.
+
+Version 4.1.6.10 (21. October 2021 - rev6243)
+ Fixed: The ChatPeer.ConfigUnitySockets(), which used a surplus typeof() for Xbox configuration.
+
+Version 4.1.6.6 (21. September 2021 - rev6204)
+ Changed: For Xbox, order of checked assemblies when getting Type SocketNativeSource. It's more likely to be in Assembly-CSharp.
+
+Version 4.1.6.5 (24. August 2021 - rev6181)
+ Updated: The default name server host to "ns.photonengine.io". When using WSS on this, it expects TLS1.2 (Win 7 and old Unity versions may not support this).
+
+Version 4.1.6.2 (17. June 2021)
+ Changed: The enumeration CustomAuthenticationType was changed to fix naming inconsistencies. Use PlayStation4 and PlayStation5 respectively. Old variants are available as obsolete.
+
+Version 4.1.5.2 (12. March 2021)
+ ADDED: CustomAuthenticationType.Playstation5 (value 12).
+
+Version 4.1.5.0 (03. March 2021)
+ Updated: ChatPeer ConfigUnitySockets() to the analog of the Realtime API.
+
+Version 4.1.5.0 (3. February 2021)
+ Internal: AuthenticationValues.Token is now an object instead of a string (so some internal code changed). This enables the server to send a byte[], which is more effective than a string.
+
+Version 4.1.4.6 (16. November 2020)
+ Added: ChatClient.PrivateChatHistoryLength field. If set before you connect, this can be used to limit the number of private messages when the server (re)subscribes the client to (still alive) a private chat channel.
+ Added: Protocol Fallback option for Chat. Analog to the Realtime API, Chat can now try another protocol, if the initial connect to the Name Server fails. After the timeout or when an error happened, UDP will fallback to TCP. TCP will fallback to UDP.
+ Added: EnableProtocolFallback in ChatClient and ChatAppSettings. When using ConnectUsingSettings, the ChatClient's value gets set and used.
+ Changed: Connect(appid, appversion, authValues) will only apply the authvalues parameter, if that's non-null.
+ Changed: ChatAppSettings field AppId is now AppIdChat (matching the value in Realtime API AppSettings). The old name is currently just obsolete.
+ Added: ChatAppSettings.Port to override the Name Server Port if needed. Note: Chat does not support "Alternative Ports" yet (ports pre-defined per server).
+ Added: ChatPeer.NameServerPortOverride value to replace/override the default per-protocol port value (by the one in the AppSettings, e.g.).
+
+Version 4.1.4.5 (02. September 2020)
+ Added: Option for extended features: Channels may send a user list, channels and users can have custom properties and there are web-forwarding flags. Needs compile define CHAT_EXTENDED. This also adds new methods to the IChatClientListener.
+ Changed: AuthenticationValues has been refined, analog to the changes in the Realtime API.
+
+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.20
+ Changed: ChatDisconnectCause enum and OnDisconnected callback usage updated to be in sync. with Realtime.
+ Added: ChatClient.ConnectUsingSettings(ChatAppSettings appSettings).
+ Added: more error logs when something fails internally.
+
+Version 4.1.2.19 (12. November 2019 - rev5266)
+ Changed: ChatPeer now look for SocketNativeSource instead of SocketWebTcpNativeDynamic when the target platform is XB One. A new Xbox addon is coming up on our SDK page.
+
+Version 4.1.2.16 (25. June 2019 - rev5168)
+ Added: ChatClient.TryGetPrivateChannelByUser.
+
+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.9 (13. February 2019 - rev4985)
+ Added: Client API for Max Subscribers and Publish Subscribers features inside public channels.
+
+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.14 (5. July 2017 - rev4191)
+ Added: ChatClient can optionally run a thread to call SendOutgoingCommands in intervals. This makes sure the connection doesn't fail easily (e.g. when Unity is loading scenes, etc.). You still have to call Service to dispatch received messages.
+ Added: ChatClient.UseBackgroundWorkerForSending. Set this to true, to use the new background thread. Note: Do not use this in WebGL exports from Unity cause Threads are unavailable in them.
+
+Version 4.1.1.2 (13. September 2016 - rev3652)
+ Changed: GetNameServerAddress() is the same in Chat and LoadBalancing APIs now.
+ 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.
\ No newline at end of file
diff --git a/Assets/Photon/PhotonChat/Code/changes-chat.txt.meta b/Assets/Photon/PhotonChat/Code/changes-chat.txt.meta
new file mode 100644
index 00000000..e18ac756
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Code/changes-chat.txt.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: e5c3dda6f11fe7845989297c8a603dc2
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos.meta b/Assets/Photon/PhotonChat/Demos.meta
new file mode 100644
index 00000000..9d520456
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 801c62f7d03cb463ba20067deb330234
+folderAsset: yes
+timeCreated: 1537874612
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos/Common.meta b/Assets/Photon/PhotonChat/Demos/Common.meta
new file mode 100644
index 00000000..9661d1ee
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/Common.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 1aab6e4c105054f7e91af2cf027064d1
+folderAsset: yes
+timeCreated: 1538395282
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos/Common/EventSystemSpawner.cs b/Assets/Photon/PhotonChat/Demos/Common/EventSystemSpawner.cs
new file mode 100644
index 00000000..d58b6cd8
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/Common/EventSystemSpawner.cs
@@ -0,0 +1,40 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+//
+//
+// For additive Scene Loading context, eventSystem can't be added to each scene and instead should be instantiated only if necessary.
+// https://answers.unity.com/questions/1403002/multiple-eventsystem-in-scene-this-is-not-supporte.html
+//
+// developer@exitgames.com
+// --------------------------------------------------------------------------------------------------------------------
+
+using UnityEngine;
+using UnityEngine.EventSystems;
+
+namespace Photon.Chat.UtilityScripts
+{
+ ///
+ /// Event system spawner. Will add an EventSystem GameObject with an EventSystem component and a StandaloneInputModule component.
+ /// Use this in additive scene loading context where you would otherwise get a "Multiple EventSystem in scene... this is not supported" error from Unity.
+ ///
+ public class EventSystemSpawner : MonoBehaviour
+ {
+ void OnEnable()
+ {
+ #if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
+ Debug.LogError("PUN Demos are not compatible with the New Input System, unless you enable \"Both\" in: Edit > Project Settings > Player > Active Input Handling. Pausing App.");
+ Debug.Break();
+ return;
+ #endif
+
+ EventSystem sceneEventSystem = FindObjectOfType();
+ if (sceneEventSystem == null)
+ {
+ GameObject eventSystem = new GameObject("EventSystem");
+
+ eventSystem.AddComponent();
+ eventSystem.AddComponent();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonChat/Demos/Common/EventSystemSpawner.cs.meta b/Assets/Photon/PhotonChat/Demos/Common/EventSystemSpawner.cs.meta
new file mode 100644
index 00000000..1fcda3d6
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/Common/EventSystemSpawner.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: bd5ff9965d0784cad8e07f5eb9cb9c06
+timeCreated: 1538396402
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos/Common/OnStartDelete.cs b/Assets/Photon/PhotonChat/Demos/Common/OnStartDelete.cs
new file mode 100644
index 00000000..46ee2a01
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/Common/OnStartDelete.cs
@@ -0,0 +1,24 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// Part of: Photon Unity Utilities,
+//
+//
+// This component will destroy the GameObject it is attached to (in Start()).
+//
+// developer@exitgames.com
+// --------------------------------------------------------------------------------------------------------------------
+
+using UnityEngine;
+
+namespace Photon.Chat.UtilityScripts
+{
+ /// This component will destroy the GameObject it is attached to (in Start()).
+ public class OnStartDelete : MonoBehaviour
+ {
+ // Use this for initialization
+ private void Start()
+ {
+ Destroy(this.gameObject);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonChat/Demos/Common/OnStartDelete.cs.meta b/Assets/Photon/PhotonChat/Demos/Common/OnStartDelete.cs.meta
new file mode 100644
index 00000000..c1b54284
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/Common/OnStartDelete.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 0b1cdd4de66f84fa1af4cb197e5d901d
+timeCreated: 1538396603
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos/Common/TextButtonTransition.cs b/Assets/Photon/PhotonChat/Demos/Common/TextButtonTransition.cs
new file mode 100644
index 00000000..a6fffebb
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/Common/TextButtonTransition.cs
@@ -0,0 +1,70 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+//
+//
+// Use this on Button texts to have some color transition on the text as well without corrupting button's behaviour.
+//
+// developer@exitgames.com
+// --------------------------------------------------------------------------------------------------------------------
+
+using UnityEngine;
+using UnityEngine.EventSystems;
+using UnityEngine.UI;
+
+namespace Photon.Chat.UtilityScripts
+{
+
+ ///
+ /// Use this on Button texts to have some color transition on the text as well without corrupting button's behaviour.
+ ///
+ [RequireComponent(typeof(Text))]
+ public class TextButtonTransition : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
+ {
+
+ Text _text;
+
+ ///
+ /// The selectable Component.
+ ///
+ public Selectable Selectable;
+
+ ///
+ /// The color of the normal of the transition state.
+ ///
+ public Color NormalColor= Color.white;
+
+ ///
+ /// The color of the hover of the transition state.
+ ///
+ public Color HoverColor = Color.black;
+
+ public void Awake()
+ {
+ _text = GetComponent();
+ }
+
+ public void OnEnable()
+ {
+ _text.color = NormalColor;
+ }
+
+ public void OnDisable()
+ {
+ _text.color = NormalColor;
+ }
+
+ public void OnPointerEnter(PointerEventData eventData)
+ {
+ if (Selectable == null || Selectable.IsInteractable()) {
+ _text.color = HoverColor;
+ }
+ }
+
+ public void OnPointerExit(PointerEventData eventData)
+ {
+ if (Selectable == null || Selectable.IsInteractable()) {
+ _text.color = NormalColor;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonChat/Demos/Common/TextButtonTransition.cs.meta b/Assets/Photon/PhotonChat/Demos/Common/TextButtonTransition.cs.meta
new file mode 100644
index 00000000..460ca081
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/Common/TextButtonTransition.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 060fe8295761a47268586d33ef5673e0
+timeCreated: 1538395273
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos/Common/TextToggleIsOnTransition.cs b/Assets/Photon/PhotonChat/Demos/Common/TextToggleIsOnTransition.cs
new file mode 100644
index 00000000..dd2a4769
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/Common/TextToggleIsOnTransition.cs
@@ -0,0 +1,86 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+//
+//
+// Use this on Button texts to have some color transition on the text as well without corrupting button's behaviour.
+//
+// developer@exitgames.com
+// --------------------------------------------------------------------------------------------------------------------
+
+using UnityEngine;
+using UnityEngine.EventSystems;
+using UnityEngine.UI;
+
+namespace Photon.Chat.UtilityScripts
+{
+
+ ///
+ /// Use this on toggles texts to have some color transition on the text depending on the isOn State.
+ ///
+ [RequireComponent(typeof(Text))]
+ public class TextToggleIsOnTransition : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
+ {
+
+ ///
+ /// The toggle Component.
+ ///
+ public Toggle toggle;
+
+ Text _text;
+
+ ///
+ /// The color of the normal on transition state.
+ ///
+ public Color NormalOnColor= Color.white;
+
+ ///
+ /// The color of the normal off transition state.
+ ///
+ public Color NormalOffColor = Color.black;
+
+ ///
+ /// The color of the hover on transition state.
+ ///
+ public Color HoverOnColor= Color.black;
+
+ ///
+ /// The color of the hover off transition state.
+ ///
+ public Color HoverOffColor = Color.black;
+
+ bool isHover;
+
+ public void OnEnable()
+ {
+ _text = GetComponent();
+
+ OnValueChanged (toggle.isOn);
+
+ toggle.onValueChanged.AddListener(OnValueChanged);
+
+ }
+
+ public void OnDisable()
+ {
+ toggle.onValueChanged.RemoveListener(OnValueChanged);
+ }
+
+ public void OnValueChanged(bool isOn)
+ {
+ _text.color = isOn? (isHover?HoverOnColor:HoverOnColor) : (isHover?NormalOffColor:NormalOffColor) ;
+ }
+
+ public void OnPointerEnter(PointerEventData eventData)
+ {
+ isHover = true;
+ _text.color = toggle.isOn?HoverOnColor:HoverOffColor;
+ }
+
+ public void OnPointerExit(PointerEventData eventData)
+ {
+ isHover = false;
+ _text.color = toggle.isOn?NormalOnColor:NormalOffColor;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonChat/Demos/Common/TextToggleIsOnTransition.cs.meta b/Assets/Photon/PhotonChat/Demos/Common/TextToggleIsOnTransition.cs.meta
new file mode 100644
index 00000000..a97b21f7
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/Common/TextToggleIsOnTransition.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 1e808171e8963498bb1db072a977d750
+timeCreated: 1538395754
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat.meta b/Assets/Photon/PhotonChat/Demos/DemoChat.meta
new file mode 100644
index 00000000..40682063
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 4e3a46219ebf94310a9f347733f88f31
+folderAsset: yes
+timeCreated: 1537874626
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/AppSettingsExtensions.cs b/Assets/Photon/PhotonChat/Demos/DemoChat/AppSettingsExtensions.cs
new file mode 100644
index 00000000..22c59f49
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/AppSettingsExtensions.cs
@@ -0,0 +1,33 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// Demo code for Photon Chat in Unity.
+// developer@exitgames.com
+// --------------------------------------------------------------------------------------------------------------------
+
+
+using Photon.Realtime;
+
+
+namespace Photon.Chat.Demo
+{
+ public static class AppSettingsExtensions
+ {
+ public static ChatAppSettings GetChatSettings(this AppSettings appSettings)
+ {
+ return new ChatAppSettings
+ {
+ AppIdChat = appSettings.AppIdChat,
+ AppVersion = appSettings.AppVersion,
+ FixedRegion = appSettings.IsBestRegion ? null : appSettings.FixedRegion,
+ NetworkLogging = appSettings.NetworkLogging,
+ Protocol = appSettings.Protocol,
+ EnableProtocolFallback = appSettings.EnableProtocolFallback,
+ Server = appSettings.IsDefaultNameServer ? null : appSettings.Server,
+ Port = (ushort)appSettings.Port,
+ ProxyServer = appSettings.ProxyServer
+ // values not copied from AppSettings class: AuthMode
+ // values not needed from AppSettings class: EnableLobbyStatistics
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/AppSettingsExtensions.cs.meta b/Assets/Photon/PhotonChat/Demos/DemoChat/AppSettingsExtensions.cs.meta
new file mode 100644
index 00000000..27b14079
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/AppSettingsExtensions.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 4fcf4818ecc9abf4e9b7e0c37af9b851
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/ChannelSelector.cs b/Assets/Photon/PhotonChat/Demos/DemoChat/ChannelSelector.cs
new file mode 100644
index 00000000..4bf9644a
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/ChannelSelector.cs
@@ -0,0 +1,32 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// Demo code for Photon Chat in Unity.
+// developer@exitgames.com
+// --------------------------------------------------------------------------------------------------------------------
+
+
+using UnityEngine;
+using UnityEngine.EventSystems;
+using UnityEngine.UI;
+
+
+namespace Photon.Chat.Demo
+{
+ public class ChannelSelector : MonoBehaviour, IPointerClickHandler
+ {
+ public string Channel;
+
+ public void SetChannel(string channel)
+ {
+ this.Channel = channel;
+ Text t = this.GetComponentInChildren();
+ t.text = this.Channel;
+ }
+
+ public void OnPointerClick(PointerEventData eventData)
+ {
+ ChatGui handler = FindObjectOfType();
+ handler.ShowChannel(this.Channel);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/ChannelSelector.cs.meta b/Assets/Photon/PhotonChat/Demos/DemoChat/ChannelSelector.cs.meta
new file mode 100644
index 00000000..f2739cdb
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/ChannelSelector.cs.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 48caa72710147fc4f9389b0b5ec6137d
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/ChatAppIdCheckerUI.cs b/Assets/Photon/PhotonChat/Demos/DemoChat/ChatAppIdCheckerUI.cs
new file mode 100644
index 00000000..0bef6116
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/ChatAppIdCheckerUI.cs
@@ -0,0 +1,60 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// Demo code for Photon Chat in Unity.
+// developer@exitgames.com
+// --------------------------------------------------------------------------------------------------------------------
+
+
+using UnityEngine;
+
+
+using UnityEngine.UI;
+#if PHOTON_UNITY_NETWORKING
+using Photon.Pun;
+#endif
+
+namespace Photon.Chat.Demo
+{
+ ///
+ /// This is used in the Editor Splash to properly inform the developer about the chat AppId requirement.
+ ///
+ [ExecuteInEditMode]
+ public class ChatAppIdCheckerUI : MonoBehaviour
+ {
+ public Text Description;
+ public bool WizardOpenedOnce; // avoid opening the wizard again and again
+
+ // TODO: maybe this can run on Start(), not on Update()?!
+ public void Update()
+ {
+ bool showWarning = false;
+ string descriptionText = string.Empty;
+
+ #if PHOTON_UNITY_NETWORKING
+ showWarning = string.IsNullOrEmpty(PhotonNetwork.PhotonServerSettings.AppSettings.AppIdChat);
+ if (showWarning)
+ {
+ descriptionText = "WARNING: \nPlease setup a Chat AppId in the PhotonServerSettings file.";
+ }
+ #else
+ ChatGui cGui = FindObjectOfType(); // TODO: this could be a serialized reference instead of finding this each time
+
+ showWarning = cGui == null || string.IsNullOrEmpty(cGui.chatAppSettings.AppIdChat);
+ if (showWarning)
+ {
+ descriptionText = "Please setup the Chat AppId.\nOpen the setup panel: Window, Photon Chat, Setup. ";
+
+ #if UNITY_EDITOR
+ if (!WizardOpenedOnce)
+ {
+ WizardOpenedOnce = true;
+ UnityEditor.EditorApplication.ExecuteMenuItem("Window/Photon Chat/Setup");
+ }
+ #endif
+ }
+ #endif
+
+ this.Description.text = descriptionText;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/ChatAppIdCheckerUI.cs.meta b/Assets/Photon/PhotonChat/Demos/DemoChat/ChatAppIdCheckerUI.cs.meta
new file mode 100644
index 00000000..a4a8033b
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/ChatAppIdCheckerUI.cs.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 4eb1284704a754507acb17b07b888086
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/ChatGui.cs b/Assets/Photon/PhotonChat/Demos/DemoChat/ChatGui.cs
new file mode 100644
index 00000000..6eb444c6
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/ChatGui.cs
@@ -0,0 +1,665 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// Demo code for Photon Chat in Unity.
+// developer@exitgames.com
+// --------------------------------------------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+
+using UnityEngine;
+using UnityEngine.UI;
+
+using Photon.Chat;
+using Photon.Realtime;
+using AuthenticationValues = Photon.Chat.AuthenticationValues;
+#if PHOTON_UNITY_NETWORKING
+using Photon.Pun;
+#endif
+
+
+namespace Photon.Chat.Demo
+{
+ ///
+ /// This simple Chat UI demonstrate basics usages of the Chat Api
+ ///
+ ///
+ /// The ChatClient basically lets you create any number of channels.
+ ///
+ /// some friends are already set in the Chat demo "DemoChat-Scene", 'Joe', 'Jane' and 'Bob', simply log with them so that you can see the status changes in the Interface
+ ///
+ /// Workflow:
+ /// Create ChatClient, Connect to a server with your AppID, Authenticate the user (apply a unique name,)
+ /// and subscribe to some channels.
+ /// Subscribe a channel before you publish to that channel!
+ ///
+ ///
+ /// Note:
+ /// Don't forget to call ChatClient.Service() on Update to keep the Chatclient operational.
+ ///
+ public class ChatGui : MonoBehaviour, IChatClientListener
+ {
+
+ public string[] ChannelsToJoinOnConnect; // set in inspector. Demo channels to join automatically.
+
+ public string[] FriendsList;
+
+ public int HistoryLengthToFetch; // set in inspector. Up to a certain degree, previously sent messages can be fetched for context
+
+ public string UserName { get; set; }
+
+ private string selectedChannelName; // mainly used for GUI/input
+
+ public ChatClient chatClient;
+
+ #if !PHOTON_UNITY_NETWORKING
+ public ChatAppSettings ChatAppSettings
+ {
+ get { return this.chatAppSettings; }
+ }
+
+ [SerializeField]
+ #endif
+ protected internal ChatAppSettings chatAppSettings;
+
+
+ public GameObject missingAppIdErrorPanel;
+ public GameObject ConnectingLabel;
+
+ public RectTransform ChatPanel; // set in inspector (to enable/disable panel)
+ public GameObject UserIdFormPanel;
+ public InputField InputFieldChat; // set in inspector
+ public Text CurrentChannelText; // set in inspector
+ public Toggle ChannelToggleToInstantiate; // set in inspector
+
+
+ public GameObject FriendListUiItemtoInstantiate;
+
+ private readonly Dictionary channelToggles = new Dictionary();
+
+ private readonly Dictionary friendListItemLUT = new Dictionary();
+
+ public bool ShowState = true;
+ public GameObject Title;
+ public Text StateText; // set in inspector
+ public Text UserIdText; // set in inspector
+
+ // private static string WelcomeText = "Welcome to chat. Type \\help to list commands.";
+ private static string HelpText = "\n -- HELP --\n" +
+ "To subscribe to channel(s) (channelnames are case sensitive) : \n" +
+ "\t\\subscribe
\n" +
+ "\tor\n" +
+ "\t\\s
\n" +
+ "\n" +
+ "To leave channel(s):\n" +
+ "\t\\unsubscribe
\n" +
+ "\tor\n" +
+ "\t\\u
\n" +
+ "\n" +
+ "To switch the active channel\n" +
+ "\t\\join \n" +
+ "\tor\n" +
+ "\t\\j \n" +
+ "\n" +
+ "To send a private message: (username are case sensitive)\n" +
+ "\t\\msg \n" +
+ "\n" +
+ "To change status:\n" +
+ "\t\\state \n" +
+ "0 = Offline " +
+ "1 = Invisible " +
+ "2 = Online " +
+ "3 = Away \n" +
+ "4 = Do not disturb " +
+ "5 = Looking For Group " +
+ "6 = Playing" +
+ "\n\n" +
+ "To clear the current chat tab (private chats get closed):\n" +
+ "\t\\clear ";
+
+
+ public void Start()
+ {
+ DontDestroyOnLoad(this.gameObject);
+
+ this.UserIdText.text = "";
+ this.StateText.text = "";
+ this.StateText.gameObject.SetActive(true);
+ this.UserIdText.gameObject.SetActive(true);
+ this.Title.SetActive(true);
+ this.ChatPanel.gameObject.SetActive(false);
+ this.ConnectingLabel.SetActive(false);
+
+ if (string.IsNullOrEmpty(this.UserName))
+ {
+ this.UserName = "user" + Environment.TickCount%99; //made-up username
+ }
+
+ #if PHOTON_UNITY_NETWORKING
+ this.chatAppSettings = PhotonNetwork.PhotonServerSettings.AppSettings.GetChatSettings();
+ #endif
+
+ bool appIdPresent = !string.IsNullOrEmpty(this.chatAppSettings.AppIdChat);
+
+ this.missingAppIdErrorPanel.SetActive(!appIdPresent);
+ this.UserIdFormPanel.gameObject.SetActive(appIdPresent);
+
+ if (!appIdPresent)
+ {
+ Debug.LogError("You need to set the chat app ID in the PhotonServerSettings file in order to continue.");
+ }
+ }
+
+ public void Connect()
+ {
+ this.UserIdFormPanel.gameObject.SetActive(false);
+
+ this.chatClient = new ChatClient(this);
+ #if !UNITY_WEBGL
+ this.chatClient.UseBackgroundWorkerForSending = true;
+ #endif
+ this.chatClient.AuthValues = new AuthenticationValues(this.UserName);
+ this.chatClient.ConnectUsingSettings(this.chatAppSettings);
+
+ this.ChannelToggleToInstantiate.gameObject.SetActive(false);
+ Debug.Log("Connecting as: " + this.UserName);
+
+ this.ConnectingLabel.SetActive(true);
+ }
+
+ /// To avoid that the Editor becomes unresponsive, disconnect all Photon connections in OnDestroy.
+ public void OnDestroy()
+ {
+ if (this.chatClient != null)
+ {
+ this.chatClient.Disconnect();
+ }
+ }
+
+ /// To avoid that the Editor becomes unresponsive, disconnect all Photon connections in OnApplicationQuit.
+ public void OnApplicationQuit()
+ {
+ if (this.chatClient != null)
+ {
+ this.chatClient.Disconnect();
+ }
+ }
+
+ public void Update()
+ {
+ if (this.chatClient != null)
+ {
+ this.chatClient.Service(); // make sure to call this regularly! it limits effort internally, so calling often is ok!
+ }
+
+ // check if we are missing context, which means we got kicked out to get back to the Photon Demo hub.
+ if ( this.StateText == null)
+ {
+ Destroy(this.gameObject);
+ return;
+ }
+
+ this.StateText.gameObject.SetActive(this.ShowState); // this could be handled more elegantly, but for the demo it's ok.
+ }
+
+
+ public void OnEnterSend()
+ {
+ if (Input.GetKey(KeyCode.Return) || Input.GetKey(KeyCode.KeypadEnter))
+ {
+ this.SendChatMessage(this.InputFieldChat.text);
+ this.InputFieldChat.text = "";
+ }
+ }
+
+ public void OnClickSend()
+ {
+ if (this.InputFieldChat != null)
+ {
+ this.SendChatMessage(this.InputFieldChat.text);
+ this.InputFieldChat.text = "";
+ }
+ }
+
+
+ public int TestLength = 2048;
+ private byte[] testBytes = new byte[2048];
+
+ private void SendChatMessage(string inputLine)
+ {
+ if (string.IsNullOrEmpty(inputLine))
+ {
+ return;
+ }
+ if ("test".Equals(inputLine))
+ {
+ if (this.TestLength != this.testBytes.Length)
+ {
+ this.testBytes = new byte[this.TestLength];
+ }
+
+ this.chatClient.SendPrivateMessage(this.chatClient.AuthValues.UserId, this.testBytes, true);
+ }
+
+
+ bool doingPrivateChat = this.chatClient.PrivateChannels.ContainsKey(this.selectedChannelName);
+ string privateChatTarget = string.Empty;
+ if (doingPrivateChat)
+ {
+ // the channel name for a private conversation is (on the client!!) always composed of both user's IDs: "this:remote"
+ // so the remote ID is simple to figure out
+
+ string[] splitNames = this.selectedChannelName.Split(new char[] { ':' });
+ privateChatTarget = splitNames[1];
+ }
+ //UnityEngine.Debug.Log("selectedChannelName: " + selectedChannelName + " doingPrivateChat: " + doingPrivateChat + " privateChatTarget: " + privateChatTarget);
+
+
+ if (inputLine[0].Equals('\\'))
+ {
+ string[] tokens = inputLine.Split(new char[] {' '}, 2);
+ if (tokens[0].Equals("\\help"))
+ {
+ this.PostHelpToCurrentChannel();
+ }
+ if (tokens[0].Equals("\\state"))
+ {
+ int newState = 0;
+
+
+ List messages = new List();
+ messages.Add ("i am state " + newState);
+ string[] subtokens = tokens[1].Split(new char[] {' ', ','});
+
+ if (subtokens.Length > 0)
+ {
+ newState = int.Parse(subtokens[0]);
+ }
+
+ if (subtokens.Length > 1)
+ {
+ messages.Add(subtokens[1]);
+ }
+
+ this.chatClient.SetOnlineStatus(newState,messages.ToArray()); // this is how you set your own state and (any) message
+ }
+ else if ((tokens[0].Equals("\\subscribe") || tokens[0].Equals("\\s")) && !string.IsNullOrEmpty(tokens[1]))
+ {
+ this.chatClient.Subscribe(tokens[1].Split(new char[] {' ', ','}));
+ }
+ else if ((tokens[0].Equals("\\unsubscribe") || tokens[0].Equals("\\u")) && !string.IsNullOrEmpty(tokens[1]))
+ {
+ this.chatClient.Unsubscribe(tokens[1].Split(new char[] {' ', ','}));
+ }
+ else if (tokens[0].Equals("\\clear"))
+ {
+ if (doingPrivateChat)
+ {
+ this.chatClient.PrivateChannels.Remove(this.selectedChannelName);
+ }
+ else
+ {
+ ChatChannel channel;
+ if (this.chatClient.TryGetChannel(this.selectedChannelName, doingPrivateChat, out channel))
+ {
+ channel.ClearMessages();
+ }
+ }
+ }
+ else if (tokens[0].Equals("\\msg") && !string.IsNullOrEmpty(tokens[1]))
+ {
+ string[] subtokens = tokens[1].Split(new char[] {' ', ','}, 2);
+ if (subtokens.Length < 2) return;
+
+ string targetUser = subtokens[0];
+ string message = subtokens[1];
+ this.chatClient.SendPrivateMessage(targetUser, message);
+ }
+ else if ((tokens[0].Equals("\\join") || tokens[0].Equals("\\j")) && !string.IsNullOrEmpty(tokens[1]))
+ {
+ string[] subtokens = tokens[1].Split(new char[] { ' ', ',' }, 2);
+
+ // If we are already subscribed to the channel we directly switch to it, otherwise we subscribe to it first and then switch to it implicitly
+ if (this.channelToggles.ContainsKey(subtokens[0]))
+ {
+ this.ShowChannel(subtokens[0]);
+ }
+ else
+ {
+ this.chatClient.Subscribe(new string[] { subtokens[0] });
+ }
+ }
+ #if CHAT_EXTENDED
+ else if ((tokens[0].Equals("\\nickname") || tokens[0].Equals("\\nick") ||tokens[0].Equals("\\n")) && !string.IsNullOrEmpty(tokens[1]))
+ {
+ if (!doingPrivateChat)
+ {
+ this.chatClient.SetCustomUserProperties(this.selectedChannelName, this.chatClient.UserId, new Dictionary {{"Nickname", tokens[1]}});
+ }
+
+ }
+ #endif
+ else
+ {
+ Debug.Log("The command '" + tokens[0] + "' is invalid.");
+ }
+ }
+ else
+ {
+ if (doingPrivateChat)
+ {
+ this.chatClient.SendPrivateMessage(privateChatTarget, inputLine);
+ }
+ else
+ {
+ this.chatClient.PublishMessage(this.selectedChannelName, inputLine);
+ }
+ }
+ }
+
+ public void PostHelpToCurrentChannel()
+ {
+ this.CurrentChannelText.text += HelpText;
+ }
+
+ public void DebugReturn(ExitGames.Client.Photon.DebugLevel level, string message)
+ {
+ if (level == ExitGames.Client.Photon.DebugLevel.ERROR)
+ {
+ Debug.LogError(message);
+ }
+ else if (level == ExitGames.Client.Photon.DebugLevel.WARNING)
+ {
+ Debug.LogWarning(message);
+ }
+ else
+ {
+ Debug.Log(message);
+ }
+ }
+
+ public void OnConnected()
+ {
+ if (this.ChannelsToJoinOnConnect != null && this.ChannelsToJoinOnConnect.Length > 0)
+ {
+ this.chatClient.Subscribe(this.ChannelsToJoinOnConnect, this.HistoryLengthToFetch);
+ }
+
+ this.ConnectingLabel.SetActive(false);
+
+ this.UserIdText.text = "Connected as "+ this.UserName;
+
+ this.ChatPanel.gameObject.SetActive(true);
+
+ if (this.FriendsList!=null && this.FriendsList.Length>0)
+ {
+ this.chatClient.AddFriends(this.FriendsList); // Add some users to the server-list to get their status updates
+
+ // add to the UI as well
+ foreach(string _friend in this.FriendsList)
+ {
+ if (this.FriendListUiItemtoInstantiate != null && _friend!= this.UserName)
+ {
+ this.InstantiateFriendButton(_friend);
+ }
+
+ }
+
+ }
+
+ if (this.FriendListUiItemtoInstantiate != null)
+ {
+ this.FriendListUiItemtoInstantiate.SetActive(false);
+ }
+
+
+ this.chatClient.SetOnlineStatus(ChatUserStatus.Online); // You can set your online state (without a mesage).
+ }
+
+ public void OnDisconnected()
+ {
+ Debug.Log("OnDisconnected()");
+ this.ConnectingLabel.SetActive(false);
+ }
+
+ public void OnChatStateChange(ChatState state)
+ {
+ // use OnConnected() and OnDisconnected()
+ // this method might become more useful in the future, when more complex states are being used.
+
+ this.StateText.text = state.ToString();
+ }
+
+ public void OnSubscribed(string[] channels, bool[] results)
+ {
+ // in this demo, we simply send a message into each channel. This is NOT a must have!
+ foreach (string channel in channels)
+ {
+ this.chatClient.PublishMessage(channel, "says 'hi'."); // you don't HAVE to send a msg on join but you could.
+
+ if (this.ChannelToggleToInstantiate != null)
+ {
+ this.InstantiateChannelButton(channel);
+
+ }
+ }
+
+ Debug.Log("OnSubscribed: " + string.Join(", ", channels));
+
+ /*
+ // select first subscribed channel in alphabetical order
+ if (this.chatClient.PublicChannels.Count > 0)
+ {
+ var l = new List(this.chatClient.PublicChannels.Keys);
+ l.Sort();
+ string selected = l[0];
+ if (this.channelToggles.ContainsKey(selected))
+ {
+ ShowChannel(selected);
+ foreach (var c in this.channelToggles)
+ {
+ c.Value.isOn = false;
+ }
+ this.channelToggles[selected].isOn = true;
+ AddMessageToSelectedChannel(WelcomeText);
+ }
+ }
+ */
+
+ // Switch to the first newly created channel
+ this.ShowChannel(channels[0]);
+ }
+
+ ///
+ public void OnSubscribed(string channel, string[] users, Dictionary properties)
+ {
+ Debug.LogFormat("OnSubscribed: {0}, users.Count: {1} Channel-props: {2}.", channel, users.Length, properties.ToStringFull());
+ }
+
+ private void InstantiateChannelButton(string channelName)
+ {
+ if (this.channelToggles.ContainsKey(channelName))
+ {
+ Debug.Log("Skipping creation for an existing channel toggle.");
+ return;
+ }
+
+ Toggle cbtn = (Toggle)Instantiate(this.ChannelToggleToInstantiate);
+ cbtn.gameObject.SetActive(true);
+ cbtn.GetComponentInChildren().SetChannel(channelName);
+ cbtn.transform.SetParent(this.ChannelToggleToInstantiate.transform.parent, false);
+
+ this.channelToggles.Add(channelName, cbtn);
+ }
+
+ private void InstantiateFriendButton(string friendId)
+ {
+ GameObject fbtn = (GameObject)Instantiate(this.FriendListUiItemtoInstantiate);
+ fbtn.gameObject.SetActive(true);
+ FriendItem _friendItem = fbtn.GetComponent();
+
+ _friendItem.FriendId = friendId;
+
+ fbtn.transform.SetParent(this.FriendListUiItemtoInstantiate.transform.parent, false);
+
+ this.friendListItemLUT[friendId] = _friendItem;
+ }
+
+
+ public void OnUnsubscribed(string[] channels)
+ {
+ foreach (string channelName in channels)
+ {
+ if (this.channelToggles.ContainsKey(channelName))
+ {
+ Toggle t = this.channelToggles[channelName];
+ Destroy(t.gameObject);
+
+ this.channelToggles.Remove(channelName);
+
+ Debug.Log("Unsubscribed from channel '" + channelName + "'.");
+
+ // Showing another channel if the active channel is the one we unsubscribed from before
+ if (channelName == this.selectedChannelName && this.channelToggles.Count > 0)
+ {
+ IEnumerator> firstEntry = this.channelToggles.GetEnumerator();
+ firstEntry.MoveNext();
+
+ this.ShowChannel(firstEntry.Current.Key);
+
+ firstEntry.Current.Value.isOn = true;
+ }
+ }
+ else
+ {
+ Debug.Log("Can't unsubscribe from channel '" + channelName + "' because you are currently not subscribed to it.");
+ }
+ }
+ }
+
+ public void OnGetMessages(string channelName, string[] senders, object[] messages)
+ {
+ if (channelName.Equals(this.selectedChannelName))
+ {
+ // update text
+ this.ShowChannel(this.selectedChannelName);
+ }
+ }
+
+ public void OnPrivateMessage(string sender, object message, string channelName)
+ {
+ // as the ChatClient is buffering the messages for you, this GUI doesn't need to do anything here
+ // you also get messages that you sent yourself. in that case, the channelName is determinded by the target of your msg
+ this.InstantiateChannelButton(channelName);
+
+ byte[] msgBytes = message as byte[];
+ if (msgBytes != null)
+ {
+ Debug.Log("Message with byte[].Length: "+ msgBytes.Length);
+ }
+ if (this.selectedChannelName.Equals(channelName))
+ {
+ this.ShowChannel(channelName);
+ }
+ }
+
+ ///
+ /// New status of another user (you get updates for users set in your friends list).
+ ///
+ /// Name of the user.
+ /// New status of that user.
+ /// True if the status contains a message you should cache locally. False: This status update does not include a
+ /// message (keep any you have).
+ /// Message that user set.
+ public void OnStatusUpdate(string user, int status, bool gotMessage, object message)
+ {
+
+ Debug.LogWarning("status: " + string.Format("{0} is {1}. Msg:{2}", user, status, message));
+
+ if (this.friendListItemLUT.ContainsKey(user))
+ {
+ FriendItem _friendItem = this.friendListItemLUT[user];
+ if ( _friendItem!=null) _friendItem.OnFriendStatusUpdate(status,gotMessage,message);
+ }
+ }
+
+ public void OnUserSubscribed(string channel, string user)
+ {
+ Debug.LogFormat("OnUserSubscribed: channel=\"{0}\" userId=\"{1}\"", channel, user);
+ }
+
+ public void OnUserUnsubscribed(string channel, string user)
+ {
+ Debug.LogFormat("OnUserUnsubscribed: channel=\"{0}\" userId=\"{1}\"", channel, user);
+ }
+
+ ///
+ public void OnChannelPropertiesChanged(string channel, string userId, Dictionary properties)
+ {
+ Debug.LogFormat("OnChannelPropertiesChanged: {0} by {1}. Props: {2}.", channel, userId, Extensions.ToStringFull(properties));
+ }
+
+ public void OnUserPropertiesChanged(string channel, string targetUserId, string senderUserId, Dictionary properties)
+ {
+ Debug.LogFormat("OnUserPropertiesChanged: (channel:{0} user:{1}) by {2}. Props: {3}.", channel, targetUserId, senderUserId, Extensions.ToStringFull(properties));
+ }
+
+ ///
+ public void OnErrorInfo(string channel, string error, object data)
+ {
+ Debug.LogFormat("OnErrorInfo for channel {0}. Error: {1} Data: {2}", channel, error, data);
+ }
+
+ public void AddMessageToSelectedChannel(string msg)
+ {
+ ChatChannel channel = null;
+ bool found = this.chatClient.TryGetChannel(this.selectedChannelName, out channel);
+ if (!found)
+ {
+ Debug.Log("AddMessageToSelectedChannel failed to find channel: " + this.selectedChannelName);
+ return;
+ }
+
+ if (channel != null)
+ {
+ channel.Add("Bot", msg,0); //TODO: how to use msgID?
+ }
+ }
+
+
+
+ public void ShowChannel(string channelName)
+ {
+ if (string.IsNullOrEmpty(channelName))
+ {
+ return;
+ }
+
+ ChatChannel channel = null;
+ bool found = this.chatClient.TryGetChannel(channelName, out channel);
+ if (!found)
+ {
+ Debug.Log("ShowChannel failed to find channel: " + channelName);
+ return;
+ }
+
+ this.selectedChannelName = channelName;
+ this.CurrentChannelText.text = channel.ToStringMessages();
+ Debug.Log("ShowChannel: " + this.selectedChannelName);
+
+ foreach (KeyValuePair pair in this.channelToggles)
+ {
+ pair.Value.isOn = pair.Key == channelName ? true : false;
+ }
+ }
+
+ public void OpenDashboard()
+ {
+ Application.OpenURL("https://dashboard.photonengine.com");
+ }
+
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/ChatGui.cs.meta b/Assets/Photon/PhotonChat/Demos/DemoChat/ChatGui.cs.meta
new file mode 100644
index 00000000..fb899d85
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/ChatGui.cs.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 02d148d0890b2d44dbdf7f1c1b39a499
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/DemoChat-Scene.unity b/Assets/Photon/PhotonChat/Demos/DemoChat/DemoChat-Scene.unity
new file mode 100644
index 00000000..574bd7cd
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/DemoChat-Scene.unity
@@ -0,0 +1,6540 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!29 &1
+OcclusionCullingSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_OcclusionBakeSettings:
+ smallestOccluder: 5
+ smallestHole: 0.25
+ backfaceThreshold: 100
+ m_SceneGUID: 00000000000000000000000000000000
+ m_OcclusionCullingData: {fileID: 0}
+--- !u!104 &2
+RenderSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 9
+ m_Fog: 0
+ m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
+ m_FogMode: 3
+ m_FogDensity: 0.01
+ m_LinearFogStart: 0
+ m_LinearFogEnd: 300
+ m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
+ m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
+ m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
+ m_AmbientIntensity: 1
+ m_AmbientMode: 3
+ m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
+ m_SkyboxMaterial: {fileID: 0}
+ m_HaloStrength: 0.5
+ m_FlareStrength: 1
+ m_FlareFadeSpeed: 3
+ m_HaloTexture: {fileID: 0}
+ m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
+ m_DefaultReflectionMode: 0
+ m_DefaultReflectionResolution: 128
+ m_ReflectionBounces: 1
+ m_ReflectionIntensity: 1
+ m_CustomReflection: {fileID: 0}
+ m_Sun: {fileID: 0}
+ m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
+ m_UseRadianceAmbientProbe: 0
+--- !u!157 &4
+LightmapSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 11
+ m_GIWorkflowMode: 1
+ m_GISettings:
+ serializedVersion: 2
+ m_BounceScale: 1
+ m_IndirectOutputScale: 1
+ m_AlbedoBoost: 1
+ m_EnvironmentLightingMode: 0
+ m_EnableBakedLightmaps: 1
+ m_EnableRealtimeLightmaps: 0
+ m_LightmapEditorSettings:
+ serializedVersion: 10
+ m_Resolution: 1
+ m_BakeResolution: 50
+ m_AtlasSize: 1024
+ m_AO: 0
+ m_AOMaxDistance: 1
+ m_CompAOExponent: 0
+ m_CompAOExponentDirect: 0
+ m_Padding: 2
+ m_LightmapParameters: {fileID: 0}
+ m_LightmapsBakeMode: 1
+ m_TextureCompression: 0
+ m_FinalGather: 0
+ m_FinalGatherFiltering: 1
+ m_FinalGatherRayCount: 1024
+ m_ReflectionCompression: 2
+ m_MixedBakeMode: 1
+ m_BakeBackend: 0
+ m_PVRSampling: 1
+ m_PVRDirectSampleCount: 32
+ m_PVRSampleCount: 500
+ m_PVRBounces: 2
+ m_PVRFilterTypeDirect: 0
+ m_PVRFilterTypeIndirect: 0
+ m_PVRFilterTypeAO: 0
+ m_PVRFilteringMode: 0
+ m_PVRCulling: 1
+ m_PVRFilteringGaussRadiusDirect: 1
+ m_PVRFilteringGaussRadiusIndirect: 5
+ m_PVRFilteringGaussRadiusAO: 2
+ m_PVRFilteringAtrousPositionSigmaDirect: 0.5
+ m_PVRFilteringAtrousPositionSigmaIndirect: 2
+ m_PVRFilteringAtrousPositionSigmaAO: 1
+ m_ShowResolutionOverlay: 1
+ m_LightingDataAsset: {fileID: 0}
+ m_UseShadowmask: 0
+--- !u!196 &5
+NavMeshSettings:
+ serializedVersion: 2
+ m_ObjectHideFlags: 0
+ m_BuildSettings:
+ serializedVersion: 2
+ agentTypeID: 0
+ agentRadius: 0.5
+ agentHeight: 2
+ agentSlope: 45
+ agentClimb: 0.4
+ ledgeDropHeight: 0
+ maxJumpAcrossDistance: 0
+ minRegionArea: 2
+ manualCellSize: 0
+ cellSize: 0.16666666
+ manualTileSize: 0
+ tileSize: 256
+ accuratePlacement: 0
+ debug:
+ m_Flags: 0
+ m_NavMeshData: {fileID: 0}
+--- !u!1 &48879805
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 194772, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 48879806}
+ - component: {fileID: 48879810}
+ - component: {fileID: 48879809}
+ - component: {fileID: 48879808}
+ m_Layer: 5
+ m_Name: Button Regular
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &48879806
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22494772, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 48879805}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 1127833552}
+ m_Father: {fileID: 726519996}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &48879808
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11494768, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 48879805}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Navigation:
+ m_Mode: 0
+ m_SelectOnUp: {fileID: 0}
+ m_SelectOnDown: {fileID: 0}
+ m_SelectOnLeft: {fileID: 0}
+ m_SelectOnRight: {fileID: 0}
+ m_Transition: 1
+ m_Colors:
+ m_NormalColor: {r: 0.31764707, g: 0.3372549, b: 0.38431373, a: 1}
+ m_HighlightedColor: {r: 0.8784314, g: 0.48235294, b: 0, a: 1}
+ m_PressedColor: {r: 0.8784314, g: 0, b: 0, a: 1}
+ m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
+ m_ColorMultiplier: 1
+ m_FadeDuration: 0.1
+ m_SpriteState:
+ m_HighlightedSprite: {fileID: 0}
+ m_PressedSprite: {fileID: 0}
+ m_DisabledSprite: {fileID: 0}
+ m_AnimationTriggers:
+ m_NormalTrigger: Normal
+ m_HighlightedTrigger: Highlighted
+ m_PressedTrigger: Pressed
+ m_DisabledTrigger: Disabled
+ m_Interactable: 1
+ m_TargetGraphic: {fileID: 48879809}
+ m_OnClick:
+ m_PersistentCalls:
+ m_Calls:
+ - m_Target: {fileID: 192561278}
+ m_MethodName: OpenDashboard
+ m_Mode: 1
+ m_Arguments:
+ m_ObjectArgument: {fileID: 0}
+ m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
+ m_IntArgument: 0
+ m_FloatArgument: 0
+ m_StringArgument:
+ m_BoolArgument: 0
+ m_CallState: 2
+--- !u!114 &48879809
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11494766, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 48879805}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 0}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &48879810
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22294772, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 48879805}
+ m_CullTransparentMesh: 0
+--- !u!1 &64425121
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 160816, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 64425122}
+ - component: {fileID: 64425125}
+ - component: {fileID: 64425124}
+ - component: {fileID: 64425123}
+ m_Layer: 5
+ m_Name: Outline
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &64425122
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22460816, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 64425121}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 1989416849}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &64425123
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11460816, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 64425121}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 1
+ m_MinWidth: -1
+ m_MinHeight: -1
+ m_PreferredWidth: -1
+ m_PreferredHeight: -1
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!114 &64425124
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11460818, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 64425121}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0, g: 0, b: 0, a: 0.39215687}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 21300000, guid: ea7134547a5488b41a6bb5243b4ec2f1, type: 3}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &64425125
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22260816, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 64425121}
+ m_CullTransparentMesh: 0
+--- !u!1 &141587190
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 194774, guid: d6318142e396e499796d37501c1a7531,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 141587195}
+ - component: {fileID: 141587194}
+ - component: {fileID: 141587193}
+ - component: {fileID: 141587191}
+ - component: {fileID: 141587192}
+ m_Layer: 5
+ m_Name: Health
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &141587191
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11490564, guid: d6318142e396e499796d37501c1a7531,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 141587190}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1573420865, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
+ m_EffectDistance: {x: 1, y: -1}
+ m_UseGraphicAlpha: 1
+--- !u!114 &141587192
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 141587190}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 060fe8295761a47268586d33ef5673e0, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ Selectable: {fileID: 0}
+ NormalColor: {r: 1, g: 1, b: 1, a: 1}
+ HoverColor: {r: 0, g: 0, b: 0, a: 1}
+--- !u!114 &141587193
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11494770, guid: d6318142e396e499796d37501c1a7531,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 141587190}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 5abfb0a229c98b3499cffa6c59c2ffb4, type: 3}
+ m_FontSize: 10
+ m_FontStyle: 0
+ m_BestFit: 1
+ m_MinSize: 10
+ m_MaxSize: 16
+ m_Alignment: 5
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: 100%
+--- !u!222 &141587194
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22294774, guid: d6318142e396e499796d37501c1a7531,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 141587190}
+ m_CullTransparentMesh: 0
+--- !u!224 &141587195
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22494774, guid: d6318142e396e499796d37501c1a7531,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 141587190}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 328181931}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 1, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: -5, y: 0}
+ m_SizeDelta: {x: 60, y: 0}
+ m_Pivot: {x: 1, y: 0.5}
+--- !u!1 &153676942
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 153676943}
+ - component: {fileID: 153676945}
+ - component: {fileID: 153676944}
+ m_Layer: 5
+ m_Name: Background
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &153676943
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 153676942}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 770857990}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &153676944
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 153676942}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 21300000, guid: 2fb83ea89df639b43a22d707d3c22af1, type: 3}
+ m_Type: 0
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &153676945
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 153676942}
+ m_CullTransparentMesh: 0
+--- !u!1 &160598229
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 160598230}
+ - component: {fileID: 160598233}
+ - component: {fileID: 160598232}
+ - component: {fileID: 160598231}
+ m_Layer: 5
+ m_Name: Outline
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &160598230
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 160598229}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 814826292}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &160598231
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 160598229}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 1
+ m_MinWidth: -1
+ m_MinHeight: -1
+ m_PreferredWidth: -1
+ m_PreferredHeight: -1
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!114 &160598232
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 160598229}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 21300000, guid: ea7134547a5488b41a6bb5243b4ec2f1, type: 3}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &160598233
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 160598229}
+ m_CullTransparentMesh: 0
+--- !u!1 &162519640
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 162519641}
+ - component: {fileID: 162519643}
+ - component: {fileID: 162519642}
+ m_Layer: 5
+ m_Name: username Text
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 0
+--- !u!224 &162519641
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 162519640}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 0.99999994, y: 0.99999994, z: 0.99999994}
+ m_Children: []
+ m_Father: {fileID: 770857990}
+ m_RootOrder: 4
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 1}
+ m_AnchorMax: {x: 0, y: 1}
+ m_AnchoredPosition: {x: 5, y: 0}
+ m_SizeDelta: {x: 250, y: 35}
+ m_Pivot: {x: 0, y: 1}
+--- !u!114 &162519642
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 162519640}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 4345225956e176043b2f73b9ee1b0f2b, type: 3}
+ m_FontSize: 24
+ m_FontStyle: 0
+ m_BestFit: 0
+ m_MinSize: 10
+ m_MaxSize: 40
+ m_Alignment: 3
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: Username
+--- !u!222 &162519643
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 162519640}
+ m_CullTransparentMesh: 0
+--- !u!1 &192561276
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 192561277}
+ - component: {fileID: 192561278}
+ - component: {fileID: 192561279}
+ m_Layer: 0
+ m_Name: Scripts
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &192561277
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 192561276}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &192561278
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 192561276}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 02d148d0890b2d44dbdf7f1c1b39a499, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ ChannelsToJoinOnConnect:
+ - Region
+ - Guild
+ FriendsList:
+ - Joe
+ - Jane
+ - Bob
+ HistoryLengthToFetch: 0
+ missingAppIdErrorPanel: {fileID: 1860384066}
+ ConnectingLabel: {fileID: 1323013538}
+ ChatPanel: {fileID: 1507568401}
+ UserIdFormPanel: {fileID: 814826291}
+ InputFieldChat: {fileID: 1989416850}
+ CurrentChannelText: {fileID: 1641022483}
+ ChannelToggleToInstantiate: {fileID: 342400385}
+ FriendListUiItemtoInstantiate: {fileID: 328181930}
+ ShowState: 1
+ Title: {fileID: 938244445}
+ StateText: {fileID: 2126670842}
+ UserIdText: {fileID: 162519642}
+ TestLength: 2048
+--- !u!114 &192561279
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 192561276}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 696a5174ff5e707479b3540eb56d14b7, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ chatNewComponent: {fileID: 192561278}
+ idInput: {fileID: 1320934697}
+--- !u!1 &193452638
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 187090, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 193452639}
+ - component: {fileID: 193452641}
+ - component: {fileID: 193452640}
+ m_Layer: 5
+ m_Name: Placeholder
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &193452639
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22487090, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 193452638}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 1989416849}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: -0.5}
+ m_SizeDelta: {x: -20, y: -13}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &193452640
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11487088, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 193452638}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 0.5019608}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 5abfb0a229c98b3499cffa6c59c2ffb4, type: 3}
+ m_FontSize: 12
+ m_FontStyle: 2
+ m_BestFit: 1
+ m_MinSize: 8
+ m_MaxSize: 16
+ m_Alignment: 3
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: Enter Chat Message...
+--- !u!222 &193452641
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22287090, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 193452638}
+ m_CullTransparentMesh: 0
+--- !u!1 &217679864
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 217679865}
+ - component: {fileID: 217679867}
+ - component: {fileID: 217679866}
+ m_Layer: 5
+ m_Name: Editor SplashScreen Panel
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &217679865
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 217679864}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 517645106}
+ - {fileID: 241317248}
+ - {fileID: 915497946}
+ m_Father: {fileID: 770857990}
+ m_RootOrder: 8
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &217679866
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 217679864}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 0b1cdd4de66f84fa1af4cb197e5d901d, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+--- !u!225 &217679867
+CanvasGroup:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 217679864}
+ m_Enabled: 1
+ m_Alpha: 1
+ m_Interactable: 1
+ m_BlocksRaycasts: 1
+ m_IgnoreParentGroups: 0
+--- !u!1 &239533971
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 194772, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 239533972}
+ - component: {fileID: 239533976}
+ - component: {fileID: 239533975}
+ - component: {fileID: 239533974}
+ m_Layer: 5
+ m_Name: Button Regular
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &239533972
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22494772, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 239533971}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 1880491503}
+ m_Father: {fileID: 814826292}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 1}
+ m_AnchorMax: {x: 0, y: 1}
+ m_AnchoredPosition: {x: 125, y: -75}
+ m_SizeDelta: {x: 240, y: 40}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &239533974
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11494768, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 239533971}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Navigation:
+ m_Mode: 0
+ m_SelectOnUp: {fileID: 0}
+ m_SelectOnDown: {fileID: 0}
+ m_SelectOnLeft: {fileID: 0}
+ m_SelectOnRight: {fileID: 0}
+ m_Transition: 1
+ m_Colors:
+ m_NormalColor: {r: 0.31764707, g: 0.3372549, b: 0.38431373, a: 1}
+ m_HighlightedColor: {r: 0.8784314, g: 0.48235294, b: 0, a: 1}
+ m_PressedColor: {r: 0.8784314, g: 0, b: 0, a: 1}
+ m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
+ m_ColorMultiplier: 1
+ m_FadeDuration: 0.1
+ m_SpriteState:
+ m_HighlightedSprite: {fileID: 0}
+ m_PressedSprite: {fileID: 0}
+ m_DisabledSprite: {fileID: 0}
+ m_AnimationTriggers:
+ m_NormalTrigger: Normal
+ m_HighlightedTrigger: Highlighted
+ m_PressedTrigger: Pressed
+ m_DisabledTrigger: Disabled
+ m_Interactable: 1
+ m_TargetGraphic: {fileID: 239533975}
+ m_OnClick:
+ m_PersistentCalls:
+ m_Calls:
+ - m_Target: {fileID: 192561279}
+ m_MethodName: StartChat
+ m_Mode: 1
+ m_Arguments:
+ m_ObjectArgument: {fileID: 0}
+ m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
+ m_IntArgument: 0
+ m_FloatArgument: 0
+ m_StringArgument:
+ m_BoolArgument: 0
+ m_CallState: 2
+--- !u!114 &239533975
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11494766, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 239533971}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 0}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &239533976
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22294772, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 239533971}
+ m_CullTransparentMesh: 0
+--- !u!1 &241317247
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 241317248}
+ - component: {fileID: 241317251}
+ - component: {fileID: 241317250}
+ - component: {fileID: 241317249}
+ - component: {fileID: 241317252}
+ m_Layer: 5
+ m_Name: Chat App Id Feedback
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &241317248
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 241317247}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 217679865}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0.5}
+ m_AnchorMax: {x: 1, y: 0.5}
+ m_AnchoredPosition: {x: 0, y: 100}
+ m_SizeDelta: {x: -20, y: 75}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &241317249
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 241317247}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1573420865, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_EffectColor: {r: 0, g: 0, b: 0, a: 1}
+ m_EffectDistance: {x: 1, y: -1}
+ m_UseGraphicAlpha: 1
+--- !u!114 &241317250
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 241317247}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 0.69411767}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 5abfb0a229c98b3499cffa6c59c2ffb4, type: 3}
+ m_FontSize: 30
+ m_FontStyle: 0
+ m_BestFit: 0
+ m_MinSize: 1
+ m_MaxSize: 40
+ m_Alignment: 1
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text:
+--- !u!222 &241317251
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 241317247}
+ m_CullTransparentMesh: 0
+--- !u!114 &241317252
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 241317247}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 4eb1284704a754507acb17b07b888086, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ Description: {fileID: 241317250}
+ WizardOpenedOnce: 1
+--- !u!1 &247629931
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 160816, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 247629932}
+ - component: {fileID: 247629935}
+ - component: {fileID: 247629934}
+ - component: {fileID: 247629933}
+ m_Layer: 5
+ m_Name: Outline
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &247629932
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22460816, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 247629931}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 1320934696}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &247629933
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11460816, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 247629931}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 1
+ m_MinWidth: -1
+ m_MinHeight: -1
+ m_PreferredWidth: -1
+ m_PreferredHeight: -1
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!114 &247629934
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11460818, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 247629931}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0, g: 0, b: 0, a: 0.39215687}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 21300000, guid: ea7134547a5488b41a6bb5243b4ec2f1, type: 3}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &247629935
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22260816, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 247629931}
+ m_CullTransparentMesh: 0
+--- !u!1 &276589553
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 148466, guid: 5d91df74039db4d67a68595d5b9bbf4f,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 276589554}
+ - component: {fileID: 276589556}
+ - component: {fileID: 276589555}
+ m_Layer: 5
+ m_Name: OnToggle
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &276589554
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22448466, guid: 5d91df74039db4d67a68595d5b9bbf4f,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 276589553}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 342400384}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &276589555
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11448464, guid: 5d91df74039db4d67a68595d5b9bbf4f,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 276589553}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0.8784314, g: 0.48235294, b: 0, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 0}
+ m_Type: 0
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &276589556
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22248466, guid: 5d91df74039db4d67a68595d5b9bbf4f,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 276589553}
+ m_CullTransparentMesh: 0
+--- !u!1 &328181930
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 194772, guid: d6318142e396e499796d37501c1a7531,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 328181931}
+ - component: {fileID: 328181937}
+ - component: {fileID: 328181936}
+ - component: {fileID: 328181935}
+ - component: {fileID: 328181933}
+ - component: {fileID: 328181932}
+ m_Layer: 5
+ m_Name: Friends List Item
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &328181931
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22494772, guid: d6318142e396e499796d37501c1a7531,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 328181930}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 1520067144}
+ - {fileID: 1754144655}
+ - {fileID: 141587195}
+ m_Father: {fileID: 1366707550}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 1}
+ m_AnchorMax: {x: 0, y: 1}
+ m_AnchoredPosition: {x: 5, y: -35}
+ m_SizeDelta: {x: 240, y: 30}
+ m_Pivot: {x: 0, y: 0}
+--- !u!114 &328181932
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11447548, guid: d6318142e396e499796d37501c1a7531,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 328181930}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 660b16ba396d0465b98be14947420288, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ NameLabel: {fileID: 1520067145}
+ StatusLabel: {fileID: 1754144658}
+ Health: {fileID: 141587193}
+--- !u!114 &328181933
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11465746, guid: d6318142e396e499796d37501c1a7531,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 328181930}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 0
+ m_MinWidth: -1
+ m_MinHeight: 30
+ m_PreferredWidth: -1
+ m_PreferredHeight: 30
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!114 &328181935
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11494768, guid: d6318142e396e499796d37501c1a7531,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 328181930}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Navigation:
+ m_Mode: 0
+ m_SelectOnUp: {fileID: 0}
+ m_SelectOnDown: {fileID: 0}
+ m_SelectOnLeft: {fileID: 0}
+ m_SelectOnRight: {fileID: 0}
+ m_Transition: 1
+ m_Colors:
+ m_NormalColor: {r: 0.31764707, g: 0.3372549, b: 0.38431373, a: 1}
+ m_HighlightedColor: {r: 0.8784314, g: 0.48235294, b: 0, a: 1}
+ m_PressedColor: {r: 0.8784314, g: 0, b: 0, a: 1}
+ m_DisabledColor: {r: 0.31764707, g: 0.3372549, b: 0.38431373, a: 1}
+ m_ColorMultiplier: 1
+ m_FadeDuration: 0.1
+ m_SpriteState:
+ m_HighlightedSprite: {fileID: 0}
+ m_PressedSprite: {fileID: 0}
+ m_DisabledSprite: {fileID: 0}
+ m_AnimationTriggers:
+ m_NormalTrigger: Normal
+ m_HighlightedTrigger: Highlighted
+ m_PressedTrigger: Pressed
+ m_DisabledTrigger: Disabled
+ m_Interactable: 0
+ m_TargetGraphic: {fileID: 328181936}
+ m_OnClick:
+ m_PersistentCalls:
+ m_Calls:
+ - m_Target: {fileID: 0}
+ m_MethodName: JoinRandomRoom
+ m_Mode: 1
+ m_Arguments:
+ m_ObjectArgument: {fileID: 0}
+ m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
+ m_IntArgument: 0
+ m_FloatArgument: 0
+ m_StringArgument:
+ m_BoolArgument: 0
+ m_CallState: 2
+--- !u!114 &328181936
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11494766, guid: d6318142e396e499796d37501c1a7531,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 328181930}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 0}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &328181937
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22294772, guid: d6318142e396e499796d37501c1a7531,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 328181930}
+ m_CullTransparentMesh: 0
+--- !u!1 &330710524
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 330710525}
+ - component: {fileID: 330710528}
+ - component: {fileID: 330710527}
+ - component: {fileID: 330710526}
+ m_Layer: 5
+ m_Name: Title
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &330710525
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 330710524}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 814826292}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 1}
+ m_AnchorMax: {x: 0, y: 1}
+ m_AnchoredPosition: {x: 0, y: 35}
+ m_SizeDelta: {x: 230, y: 40}
+ m_Pivot: {x: 0, y: 1}
+--- !u!114 &330710526
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 330710524}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 1
+ m_MinWidth: -1
+ m_MinHeight: -1
+ m_PreferredWidth: -1
+ m_PreferredHeight: 0
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!114 &330710527
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 330710524}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0.8784314, g: 0.48235294, b: 0, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 5abfb0a229c98b3499cffa6c59c2ffb4, type: 3}
+ m_FontSize: 22
+ m_FontStyle: 0
+ m_BestFit: 1
+ m_MinSize: 10
+ m_MaxSize: 22
+ m_Alignment: 3
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: User Id
+--- !u!222 &330710528
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 330710524}
+ m_CullTransparentMesh: 0
+--- !u!1 &342400383
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 148462, guid: 5d91df74039db4d67a68595d5b9bbf4f,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 342400384}
+ - component: {fileID: 342400388}
+ - component: {fileID: 342400387}
+ - component: {fileID: 342400386}
+ - component: {fileID: 342400385}
+ - component: {fileID: 342400389}
+ m_Layer: 5
+ m_Name: Toggle Regular
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &342400384
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22448462, guid: 5d91df74039db4d67a68595d5b9bbf4f,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 342400383}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 276589554}
+ - {fileID: 384316751}
+ m_Father: {fileID: 1427448790}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 1}
+ m_AnchorMax: {x: 0, y: 1}
+ m_AnchoredPosition: {x: 125, y: -20}
+ m_SizeDelta: {x: 240, y: 30}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &342400385
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11448462, guid: 5d91df74039db4d67a68595d5b9bbf4f,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 342400383}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 2109663825, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Navigation:
+ m_Mode: 3
+ m_SelectOnUp: {fileID: 0}
+ m_SelectOnDown: {fileID: 0}
+ m_SelectOnLeft: {fileID: 0}
+ m_SelectOnRight: {fileID: 0}
+ m_Transition: 1
+ m_Colors:
+ m_NormalColor: {r: 0.31764707, g: 0.3372549, b: 0.38431373, a: 1}
+ m_HighlightedColor: {r: 0.8784314, g: 0.48235294, b: 0, a: 1}
+ m_PressedColor: {r: 0.8784314, g: 0, b: 0, a: 1}
+ m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
+ m_ColorMultiplier: 1
+ m_FadeDuration: 0.1
+ m_SpriteState:
+ m_HighlightedSprite: {fileID: 0}
+ m_PressedSprite: {fileID: 0}
+ m_DisabledSprite: {fileID: 0}
+ m_AnimationTriggers:
+ m_NormalTrigger: Normal
+ m_HighlightedTrigger: Highlighted
+ m_PressedTrigger: Pressed
+ m_DisabledTrigger: Disabled
+ m_Interactable: 1
+ m_TargetGraphic: {fileID: 342400387}
+ toggleTransition: 1
+ graphic: {fileID: 276589555}
+ m_Group: {fileID: 1427448795}
+ onValueChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_IsOn: 0
+--- !u!114 &342400386
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11448460, guid: 5d91df74039db4d67a68595d5b9bbf4f,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 342400383}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 0
+ m_MinWidth: -1
+ m_MinHeight: 30
+ m_PreferredWidth: -1
+ m_PreferredHeight: 30
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!114 &342400387
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11448454, guid: 5d91df74039db4d67a68595d5b9bbf4f,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 342400383}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 0}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &342400388
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22248462, guid: 5d91df74039db4d67a68595d5b9bbf4f,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 342400383}
+ m_CullTransparentMesh: 0
+--- !u!114 &342400389
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 342400383}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 48caa72710147fc4f9389b0b5ec6137d, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ Channel:
+--- !u!1 &384316750
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 148464, guid: 5d91df74039db4d67a68595d5b9bbf4f,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 384316751}
+ - component: {fileID: 384316755}
+ - component: {fileID: 384316754}
+ - component: {fileID: 384316752}
+ m_Layer: 5
+ m_Name: Text
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &384316751
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22448464, guid: 5d91df74039db4d67a68595d5b9bbf4f,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 384316750}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 342400384}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: -10, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &384316752
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 384316750}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 1e808171e8963498bb1db072a977d750, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ toggle: {fileID: 342400385}
+ NormalOnColor: {r: 0, g: 0, b: 0, a: 1}
+ NormalOffColor: {r: 1, g: 1, b: 1, a: 1}
+ HoverOnColor: {r: 0, g: 0, b: 0, a: 1}
+ HoverOffColor: {r: 0, g: 0, b: 0, a: 1}
+--- !u!114 &384316754
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11448458, guid: 5d91df74039db4d67a68595d5b9bbf4f,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 384316750}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 5abfb0a229c98b3499cffa6c59c2ffb4, type: 3}
+ m_FontSize: 24
+ m_FontStyle: 0
+ m_BestFit: 1
+ m_MinSize: 10
+ m_MaxSize: 24
+ m_Alignment: 4
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: Channel
+--- !u!222 &384316755
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22248464, guid: 5d91df74039db4d67a68595d5b9bbf4f,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 384316750}
+ m_CullTransparentMesh: 0
+--- !u!1 &517645105
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 517645106}
+ - component: {fileID: 517645110}
+ - component: {fileID: 517645109}
+ - component: {fileID: 517645108}
+ - component: {fileID: 517645107}
+ m_Layer: 5
+ m_Name: Title
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &517645106
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 517645105}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 217679865}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0.5}
+ m_AnchorMax: {x: 1, y: 0.5}
+ m_AnchoredPosition: {x: 0, y: 190.68}
+ m_SizeDelta: {x: -20, y: 81.37}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &517645107
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 517645105}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1573420865, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_EffectColor: {r: 0, g: 0, b: 0, a: 1}
+ m_EffectDistance: {x: 1, y: -1}
+ m_UseGraphicAlpha: 1
+--- !u!114 &517645108
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 517645105}
+ m_Enabled: 0
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -900027084, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_EffectColor: {r: 0, g: 0, b: 0, a: 1}
+ m_EffectDistance: {x: 1, y: -1}
+ m_UseGraphicAlpha: 1
+--- !u!114 &517645109
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 517645105}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 0.69411767}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 4345225956e176043b2f73b9ee1b0f2b, type: 3}
+ m_FontSize: 87
+ m_FontStyle: 0
+ m_BestFit: 1
+ m_MinSize: 10
+ m_MaxSize: 100
+ m_Alignment: 4
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: Chat Demo
+--- !u!222 &517645110
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 517645105}
+ m_CullTransparentMesh: 0
+--- !u!1 &523050027
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 194774, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 523050028}
+ - component: {fileID: 523050032}
+ - component: {fileID: 523050031}
+ - component: {fileID: 523050029}
+ - component: {fileID: 523050030}
+ m_Layer: 5
+ m_Name: Text
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &523050028
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22494774, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 523050027}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 970871620}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: -10, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &523050029
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11490564, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 523050027}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1573420865, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
+ m_EffectDistance: {x: 1, y: -1}
+ m_UseGraphicAlpha: 1
+--- !u!114 &523050030
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 523050027}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 060fe8295761a47268586d33ef5673e0, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ Selectable: {fileID: 0}
+ NormalColor: {r: 1, g: 1, b: 1, a: 1}
+ HoverColor: {r: 0, g: 0, b: 0, a: 1}
+--- !u!114 &523050031
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11494770, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 523050027}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 5abfb0a229c98b3499cffa6c59c2ffb4, type: 3}
+ m_FontSize: 24
+ m_FontStyle: 0
+ m_BestFit: 1
+ m_MinSize: 10
+ m_MaxSize: 24
+ m_Alignment: 4
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: '?'
+--- !u!222 &523050032
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22294774, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 523050027}
+ m_CullTransparentMesh: 0
+--- !u!1 &578492557
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 578492558}
+ - component: {fileID: 578492561}
+ - component: {fileID: 578492560}
+ - component: {fileID: 578492559}
+ m_Layer: 5
+ m_Name: Outline
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &578492558
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 578492557}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 1989416849}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &578492559
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 578492557}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 1
+ m_MinWidth: -1
+ m_MinHeight: -1
+ m_PreferredWidth: -1
+ m_PreferredHeight: -1
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!114 &578492560
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 578492557}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 21300000, guid: ea7134547a5488b41a6bb5243b4ec2f1, type: 3}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &578492561
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 578492557}
+ m_CullTransparentMesh: 0
+--- !u!1 &589294878
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 187088, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 589294879}
+ - component: {fileID: 589294881}
+ - component: {fileID: 589294880}
+ m_Layer: 5
+ m_Name: Text
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &589294879
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22487088, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 589294878}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 1320934696}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: -20, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &589294880
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11487086, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 589294878}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 5abfb0a229c98b3499cffa6c59c2ffb4, type: 3}
+ m_FontSize: 22
+ m_FontStyle: 0
+ m_BestFit: 1
+ m_MinSize: 10
+ m_MaxSize: 22
+ m_Alignment: 3
+ m_AlignByGeometry: 0
+ m_RichText: 0
+ m_HorizontalOverflow: 1
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text:
+--- !u!222 &589294881
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22287088, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 589294878}
+ m_CullTransparentMesh: 0
+--- !u!1 &726519995
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 726519996}
+ - component: {fileID: 726519997}
+ m_Layer: 5
+ m_Name: Button Layout
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &726519996
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 726519995}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 48879806}
+ m_Father: {fileID: 1014753128}
+ m_RootOrder: 4
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 1}
+ m_AnchorMax: {x: 0, y: 1}
+ m_AnchoredPosition: {x: 100, y: -180}
+ m_SizeDelta: {x: 190, y: 30}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &726519997
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 726519995}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 0
+ m_MinWidth: -1
+ m_MinHeight: 30
+ m_PreferredWidth: -1
+ m_PreferredHeight: 30
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!1 &742235968
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 742235969}
+ - component: {fileID: 742235972}
+ - component: {fileID: 742235971}
+ - component: {fileID: 742235970}
+ m_Layer: 5
+ m_Name: Text
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &742235969
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 742235968}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 814826292}
+ m_RootOrder: 4
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 0, y: 0}
+ m_AnchoredPosition: {x: 0, y: -220}
+ m_SizeDelta: {x: 250, y: 200}
+ m_Pivot: {x: 0, y: 0}
+--- !u!114 &742235970
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 742235968}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 1
+ m_MinWidth: -1
+ m_MinHeight: -1
+ m_PreferredWidth: -1
+ m_PreferredHeight: -1
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!114 &742235971
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 742235968}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 5abfb0a229c98b3499cffa6c59c2ffb4, type: 3}
+ m_FontSize: 16
+ m_FontStyle: 0
+ m_BestFit: 0
+ m_MinSize: 10
+ m_MaxSize: 40
+ m_Alignment: 0
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: Unique UserIds guarantee correct behaviour for AddFriends(). Pick Joe ,Jane
+ or Bob usersId as they are predefined
+--- !u!222 &742235972
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 742235968}
+ m_CullTransparentMesh: 0
+--- !u!1 &749398466
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 194774, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 749398467}
+ - component: {fileID: 749398471}
+ - component: {fileID: 749398470}
+ - component: {fileID: 749398468}
+ - component: {fileID: 749398469}
+ m_Layer: 5
+ m_Name: Text
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &749398467
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22494774, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 749398466}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 1508114938}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: -10, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &749398468
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11490564, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 749398466}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1573420865, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
+ m_EffectDistance: {x: 1, y: -1}
+ m_UseGraphicAlpha: 1
+--- !u!114 &749398469
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 749398466}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 060fe8295761a47268586d33ef5673e0, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ Selectable: {fileID: 0}
+ NormalColor: {r: 1, g: 1, b: 1, a: 1}
+ HoverColor: {r: 0, g: 0, b: 0, a: 1}
+--- !u!114 &749398470
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11494770, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 749398466}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 5abfb0a229c98b3499cffa6c59c2ffb4, type: 3}
+ m_FontSize: 24
+ m_FontStyle: 0
+ m_BestFit: 1
+ m_MinSize: 10
+ m_MaxSize: 24
+ m_Alignment: 4
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: Send
+--- !u!222 &749398471
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22294774, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 749398466}
+ m_CullTransparentMesh: 0
+--- !u!1 &750611066
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 187090, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 750611067}
+ - component: {fileID: 750611069}
+ - component: {fileID: 750611068}
+ m_Layer: 5
+ m_Name: Placeholder
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &750611067
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22487090, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 750611066}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 1320934696}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: -0.5}
+ m_SizeDelta: {x: -20, y: -13}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &750611068
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11487088, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 750611066}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 0.5019608}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 5abfb0a229c98b3499cffa6c59c2ffb4, type: 3}
+ m_FontSize: 12
+ m_FontStyle: 2
+ m_BestFit: 1
+ m_MinSize: 8
+ m_MaxSize: 16
+ m_Alignment: 3
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: Enter User Id
+--- !u!222 &750611069
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22287090, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 750611066}
+ m_CullTransparentMesh: 0
+--- !u!1 &752115433
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 752115434}
+ - component: {fileID: 752115437}
+ - component: {fileID: 752115436}
+ - component: {fileID: 752115435}
+ m_Layer: 5
+ m_Name: Outline
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &752115434
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 752115433}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 1366707550}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &752115435
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 752115433}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 1
+ m_MinWidth: -1
+ m_MinHeight: -1
+ m_PreferredWidth: -1
+ m_PreferredHeight: -1
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!114 &752115436
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 752115433}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 21300000, guid: ea7134547a5488b41a6bb5243b4ec2f1, type: 3}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &752115437
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 752115433}
+ m_CullTransparentMesh: 0
+--- !u!1 &770857986
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 770857990}
+ - component: {fileID: 770857989}
+ - component: {fileID: 770857987}
+ - component: {fileID: 770857991}
+ m_Layer: 5
+ m_Name: Canvas
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &770857987
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 770857986}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreReversedGraphics: 1
+ m_BlockingObjects: 0
+ m_BlockingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+--- !u!223 &770857989
+Canvas:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 770857986}
+ m_Enabled: 1
+ serializedVersion: 3
+ m_RenderMode: 0
+ m_Camera: {fileID: 0}
+ m_PlaneDistance: 100
+ m_PixelPerfect: 1
+ m_ReceivesEvents: 1
+ m_OverrideSorting: 0
+ m_OverridePixelPerfect: 0
+ m_SortingBucketNormalizedSize: 0
+ m_AdditionalShaderChannelsFlag: 25
+ m_SortingLayerID: 0
+ m_SortingOrder: 0
+ m_TargetDisplay: 0
+--- !u!224 &770857990
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 770857986}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 0, y: 0, z: 0}
+ m_Children:
+ - {fileID: 153676943}
+ - {fileID: 1163197799}
+ - {fileID: 938244446}
+ - {fileID: 2126670841}
+ - {fileID: 162519641}
+ - {fileID: 1323013539}
+ - {fileID: 814826292}
+ - {fileID: 1507568401}
+ - {fileID: 217679865}
+ m_Father: {fileID: 0}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 0, y: 0}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0, y: 0}
+--- !u!114 &770857991
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 770857986}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_UiScaleMode: 1
+ m_ReferencePixelsPerUnit: 100
+ m_ScaleFactor: 1
+ m_ReferenceResolution: {x: 800, y: 600}
+ m_ScreenMatchMode: 0
+ m_MatchWidthOrHeight: 0.5
+ m_PhysicalUnit: 3
+ m_FallbackScreenDPI: 94
+ m_DefaultSpriteDPI: 94
+ m_DynamicPixelsPerUnit: 1
+--- !u!1 &814826291
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 814826292}
+ - component: {fileID: 814826295}
+ - component: {fileID: 814826294}
+ - component: {fileID: 814826293}
+ m_Layer: 5
+ m_Name: User Id Form Panel
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 0
+--- !u!224 &814826292
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 814826291}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 160598230}
+ - {fileID: 330710525}
+ - {fileID: 1320934696}
+ - {fileID: 239533972}
+ - {fileID: 742235969}
+ m_Father: {fileID: 770857990}
+ m_RootOrder: 6
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0.5, y: 0.5}
+ m_AnchorMax: {x: 0.5, y: 0.5}
+ m_AnchoredPosition: {x: 0.000030517578, y: 0}
+ m_SizeDelta: {x: 250, y: 100}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &814826293
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 814826291}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1297475563, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Padding:
+ m_Left: 5
+ m_Right: 5
+ m_Top: 5
+ m_Bottom: 5
+ m_ChildAlignment: 0
+ m_Spacing: 10
+ m_ChildForceExpandWidth: 1
+ m_ChildForceExpandHeight: 1
+ m_ChildControlWidth: 1
+ m_ChildControlHeight: 1
+--- !u!114 &814826294
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 814826291}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0.5114619, g: 0.5584751, b: 0.63235295, a: 0.019607844}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 0}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &814826295
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 814826291}
+ m_CullTransparentMesh: 0
+--- !u!1 &814846235
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 814846236}
+ - component: {fileID: 814846239}
+ - component: {fileID: 814846238}
+ - component: {fileID: 814846237}
+ m_Layer: 5
+ m_Name: ChatOutput Panel
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &814846236
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 814846235}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 1555592747}
+ - {fileID: 1937233793}
+ - {fileID: 2017670316}
+ m_Father: {fileID: 1507568401}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 127.5, y: 5}
+ m_SizeDelta: {x: -255, y: -90}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &814846237
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 814846235}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 0
+ m_MinWidth: -1
+ m_MinHeight: -1
+ m_PreferredWidth: -1
+ m_PreferredHeight: -1
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: 1
+ m_LayoutPriority: 1
+--- !u!114 &814846238
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 814846235}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0.5114619, g: 0.5584751, b: 0.63235295, a: 0.019607844}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 0}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &814846239
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 814846235}
+ m_CullTransparentMesh: 0
+--- !u!1 &863442299
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 863442300}
+ - component: {fileID: 863442305}
+ - component: {fileID: 863442304}
+ - component: {fileID: 863442303}
+ - component: {fileID: 863442302}
+ - component: {fileID: 863442301}
+ m_Layer: 5
+ m_Name: Error Title
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &863442300
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 863442299}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 1014753128}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 1}
+ m_AnchorMax: {x: 0, y: 1}
+ m_AnchoredPosition: {x: 0, y: 30}
+ m_SizeDelta: {x: 190, y: 30}
+ m_Pivot: {x: 0, y: 1}
+--- !u!114 &863442301
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 863442299}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -900027084, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
+ m_EffectDistance: {x: 1, y: -1}
+ m_UseGraphicAlpha: 1
+--- !u!114 &863442302
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 863442299}
+ m_Enabled: 0
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1573420865, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
+ m_EffectDistance: {x: 1, y: -1}
+ m_UseGraphicAlpha: 1
+--- !u!114 &863442303
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 863442299}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 1
+ m_MinWidth: -1
+ m_MinHeight: 30
+ m_PreferredWidth: -1
+ m_PreferredHeight: 30
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!114 &863442304
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 863442299}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 0, b: 0, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 5abfb0a229c98b3499cffa6c59c2ffb4, type: 3}
+ m_FontSize: 22
+ m_FontStyle: 0
+ m_BestFit: 0
+ m_MinSize: 10
+ m_MaxSize: 40
+ m_Alignment: 3
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: Missing App ID
+--- !u!222 &863442305
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 863442299}
+ m_CullTransparentMesh: 0
+--- !u!1 &915497945
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 915497946}
+ - component: {fileID: 915497949}
+ - component: {fileID: 915497948}
+ - component: {fileID: 915497947}
+ m_Layer: 5
+ m_Name: Description
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &915497946
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 915497945}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 217679865}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0.5}
+ m_AnchorMax: {x: 1, y: 0.5}
+ m_AnchoredPosition: {x: 0, y: -90.435}
+ m_SizeDelta: {x: -20, y: 281.87}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &915497947
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 915497945}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1573420865, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_EffectColor: {r: 0, g: 0, b: 0, a: 1}
+ m_EffectDistance: {x: 1, y: -1}
+ m_UseGraphicAlpha: 1
+--- !u!114 &915497948
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 915497945}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 0.69411767}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 4345225956e176043b2f73b9ee1b0f2b, type: 3}
+ m_FontSize: 30
+ m_FontStyle: 0
+ m_BestFit: 1
+ m_MinSize: 3
+ m_MaxSize: 30
+ m_Alignment: 1
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: "This is a simple Photon Chat room demo\nThe Canvas contains multiple Panels
+ for different context.\nThey are disabled intentionally, so scripts can activate
+ them.\r\nThe script IgnoreUiRaycastWhenInactive keeps inactive panels from blocking
+ input.\r\n\r\nAll users should use a UserId (to be found as friend).\r\nThis message
+ will go away at runtime."
+--- !u!222 &915497949
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 915497945}
+ m_CullTransparentMesh: 0
+--- !u!1 &938244445
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 938244446}
+ - component: {fileID: 938244448}
+ - component: {fileID: 938244447}
+ m_Layer: 5
+ m_Name: Demo Name
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 0
+--- !u!224 &938244446
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 938244445}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 770857990}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0.5, y: 1}
+ m_AnchorMax: {x: 0.5, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 250, y: 35}
+ m_Pivot: {x: 0.5, y: 1}
+--- !u!114 &938244447
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 938244445}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0.8784314, g: 0.48235294, b: 0, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 5abfb0a229c98b3499cffa6c59c2ffb4, type: 3}
+ m_FontSize: 24
+ m_FontStyle: 0
+ m_BestFit: 1
+ m_MinSize: 10
+ m_MaxSize: 40
+ m_Alignment: 4
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: Demo Chat
+--- !u!222 &938244448
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 938244445}
+ m_CullTransparentMesh: 0
+--- !u!1 &970871619
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 194772, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 970871620}
+ - component: {fileID: 970871624}
+ - component: {fileID: 970871623}
+ - component: {fileID: 970871622}
+ m_Layer: 5
+ m_Name: Button Regular
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &970871620
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22494772, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 970871619}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 523050028}
+ m_Father: {fileID: 1569829900}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 1}
+ m_AnchorMax: {x: 0, y: 1}
+ m_AnchoredPosition: {x: 5, y: -5}
+ m_SizeDelta: {x: 30, y: 35}
+ m_Pivot: {x: 0, y: 1}
+--- !u!114 &970871622
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11494768, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 970871619}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Navigation:
+ m_Mode: 0
+ m_SelectOnUp: {fileID: 0}
+ m_SelectOnDown: {fileID: 0}
+ m_SelectOnLeft: {fileID: 0}
+ m_SelectOnRight: {fileID: 0}
+ m_Transition: 1
+ m_Colors:
+ m_NormalColor: {r: 0.31764707, g: 0.3372549, b: 0.38431373, a: 1}
+ m_HighlightedColor: {r: 0.8784314, g: 0.48235294, b: 0, a: 1}
+ m_PressedColor: {r: 0.8784314, g: 0, b: 0, a: 1}
+ m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
+ m_ColorMultiplier: 1
+ m_FadeDuration: 0.1
+ m_SpriteState:
+ m_HighlightedSprite: {fileID: 0}
+ m_PressedSprite: {fileID: 0}
+ m_DisabledSprite: {fileID: 0}
+ m_AnimationTriggers:
+ m_NormalTrigger: Normal
+ m_HighlightedTrigger: Highlighted
+ m_PressedTrigger: Pressed
+ m_DisabledTrigger: Disabled
+ m_Interactable: 1
+ m_TargetGraphic: {fileID: 970871623}
+ m_OnClick:
+ m_PersistentCalls:
+ m_Calls:
+ - m_Target: {fileID: 192561278}
+ m_MethodName: PostHelpToCurrentChannel
+ m_Mode: 1
+ m_Arguments:
+ m_ObjectArgument: {fileID: 0}
+ m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
+ m_IntArgument: 0
+ m_FloatArgument: 0
+ m_StringArgument:
+ m_BoolArgument: 0
+ m_CallState: 2
+--- !u!114 &970871623
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11494766, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 970871619}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 0}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &970871624
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22294772, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 970871619}
+ m_CullTransparentMesh: 0
+--- !u!1 &1014753127
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1014753128}
+ - component: {fileID: 1014753131}
+ - component: {fileID: 1014753130}
+ - component: {fileID: 1014753129}
+ m_Layer: 5
+ m_Name: Error Panel
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1014753128
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1014753127}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 1739446624}
+ - {fileID: 863442300}
+ - {fileID: 1734659754}
+ - {fileID: 1322130499}
+ - {fileID: 726519996}
+ m_Father: {fileID: 1860384067}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0.5, y: 0.5}
+ m_AnchorMax: {x: 0.5, y: 0.5}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 200, y: 200}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &1014753129
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1014753127}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1297475563, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Padding:
+ m_Left: 5
+ m_Right: 5
+ m_Top: 5
+ m_Bottom: 5
+ m_ChildAlignment: 0
+ m_Spacing: 5
+ m_ChildForceExpandWidth: 1
+ m_ChildForceExpandHeight: 1
+ m_ChildControlWidth: 1
+ m_ChildControlHeight: 1
+--- !u!114 &1014753130
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1014753127}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0.21323532, g: 0, b: 0, a: 0.8039216}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 0}
+ m_Type: 0
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &1014753131
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1014753127}
+ m_CullTransparentMesh: 0
+--- !u!1 &1079401850
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1079401851}
+ - component: {fileID: 1079401852}
+ - component: {fileID: 1079401855}
+ - component: {fileID: 1079401853}
+ m_Layer: 0
+ m_Name: Main Camera
+ m_TagString: MainCamera
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &1079401851
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1079401850}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 1, z: -10}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!20 &1079401852
+Camera:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1079401850}
+ m_Enabled: 1
+ serializedVersion: 2
+ m_ClearFlags: 1
+ m_BackGroundColor: {r: 0.11764706, g: 0.11764706, b: 0.13725491, a: 1}
+ m_projectionMatrixMode: 1
+ m_SensorSize: {x: 36, y: 24}
+ m_LensShift: {x: 0, y: 0}
+ m_GateFitMode: 2
+ m_FocalLength: 50
+ m_NormalizedViewPortRect:
+ serializedVersion: 2
+ x: 0
+ y: 0
+ width: 1
+ height: 1
+ near clip plane: 0.3
+ far clip plane: 1000
+ field of view: 60
+ orthographic: 0
+ orthographic size: 100
+ m_Depth: -1
+ m_CullingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+ m_RenderingPath: -1
+ m_TargetTexture: {fileID: 0}
+ m_TargetDisplay: 0
+ m_TargetEye: 3
+ m_HDR: 0
+ m_AllowMSAA: 1
+ m_AllowDynamicResolution: 0
+ m_ForceIntoRT: 0
+ m_OcclusionCulling: 1
+ m_StereoConvergence: 10
+ m_StereoSeparation: 0.022
+--- !u!81 &1079401853
+AudioListener:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1079401850}
+ m_Enabled: 1
+--- !u!124 &1079401855
+Behaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1079401850}
+ m_Enabled: 1
+--- !u!1 &1114666229
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1114666230}
+ - component: {fileID: 1114666233}
+ - component: {fileID: 1114666232}
+ - component: {fileID: 1114666231}
+ m_Layer: 5
+ m_Name: Title
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1114666230
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1114666229}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 1366707550}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 1}
+ m_AnchorMax: {x: 0, y: 1}
+ m_AnchoredPosition: {x: 0, y: 30}
+ m_SizeDelta: {x: 230, y: 30}
+ m_Pivot: {x: 0, y: 1}
+--- !u!114 &1114666231
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1114666229}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 1
+ m_MinWidth: -1
+ m_MinHeight: -1
+ m_PreferredWidth: -1
+ m_PreferredHeight: 0
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!114 &1114666232
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1114666229}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0.8784314, g: 0.48235294, b: 0, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 5abfb0a229c98b3499cffa6c59c2ffb4, type: 3}
+ m_FontSize: 22
+ m_FontStyle: 0
+ m_BestFit: 1
+ m_MinSize: 10
+ m_MaxSize: 22
+ m_Alignment: 0
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 1
+ m_VerticalOverflow: 1
+ m_LineSpacing: 1
+ m_Text: Friends
+--- !u!222 &1114666233
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1114666229}
+ m_CullTransparentMesh: 0
+--- !u!1 &1127833551
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 194774, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1127833552}
+ - component: {fileID: 1127833556}
+ - component: {fileID: 1127833555}
+ - component: {fileID: 1127833553}
+ - component: {fileID: 1127833554}
+ m_Layer: 5
+ m_Name: Text
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1127833552
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22494774, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1127833551}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 48879806}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: -10, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &1127833553
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11490564, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1127833551}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1573420865, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
+ m_EffectDistance: {x: 1, y: -1}
+ m_UseGraphicAlpha: 1
+--- !u!114 &1127833554
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1127833551}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 060fe8295761a47268586d33ef5673e0, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ Selectable: {fileID: 0}
+ NormalColor: {r: 1, g: 1, b: 1, a: 1}
+ HoverColor: {r: 0, g: 0, b: 0, a: 1}
+--- !u!114 &1127833555
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11494770, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1127833551}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 5abfb0a229c98b3499cffa6c59c2ffb4, type: 3}
+ m_FontSize: 24
+ m_FontStyle: 0
+ m_BestFit: 1
+ m_MinSize: 10
+ m_MaxSize: 24
+ m_Alignment: 4
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: Dashboard (Online)
+--- !u!222 &1127833556
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22294774, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1127833551}
+ m_CullTransparentMesh: 0
+--- !u!1 &1140689145
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1140689146}
+ - component: {fileID: 1140689149}
+ - component: {fileID: 1140689148}
+ - component: {fileID: 1140689147}
+ m_Layer: 5
+ m_Name: Outline
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1140689146
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1140689145}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 1427448790}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &1140689147
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1140689145}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 1
+ m_MinWidth: -1
+ m_MinHeight: -1
+ m_PreferredWidth: -1
+ m_PreferredHeight: -1
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!114 &1140689148
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1140689145}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 21300000, guid: ea7134547a5488b41a6bb5243b4ec2f1, type: 3}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &1140689149
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1140689145}
+ m_CullTransparentMesh: 0
+--- !u!1 &1163197798
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1163197799}
+ - component: {fileID: 1163197802}
+ - component: {fileID: 1163197801}
+ - component: {fileID: 1163197800}
+ m_Layer: 5
+ m_Name: Watermark
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1163197799
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1163197798}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 770857990}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 1, y: 0}
+ m_AnchorMax: {x: 1, y: 0}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 128, y: 128}
+ m_Pivot: {x: 1, y: 0}
+--- !u!114 &1163197800
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1163197798}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Navigation:
+ m_Mode: 3
+ m_SelectOnUp: {fileID: 0}
+ m_SelectOnDown: {fileID: 0}
+ m_SelectOnLeft: {fileID: 0}
+ m_SelectOnRight: {fileID: 0}
+ m_Transition: 1
+ m_Colors:
+ m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
+ m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
+ m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
+ m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
+ m_ColorMultiplier: 1
+ m_FadeDuration: 0.1
+ m_SpriteState:
+ m_HighlightedSprite: {fileID: 0}
+ m_PressedSprite: {fileID: 0}
+ m_DisabledSprite: {fileID: 0}
+ m_AnimationTriggers:
+ m_NormalTrigger: Normal
+ m_HighlightedTrigger: Highlighted
+ m_PressedTrigger: Pressed
+ m_DisabledTrigger: Disabled
+ m_Interactable: 1
+ m_TargetGraphic: {fileID: 1163197801}
+ m_OnClick:
+ m_PersistentCalls:
+ m_Calls: []
+--- !u!114 &1163197801
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1163197798}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 0.2784314}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 21300000, guid: 37b0a18b391c6ae468b5bcc74bba2c1a, type: 3}
+ m_Type: 0
+ m_PreserveAspect: 1
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &1163197802
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1163197798}
+ m_CullTransparentMesh: 0
+--- !u!1 &1223575070
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1223575071}
+ - component: {fileID: 1223575073}
+ - component: {fileID: 1223575072}
+ m_Layer: 5
+ m_Name: Modal Panel
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1223575071
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1223575070}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 1860384067}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &1223575072
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1223575070}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.67058825}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &1223575073
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1223575070}
+ m_CullTransparentMesh: 0
+--- !u!1 &1320934695
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 187092, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1320934696}
+ - component: {fileID: 1320934699}
+ - component: {fileID: 1320934698}
+ - component: {fileID: 1320934697}
+ m_Layer: 5
+ m_Name: InputField Regular
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1320934696
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22487092, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1320934695}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 247629932}
+ - {fileID: 750611067}
+ - {fileID: 589294879}
+ m_Father: {fileID: 814826292}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 1}
+ m_AnchorMax: {x: 0, y: 1}
+ m_AnchoredPosition: {x: 125, y: -5}
+ m_SizeDelta: {x: 240, y: 40}
+ m_Pivot: {x: 0.5, y: 1}
+--- !u!114 &1320934697
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11487092, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1320934695}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 575553740, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Navigation:
+ m_Mode: 0
+ m_SelectOnUp: {fileID: 0}
+ m_SelectOnDown: {fileID: 0}
+ m_SelectOnLeft: {fileID: 0}
+ m_SelectOnRight: {fileID: 0}
+ m_Transition: 1
+ m_Colors:
+ m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
+ m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
+ m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
+ m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
+ m_ColorMultiplier: 1
+ m_FadeDuration: 0.1
+ m_SpriteState:
+ m_HighlightedSprite: {fileID: 0}
+ m_PressedSprite: {fileID: 0}
+ m_DisabledSprite: {fileID: 0}
+ m_AnimationTriggers:
+ m_NormalTrigger: Normal
+ m_HighlightedTrigger: Highlighted
+ m_PressedTrigger: Pressed
+ m_DisabledTrigger: Disabled
+ m_Interactable: 1
+ m_TargetGraphic: {fileID: 1320934698}
+ m_TextComponent: {fileID: 589294880}
+ m_Placeholder: {fileID: 750611068}
+ m_ContentType: 0
+ m_InputType: 0
+ m_AsteriskChar: 42
+ m_KeyboardType: 0
+ m_LineType: 0
+ m_HideMobileInput: 0
+ m_CharacterValidation: 0
+ m_CharacterLimit: 0
+ m_OnEndEdit:
+ m_PersistentCalls:
+ m_Calls:
+ - m_Target: {fileID: 192561279}
+ m_MethodName: EndEditOnEnter
+ m_Mode: 1
+ m_Arguments:
+ m_ObjectArgument: {fileID: 0}
+ m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
+ m_IntArgument: 0
+ m_FloatArgument: 0
+ m_StringArgument:
+ m_BoolArgument: 0
+ m_CallState: 2
+ m_OnValueChanged:
+ m_PersistentCalls:
+ m_Calls:
+ - m_Target: {fileID: 0}
+ m_MethodName: set_PlayerName
+ m_Mode: 0
+ m_Arguments:
+ m_ObjectArgument: {fileID: 0}
+ m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
+ m_IntArgument: 0
+ m_FloatArgument: 0
+ m_StringArgument:
+ m_BoolArgument: 0
+ m_CallState: 2
+ m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
+ m_CustomCaretColor: 0
+ m_SelectionColor: {r: 0.8784314, g: 0.48235294, b: 0, a: 1}
+ m_Text:
+ m_CaretBlinkRate: 1.7
+ m_CaretWidth: 1
+ m_ReadOnly: 0
+--- !u!114 &1320934698
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11487090, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1320934695}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0.31764707, g: 0.3372549, b: 0.38431373, a: 0.24313726}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 0}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &1320934699
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22287092, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1320934695}
+ m_CullTransparentMesh: 0
+--- !u!1 &1322130497
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1322130499}
+ - component: {fileID: 1322130498}
+ m_Layer: 5
+ m_Name: LayoutElement
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &1322130498
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1322130497}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 0
+ m_MinWidth: -1
+ m_MinHeight: -1
+ m_PreferredWidth: -1
+ m_PreferredHeight: 1000
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!224 &1322130499
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1322130497}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 1014753128}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 1}
+ m_AnchorMax: {x: 0, y: 1}
+ m_AnchoredPosition: {x: 100, y: -135}
+ m_SizeDelta: {x: 190, y: 50}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!1 &1323013538
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1323013539}
+ - component: {fileID: 1323013543}
+ - component: {fileID: 1323013542}
+ - component: {fileID: 1323013541}
+ - component: {fileID: 1323013540}
+ m_Layer: 5
+ m_Name: Connecting label
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 0
+--- !u!224 &1323013539
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1323013538}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 770857990}
+ m_RootOrder: 5
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &1323013540
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1323013538}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1573420865, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_EffectColor: {r: 0, g: 0, b: 0, a: 1}
+ m_EffectDistance: {x: 1, y: -1}
+ m_UseGraphicAlpha: 1
+--- !u!114 &1323013541
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1323013538}
+ m_Enabled: 0
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -900027084, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_EffectColor: {r: 0, g: 0, b: 0, a: 1}
+ m_EffectDistance: {x: 1, y: -1}
+ m_UseGraphicAlpha: 1
+--- !u!114 &1323013542
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1323013538}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 0.69411767}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 4345225956e176043b2f73b9ee1b0f2b, type: 3}
+ m_FontSize: 40
+ m_FontStyle: 0
+ m_BestFit: 1
+ m_MinSize: 10
+ m_MaxSize: 40
+ m_Alignment: 4
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: Connecting...
+--- !u!222 &1323013543
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1323013538}
+ m_CullTransparentMesh: 0
+--- !u!1 &1366707549
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1366707550}
+ - component: {fileID: 1366707555}
+ - component: {fileID: 1366707554}
+ - component: {fileID: 1366707553}
+ - component: {fileID: 1366707552}
+ - component: {fileID: 1366707551}
+ m_Layer: 5
+ m_Name: Friends Panel
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1366707550
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1366707549}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 752115434}
+ - {fileID: 1114666230}
+ - {fileID: 328181931}
+ m_Father: {fileID: 1507568401}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 0, y: 0.5}
+ m_AnchoredPosition: {x: 0, y: 20}
+ m_SizeDelta: {x: 250, y: -60}
+ m_Pivot: {x: 0, y: 0.5}
+--- !u!114 &1366707551
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1366707549}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1297475563, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Padding:
+ m_Left: 5
+ m_Right: 5
+ m_Top: 5
+ m_Bottom: 5
+ m_ChildAlignment: 0
+ m_Spacing: 5
+ m_ChildForceExpandWidth: 1
+ m_ChildForceExpandHeight: 0
+ m_ChildControlWidth: 1
+ m_ChildControlHeight: 1
+--- !u!114 &1366707552
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1366707549}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -1184210157, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_AllowSwitchOff: 0
+--- !u!114 &1366707553
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1366707549}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 0
+ m_MinWidth: -1
+ m_MinHeight: 30
+ m_PreferredWidth: -1
+ m_PreferredHeight: 30
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!114 &1366707554
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1366707549}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0.5114619, g: 0.5584751, b: 0.63235295, a: 0.019607844}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 0}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &1366707555
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1366707549}
+ m_CullTransparentMesh: 0
+--- !u!1 &1427448789
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1427448790}
+ - component: {fileID: 1427448793}
+ - component: {fileID: 1427448792}
+ - component: {fileID: 1427448791}
+ - component: {fileID: 1427448795}
+ - component: {fileID: 1427448794}
+ m_Layer: 5
+ m_Name: ChannelBar Panel
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1427448790
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1427448789}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 1140689146}
+ - {fileID: 2129492527}
+ - {fileID: 342400384}
+ m_Father: {fileID: 1507568401}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0.5}
+ m_AnchorMax: {x: 0, y: 1}
+ m_AnchoredPosition: {x: 0, y: -5}
+ m_SizeDelta: {x: 250, y: -70}
+ m_Pivot: {x: 0, y: 0.5}
+--- !u!114 &1427448791
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1427448789}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 0
+ m_MinWidth: -1
+ m_MinHeight: 30
+ m_PreferredWidth: -1
+ m_PreferredHeight: 30
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!114 &1427448792
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1427448789}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0.5114619, g: 0.5584751, b: 0.63235295, a: 0.019607844}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 0}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &1427448793
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1427448789}
+ m_CullTransparentMesh: 0
+--- !u!114 &1427448794
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1427448789}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1297475563, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Padding:
+ m_Left: 5
+ m_Right: 5
+ m_Top: 5
+ m_Bottom: 5
+ m_ChildAlignment: 0
+ m_Spacing: 5
+ m_ChildForceExpandWidth: 1
+ m_ChildForceExpandHeight: 0
+ m_ChildControlWidth: 1
+ m_ChildControlHeight: 1
+--- !u!114 &1427448795
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1427448789}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -1184210157, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_AllowSwitchOff: 0
+--- !u!1 &1507568400
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1507568401}
+ - component: {fileID: 1507568405}
+ m_Layer: 5
+ m_Name: Chat Panel
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 0
+--- !u!224 &1507568401
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1507568400}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 1427448790}
+ - {fileID: 1366707550}
+ - {fileID: 814846236}
+ - {fileID: 1569829900}
+ m_Father: {fileID: 770857990}
+ m_RootOrder: 7
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: -15.000061}
+ m_SizeDelta: {x: -10, y: -40}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &1507568405
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1507568400}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 4ba4c747f6975ea46bcc0a55ffe3bfe8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+--- !u!1 &1508114937
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 194772, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1508114938}
+ - component: {fileID: 1508114942}
+ - component: {fileID: 1508114941}
+ - component: {fileID: 1508114940}
+ m_Layer: 5
+ m_Name: Button Regular
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1508114938
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22494772, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1508114937}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 749398467}
+ m_Father: {fileID: 1569829900}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 1, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: -5, y: 0}
+ m_SizeDelta: {x: 100, y: -10}
+ m_Pivot: {x: 1, y: 0.5}
+--- !u!114 &1508114940
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11494768, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1508114937}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Navigation:
+ m_Mode: 0
+ m_SelectOnUp: {fileID: 0}
+ m_SelectOnDown: {fileID: 0}
+ m_SelectOnLeft: {fileID: 0}
+ m_SelectOnRight: {fileID: 0}
+ m_Transition: 1
+ m_Colors:
+ m_NormalColor: {r: 0.31764707, g: 0.3372549, b: 0.38431373, a: 1}
+ m_HighlightedColor: {r: 0.8784314, g: 0.48235294, b: 0, a: 1}
+ m_PressedColor: {r: 0.8784314, g: 0, b: 0, a: 1}
+ m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
+ m_ColorMultiplier: 1
+ m_FadeDuration: 0.1
+ m_SpriteState:
+ m_HighlightedSprite: {fileID: 0}
+ m_PressedSprite: {fileID: 0}
+ m_DisabledSprite: {fileID: 0}
+ m_AnimationTriggers:
+ m_NormalTrigger: Normal
+ m_HighlightedTrigger: Highlighted
+ m_PressedTrigger: Pressed
+ m_DisabledTrigger: Disabled
+ m_Interactable: 1
+ m_TargetGraphic: {fileID: 1508114941}
+ m_OnClick:
+ m_PersistentCalls:
+ m_Calls:
+ - m_Target: {fileID: 192561278}
+ m_MethodName: OnClickSend
+ m_Mode: 1
+ m_Arguments:
+ m_ObjectArgument: {fileID: 0}
+ m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
+ m_IntArgument: 0
+ m_FloatArgument: 0
+ m_StringArgument:
+ m_BoolArgument: 0
+ m_CallState: 2
+--- !u!114 &1508114941
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11494766, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1508114937}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 0}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &1508114942
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22294772, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1508114937}
+ m_CullTransparentMesh: 0
+--- !u!1 &1520067143
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 111722, guid: d6318142e396e499796d37501c1a7531,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1520067144}
+ - component: {fileID: 1520067148}
+ - component: {fileID: 1520067145}
+ - component: {fileID: 1520067146}
+ m_Layer: 5
+ m_Name: Text
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1520067144
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22411722, guid: d6318142e396e499796d37501c1a7531,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1520067143}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 328181931}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: -10, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &1520067145
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11411724, guid: d6318142e396e499796d37501c1a7531,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1520067143}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 5abfb0a229c98b3499cffa6c59c2ffb4, type: 3}
+ m_FontSize: 24
+ m_FontStyle: 0
+ m_BestFit: 1
+ m_MinSize: 10
+ m_MaxSize: 24
+ m_Alignment: 4
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: Joe
+--- !u!114 &1520067146
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11411726, guid: d6318142e396e499796d37501c1a7531,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1520067143}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1573420865, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
+ m_EffectDistance: {x: 1, y: -1}
+ m_UseGraphicAlpha: 1
+--- !u!222 &1520067148
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22211722, guid: d6318142e396e499796d37501c1a7531,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1520067143}
+ m_CullTransparentMesh: 0
+--- !u!1 &1555592746
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1555592747}
+ - component: {fileID: 1555592750}
+ - component: {fileID: 1555592749}
+ - component: {fileID: 1555592748}
+ m_Layer: 5
+ m_Name: Outline
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1555592747
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1555592746}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 814846236}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &1555592748
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1555592746}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 1
+ m_MinWidth: -1
+ m_MinHeight: -1
+ m_PreferredWidth: -1
+ m_PreferredHeight: -1
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!114 &1555592749
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1555592746}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 21300000, guid: ea7134547a5488b41a6bb5243b4ec2f1, type: 3}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &1555592750
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1555592746}
+ m_CullTransparentMesh: 0
+--- !u!1 &1569829899
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1569829900}
+ - component: {fileID: 1569829903}
+ - component: {fileID: 1569829902}
+ m_Layer: 5
+ m_Name: InputBar Panel
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1569829900
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1569829899}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 1670585027}
+ - {fileID: 970871620}
+ - {fileID: 1989416849}
+ - {fileID: 1508114938}
+ m_Father: {fileID: 1507568401}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 0}
+ m_AnchoredPosition: {x: 127.5, y: 0}
+ m_SizeDelta: {x: -255, y: 45}
+ m_Pivot: {x: 0.5, y: 0}
+--- !u!114 &1569829902
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1569829899}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0.5114619, g: 0.5584751, b: 0.63235295, a: 0.019607844}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 0}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &1569829903
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1569829899}
+ m_CullTransparentMesh: 0
+--- !u!1 &1641022481
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1641022482}
+ - component: {fileID: 1641022484}
+ - component: {fileID: 1641022483}
+ - component: {fileID: 1641022485}
+ m_Layer: 5
+ m_Name: Selected Channel Text
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1641022482
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1641022481}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 2017670316}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 0, y: 0}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 568, y: 17.198803}
+ m_Pivot: {x: 0, y: 0}
+--- !u!114 &1641022483
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1641022481}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 5abfb0a229c98b3499cffa6c59c2ffb4, type: 3}
+ m_FontSize: 18
+ m_FontStyle: 0
+ m_BestFit: 0
+ m_MinSize: 10
+ m_MaxSize: 40
+ m_Alignment: 6
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: Not in chat yet
+--- !u!222 &1641022484
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1641022481}
+ m_CullTransparentMesh: 0
+--- !u!114 &1641022485
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1641022481}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1741964061, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_HorizontalFit: 0
+ m_VerticalFit: 2
+--- !u!1 &1670585026
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1670585027}
+ - component: {fileID: 1670585030}
+ - component: {fileID: 1670585029}
+ - component: {fileID: 1670585028}
+ m_Layer: 5
+ m_Name: Outline
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1670585027
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1670585026}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 1569829900}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &1670585028
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1670585026}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 1
+ m_MinWidth: -1
+ m_MinHeight: -1
+ m_PreferredWidth: -1
+ m_PreferredHeight: -1
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!114 &1670585029
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1670585026}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 21300000, guid: ea7134547a5488b41a6bb5243b4ec2f1, type: 3}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &1670585030
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1670585026}
+ m_CullTransparentMesh: 0
+--- !u!1 &1734659753
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1734659754}
+ - component: {fileID: 1734659757}
+ - component: {fileID: 1734659756}
+ - component: {fileID: 1734659755}
+ m_Layer: 5
+ m_Name: 'Message '
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1734659754
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1734659753}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 1014753128}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 1}
+ m_AnchorMax: {x: 0, y: 1}
+ m_AnchoredPosition: {x: 100, y: -55}
+ m_SizeDelta: {x: 190, y: 100}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &1734659755
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1734659753}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 0
+ m_MinWidth: -1
+ m_MinHeight: 100
+ m_PreferredWidth: -1
+ m_PreferredHeight: 100
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!114 &1734659756
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1734659753}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 5abfb0a229c98b3499cffa6c59c2ffb4, type: 3}
+ m_FontSize: 14
+ m_FontStyle: 0
+ m_BestFit: 0
+ m_MinSize: 10
+ m_MaxSize: 40
+ m_Alignment: 0
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: 'To continue, this demo needs a Chat AppId set up.
+
+
+ You can create one in the Photon Dashboard to copy and paste it into the demo.'
+--- !u!222 &1734659757
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1734659753}
+ m_CullTransparentMesh: 0
+--- !u!1 &1739446623
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1739446624}
+ - component: {fileID: 1739446627}
+ - component: {fileID: 1739446626}
+ - component: {fileID: 1739446625}
+ m_Layer: 5
+ m_Name: Outline
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1739446624
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1739446623}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 1014753128}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &1739446625
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1739446623}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 1
+ m_MinWidth: -1
+ m_MinHeight: -1
+ m_PreferredWidth: -1
+ m_PreferredHeight: -1
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!114 &1739446626
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1739446623}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 21300000, guid: ea7134547a5488b41a6bb5243b4ec2f1, type: 3}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &1739446627
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1739446623}
+ m_CullTransparentMesh: 0
+--- !u!1 &1754144654
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 146428, guid: d6318142e396e499796d37501c1a7531,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1754144655}
+ - component: {fileID: 1754144659}
+ - component: {fileID: 1754144658}
+ - component: {fileID: 1754144656}
+ m_Layer: 5
+ m_Name: Status
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1754144655
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22446428, guid: d6318142e396e499796d37501c1a7531,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1754144654}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 328181931}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 0, y: 1}
+ m_AnchoredPosition: {x: 5, y: 0}
+ m_SizeDelta: {x: 60, y: 0}
+ m_Pivot: {x: 0, y: 0.5}
+--- !u!114 &1754144656
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11446428, guid: d6318142e396e499796d37501c1a7531,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1754144654}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1573420865, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
+ m_EffectDistance: {x: 1, y: -1}
+ m_UseGraphicAlpha: 1
+--- !u!114 &1754144658
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11446426, guid: d6318142e396e499796d37501c1a7531,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1754144654}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 5abfb0a229c98b3499cffa6c59c2ffb4, type: 3}
+ m_FontSize: 10
+ m_FontStyle: 0
+ m_BestFit: 1
+ m_MinSize: 10
+ m_MaxSize: 16
+ m_Alignment: 3
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: Offline
+--- !u!222 &1754144659
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22246428, guid: d6318142e396e499796d37501c1a7531,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1754144654}
+ m_CullTransparentMesh: 0
+--- !u!1 &1809679009
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1809679013}
+ - component: {fileID: 1809679010}
+ m_Layer: 0
+ m_Name: EventSystem Spawner
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &1809679010
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1809679009}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: bd5ff9965d0784cad8e07f5eb9cb9c06, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+--- !u!4 &1809679013
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1809679009}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &1860384066
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1860384067}
+ - component: {fileID: 1860384070}
+ - component: {fileID: 1860384069}
+ - component: {fileID: 1860384068}
+ m_Layer: 5
+ m_Name: Missing App Id Canvas
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 0
+--- !u!224 &1860384067
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1860384066}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 0, y: 0, z: 0}
+ m_Children:
+ - {fileID: 1223575071}
+ - {fileID: 1014753128}
+ m_Father: {fileID: 0}
+ m_RootOrder: 4
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 0, y: 0}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0, y: 0}
+--- !u!114 &1860384068
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1860384066}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreReversedGraphics: 1
+ m_BlockingObjects: 3
+ m_BlockingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+--- !u!114 &1860384069
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1860384066}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_UiScaleMode: 1
+ m_ReferencePixelsPerUnit: 100
+ m_ScaleFactor: 1
+ m_ReferenceResolution: {x: 800, y: 600}
+ m_ScreenMatchMode: 0
+ m_MatchWidthOrHeight: 0
+ m_PhysicalUnit: 3
+ m_FallbackScreenDPI: 96
+ m_DefaultSpriteDPI: 96
+ m_DynamicPixelsPerUnit: 1
+--- !u!223 &1860384070
+Canvas:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1860384066}
+ m_Enabled: 1
+ serializedVersion: 3
+ m_RenderMode: 0
+ m_Camera: {fileID: 0}
+ m_PlaneDistance: 100
+ m_PixelPerfect: 1
+ m_ReceivesEvents: 1
+ m_OverrideSorting: 0
+ m_OverridePixelPerfect: 0
+ m_SortingBucketNormalizedSize: 0
+ m_AdditionalShaderChannelsFlag: 25
+ m_SortingLayerID: 0
+ m_SortingOrder: 1000
+ m_TargetDisplay: 0
+--- !u!1 &1880491502
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 194774, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1880491503}
+ - component: {fileID: 1880491507}
+ - component: {fileID: 1880491506}
+ - component: {fileID: 1880491504}
+ - component: {fileID: 1880491505}
+ m_Layer: 5
+ m_Name: Text
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1880491503
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22494774, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1880491502}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 239533972}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: -10, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &1880491504
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11490564, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1880491502}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1573420865, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
+ m_EffectDistance: {x: 1, y: -1}
+ m_UseGraphicAlpha: 1
+--- !u!114 &1880491505
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1880491502}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 060fe8295761a47268586d33ef5673e0, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ Selectable: {fileID: 0}
+ NormalColor: {r: 1, g: 1, b: 1, a: 1}
+ HoverColor: {r: 0, g: 0, b: 0, a: 1}
+--- !u!114 &1880491506
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11494770, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1880491502}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 5abfb0a229c98b3499cffa6c59c2ffb4, type: 3}
+ m_FontSize: 24
+ m_FontStyle: 0
+ m_BestFit: 1
+ m_MinSize: 10
+ m_MaxSize: 24
+ m_Alignment: 4
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: Connect
+--- !u!222 &1880491507
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22294774, guid: 4f826638dd73749d88747935ea56c522,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1880491502}
+ m_CullTransparentMesh: 0
+--- !u!1 &1937233792
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1937233793}
+ - component: {fileID: 1937233796}
+ - component: {fileID: 1937233795}
+ - component: {fileID: 1937233794}
+ m_Layer: 5
+ m_Name: Title
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1937233793
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1937233792}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 814846236}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 1}
+ m_AnchorMax: {x: 0, y: 1}
+ m_AnchoredPosition: {x: 0, y: 30}
+ m_SizeDelta: {x: 230, y: 30}
+ m_Pivot: {x: 0, y: 1}
+--- !u!114 &1937233794
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1937233792}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 1
+ m_MinWidth: -1
+ m_MinHeight: -1
+ m_PreferredWidth: -1
+ m_PreferredHeight: 0
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!114 &1937233795
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1937233792}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0.8784314, g: 0.48235294, b: 0, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 5abfb0a229c98b3499cffa6c59c2ffb4, type: 3}
+ m_FontSize: 22
+ m_FontStyle: 0
+ m_BestFit: 1
+ m_MinSize: 10
+ m_MaxSize: 22
+ m_Alignment: 0
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 1
+ m_VerticalOverflow: 1
+ m_LineSpacing: 1
+ m_Text: Chat
+--- !u!222 &1937233796
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1937233792}
+ m_CullTransparentMesh: 0
+--- !u!1 &1954920730
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 187088, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1954920731}
+ - component: {fileID: 1954920733}
+ - component: {fileID: 1954920732}
+ m_Layer: 5
+ m_Name: Text
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1954920731
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22487088, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1954920730}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 1989416849}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: -20, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &1954920732
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11487086, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1954920730}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 5abfb0a229c98b3499cffa6c59c2ffb4, type: 3}
+ m_FontSize: 22
+ m_FontStyle: 0
+ m_BestFit: 1
+ m_MinSize: 10
+ m_MaxSize: 22
+ m_Alignment: 3
+ m_AlignByGeometry: 0
+ m_RichText: 0
+ m_HorizontalOverflow: 1
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text:
+--- !u!222 &1954920733
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22287088, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1954920730}
+ m_CullTransparentMesh: 0
+--- !u!1 &1989416848
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 187092, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1989416849}
+ - component: {fileID: 1989416852}
+ - component: {fileID: 1989416851}
+ - component: {fileID: 1989416850}
+ m_Layer: 5
+ m_Name: InputField Regular
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1989416849
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22487092, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1989416848}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 578492558}
+ - {fileID: 193452639}
+ - {fileID: 64425122}
+ - {fileID: 1954920731}
+ m_Father: {fileID: 1569829900}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: -35, y: 0}
+ m_SizeDelta: {x: -150, y: -10}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &1989416850
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11487092, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1989416848}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 575553740, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Navigation:
+ m_Mode: 0
+ m_SelectOnUp: {fileID: 0}
+ m_SelectOnDown: {fileID: 0}
+ m_SelectOnLeft: {fileID: 0}
+ m_SelectOnRight: {fileID: 0}
+ m_Transition: 1
+ m_Colors:
+ m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
+ m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
+ m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
+ m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
+ m_ColorMultiplier: 1
+ m_FadeDuration: 0.1
+ m_SpriteState:
+ m_HighlightedSprite: {fileID: 0}
+ m_PressedSprite: {fileID: 0}
+ m_DisabledSprite: {fileID: 0}
+ m_AnimationTriggers:
+ m_NormalTrigger: Normal
+ m_HighlightedTrigger: Highlighted
+ m_PressedTrigger: Pressed
+ m_DisabledTrigger: Disabled
+ m_Interactable: 1
+ m_TargetGraphic: {fileID: 1989416851}
+ m_TextComponent: {fileID: 1954920732}
+ m_Placeholder: {fileID: 193452640}
+ m_ContentType: 0
+ m_InputType: 0
+ m_AsteriskChar: 42
+ m_KeyboardType: 0
+ m_LineType: 0
+ m_HideMobileInput: 0
+ m_CharacterValidation: 0
+ m_CharacterLimit: 0
+ m_OnEndEdit:
+ m_PersistentCalls:
+ m_Calls:
+ - m_Target: {fileID: 192561278}
+ m_MethodName: OnEnterSend
+ m_Mode: 1
+ m_Arguments:
+ m_ObjectArgument: {fileID: 0}
+ m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
+ m_IntArgument: 0
+ m_FloatArgument: 0
+ m_StringArgument:
+ m_BoolArgument: 0
+ m_CallState: 2
+ m_OnValueChanged:
+ m_PersistentCalls:
+ m_Calls:
+ - m_Target: {fileID: 0}
+ m_MethodName: set_PlayerName
+ m_Mode: 0
+ m_Arguments:
+ m_ObjectArgument: {fileID: 0}
+ m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
+ m_IntArgument: 0
+ m_FloatArgument: 0
+ m_StringArgument:
+ m_BoolArgument: 0
+ m_CallState: 2
+ m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
+ m_CustomCaretColor: 0
+ m_SelectionColor: {r: 0.8784314, g: 0.48235294, b: 0, a: 1}
+ m_Text:
+ m_CaretBlinkRate: 1.7
+ m_CaretWidth: 1
+ m_ReadOnly: 0
+--- !u!114 &1989416851
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 11487090, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1989416848}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0.31764707, g: 0.3372549, b: 0.38431373, a: 0.24313726}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 0}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &1989416852
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 22287092, guid: 3028bc57b884945d5aef896428ae1521,
+ type: 2}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1989416848}
+ m_CullTransparentMesh: 0
+--- !u!1 &2017670315
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 2017670316}
+ - component: {fileID: 2017670319}
+ - component: {fileID: 2017670318}
+ - component: {fileID: 2017670317}
+ - component: {fileID: 2017670320}
+ m_Layer: 5
+ m_Name: Scroll Panel
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &2017670316
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2017670315}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 1641022482}
+ m_Father: {fileID: 814846236}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: -10, y: -10}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &2017670317
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2017670315}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1367256648, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Content: {fileID: 1641022482}
+ m_Horizontal: 0
+ m_Vertical: 1
+ m_MovementType: 1
+ m_Elasticity: 0.1
+ m_Inertia: 1
+ m_DecelerationRate: 0.135
+ m_ScrollSensitivity: 1
+ m_Viewport: {fileID: 0}
+ m_HorizontalScrollbar: {fileID: 0}
+ m_VerticalScrollbar: {fileID: 0}
+ m_HorizontalScrollbarVisibility: 0
+ m_VerticalScrollbarVisibility: 0
+ m_HorizontalScrollbarSpacing: 0
+ m_VerticalScrollbarSpacing: 0
+ m_OnValueChanged:
+ m_PersistentCalls:
+ m_Calls: []
+--- !u!114 &2017670318
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2017670315}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 0.392}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &2017670319
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2017670315}
+ m_CullTransparentMesh: 0
+--- !u!114 &2017670320
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2017670315}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: -1200242548, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_ShowMaskGraphic: 0
+--- !u!1 &2126670840
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 2126670841}
+ - component: {fileID: 2126670843}
+ - component: {fileID: 2126670842}
+ m_Layer: 5
+ m_Name: Status Text
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 0
+--- !u!224 &2126670841
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2126670840}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 770857990}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 1, y: 1}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: -5, y: 0}
+ m_SizeDelta: {x: 250, y: 35}
+ m_Pivot: {x: 1, y: 1}
+--- !u!114 &2126670842
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2126670840}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 4345225956e176043b2f73b9ee1b0f2b, type: 3}
+ m_FontSize: 24
+ m_FontStyle: 0
+ m_BestFit: 0
+ m_MinSize: 10
+ m_MaxSize: 40
+ m_Alignment: 5
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 0
+ m_VerticalOverflow: 0
+ m_LineSpacing: 1
+ m_Text: Status Text
+--- !u!222 &2126670843
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2126670840}
+ m_CullTransparentMesh: 0
+--- !u!1 &2129492526
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 2129492527}
+ - component: {fileID: 2129492530}
+ - component: {fileID: 2129492529}
+ - component: {fileID: 2129492528}
+ m_Layer: 5
+ m_Name: Title
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &2129492527
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2129492526}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 1427448790}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 1}
+ m_AnchorMax: {x: 0, y: 1}
+ m_AnchoredPosition: {x: 0, y: 30}
+ m_SizeDelta: {x: 230, y: 30}
+ m_Pivot: {x: 0, y: 1}
+--- !u!114 &2129492528
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2129492526}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreLayout: 1
+ m_MinWidth: -1
+ m_MinHeight: -1
+ m_PreferredWidth: -1
+ m_PreferredHeight: 0
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!114 &2129492529
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2129492526}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0.8784314, g: 0.48235294, b: 0, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_FontData:
+ m_Font: {fileID: 12800000, guid: 5abfb0a229c98b3499cffa6c59c2ffb4, type: 3}
+ m_FontSize: 22
+ m_FontStyle: 0
+ m_BestFit: 1
+ m_MinSize: 10
+ m_MaxSize: 22
+ m_Alignment: 0
+ m_AlignByGeometry: 0
+ m_RichText: 1
+ m_HorizontalOverflow: 1
+ m_VerticalOverflow: 1
+ m_LineSpacing: 1
+ m_Text: 'Channels
+
+'
+--- !u!222 &2129492530
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2129492526}
+ m_CullTransparentMesh: 0
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/DemoChat-Scene.unity.meta b/Assets/Photon/PhotonChat/Demos/DemoChat/DemoChat-Scene.unity.meta
new file mode 100644
index 00000000..071ca86f
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/DemoChat-Scene.unity.meta
@@ -0,0 +1,6 @@
+fileFormatVersion: 2
+guid: ec07267f6a28fb044ac89845274e79af
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/Editor.meta b/Assets/Photon/PhotonChat/Demos/DemoChat/Editor.meta
new file mode 100644
index 00000000..2a662134
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/Editor.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c33037d6755b1134db073d59feb6f7d9
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/Editor/ChatEditor.cs b/Assets/Photon/PhotonChat/Demos/DemoChat/Editor/ChatEditor.cs
new file mode 100644
index 00000000..b69eb34e
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/Editor/ChatEditor.cs
@@ -0,0 +1,279 @@
+#if !PHOTON_UNITY_NETWORKING
+using System;
+using Photon.Chat;
+using Photon.Chat.Demo;
+using Photon.Realtime;
+using UnityEditor;
+using UnityEngine;
+
+[InitializeOnLoad]
+public class ChatEditor : EditorWindow
+{
+ static ChatEditor()
+ {
+ EditorApplication.update += OnEditorUpdate;
+ }
+
+ private static void OnEditorUpdate()
+ {
+ EditorApplication.update -= OnEditorUpdate;
+
+ //ChatSettings settings = ChatSettings.Load();
+ //if (settings != null && !settings.WizardDone && string.IsNullOrEmpty(settings.AppId))
+ //{
+ // OpenWizard();
+ //}
+ }
+
+
+ [MenuItem("Window/Photon Chat/Setup")]
+ public static void OpenWizard()
+ {
+ //currentSettings = ChatSettings.Load();
+ //currentSettings.WizardDone = true;
+ //EditorUtility.SetDirty(currentSettings);
+
+ ChatEditor editor = (ChatEditor)EditorWindow.GetWindow(typeof (ChatEditor), false, "Photon Chat");
+ editor.minSize = editor.preferredSize;
+ }
+
+
+ private ChatGui cGui;
+ internal string mailOrAppId;
+ internal bool showDashboardLink = false;
+ internal bool showRegistrationDone = false;
+ internal bool showRegistrationError = false;
+ private readonly Vector2 preferredSize = new Vector2(350, 400);
+
+ internal static string UrlCloudDashboard = "https://dashboard.photonengine.com/en-US/";
+
+ public string WelcomeText = "Thanks for importing Photon Chat.\nThis window should set you up.\n\nYou will need a free Photon Account to setup a Photon Chat application.\nOpen the Photon Dashboard (webpage) to access your account (see button below).\n\nCopy and paste a Chat AppId into the field and click \"Setup\".";
+ //public string AlreadyRegisteredInfo = "The email is registered so we can't fetch your AppId (without password).\n\nPlease login online to get your AppId and paste it above.";
+ //public string RegisteredNewAccountInfo = "We created a (free) account and fetched you an AppId.\nWelcome. Your Photon Chat project is setup.";
+ //public string FailedToRegisterAccount = "This wizard failed to register an account right now. Please check your mail address or try via the Dashboard.";
+ //public string AppliedToSettingsInfo = "Your AppId is now applied to this project.";
+ public string SetupCompleteInfo = "Done! \nYour Chat AppId is now stored in the Scripts object, Chat App Settings.";
+ public string CloseWindowButton = "Close";
+ public string OpenCloudDashboardText = "Photon Dashboard Login";
+ public string OpenCloudDashboardTooltip = "Review Cloud App information and statistics.";
+
+
+ public void OnGUI()
+ {
+ if (this.cGui == null)
+ {
+ cGui = FindObjectOfType();
+ }
+
+ GUI.skin.label.wordWrap = true;
+ GUI.skin.label.richText = true;
+ if (string.IsNullOrEmpty(mailOrAppId))
+ {
+ mailOrAppId = string.Empty;
+ }
+
+ GUILayout.Label("Chat Settings", EditorStyles.boldLabel);
+ GUILayout.Label(this.WelcomeText);
+ GUILayout.Space(15);
+
+
+ GUILayout.Label("Chat AppId");
+ string input = EditorGUILayout.TextField(this.mailOrAppId);
+
+
+ if (GUI.changed)
+ {
+ this.mailOrAppId = input.Trim();
+ }
+
+ //bool isMail = false;
+ bool minimumInput = false;
+ bool isAppId = false;
+
+ if (IsValidEmail(this.mailOrAppId))
+ {
+ // this should be a mail address
+ minimumInput = true;
+ //isMail = true;
+ }
+ else if (IsAppId(this.mailOrAppId))
+ {
+ // this should be an appId
+ minimumInput = true;
+ isAppId = true;
+ }
+
+
+ EditorGUI.BeginDisabledGroup(!minimumInput);
+
+
+ GUILayout.BeginHorizontal();
+ GUILayout.FlexibleSpace();
+ bool setupBtn = GUILayout.Button("Setup", GUILayout.Width(205));
+ GUILayout.FlexibleSpace();
+ GUILayout.EndHorizontal();
+
+
+ if (setupBtn)
+ {
+ this.showDashboardLink = false;
+ this.showRegistrationDone = false;
+ this.showRegistrationError = false;
+
+ //if (isMail)
+ //{
+ // EditorUtility.DisplayProgressBar("Fetching Account", "Trying to register a Photon Cloud Account.", 0.5f);
+ // AccountService service = new AccountService();
+ // //service.RegisterByEmail(this.mailOrAppId, AccountService.Origin.Pun);
+ // //EditorUtility.ClearProgressBar();
+
+ // //if (service.ReturnCode == 0)
+ // //{
+ // // currentSettings.AppId = service.AppId;
+ // // EditorUtility.SetDirty(currentSettings);
+ // // this.showRegistrationDone = true;
+
+ // // Selection.objects = new UnityEngine.Object[] { currentSettings };
+ // //}
+ // //else
+ // //{
+ // // if (service.Message.Contains("registered"))
+ // // {
+ // // this.showDashboardLink = true;
+ // // }
+ // // else
+ // // {
+ // // this.showRegistrationError = true;
+ // // }
+ // //}
+ //}
+ //else
+ if (isAppId)
+ {
+ //currentSettings.AppId = this.mailOrAppId;
+ //EditorUtility.SetDirty(currentSettings);
+ if (this.cGui != null)
+ {
+ this.cGui.ChatAppSettings.AppIdChat = this.mailOrAppId;
+ EditorUtility.SetDirty(this.cGui);
+ }
+
+ showRegistrationDone = true;
+ }
+
+ //EditorGUIUtility.PingObject(currentSettings);
+ }
+ EditorGUI.EndDisabledGroup();
+
+
+ GUILayout.BeginHorizontal();
+ GUILayout.FlexibleSpace();
+ if (GUILayout.Button(new GUIContent(OpenCloudDashboardText, OpenCloudDashboardTooltip), GUILayout.Width(205)))
+ {
+ EditorUtility.OpenWithDefaultApp(UrlCloudDashboard);
+ }
+ GUILayout.FlexibleSpace();
+ GUILayout.EndHorizontal();
+
+ //if (this.showDashboardLink)
+ //{
+ // // button to open dashboard and get the AppId
+ // GUILayout.Space(15);
+ // GUILayout.Label(AlreadyRegisteredInfo);
+
+
+ // GUILayout.BeginHorizontal();
+ // GUILayout.FlexibleSpace();
+ // if (GUILayout.Button(new GUIContent(OpenCloudDashboardText, OpenCloudDashboardTooltip), GUILayout.Width(205)))
+ // {
+ // EditorUtility.OpenWithDefaultApp(UrlCloudDashboard + Uri.EscapeUriString(this.mailOrAppId));
+ // this.mailOrAppId = string.Empty;
+ // this.showDashboardLink = false;
+ // }
+ // GUILayout.FlexibleSpace();
+ // GUILayout.EndHorizontal();
+ //}
+ //if (this.showRegistrationError)
+ //{
+ // GUILayout.Space(15);
+ // GUILayout.Label(FailedToRegisterAccount);
+
+ // GUILayout.BeginHorizontal();
+ // GUILayout.FlexibleSpace();
+ // if (GUILayout.Button(new GUIContent(OpenCloudDashboardText, OpenCloudDashboardTooltip), GUILayout.Width(205)))
+ // {
+ // EditorUtility.OpenWithDefaultApp(UrlCloudDashboard + Uri.EscapeUriString(this.mailOrAppId));
+ // this.mailOrAppId = string.Empty;
+ // this.showDashboardLink = false;
+ // }
+ // GUILayout.FlexibleSpace();
+ // GUILayout.EndHorizontal();
+
+ //}
+ if (this.showRegistrationDone)
+ {
+ GUILayout.Space(15);
+ //GUILayout.Label("Registration done");
+ ////if (isMail)
+ ////{
+ //// GUILayout.Label(RegisteredNewAccountInfo);
+ ////}
+ ////else
+ ////{
+ // GUILayout.Label(AppliedToSettingsInfo);
+ ////}
+
+ // setup-complete info
+ GUILayout.Space(15);
+ GUILayout.Label(SetupCompleteInfo);
+
+
+ // close window (done)
+ GUILayout.BeginHorizontal();
+ GUILayout.FlexibleSpace();
+ if (GUILayout.Button(CloseWindowButton, GUILayout.Width(205)))
+ {
+ this.Close();
+ }
+ GUILayout.FlexibleSpace();
+ GUILayout.EndHorizontal();
+ }
+ }
+
+ public static bool IsAppId(string val)
+ {
+ if (string.IsNullOrEmpty(val) || val.Length < 16)
+ {
+ return false;
+ }
+
+ try
+ {
+ new Guid(val);
+ }
+ catch
+ {
+ return false;
+ }
+ return true;
+ }
+
+ // https://stackoverflow.com/a/1374644/1449056
+ private static bool IsValidEmail(string email)
+ {
+ if (string.IsNullOrEmpty(email) || !email.Contains("@"))
+ {
+ return false;
+ }
+ try
+ {
+ System.Net.Mail.MailAddress addr = new System.Net.Mail.MailAddress(email);
+ return email.Equals(addr.Address);
+ }
+ catch
+ {
+ return false;
+ }
+ }
+}
+#endif
\ No newline at end of file
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/Editor/ChatEditor.cs.meta b/Assets/Photon/PhotonChat/Demos/DemoChat/Editor/ChatEditor.cs.meta
new file mode 100644
index 00000000..b66c34ef
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/Editor/ChatEditor.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 0ef7cc863c103cf44930b0411a10ad1f
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/Files.meta b/Assets/Photon/PhotonChat/Demos/DemoChat/Files.meta
new file mode 100644
index 00000000..89c539d8
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/Files.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c73bd05f7e3a006418e6398b47511e49
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/Files/Gradient.png b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/Gradient.png
new file mode 100644
index 00000000..67e1ce23
Binary files /dev/null and b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/Gradient.png differ
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/Files/Gradient.png.meta b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/Gradient.png.meta
new file mode 100644
index 00000000..f40fcd23
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/Gradient.png.meta
@@ -0,0 +1,88 @@
+fileFormatVersion: 2
+guid: 2fb83ea89df639b43a22d707d3c22af1
+TextureImporter:
+ fileIDToRecycleName: {}
+ externalObjects: {}
+ serializedVersion: 9
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: -2
+ maxTextureSize: 256
+ textureSettings:
+ serializedVersion: 2
+ filterMode: 0
+ aniso: 16
+ mipBias: -100
+ wrapU: 1
+ wrapV: 1
+ wrapW: 1
+ nPOTScale: 0
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 1
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 1
+ spriteTessellationDetail: -1
+ textureType: 8
+ textureShape: 1
+ singleChannelComponent: 0
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ platformSettings:
+ - serializedVersion: 2
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 256
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID: 9f2a0d94850205c449718d6a65b6da2c
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/Files/Jura-Medium.ttf b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/Jura-Medium.ttf
new file mode 100644
index 00000000..acaa33e0
Binary files /dev/null and b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/Jura-Medium.ttf differ
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/Files/Jura-Medium.ttf.meta b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/Jura-Medium.ttf.meta
new file mode 100644
index 00000000..d22efdb4
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/Jura-Medium.ttf.meta
@@ -0,0 +1,24 @@
+fileFormatVersion: 2
+guid: 5abfb0a229c98b3499cffa6c59c2ffb4
+TrueTypeFontImporter:
+ externalObjects: {}
+ serializedVersion: 4
+ fontSize: 16
+ forceTextureCase: -2
+ characterSpacing: 0
+ characterPadding: 1
+ includeFontData: 1
+ fontName: Jura
+ fontNames:
+ - Jura
+ fallbackFontReferences:
+ - {fileID: 12800000, guid: e00995507c2406448b4c8429136104dd, type: 3}
+ - {fileID: 12800000, guid: 4a4df204c321f9c40b0dbfb1baaffb4c, type: 3}
+ customCharacters:
+ fontRenderingMode: 0
+ ascentCalculationMode: 1
+ useLegacyBoundsCalculation: 0
+ shouldRoundAdvanceValue: 1
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/Files/OutlinedSquaredBox.png b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/OutlinedSquaredBox.png
new file mode 100644
index 00000000..dcfa148f
Binary files /dev/null and b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/OutlinedSquaredBox.png differ
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/Files/OutlinedSquaredBox.png.meta b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/OutlinedSquaredBox.png.meta
new file mode 100644
index 00000000..3b2c35ac
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/OutlinedSquaredBox.png.meta
@@ -0,0 +1,88 @@
+fileFormatVersion: 2
+guid: ea7134547a5488b41a6bb5243b4ec2f1
+TextureImporter:
+ fileIDToRecycleName: {}
+ externalObjects: {}
+ serializedVersion: 9
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 0
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: -3
+ maxTextureSize: 1024
+ textureSettings:
+ serializedVersion: 2
+ filterMode: 0
+ aniso: 16
+ mipBias: -100
+ wrapU: 1
+ wrapV: 1
+ wrapW: 1
+ nPOTScale: 0
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 1
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 1, y: 1, z: 1, w: 1}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 1
+ spriteTessellationDetail: -1
+ textureType: 8
+ textureShape: 1
+ singleChannelComponent: 0
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ platformSettings:
+ - serializedVersion: 2
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 1024
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID: 0ca28098c6f2a0a4ba4f7e88ae619ca9
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/Files/PunIcon-White-129.png b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/PunIcon-White-129.png
new file mode 100644
index 00000000..885c22f7
Binary files /dev/null and b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/PunIcon-White-129.png differ
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/Files/PunIcon-White-129.png.meta b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/PunIcon-White-129.png.meta
new file mode 100644
index 00000000..19e7ee7e
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/PunIcon-White-129.png.meta
@@ -0,0 +1,88 @@
+fileFormatVersion: 2
+guid: 37b0a18b391c6ae468b5bcc74bba2c1a
+TextureImporter:
+ fileIDToRecycleName: {}
+ externalObjects: {}
+ serializedVersion: 9
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 0
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: -2
+ maxTextureSize: 128
+ textureSettings:
+ serializedVersion: 2
+ filterMode: -1
+ aniso: 1
+ mipBias: -100
+ wrapU: 1
+ wrapV: 1
+ wrapW: 1
+ nPOTScale: 0
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 1
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 1
+ spriteTessellationDetail: -1
+ textureType: 8
+ textureShape: 1
+ singleChannelComponent: 0
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ platformSettings:
+ - serializedVersion: 2
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 128
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 1
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID: 10108fb3311b5d345a644c65ddc43a0d
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/Files/eurof35.ttf b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/eurof35.ttf
new file mode 100644
index 00000000..ad174c33
Binary files /dev/null and b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/eurof35.ttf differ
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/Files/eurof35.ttf.meta b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/eurof35.ttf.meta
new file mode 100644
index 00000000..c63831be
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/eurof35.ttf.meta
@@ -0,0 +1,23 @@
+fileFormatVersion: 2
+guid: 4345225956e176043b2f73b9ee1b0f2b
+TrueTypeFontImporter:
+ externalObjects: {}
+ serializedVersion: 4
+ fontSize: 16
+ forceTextureCase: -2
+ characterSpacing: 0
+ characterPadding: 1
+ includeFontData: 1
+ fontName: eurofurence light
+ fontNames:
+ - eurofurence light
+ fallbackFontReferences:
+ - {fileID: 12800000, guid: 954746d370bc8934299c8c8267543f4f, type: 3}
+ customCharacters:
+ fontRenderingMode: 0
+ ascentCalculationMode: 1
+ useLegacyBoundsCalculation: 0
+ shouldRoundAdvanceValue: 1
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/Files/eurof_tt.txt b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/eurof_tt.txt
new file mode 100644
index 00000000..b62725a2
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/eurof_tt.txt
@@ -0,0 +1,21 @@
+------------------------------------------------------------------------
+The eurofurence typeface family by tobias b koehler (unci@tigerden.com)
+------------------------------------------------------------------------
+
+This is a family of geometric rounded sans serif fonts consisting of
+three weights (light, medium, bold) in upright and italic styles,
+originally designed for EuroFurence, the first European furry convention
+1995 in Kaiser-Wilhelm-Koog.
+
+The character set includes Roman, Greek and Cyrillic characters.
+File format is TrueType for PC (under Windows, Linux etc).
+
+These fonts are freeware and can be distributed as long as they are
+together with this text file. I would appreciate it though if you could
+contact me at unci@tigerden.com if you put them on a server. Free
+samples from commercial users are always very welcome. :)
+
+For more information, please see the uncifonts WWW page at:
+http://mercurio.iet.unipi.it/users/tobias/uncifonts.html
+
+Have fun! tobias b koehler, 2000-04-02
\ No newline at end of file
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/Files/eurof_tt.txt.meta b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/eurof_tt.txt.meta
new file mode 100644
index 00000000..6d6d0015
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/Files/eurof_tt.txt.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: e96690bd3586cf643a223def4feaa4d4
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/FriendItem.cs b/Assets/Photon/PhotonChat/Demos/DemoChat/FriendItem.cs
new file mode 100644
index 00000000..1027894e
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/FriendItem.cs
@@ -0,0 +1,84 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// Demo code for Photon Chat in Unity.
+// developer@exitgames.com
+// --------------------------------------------------------------------------------------------------------------------
+
+
+using UnityEngine;
+using UnityEngine.UI;
+
+
+namespace Photon.Chat.Demo
+{
+ ///
+ /// Friend UI item used to represent the friend status as well as message.
+ /// It aims at showing how to share health for a friend that plays on a different room than you for example.
+ /// But of course the message can be anything and a lot more complex.
+ ///
+ public class FriendItem : MonoBehaviour
+ {
+ [HideInInspector]
+ public string FriendId
+ {
+ set { this.NameLabel.text = value; }
+ get { return this.NameLabel.text; }
+ }
+
+ public Text NameLabel;
+ public Text StatusLabel;
+ public Text Health;
+
+ public void Awake()
+ {
+ this.Health.text = string.Empty;
+ }
+
+ public void OnFriendStatusUpdate(int status, bool gotMessage, object message)
+ {
+ string _status;
+
+ switch (status)
+ {
+ case 1:
+ _status = "Invisible";
+ break;
+ case 2:
+ _status = "Online";
+ break;
+ case 3:
+ _status = "Away";
+ break;
+ case 4:
+ _status = "Do not disturb";
+ break;
+ case 5:
+ _status = "Looking For Game/Group";
+ break;
+ case 6:
+ _status = "Playing";
+ break;
+ default:
+ _status = "Offline";
+ break;
+ }
+
+ this.StatusLabel.text = _status;
+
+ if (gotMessage)
+ {
+ string _health = string.Empty;
+ if (message != null)
+ {
+ string[] _messages = message as string[];
+ if (_messages != null && _messages.Length >= 2)
+ {
+ _health = (string)_messages[1] + "%";
+ }
+ }
+
+ this.Health.text = _health;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/FriendItem.cs.meta b/Assets/Photon/PhotonChat/Demos/DemoChat/FriendItem.cs.meta
new file mode 100644
index 00000000..753c04d8
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/FriendItem.cs.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 660b16ba396d0465b98be14947420288
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/IgnoreUiRaycastWhenInactive.cs b/Assets/Photon/PhotonChat/Demos/DemoChat/IgnoreUiRaycastWhenInactive.cs
new file mode 100644
index 00000000..921f0ffa
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/IgnoreUiRaycastWhenInactive.cs
@@ -0,0 +1,20 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// Demo code for Photon Chat in Unity.
+// developer@exitgames.com
+// --------------------------------------------------------------------------------------------------------------------
+
+
+using UnityEngine;
+
+
+namespace Photon.Chat.Demo
+{
+ public class IgnoreUiRaycastWhenInactive : MonoBehaviour, ICanvasRaycastFilter
+ {
+ public bool IsRaycastLocationValid(Vector2 screenPoint, Camera eventCamera)
+ {
+ return this.gameObject.activeInHierarchy;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/IgnoreUiRaycastWhenInactive.cs.meta b/Assets/Photon/PhotonChat/Demos/DemoChat/IgnoreUiRaycastWhenInactive.cs.meta
new file mode 100644
index 00000000..75adf539
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/IgnoreUiRaycastWhenInactive.cs.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 4ba4c747f6975ea46bcc0a55ffe3bfe8
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/NamePickGui.cs b/Assets/Photon/PhotonChat/Demos/DemoChat/NamePickGui.cs
new file mode 100644
index 00000000..8e5852cd
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/NamePickGui.cs
@@ -0,0 +1,55 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// Demo code for Photon Chat in Unity.
+// developer@exitgames.com
+// --------------------------------------------------------------------------------------------------------------------
+
+
+using UnityEngine;
+using UnityEngine.UI;
+
+
+namespace Photon.Chat.Demo
+{
+ [RequireComponent(typeof(ChatGui))]
+ public class NamePickGui : MonoBehaviour
+ {
+ private const string UserNamePlayerPref = "NamePickUserName";
+
+ public ChatGui chatNewComponent;
+
+ public InputField idInput;
+
+ public void Start()
+ {
+ this.chatNewComponent = FindObjectOfType();
+
+
+ string prefsName = PlayerPrefs.GetString(UserNamePlayerPref);
+ if (!string.IsNullOrEmpty(prefsName))
+ {
+ this.idInput.text = prefsName;
+ }
+ }
+
+
+ // new UI will fire "EndEdit" event also when loosing focus. So check "enter" key and only then StartChat.
+ public void EndEditOnEnter()
+ {
+ if (Input.GetKey(KeyCode.Return) || Input.GetKey(KeyCode.KeypadEnter))
+ {
+ this.StartChat();
+ }
+ }
+
+ public void StartChat()
+ {
+ ChatGui chatNewComponent = FindObjectOfType();
+ chatNewComponent.UserName = this.idInput.text.Trim();
+ chatNewComponent.Connect();
+ this.enabled = false;
+
+ PlayerPrefs.SetString(UserNamePlayerPref, chatNewComponent.UserName);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonChat/Demos/DemoChat/NamePickGui.cs.meta b/Assets/Photon/PhotonChat/Demos/DemoChat/NamePickGui.cs.meta
new file mode 100644
index 00000000..c0d3682d
--- /dev/null
+++ b/Assets/Photon/PhotonChat/Demos/DemoChat/NamePickGui.cs.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 696a5174ff5e707479b3540eb56d14b7
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonLibs.meta b/Assets/Photon/PhotonLibs.meta
new file mode 100644
index 00000000..05f4c176
--- /dev/null
+++ b/Assets/Photon/PhotonLibs.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: ee1734b1a7bac244bb5f15ecd778b5f2
+folderAsset: yes
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonLibs/Metro.meta b/Assets/Photon/PhotonLibs/Metro.meta
new file mode 100644
index 00000000..42ef35f6
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/Metro.meta
@@ -0,0 +1,5 @@
+fileFormatVersion: 2
+guid: 887ac71c799552346b6cf7654fb699cb
+folderAsset: yes
+DefaultImporter:
+ userData:
diff --git a/Assets/Photon/PhotonLibs/Metro/Photon3Unity3D.dll b/Assets/Photon/PhotonLibs/Metro/Photon3Unity3D.dll
new file mode 100644
index 00000000..ed7cb989
Binary files /dev/null and b/Assets/Photon/PhotonLibs/Metro/Photon3Unity3D.dll differ
diff --git a/Assets/Photon/PhotonLibs/Metro/Photon3Unity3D.dll.meta b/Assets/Photon/PhotonLibs/Metro/Photon3Unity3D.dll.meta
new file mode 100644
index 00000000..29b2a9ba
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/Metro/Photon3Unity3D.dll.meta
@@ -0,0 +1,47 @@
+fileFormatVersion: 2
+guid: 3b5a0a7dce46a13459199d174ad3db3f
+PluginImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ iconMap: {}
+ executionOrder: {}
+ defineConstraints: []
+ isPreloaded: 0
+ isOverridable: 0
+ isExplicitlyReferenced: 0
+ validateReferences: 1
+ platformData:
+ - first:
+ '': Any
+ second:
+ enabled: 1
+ settings: {}
+ - first:
+ '': WP8
+ second:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ DontProcess: False
+ PlaceholderPath: Assets/Photon/PhotonLibs/Photon3Unity3D.dll
+ SDK: AnySDK
+ ScriptingBackend: DotNet
+ - first:
+ Editor: Editor
+ second:
+ enabled: 0
+ settings:
+ DefaultValueInitialized: true
+ - first:
+ Windows Store Apps: WindowsStoreApps
+ second:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ DontProcess: false
+ PlaceholderPath: Assets/Photon/PhotonLibs/Photon3Unity3D.dll
+ SDK: AnySDK
+ ScriptingBackend: DotNet
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonLibs/Metro/Photon3Unity3D.pri b/Assets/Photon/PhotonLibs/Metro/Photon3Unity3D.pri
new file mode 100644
index 00000000..889f87b8
Binary files /dev/null and b/Assets/Photon/PhotonLibs/Metro/Photon3Unity3D.pri differ
diff --git a/Assets/Photon/PhotonLibs/Metro/Photon3Unity3D.pri.meta b/Assets/Photon/PhotonLibs/Metro/Photon3Unity3D.pri.meta
new file mode 100644
index 00000000..eb420eff
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/Metro/Photon3Unity3D.pri.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 3439a9e4030efca45b6cc06240106c02
+timeCreated: 1460035811
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonLibs/Photon3Unity3D.dll b/Assets/Photon/PhotonLibs/Photon3Unity3D.dll
new file mode 100644
index 00000000..8e047228
Binary files /dev/null and b/Assets/Photon/PhotonLibs/Photon3Unity3D.dll differ
diff --git a/Assets/Photon/PhotonLibs/Photon3Unity3D.dll.meta b/Assets/Photon/PhotonLibs/Photon3Unity3D.dll.meta
new file mode 100644
index 00000000..a7208555
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/Photon3Unity3D.dll.meta
@@ -0,0 +1,38 @@
+fileFormatVersion: 2
+guid: aadb37a20a33632429047acaef43658a
+labels:
+- ExitGames
+- PUN
+- Photon
+- Networking
+PluginImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ iconMap: {}
+ executionOrder: {}
+ defineConstraints: []
+ isPreloaded: 0
+ isOverridable: 0
+ isExplicitlyReferenced: 0
+ validateReferences: 1
+ platformData:
+ - first:
+ '': Any
+ second:
+ enabled: 1
+ settings: {}
+ - first:
+ Editor: Editor
+ second:
+ enabled: 0
+ settings:
+ DefaultValueInitialized: true
+ - first:
+ Windows Store Apps: WindowsStoreApps
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonLibs/Photon3Unity3D.xml b/Assets/Photon/PhotonLibs/Photon3Unity3D.xml
new file mode 100644
index 00000000..f85d60c5
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/Photon3Unity3D.xml
@@ -0,0 +1,2767 @@
+
+
+
+ Photon3Unity3D
+
+
+
+
+ Initializes a new instance of the class.
+
+
+
+
+ Gets the public key that can be used by another DiffieHellmanCryptoProvider object
+ to generate a shared secret agreement.
+
+
+
+
+ Derives the shared key is generated from the secret agreement between two parties,
+ given a byte array that contains the second party's public key.
+
+
+ The second party's public key.
+
+
+
+ Interface for Photon's DiffieHellman/Payload Encryption.
+
+
+
+ Provides classical Diffie-Hellman Modular Exponentiation Groups defined by the
+ OAKLEY Key Determination Protocol (RFC 2412).
+
+
+
+
+ Gets the genrator (N) used by the the well known groups 1,2 and 5.
+
+
+
+
+ Gets the 768 bit prime for the well known group 1.
+
+
+
+
+ Gets the 1024 bit prime for the well known group 2.
+
+
+
+
+ Gets the 1536 bit prime for the well known group 5.
+
+
+
+ A slice of memory that should be pooled and reused. Wraps a byte-array.
+
+ This is a serializable datatype for the .Net clients. It will serialize and transfer as byte[].
+ If PhotonPeer.UseByteArraySlicePoolForEvents is enabled, byte-arrays in (incoming) events will be deserialized as
+ ByteArraySlice.
+
+ Adjust your OnEvent code accordingly.
+
+
+
+ The buffer for the slice.
+
+
+ The position where the content starts in Buffer.
+
+
+ The length of the data in the Buffer.
+
+
+
+ Internal constructor - these instances will be part of the pooling system.
+
+ The pool to return to.
+ The index to return to (in the related returnPool).
+
+
+
+ Create a new ByteArraySlice. The buffer supplied will be used. Usage is similar to ArraySegment.
+
+ Not part of pooling.
+
+
+
+ Creates a ByteArraySlice, which is not pooled. It has no Buffer.
+
+ Not part of pooling.
+
+
+
+ If this item was fetched from a ByteArraySlicePool, this will return it.
+
+
+ True if this was a pooled item and it successfully was returned.
+ If it does not belong to a pool nothing will happen, and false will be returned.
+
+
+
+ Resets Count and Offset to 0 each.
+
+
+ Tiered pool for ByteArraySlices. Reduces the allocations once enough slices are available.
+
+
+
+ Requests for buffers smaller than 2^minStackIndex will use 2^minStackIndex. This value avoids allocations of smaller rarely used buffers.
+ Set this to a lower value if you will never need sizes larger than byte[2^minStackIndex]
+
+
+
+ Count of allocations this pool did.
+
+
+ Creates a new pool.
+
+
+
+ Get a ByteArraySlice from pool. This overload handles user supplied byte[] and byte count and can be used as a non-boxing alternative to ArraySegment<byte>.
+
+
+ This effectively pools the ByteArraySlice instances but not their data.
+ ByteArraySlice.Release() will return the slice itself to the pool but delete the reference to the buffer supplied here.
+
+
+
+
+ Get byte[] wrapper from pool. This overload accepts a bytecount and will return a wrapper with a byte[] that size or greater.
+
+
+
+ Pops a slice from the stack or creates a new slice for that stack.
+ The stack to use. Lock that stack before calling PopOrCreate for thread safety.
+
+ A slice.
+
+
+
+ Releasing a ByteArraySlice, will put it back into the pool, if it was acquired from one.
+
+ The ByteArraySlice to return to the pool.
+ The stackIndex for this slice.
+ True if this slice was returned to some pool. False if not (null or stackIndex < 0.
+
+
+
+ Clears all pool items with byte array sizes between lower and upper inclusively.
+
+
+ Use this if you sent some unusually large RaiseEvents and believe the buffers of that size
+ will not be needed again, and you would like to free up the buffer memory.
+
+
+
+
+ Replacement for Dictionary<K,V> which does not allocate memory during usage.
+
+ Key type.
+ Value type.
+
+
+
+ This is a substitute for the Hashtable class, missing in: Win8RT and Windows Phone. It uses a Dictionary<object,object> as base.
+
+
+ Please be aware that this class might act differently than the Hashtable equivalent.
+ As far as Photon is concerned, the substitution is sufficiently precise.
+
+
+
+
+ Translates the byte key into the pre-boxed byte before doing the lookup.
+
+
+
+
+
+
+ Creates a shallow copy of the Hashtable.
+
+
+ A shallow copy of a collection copies only the elements of the collection, whether they are
+ reference types or value types, but it does not copy the objects that the references refer
+ to. The references in the new collection point to the same objects that the references in
+ the original collection point to.
+
+ Shallow copy of the Hashtable.
+
+
+
+ Used as container for unknown types the client could not deserialize.
+
+
+
+
+ The type code which was read for this type.
+
+
+
+
+ The size/length value that was read for this type.
+
+ May be larger than Data.Length, if the Size exceeded the remaining message content.
+
+
+
+ Container for the data that arrived.
+
+ If the Size exceeded the remaining message length, only the remaining data is read. This may be null, if the size was somehow less than 1.
+
+
+ Interface for DatagramEncryptor implementations.
+
+
+ Initialize the encryptor.
+
+
+
+ Encryption/decryption algorithm implementation
+
+
+
+
+ Packet authentication algorithm impelmenation
+
+
+
+ Number for reliable unsequenced commands (separate from "standard" reliable sequenced). Used to avoid duplicates.
+
+
+ The highest number of reliable unsequenced commands that arrived (and all commands before).
+
+
+ Any reliable unsequenced number that's been received, which is higher than the current highest in complete sequence (reliableUnsequencedNumbersCompletelyReceived).
+
+
+ To store the highest acknowledged sequence number (and get some impression what the server already received and stored).
+
+
+ Checks and queues incoming reliable unsequenced commands ("send" or "fragment"), if they haven't been received yet.
+ The command to check and queue.
+ True if the command is new and got queued (or could be executed/dispatched).
+
+
+ Quick Resends are suspended if the sent queue is this size or larger.
+
+
+ One list for all channels keeps sent commands (for re-sending).
+
+
+ One pool of ACK byte arrays ( 20 bytes each) for all channels to keep acknowledgements.
+
+
+ Gets enabled by "request" from server (not by client).
+
+
+ Initial PeerId as used in Connect command. If EnableServerTracing is false.
+
+
+ Initial PeerId to enable Photon Tracing, as used in Connect command. See: EnableServerTracing.
+
+
+
+ Checks the incoming queue and Dispatches received data if possible.
+
+ If a Dispatch happened or not, which shows if more Dispatches might be needed.
+
+
+ Gets the target size for fragments.
+
+ Caches the result for a specific MTU value.
+ Fragment length is different, when datagram encryption is used (so this caches two values in fact).
+
+
+
+
+
+ gathers acks until udp-packet is full and sends it!
+
+
+
+ Queue of received commands. ReceiveIncomingCommands will queue commands, except ACKs which Execute immediately.
+
+
+
+ gathers commands from all (out)queues until udp-packet is full and sends it!
+
+
+
+
+ Checks connected state and channel before operation is serialized and enqueued for sending.
+
+ if operation could be enqueued
+
+
+ reliable-udp-level function to send some byte[] to the server via un/reliable command
+ only called when a custom operation should be send
+ the invocation ID for this operation (the payload)
+
+
+ reads incoming udp-packages to create and queue incoming commands*
+
+
+ Queues incoming commands in the correct order as either unreliable, reliable or unsequenced.
+ If queued or not.
+
+
+ removes commands which are acknowledged
+
+
+
+ Enumeration of situations that change the peers internal status.
+ Used in calls to OnStatusChanged to inform your application of various situations that might happen.
+
+
+ Most of these codes are referenced somewhere else in the documentation when they are relevant to methods.
+
+
+
+ the PhotonPeer is connected. See {@link PhotonListener#OnStatusChanged}*
+
+
+ the PhotonPeer just disconnected. See {@link PhotonListener#OnStatusChanged}*
+
+
+ the PhotonPeer encountered an exception and will disconnect, too. See {@link PhotonListener#OnStatusChanged}*
+
+
+ Exception while opening the incoming connection to the server. Followed by Disconnect.
+ The server could be down / not running or the client has no network or a misconfigured DNS. See {@link PhotonListener#OnStatusChanged}*
+
+
+ Used on platforms that throw a security exception on connect. Unity3d does this, e.g., if a webplayer build could not fetch a policy-file from a remote server.
+
+
+ Sending command failed. Either not connected, or the requested channel is bigger than the number of initialized channels.
+
+
+ Exception, if a server cannot be connected. Followed by Disconnect.
+ Most likely, the server is not responding. Ask user to try again later.
+
+
+ Disconnection due to a timeout (client did no longer receive ACKs from server). Followed by Disconnect.
+
+
+ Timeout disconnect by server. The server didn't receive necessary ACKs in time. Followed by Disconnect.
+
+
+ Disconnect by server due to concurrent user limit reached (received a disconnect command).
+
+
+ (1043) Disconnect by server due to server's logic. Followed by Disconnect.
+
+
+ Disconnect by server due to unspecified reason. Followed by Disconnect.
+
+
+ (1048) Value for OnStatusChanged()-call, when the encryption-setup for secure communication finished successfully.
+
+
+ (1049) Value for OnStatusChanged()-call, when the encryption-setup failed for some reason. Check debug logs.
+
+
+
+ Callback interface for the Photon client side. Must be provided to a new PhotonPeer in its constructor.
+
+
+ These methods are used by your PhotonPeer instance to keep your app updated. Read each method's
+ description and check out the samples to see how to use them.
+
+
+
+
+ Provides textual descriptions for various error conditions and noteworthy situations.
+ In cases where the application needs to react, a call to OnStatusChanged is used.
+ OnStatusChanged gives "feedback" to the game, DebugReturn provies human readable messages
+ on the background.
+
+
+ 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. Use PhotonPeer.DebugOut to select how verbose the output is.
+
+ DebugLevel (severity) of the message.
+ Debug text. Print to System.Console or screen.
+
+
+
+ Callback method which gives you (async) responses for called operations.
+
+
+ Similar to method-calling, operations can have a result.
+ Because operation-calls are non-blocking and executed on the server, responses are provided
+ after a roundtrip as call to this method.
+
+ Example: Trying to create a room usually succeeds but can fail if the room's name is already
+ in use (room names are their IDs).
+
+ This method is used as general callback for all operations. Each response corresponds to a certain
+ "type" of operation by its OperationCode.
+
+
+
+ When you join a room, the server will assign a consecutive number to each client: the
+ "actorNr" or "player number". This is sent back in the operation result.
+
+ Fetch your actorNr of a Join response like this:
+ int actorNr = (int)operationResponse[(byte)OperationCode.ActorNr];
+
+ The response to an operation\-call.
+
+
+
+ OnStatusChanged is called to let the game know when asynchronous actions finished or when errors happen.
+
+
+ Not all of the many StatusCode values will apply to your game. Example: If you don't use encryption,
+ the respective status changes are never made.
+
+ The values are all part of the StatusCode enumeration and described value-by-value.
+
+ A code to identify the situation.
+
+
+
+ Called whenever an event from the Photon Server is dispatched.
+
+
+ Events are used for communication between clients and allow the server to update clients anytime.
+ The creation of an event is often triggered by an operation (called by this client or an other).
+
+ Each event carries a Code plus optional content in its Parameters.
+ Your application should identify which content to expect by the event's Code.
+
+ Events can be defined and modified server-side.
+
+ If you use the LoadBalancing api as basis, several events like EvJoin and EvLeave are pre-defined.
+ The LoadBalancing api provides the EventCode and ParameterCode classes for pre-defined events.
+
+ Photon also allows you to come up with custom events on the fly, purely client-side.
+ To do so, use OpRaiseEvent.
+
+ Events are incoming messages and as such buffered in the peer.
+ Calling PhotonPeer.DispatchIncomingCommands will call IPhotonPeerListener.OnEvent, to hand over received events.
+
+ PhotonPeer.ReuseEventInstance is an option to optimize memory usage by reusing one EventData instance.
+
+ The event currently being dispatched.
+
+
+ The protocol for this socket, defined in constructor.
+
+
+ Address, as defined via a Connect() call. Including protocol, port and or path.
+ This is set in the constructor and in Connect() again. Typically the address does not change after the IPhotonSocket is instantiated.
+
+
+ Contains only the server's hostname (stripped protocol, port and or path). Set in IPhotonSocket.Connect().
+
+
+ Contains the IP address of the previously resolved ServerAddress (or empty, if GetIpAddress wasn't used).
+
+
+ Contains only the server's port address (as string). Set in IphotonSocket.Connect().
+
+
+ Where available, this exposes if the server's address was resolved into an IPv6 address or not.
+
+
+
+ Provides the protocol string, of the current PhotonPeer.SerializationProtocolType to be used for WebSocket connections.
+
+
+ Any WebSocket wrapper could access this to get the desired binary protocol for the connection.
+ Some WebSocket implementations use a static value of the same name and need to be updated.
+
+ The value is not cached and each call will create the needed string on the fly.
+
+
+
+
+ Separates the given address into address (host name or IP) and port. Port must be included after colon!
+
+
+ This method expects any address to include a port. The final ':' in addressAndPort has to separate it.
+ IPv6 addresses have multiple colons and must use brackets to separate address from port.
+
+ Examples:
+ ns.exitgames.com:5058
+ http://[2001:db8:1f70::999:de8:7648:6e8]:100/
+ [2001:db8:1f70::999:de8:7648:6e8]:100
+ See:
+ http://serverfault.com/questions/205793/how-can-one-distinguish-the-host-and-the-port-in-an-ipv6-url
+
+
+
+ Wraps a DNS call to provide an array of addresses, sorted to have the IPv6 ones first.
+
+ This skips a DNS lookup, if the hostname is an IPv4 address. Then only this address is used as is.
+ The DNS lookup may take a while, so it is recommended to do this in a thread. Also, it may fail entirely.
+
+
+ IPAddress array for hostname, sorted to put any IPv6 addresses first.
+ If the DNS lookup fails, HandleException(StatusCode.ExceptionOnConnect) gets called and null returned.
+ Then the socket should not attempt to connect.
+
+
+
+
+ Returns null or the IPAddress representing the address, doing Dns resolution if needed.
+
+ Only returns IPv4 or IPv6 adresses, no others.
+ The string address of a server (hostname or IP).
+ IPAddress for the string address or null, if the address is neither IPv4, IPv6 or some hostname that could be resolved.
+
+
+ Variants of the Photon specific serialization protocol used for operations, responses, events and data.
+
+
+ Version 1.6 (outdated).
+
+
+ Version 1.8.
+
+
+
+
+
+
+ Serialize creates a byte-array from the given object and returns it.
+
+ The object to serialize
+ The serialized byte-array
+
+
+
+ Deserialize returns an object reassembled from the given StreamBuffer.
+
+ The buffer to be Deserialized
+ The Deserialized object
+
+
+
+ Deserialize returns an object reassembled from the given byte-array.
+
+ The byte-array to be Deserialized
+ The Deserialized object
+
+
+
+ Interface for (UDP) traffic capturing.
+
+
+
+ Indicates if the PhotonPeer should call Record or not.
+
+
+ Implement to record network traffic. Called by PhotonPeer for each UDP message sent and received.
+
+ The buffer will not contain Ethernet Header, IP, UDP level data. Only the payload received by the client.
+
+ It is advised to not use NetworkSimulation when recording traffic.
+ The recording is done on the timing of actual receive- and send-calls and internal simulation would offset the timing.
+
+ Buffer to be sent or received. Check length value for actual content length.
+ Length of the network data.
+ Indicates incoming (true) or outgoing (false) traffic.
+ The local peerId for the connection. Defaults to 0xFFFF until assigned by the Server.
+ The currently used IPhotonSocket of this Peer. Enables you to track the connection endpoint.
+
+
+ Internal class for "commands" - the package in which operations are sent.
+
+
+ Size of the Payload, which may be null.
+
+
+ Checks commandFlags & FV_UNRELIABLE_UNSEQUENCED.
+
+
+ Checks commandFlags & FV_RELIABLE.
+
+
+
+ ACKs should never be created as NCommand. use CreateACK to wrtie the serialized ACK right away...
+
+
+
+
+
+
+
+
+ this variant does only create outgoing commands and increments . incoming ones are created from a DataInputStream
+
+
+ this variant does only create outgoing commands and increments . incoming ones are created from a DataInputStream
+
+
+ reads the command values (commandHeader and command-values) from incoming bytestream and populates the incoming command*
+
+
+
+ A simulation item is an action that can be queued to simulate network lag.
+
+
+
+ With this, the actual delay can be measured, compared to the intended lag.
+
+
+ Timestamp after which this item must be executed.
+
+
+ Action to execute when the lag-time passed.
+
+
+ Starts a new Stopwatch
+
+
+
+ A set of network simulation settings, enabled (and disabled) by PhotonPeer.IsSimulationEnabled.
+
+
+ For performance reasons, the lag and jitter settings can't be produced exactly.
+ In some cases, the resulting lag will be up to 20ms bigger than the lag settings.
+ Even if all settings are 0, simulation will be used. Set PhotonPeer.IsSimulationEnabled
+ to false to disable it if no longer needed.
+
+ All lag, jitter and loss is additional to the current, real network conditions.
+ If the network is slow in reality, this will add even more lag.
+ The jitter values will affect the lag positive and negative, so the lag settings
+ describe the medium lag even with jitter. The jitter influence is: [-jitter..+jitter].
+ Packets "lost" due to OutgoingLossPercentage count for BytesOut and LostPackagesOut.
+ Packets "lost" due to IncomingLossPercentage count for BytesIn and LostPackagesIn.
+
+
+
+ internal
+
+
+ internal
+
+
+ internal
+
+
+ internal
+
+
+ internal
+
+
+ internal
+
+
+ internal
+
+
+ This setting overrides all other settings and turns simulation on/off. Default: false.
+
+
+ Outgoing packages delay in ms. Default: 100.
+
+
+ Randomizes OutgoingLag by [-OutgoingJitter..+OutgoingJitter]. Default: 0.
+
+
+ Percentage of outgoing packets that should be lost. Between 0..100. Default: 1. TCP ignores this setting.
+
+
+ Incoming packages delay in ms. Default: 100.
+
+
+ Randomizes IncomingLag by [-IncomingJitter..+IncomingJitter]. Default: 0.
+
+
+ Percentage of incoming packets that should be lost. Between 0..100. Default: 1. TCP ignores this setting.
+
+
+ Counts how many outgoing packages actually got lost. TCP connections ignore loss and this stays 0.
+
+
+ Counts how many incoming packages actually got lost. TCP connections ignore loss and this stays 0.
+
+
+ Provides an overview of the current values in form of a string.
+ String summary.
+
+
+
+ The pool this wrapper should return to when released/disposed.
+
+
+
+
+ Gets value and if it belongs to the static pool, returns the wrapper to pool.
+
+
+
+
+
+ Boxes the value and returns boxed object. Releases the wrapper.
+
+
+
+
+
+ Removes this WrapperStruct from pooling.
+
+
+
+ Returns a String which represents the value of this instance.
+ String which represents the value of this instance.
+
+
+ Returns a String which represents the type (in brackets and value of this instance.
+ String which represents the type (in brackets) and value of this instance.
+
+
+
+ staticPool is used for implicit casting. This is not threadsafe, so casting between T and StructWrapper should only be done on the Unity main thread.
+
+
+
+
+ Replacement for object.GetType() that first checks to see if object is a WrappedStruct.
+ If so returns the StructWrapper T type, otherwise just returns object.GetType().
+
+
+
+
+
+
+ Wrap a struct in a pooled StructWrapper.
+
+
+
+
+ Wrap a struct in a pooled StructWrapper. Pulls wrapper from the static pool. Wrapper is returned to pool when Unwrapped.
+ Slighty faster version of Wrap() that is hard wired to pull from the static pool. Use the persistant bool argument to make a permanent unpooled wrapper.
+
+
+
+
+ Tests if object is either a cast T, or a wrapped T
+
+
+
+
+ Remove all wrappers in hashtable from pooling, so they can remain cached and used later.
+
+
+
+
+
+ Unwraps any WrapperStructs, boxes their value, releases hashtable entry with the boxed value. Releases the wrappers.
+
+
+
+
+ If object is a StructWrapper, the value will be extracted. If not, the object will be cast to T.
+ Wrapper is returned to the wrapper pool if applicable, so it is not considered safe to Unwrap multiple times, as the wrapper may be recycled.
+
+
+
+
+ If object is a StructWrapper, the value will be extracted. If not, the object will be cast to T.
+ Wrapper is will not be returned to its pool until it is Unwrapped, or the pool is cleared.
+
+
+
+
+ If object is a StructWrapper, the value will be extracted. If not, the object will be cast to T.
+ Wrapper is returned to the wrapper pool if applicable, so it is not considered safe to Unwrap multiple times, as the wrapper may be recycled.
+
+
+
+
+ If object is a StructWrapper, the value will be extracted. If not, the object will be cast to T.
+ Wrapper is returned to the wrapper pool if applicable, so it is not considered safe to Unwrap multiple times, as the wrapper may be recycled.
+
+
+
+
+ If object is a StructWrapper, the value will be extracted. If not, the object will be cast to T.
+
+
+
+
+ If object is a StructWrapper, the value will be extracted. If not, the object will be cast to T.
+
+
+
+
+ If object is a StructWrapper, the value will be extracted. If not, the object will be cast to T.
+ Wrapper is returned to the wrapper pool if applicable, so it is not considered safe to Unwrap multiple times, as the wrapper may be recycled.
+
+
+
+
+ If object is a StructWrapper, the value will be extracted. If not, the object will be cast to T.
+ Wrapper is returned to the wrapper pool if applicable, so it is not considered safe to Unwrap multiple times, as the wrapper may be recycled.
+
+
+
+
+ If object is a StructWrapper, the value will be extracted. If not, the object will be cast to T.
+ Wrapper is will not be returned to its pool until it is Unwrapped, or the pool is cleared.
+
+
+
+
+
+
+
+
+
+
+ Will get the object using the key. If the key is invalid, will return null.
+
+
+
+
+
+ Dictionary content as string.
+ If true, type-info is also included.
+ Full content of dictionary as string.
+
+
+ Param code. Used in internal op: InitEncryption.
+
+
+ Encryption-Mode code. Used in internal op: InitEncryption.
+
+
+ Param code. Used in internal op: InitEncryption.
+
+
+ Code of internal op: InitEncryption.
+
+
+ TODO: Code of internal op: Ping (used in PUN binary websockets).
+
+
+ Result code for any (internal) operation.
+
+
+
+ This is the replacement for the const values used in eNet like: PS_DISCONNECTED, PS_CONNECTED, etc.
+
+
+
+ No connection is available. Use connect.
+
+
+ Establishing a connection already. The app should wait for a status callback.
+
+
+
+ The low level connection with Photon is established. On connect, the library will automatically
+ send an Init package to select the application it connects to (see also PhotonPeer.Connect()).
+ When the Init is done, IPhotonPeerListener.OnStatusChanged() is called with connect.
+
+ Please note that calling operations is only possible after the OnStatusChanged() with StatusCode.Connect.
+
+
+ Connection going to be ended. Wait for status callback.
+
+
+ Acknowledging a disconnect from Photon. Wait for status callback.
+
+
+ Connection not properly disconnected.
+
+
+ The server's address, as set by a Connect() call, including any protocol, ports and or path.
+ If rHTTP is used, this can be set directly.
+
+
+
+ This is the (low level) connection state of the peer. It's internal and based on eNet's states.
+
+ Applications can read the "high level" state as PhotonPeer.PeerState, which uses a different enum.
+
+
+ Byte count of last sent operation (set during serialization).
+
+
+ Byte count of last dispatched message (set during dispatch/deserialization).
+
+
+ The command that's currently being dispatched.
+
+
+ This ID is assigned by the Realtime Server upon connection.
+ The application does not have to care about this, but it is useful in debugging.
+
+
+
+ The serverTimeOffset is serverTimestamp - localTime. Used to approximate the serverTimestamp with help of localTime
+
+
+
+
+ Count of all bytes going out (including headers)
+
+
+
+
+ Count of all bytes coming in (including headers)
+
+
+
+ Set via Connect(..., customObject) and sent in Init-Request.
+
+
+ Sent on connect in an Init Request.
+
+
+ Temporary cache of AppId. Used in Connect() to keep the AppId until we send the Init-Request (after the network-level (and Enet) connect).
+
+
+ Set to timeInt, whenever SendOutgoingCommands actually checks outgoing queues to send them. Must be connected.
+
+
+ Maximum Transfer Unit to be used for UDP+TCP
+
+
+ If IPhotonSocket.Connected is true, this value shows if the server's address resolved as IPv6 address.
+
+ You must check the socket's IsConnected state. Otherwise, this value is not initialized.
+ Sent to server in Init-Request.
+
+
+
+
+ Writes and "Init Request", which initializes the connection / application used server-side.
+
+ Uses this.ServerAddress, this.AppId, this.PhotonToken and CustomInitData and some more values.
+ Bytes of the init request.
+
+
+ Called when the server's Init Response arrived.
+
+
+ Serializes an operation into our binary messages (magic number, msg-type byte and message). Optionally encrypts.
+ This method is mostly the same in EnetPeer, TPeer and HttpPeerBase. Also, for raw messages, we have another variant.
+
+
+ Serializes an operation into our binary messages (magic number, msg-type byte and message). Optionally encrypts.
+ This method is mostly the same in EnetPeer, TPeer and HttpPeerBase. Also, for raw messages, we have another variant.
+
+
+ Returns the UDP Payload starting with Magic Number for binary protocol
+
+
+
+ Checks outgoing queues for commands to send and puts them on their way.
+ This creates one package per go in UDP.
+
+ If commands are not sent, cause they didn't fit into the package that's sent.
+
+
+
+ Checks the incoming queue and Dispatches received data if possible.
+
+ If a Dispatch happened or not, which shows if more Dispatches might be needed.
+
+
+
+ Internally uses an operation to exchange encryption keys with the server.
+
+ If the op could be sent.
+
+
+
+ Gets the currently used settings for the built-in network simulation.
+ Please check the description of NetworkSimulationSet for more details.
+
+
+
+
+ Core of the Network Simulation, which is available in Debug builds.
+ Called by a timer in intervals.
+
+
+
+ EnetPeer will set this value, so trafficstats can use it. TCP has 0 bytes per package extra
+
+
+ See PhotonPeer value.
+
+
+ See PhotonPeer value.
+
+
+ See PhotonPeer value.
+
+
+ See PhotonPeer value.
+
+
+
+ Value range for a Peer's connection and initialization state, as returned by the PeerState property.
+
+
+ While this is not the same as the StatusCode of IPhotonPeerListener.OnStatusChanged(), it directly relates to it.
+ In most cases, it makes more sense to build a game's state on top of the OnStatusChanged() as you get changes.
+
+
+
+ The peer is disconnected and can't call Operations. Call Connect().
+
+
+ The peer is establishing the connection: opening a socket, exchanging packages with Photon.
+
+
+ The connection is established and now sends the application name to Photon.
+ You set the "application name" by calling PhotonPeer.Connect().
+
+
+ The peer is connected and initialized (selected an application). You can now use operations.
+
+
+ The peer is disconnecting. It sent a disconnect to the server, which will acknowledge closing the connection.
+
+
+
+ These are the options that can be used as underlying transport protocol.
+
+
+
+ Use UDP to connect to Photon, which allows you to send operations reliable or unreliable on demand.
+
+
+ Use TCP to connect to Photon.
+
+
+ A TCP-based protocol commonly supported by browsers.For WebGL games mostly. Note: No WebSocket IPhotonSocket implementation is in this Assembly.
+ This protocol is only available in Unity exports to WebGL.
+
+
+ A TCP-based, encrypted protocol commonly supported by browsers. For WebGL games mostly. Note: No WebSocket IPhotonSocket implementation is in this Assembly.
+ This protocol is only available in Unity exports to WebGL.
+
+
+
+ Level / amount of DebugReturn callbacks. Each debug level includes output for lower ones: OFF, ERROR, WARNING, INFO, ALL.
+
+
+
+ No debug out.
+
+
+ Only error descriptions.
+
+
+ Warnings and errors.
+
+
+ Information about internal workflows, warnings and errors.
+
+
+ Most complete workflow description (but lots of debug output), info, warnings and errors.
+
+
+ Build target framework supported by this dll.
+
+
+
+ Instances of the PhotonPeer class are used to connect to a Photon server and communicate with it.
+
+
+ A PhotonPeer instance allows communication with the Photon Server, which in turn distributes messages
+ to other PhotonPeer clients.
+ An application can use more than one PhotonPeer instance, which are treated as separate users on the
+ server. Each should have its own listener instance, to separate the operations, callbacks and events.
+
+
+
+
+ No effect anymore. Removed without replacement.
+
+
+ This value was used to get/set the initial capacities of command-lists.
+ These grow on demand but knowing their capacity is of very limited use.
+ Also, various command-lists grow their capacity independent from one another.
+
+
+
+
+ No effect anymore. Removed without replacement.
+
+
+ This was used to skip some received (and buffered) unreliable commands, to avoid situations
+ where the peer has aggregated a lot of (old) messages.
+
+
+
+
+ The WarningSize was used test all message queues for congestion.
+
+
+
+
+ Gets a local timestamp in milliseconds by calling SupportClass.GetTickCount().
+ See LocalMsTimestampDelegate.
+
+
+
+ Where dynamic linking is available, this library will attempt to load a native Photon "Encryptor" plugin library for "Datagram Encryption".
+ Fallback to a managed implementation. This value is always true.
+
+
+ Obsolete and ignored. Size of CommandLog. Default is 0, no logging.
+
+
+ Obsolete and ignored. Converts the CommandLog into a readable table-like string with summary.
+
+
+ False if this library build contains C# Socket code. If true, you must set some type as SocketImplementation before connecting.
+
+
+ True if the library was compiled with DEBUG setting.
+
+
+ Version of the Native Encryptor API compiled into this assembly. Defines which PhotonEncryptorPlugin needs to be used.
+
+
+ Target framework this dll was built for.
+
+
+ Global toggle to avoid callbacks from native plugins. Defaults to false, meaning: "callbacks enabled".
+ Callbacks from native code will fail on some platforms, which is why you can disable them.
+
+
+ Can be used to remove/hide the AppId from websocket connect paths.
+
+
+ A simplified identifier for client SDKs. Photon's APIs might modify this (as a dll can be used in more than one product). Helps debugging.
+
+
+ For the Init-request, we shift the ClientId by one and the last bit signals a "debug" (0) or "release" build (1).
+
+
+ Version of this library as string.
+
+
+ Version of this library as string.
+
+
+ A Native Socket implementation is no longer part of this DLL but delivered in a separate add-on. This value always returns false.
+
+
+ Native Payload Encryption is no longer part of this DLL but delivered in a separate add-on. This value always returns false.
+
+
+ Native Datagram Encryption is no longer part of this DLL but delivered in a separate add-on. This value always returns false.
+
+
+ Enables selection of a (Photon-)serialization protocol. Used in Connect methods.
+ Defaults to SerializationProtocol.GpBinaryV16;
+
+
+ Optional definition of IPhotonSocket type per ConnectionProtocol.
+
+ Several platforms have special Socket implementations and slightly different APIs.
+ Customizing the SocketImplementationConfig helps to accomodate this.
+ By default, UDP and TCP have socket implementations assigned.
+
+ If a native socket plugin is available set the SocketNativeSource class as Type definition here.
+
+ You only need to set the SocketImplementationConfig once, after creating a PhotonPeer
+ and before connecting. If you switch the TransportProtocol, the correct implementation is being used.
+
+
+
+
+ Can be used to read the IPhotonSocket implementation at runtime (before connecting).
+
+
+ Use the SocketImplementationConfig to define which IPhotonSocket is used per ConnectionProtocol.
+
+
+
+
+ Sets the level (and amount) of debug output provided by the library.
+
+
+ This affects the callbacks to IPhotonPeerListener.DebugReturn.
+ Default Level: Error.
+
+
+
+
+ Gets the IPhotonPeerListener of this instance (set in constructor).
+ Can be used in derived classes for Listener.DebugReturn().
+
+
+
+
+ Called when the client received a Disconnect Message from the server. Signals an error and provides a message to debug the case.
+
+
+
+
+ Option to make the PhotonPeer reuse a single EventData instance for all incoming events.
+
+
+ This reduces memory garbage.
+ If enabled, the event provided via OnEvent(EventData photonEvent) is invalid once the callback finished.
+ That event's content will get modified. Typically this is not a problem as events are rarely cached.
+
+ Changing this value acquires the same lock that DispatchIncomingCommands() uses.
+
+
+
+
+ Enables a deserialization optimization for incoming events. Defaults to false.
+
+
+ When enabled, byte-arrays in incoming Photon events are deserialized into pooled ByteArraySlice instances (wrappers for byte[]).
+ This improves the memory footprint for receiving byte-arrays in events.
+
+ When used, you have to release the (pooled) ByteArraySlice instances.
+
+ Adjust your handling of EventData accordingly:
+
+ The ByteArraySlice.Buffer will usually be bigger than the send/received byte-array.
+ Check the ByteArraySlice.Count and read only the actually received bytes.
+ The Buffer is reused and not cleared. The Offset will be 0 for incoming events.
+
+ Important:
+ While the peer will acquire the ByteArraySlice and passes it to OnEvent, the game code has to call ByteArraySlice.Release()
+ when the slice is no longer needed.
+
+ Send either byte[], ArraySegment or use the ByteArraySlicePool to acquire ByteArraySlices to send.
+
+
+
+
+ Instance of a ByteArraySlicePool. UseByteArraySlicePoolForEvents defines if this PhotonPeer is using the pool for deserialization of byte[] in Photon events.
+
+ ByteArraySlice is a serializable datatype of the Photon .Net client library.
+ It helps avoid allocations by being pooled and (optionally) used in incoming Photon events (see: UseByteArraySlicePoolForEvents).
+
+ You can also use the pool to acquire ByteArraySlice instances for serialization.
+ RaiseEvent will auto-release all ByteArraySlice instances passed in.
+
+
+
+
+ This debug setting enables a new send-ordering for commands. Defaults to true and commands are sent in the order they are created. Set to false to use Enet ordering.
+
+
+
+ Skips resending (individual) commands if their reliable sequence number is this amount larger than the highest acknowledged sequence number.
+
+ This puts focus on resending commands that are older and are needed on the receiver side to dispatch commands.
+ It queues more on the client side than on the server.
+ Affects only reliable UDP (based on enet).
+
+
+
+ Skips sending reliable and unreliable commands if their reliable sequence number is this amount larger than the highest acknowledged sequence number.
+
+ This puts focus on resending commands that are older and are needed on the receiver side to dispatch commands.
+ It queues more on the client side than on the server.
+ Affects only reliable UDP (based on enet).
+
+
+
+
+ Gets count of all bytes coming in (including headers, excluding UDP/TCP overhead)
+
+
+
+
+ Gets count of all bytes going out (including headers, excluding UDP/TCP overhead)
+
+
+
+
+ Gets the size of the dispatched event or operation-result in bytes.
+ This value is set before OnEvent() or OnOperationResponse() is called (within DispatchIncomingCommands()).
+
+
+ Get this value directly in OnEvent() or OnOperationResponse(). Example:
+ void OnEvent(...) {
+ int eventSizeInBytes = this.peer.ByteCountCurrentDispatch;
+ //...
+
+ void OnOperationResponse(...) {
+ int resultSizeInBytes = this.peer.ByteCountCurrentDispatch;
+ //...
+
+
+
+ Returns the debug string of the event or operation-response currently being dispatched or string. Empty if none.
+ In a release build of the lib, this will always be empty.
+
+
+
+ Gets the size of the last serialized operation call in bytes.
+ The value includes all headers for this single operation but excludes those of UDP, Enet Package Headers and TCP.
+
+
+ Get this value immediately after calling an operation.
+ Example:
+
+ this.loadbalancingClient.OpJoinRoom("myroom");
+ int opjoinByteCount = this.loadbalancingClient.ByteCountLastOperation;
+
+
+
+ If set, the TrafficRecorder will be used to capture all traffic.
+
+ If null or not Enabled, the recorder is not being used.
+ Release builds of this library will never record traffic for performance reasons.
+
+ See ITrafficRecorder docs.
+
+
+
+
+ Debugging option to tell the Photon Server to log all datagrams.
+
+
+
+
+ Up to 4 resend attempts for a reliable command can be done in quick succession (after RTT+4*Variance).
+
+
+ By default 0. Any later resend attempt will then double the time before the next resend.
+ Max value = 4;
+ Make sure to adjust SentCountAllowance to a slightly higher value, as more repeats will get done.
+
+
+
+
+ This is the (low level) state of the connection to the server of a PhotonPeer. Managed internally and read-only.
+
+
+ Don't mix this up with the StatusCode provided in IPhotonListener.OnStatusChanged().
+ Applications should use the StatusCode of OnStatusChanged() to track their state, as
+ it also covers the higher level initialization between a client and Photon.
+
+
+
+
+ This peer's ID as assigned by the server or 0 if not using UDP. Will be 0xFFFF before the client connects.
+
+ Used for debugging only. This value is not useful in everyday Photon usage.
+
+
+
+ Count of all currently received but not-yet-Dispatched reliable commands
+ (events and operation results) from all channels.
+
+
+
+
+ Count of all commands currently queued as outgoing, including all channels and reliable, unreliable.
+
+
+
+
+ Sets a new (temporary) size of the MessageBufferPool to reuse memory where possible.
+
+
+ The MessageBufferPool is a Queue<StreamBuffer> for performance reasons.
+ This methods dequeues from the MessageBufferPool to get the Count equal to countOfBuffers,
+ then it calls MessageBufferPool.TrimExcess().
+
+ New size of the pool. Clears the pool if <= 0.
+
+
+
+ Gets / sets the number of channels available in UDP connections with Photon.
+ Photon Channels are only supported for UDP.
+ The default ChannelCount is 2. Channel IDs start with 0 and 255 is a internal channel.
+
+
+
+
+ Enables the client so send the "encrypted" flag on secure connections. Incompatible with Server SDK 4.x.
+
+
+
+
+ While not connected, this controls if the next connection(s) should use a per-package CRC checksum.
+
+
+ While turned on, the client and server will add a CRC checksum to every sent package.
+ The checksum enables both sides to detect and ignore packages that were corrupted during transfer.
+ Corrupted packages have the same impact as lost packages: They require a re-send, adding a delay
+ and could lead to timeouts.
+
+ Building the checksum has a low processing overhead but increases integrity of sent and received data.
+ Packages discarded due to failed CRC cecks are counted in PhotonPeer.PacketLossByCrc.
+
+
+
+
+ Count of packages dropped due to failed CRC checks for this connection.
+
+
+
+
+
+ Count of packages dropped due to wrong challenge for this connection.
+
+
+
+
+ Gets the count of sent but not yet acknowledged commands (for UDP connections).
+
+
+
+
+ Count of commands that got repeated (due to local repeat-timing before an ACK was received).
+
+
+
+
+ Number of send retries before a peer is considered lost/disconnected. Default: 7.
+
+
+ The initial timeout countdown of a command is calculated by the current roundTripTime + 4 * roundTripTimeVariance.
+ Please note that the timeout span until a command will be resent is not constant, but based on
+ the roundtrip time at the initial sending, which will be doubled with every failed retry.
+
+ DisconnectTimeout and SentCountAllowance are competing settings: either might trigger a disconnect on the
+ client first, depending on the values and Roundtrip Time.
+
+
+
+
+ Caps the initial timing for repeats of reliable commands. In milliseconds. Default: 400ms.
+
+
+ Unless acknowledged, reliable commands are repeated initially after: current roundTripTime + 4 * roundTripTimeVariance.
+
+ As this value can be very high when there was exceptional lag, InitialResendTimeMax makes sure that commands
+ get repeated several times before they may trigger a timeout.
+
+
+
+
+ Sets the time between pings being sent automatically. They measure the roundtrip time and keep connections from closing. Default: 1000.
+
+
+ For Photon's reliable UDP connections, pings are skipped if any reliable command was sent during the specified TimePingInterval.
+ Any reliable command is used to update the RoundTripTime and RoundTripTimeVariance.
+
+ When using TCP and WebSockets, the ping is of interest to measure the roundtrip and to keep a connection open, should nothing else
+ With those two protocols, the ping is used to update the RoundTripTime and RoundTripTimeVariance.
+
+
+
+
+ Time in milliseconds before any sent reliable command triggers a timeout disconnect, unless acknowledged by the receiver. Default: 10000.
+
+
+ DisconnectTimeout is not an exact value for a timeout. The exact timing of the timeout depends on the frequency
+ of Service() calls and the roundtrip time. Commands sent with long roundtrip-times and variance are checked less
+ often for re-sending.
+
+ DisconnectTimeout and SentCountAllowance are competing settings: either might trigger a disconnect on the
+ client first, depending on the values and Roundtrip Time.
+
+ Default: 10000 ms. Maximum setting: 65535.
+ Setting a negative value will apply the default timeout.
+
+
+
+
+ Approximated Environment.TickCount value of server (while connected).
+
+
+ UDP: The server's timestamp is automatically fetched after connecting (once). This is done
+ internally by a command which is acknowledged immediately by the server.
+ TCP: The server's timestamp fetched with each ping but set only after connecting (once).
+
+ The approximation will be off by +/- 10ms in most cases. Per peer/client and connection, the
+ offset will be constant (unless FetchServerTimestamp() is used). A constant offset should be
+ better to adjust for. Unfortunately there is no way to find out how much the local value
+ differs from the original.
+
+ The approximation adds RoundtripTime / 2 and uses this.LocalTimeInMilliSeconds to calculate
+ in-between values (this property returns a new value per tick).
+
+ The value sent by Photon equals Environment.TickCount in the logic layer.
+
+
+ 0 until connected.
+ While connected, the value is an approximation of the server's current timestamp.
+
+
+
+
+ This setter for the (local-) timestamp delegate replaces the default Environment.TickCount with any equal function.
+
+
+
+ The internally used per PhotonPeer time value.
+
+ Returns the integer part of a Stopwatch ElapsedMilliseconds value.
+ If the PhotonPeer runs continuously the ClientTime will increment from zero to Int32..::.MaxValue
+ for approximately 24.9 days, then jump to Int32..::.MinValue (a negative number), then increment
+ back to zero during the next 24.9 days.
+
+ It is recommended to use this int only for delta times, to avoid handling the overflow.
+
+
+
+ The last ConnectionTime value, when some ACKs were sent out by this client.
+ Only applicable to UDP connections.
+
+
+ The last ConnectionTime value, when SendOutgoingCommands actually checked outgoing queues to send them. Must be connected.
+ Available for UDP and TCP connections.
+
+
+ Measures the maximum milliseconds spent in PhotonSocket.Send().
+
+
+ Time until a reliable command is acknowledged by the server.
+
+ The value measures network latency and for UDP it includes the server's ACK-delay (setting in config).
+ In TCP, there is no ACK-delay, so the value is slightly lower (if you use default settings for Photon).
+
+ RoundTripTime is updated constantly. Every reliable command will contribute a fraction to this value.
+
+ This is also the approximate time until a raised event reaches another client or until an operation
+ result is available.
+
+
+
+
+ Changes of the roundtriptime as variance value. Gives a hint about how much the time is changing.
+
+
+
+ The last measured roundtrip time for this connection.
+
+
+
+ Timestamp of the last time anything (!) was received from the server (including low level Ping, ACKs, events and operation-returns).
+
+
+ This is not the time when something was dispatched. If you enable NetworkSimulation, this value is affected as well.
+
+
+
+
+ The server address which was used in PhotonPeer.Connect() or null (before Connect() was called).
+
+
+
+ Contains the IP address of the previously resolved ServerAddress (or empty, if address wasn't resolved with the internal methods).
+
+
+ The protocol this peer is currently connected/connecting with (or 0).
+
+
+ This is the transport protocol to be used for next connect (see remarks).
+ The TransportProtocol can be changed anytime but it will not change the
+ currently active connection. Instead, TransportProtocol will be applied on next Connect.
+
+
+
+
+ Gets or sets the network simulation "enabled" setting.
+ Changing this value also locks this peer's sending and when setting false,
+ the internally used queues are executed (so setting to false can take some cycles).
+
+
+
+
+ Gets the settings for built-in Network Simulation for this peer instance
+ while IsSimulationEnabled will enable or disable them.
+ Once obtained, the settings can be modified by changing the properties.
+
+
+
+
+ Defines the initial size of an internally used StreamBuffer for Tcp.
+ The StreamBuffer is used to aggregate operation into (less) send calls,
+ which uses less resoures.
+
+
+ The size is not restricing the buffer and does not affect when outgoing data is actually sent.
+
+
+
+
+ The Maximum Trasfer Unit (MTU) defines the (network-level) packet-content size that is
+ guaranteed to arrive at the server in one piece. The Photon Protocol uses this
+ size to split larger data into packets and for receive-buffers of packets.
+
+
+ This value affects the Packet-content. The resulting UDP packages will have additional
+ headers that also count against the package size (so it's bigger than this limit in the end)
+ Setting this value while being connected is not allowed and will throw an Exception.
+ Minimum is 576. Huge values won't speed up connections in most cases!
+
+
+
+
+ This property is set internally, when OpExchangeKeysForEncryption successfully finished.
+ While it's true, encryption can be used for operations.
+
+
+
+
+ While true, the peer will not send any other commands except ACKs (used in UDP connections).
+
+
+
+ Defines if Key Exchange for Encryption is done asynchronously in another thread.
+
+
+ Indicates if sequence numbers should be randomized.
+
+
+ Initialization array, used to modify the sequence numbers of channels.
+
+
+ If GCM is used for DatagramEncryption.
+ If true, the randomization-value gets added to the current value, else (CBC/old style) the randomization-value replaces the current value.
+
+
+
+ Gets the byte-count of incoming "low level" messages, which are either Enet Commands or Tcp Messages.
+ These include all headers, except those of the underlying internet protocol Udp or Tcp.
+
+
+
+
+ Gets the byte-count of outgoing "low level" messages, which are either Enet Commands or Tcp Messages.
+ These include all headers, except those of the underlying internet protocol Udp or Tcp.
+
+
+
+
+ Gets a statistic of incoming and outgoing traffic, split by operation, operation-result and event.
+
+
+ Operations are outgoing traffic, results and events are incoming.
+ Includes the per-command header sizes (Udp: Enet Command Header or Tcp: Message Header).
+
+
+
+
+ Returns the count of milliseconds the stats are enabled for tracking.
+
+
+
+
+ Enables or disables collection of statistics in TrafficStatsIncoming, TrafficStatsOutgoing and TrafficstatsGameLevel.
+
+
+ Setting this to true, also starts the stopwatch to measure the timespan the stats are collected.
+ Enables the traffic statistics of a peer: TrafficStatsIncoming, TrafficStatsOutgoing and TrafficstatsGameLevel (nothing else).
+ Default value: false (disabled).
+
+
+
+
+ Creates new instances of TrafficStats and starts a new timer for those.
+
+
+
+
+ Creates new TrafficStats values and the related Stopwatch instance. To be called when the peer is created / reset.
+
+
+
+
+ Returns a string of the most interesting connection statistics.
+ When you have issues on the client side, these might contain hints about the issue's cause.
+
+ If true, Incoming and Outgoing low-level stats are included in the string.
+ Stats as string.
+
+
+ Implements the message-protocol, based on the underlying network protocol (udp, tcp, http).
+
+
+ Setter for the Payload Encryptor type. Used for next connection.
+
+ If null, the PhotonPeer will create a DiffieHellmanCryptoProvider, which is the default.
+ This is only needed in rare cases, where using native payload encryption makes sense.
+
+ Get in touch about this, if you got questions: developer@photonengine.com
+
+
+
+ PayloadEncryption Secret. Message payloads get encrypted with it individually and on demand.
+
+
+ Setter for the Datagram Encryptor type. Used at next connect.
+
+ If null, the PhotonPeer will create a default datagram encryptor instance.
+
+
+
+ The datagram encryptor used for the current connection. Applied internally in InitDatagramEncryption.
+
+
+ Count of unreliable commands being discarded in case this client already dispatched a command that was newer (higher sequence number).
+
+
+ Set per dispatch in DispatchIncomingCommands to: commandUnreliableSequenceNumber - channel.incomingUnreliableSequenceNumber. Indicates how big the (sequence)gap is, compared to the last dispatched unreliable command.
+
+
+ Creates a new PhotonPeer with specified transport protocol (without a IPhotonPeerListener).
+ Make sure to set the Listener, before using the peer.
+
+
+
+ Creates a new PhotonPeer instance to communicate with Photon and selects the transport protocol. We recommend UDP.
+
+ a IPhotonPeerListener implementation
+ Protocol to use to connect to Photon.
+
+
+
+ Starts connecting to the given Photon server. Non-blocking.
+
+
+ Connecting to the Photon server is done asynchronous.
+ Unless an error happens right away (and this returns false), wait for the call of IPhotonPeerListener.OnStatusChanged.
+
+
+ Address of a Photon server as IP:port or hostname. WebSocket connections must contain a scheme (ws:// or wss://).
+
+
+ The ID of the app to use. Typically this is a guid (for the Photon Cloud). Max 32 characters.
+
+
+ Optional custom data to be used by server during peer creation.
+ If used for authentication, the server is able to reject a client without creating a peer.
+ Must be a serializable data type of Photon.
+
+ Custom data to send to the server in the Init request. Might be used to identify a client / user.
+
+ True if a connection attempt will be made. False if some error could be detected early-on.
+
+
+
+
+ Starts connecting to the given Photon server. Non-blocking.
+
+
+ Connecting to the Photon server is done asynchronous.
+ Unless an error happens right away (and this returns false), wait for the call of IPhotonPeerListener.OnStatusChanged.
+
+
+ Address of a Photon server as IP:port or hostname. WebSocket connections must contain a scheme (ws:// or wss://).
+
+
+ Optional address of a proxy server. Only used by WebSocket connections. Set null to use none.
+
+
+ The ID of the app to use. Typically this is a guid (for the Photon Cloud). Max 32 characters.
+
+
+ Optional Photon token data to be used by server during peer creation.
+ If used for authentication, the server is able to reject a client without creating a peer.
+ Must be of type string or byte[] (as provided by server).
+
+ Custom data to send to the server in the Init request. Might be used to identify a client / user.
+
+ True if a connection attempt will be made. False if some error could be detected early-on.
+
+
+
+
+ This method initiates a mutual disconnect between this client and the server.
+
+
+ Calling this method does not immediately close a connection. Disconnect lets the server
+ know that this client is no longer listening. For the server, this is a much faster way
+ to detect that the client is gone but it requires the client to send a few final messages.
+
+ On completion, OnStatusChanged is called with the StatusCode.Disconnect.
+
+ If the client is disconnected already or the connection thread is stopped, then there is no callback.
+
+ The default server logic will leave any joined game and trigger the respective event.
+
+
+
+
+ This method immediately closes a connection (pure client side) and ends related listening Threads.
+
+
+ Unlike Disconnect, this method will simply stop to listen to the server. Udp connections will timeout.
+ If the connections was open, this will trigger a callback to OnStatusChanged with code StatusCode.Disconnect.
+
+
+
+
+ This will fetch the server's timestamp and update the approximation for property ServerTimeInMilliseconds.
+
+
+ The server time approximation will NOT become more accurate by repeated calls. Accuracy currently depends
+ on a single roundtrip which is done as fast as possible.
+
+ The command used for this is immediately acknowledged by the server. This makes sure the roundtrip time is
+ low and the timestamp + rountriptime / 2 is close to the original value.
+
+
+
+
+ This method creates a public key for this client and exchanges it with the server.
+
+
+ Encryption is not instantly available but calls OnStatusChanged when it finishes.
+ Check for StatusCode EncryptionEstablished and EncryptionFailedToEstablish.
+
+ Calling this method sets IsEncryptionAvailable to false.
+ This method must be called before the "encrypt" parameter of OpCustom can be used.
+
+ If operation could be enqueued for sending
+
+
+
+ Initializes Datagram Encryption. Optionally, the EncryptorType is being used, if set.
+
+ Secret used to cipher udp packets.
+ Secret used for authentication of udp packets.
+ Sets if enet Sequence Numbers will be randomized or not. Preferably should be true.
+ Sets if the chaining mode should be CBC (false, default) or GCM (true). GCM mode is only available with a native encryption plugin.
+
+
+
+ Photon's Payload Encryption secret may be set by a response from the server.
+
+ The secret in form of a byte[].
+
+
+
+ This method excutes DispatchIncomingCommands and SendOutgoingCommands in your application Thread-context.
+
+
+ The Photon client libraries are designed to fit easily into a game or application. The application
+ is in control of the context (thread) in which incoming events and responses are executed and has
+ full control of the creation of UDP/TCP packages.
+
+ Sending packages and dispatching received messages are two separate tasks. Service combines them
+ into one method at the cost of control. It calls DispatchIncomingCommands and SendOutgoingCommands.
+
+ Call this method regularly (2..20 times a second).
+
+ This will Dispatch ANY remaining buffered responses and events AND will send queued outgoing commands.
+ Fewer calls might be more effective if a device cannot send many packets per second, as multiple
+ operations might be combined into one package.
+
+
+ You could replace Service by:
+
+ while (DispatchIncomingCommands()); //Dispatch until everything is Dispatched...
+ SendOutgoingCommands(); //Send a UDP/TCP package with outgoing messages
+
+
+
+
+
+
+ Creates and sends a UDP/TCP package with outgoing commands (operations and acknowledgements). Also called by Service().
+
+
+ As the Photon library does not create any UDP/TCP packages by itself. Instead, the application
+ fully controls how many packages are sent and when. A tradeoff, an application will
+ lose connection, if it is no longer calling SendOutgoingCommands or Service.
+
+ If multiple operations and ACKs are waiting to be sent, they will be aggregated into one
+ package. The package fills in this order:
+ ACKs for received commands
+ A "Ping" - only if no reliable data was sent for a while
+ Starting with the lowest Channel-Nr:
+ Reliable Commands in channel
+ Unreliable Commands in channel
+
+ This gives a higher priority to lower channels.
+
+ A longer interval between sends will lower the overhead per sent operation but
+ increase the internal delay (which adds "lag").
+
+ Call this 2..20 times per second (depending on your target platform).
+
+ The if commands are not yet sent. Udp limits it's package size, Tcp doesnt.
+
+
+
+ Dispatching received messages (commands), causes callbacks for events, responses and state changes within a IPhotonPeerListener.
+
+
+ DispatchIncomingCommands only executes a single received
+ command per call. If a command was dispatched, the return value is true and the method
+ should be called again.
+
+ This method is called by Service() until currently available commands are dispatched.
+ In general, this method should be called until it returns false. In a few cases, it might
+ make sense to pause dispatching (if a certain state is reached and the app needs to load
+ data, before it should handle new events).
+
+ The callbacks to the peer's IPhotonPeerListener are executed in the same thread that is
+ calling DispatchIncomingCommands. This makes things easier in a game loop: Event execution
+ won't clash with painting objects or the game logic.
+
+
+
+
+ Prepares your operation (code and parameters) to be sent to the Photon Server with specified SendOptions.
+
+
+ This method serializes and enqueues the operation right away while the actual sending happens later.
+ To be able to aggregate operations/messages, the Photon client sends packages only when you call SendOutgoingCommands().
+
+ The sendOptions specify how the operation gets sent exactly.
+ Keep in mind that some transport protocols don't support unreliable or unsequenced transport.
+ In that case, the sendOptions might be ignored.
+
+ The operationCode must be known by the server's logic or won't be processed.
+ In almost all cases, sending an operation will result in a OperationResponse (see: IPhotonPeerListener.OnOperationResponse).
+
+ Operations are handled by their byte\-typed code. The codes are defined in the Realtime API (a.k.a. LoadBalancing API).
+ Containing parameters as key\-value pair. The key is byte\-typed, while the value is any serializable datatype.
+ Wraps up DeliveryMode (reliability), Encryption and Channel values for sending.
+ If operation could be enqueued for sending.
+
+
+
+ Registers new types/classes for de/serialization and the fitting methods to call for this type.
+
+
+ SerializeMethod and DeserializeMethod are complementary: Feed the product of serializeMethod to
+ the constructor, to get a comparable instance of the object.
+
+ After registering a Type, it can be used in events and operations and will be serialized like
+ built-in types.
+
+ Type (class) to register.
+ A byte-code used as shortcut during transfer of this Type.
+ Method delegate to create a byte[] from a customType instance.
+ Method delegate to create instances of customType's from byte[].
+ If the Type was registered successfully.
+
+
+
+ Container for an Operation request, which is a code and parameters.
+
+
+ On the lowest level, Photon only allows byte-typed keys for operation parameters.
+ The values of each such parameter can be any serializable datatype: byte, int, hashtable and many more.
+
+
+
+ Byte-typed code for an operation - the short identifier for the server's method to call.
+
+
+ The parameters of the operation - each identified by a byte-typed code in Photon.
+
+
+
+ Contains the server's response for an operation called by this peer.
+ The indexer of this class actually provides access to the Parameters Dictionary.
+
+
+ The OperationCode defines the type of operation called on Photon and in turn also the Parameters that
+ are set in the request. Those are provided as Dictionary with byte-keys.
+ There are pre-defined constants for various codes defined in the LoadBalancing application.
+ Check: OperationCode, ParameterCode, etc.
+
+ An operation's request is summarized by the ReturnCode: a short typed code for "Ok" or
+ some different result. The code's meaning is specific per operation. An optional DebugMessage can be
+ provided to simplify debugging.
+
+ Each call of an operation gets an ID, called the "invocID". This can be matched to the IDs
+ returned with any operation calls. This way, an application could track if a certain OpRaiseEvent
+ call was successful.
+
+
+
+ The code for the operation called initially (by this peer).
+ Use enums or constants to be able to handle those codes, like OperationCode does.
+
+
+ A code that "summarizes" the operation's success or failure. Specific per operation. 0 usually means "ok".
+
+
+ An optional string sent by the server to provide readable feedback in error-cases. Might be null.
+
+
+ A Dictionary of values returned by an operation, using byte-typed keys per value.
+
+
+
+ Alternative access to the Parameters, which wraps up a TryGetValue() call on the Parameters Dictionary.
+
+ The byte-code of a returned value.
+ The value returned by the server, or null if the key does not exist in Parameters.
+
+
+ ToString() override.
+ Relatively short output of OpCode and returnCode.
+
+
+ Extensive output of operation results.
+ To be used in debug situations only, as it returns a string for each value.
+
+
+ A Photon Event consists of a Code value and a Parameters Dictionary with the event's content (if any).
+
+ The indexer of this class provides access to the values in Parameters.
+ It wraps the null check for Parameters and uses TryGetValue() for the provided key.
+
+ Photon servers use events to send information which is not triggered by a client's operation requests (those get responses).
+ The Realtime API allows you to send custom events with any Code and content via OpRaiseEvent.
+
+
+
+ The event code identifies the type of event.
+
+
+ The Parameters of an event is a Dictionary<byte, object>.
+
+
+
+ Access to the Parameters of a Photon-defined event. Custom Events only use Code, Sender and CustomData.
+
+ The key byte-code of a Photon event value.
+ The Parameters value, or null if the key does not exist in Parameters.
+
+
+
+ Defines the event key containing the Sender of the event.
+
+
+ Defaults to Sender key of Realtime API events (RaiseEvent): 254.
+ Can be set to Chat API's ChatParameterCode.Sender: 5.
+
+
+
+
+ Accesses the Sender of the event via the indexer and SenderKey. The result is cached.
+
+
+ Accesses this event's Parameters[CustomDataKey], which may be null.
+ In that case, this returns 0 (identifying the server as sender).
+
+
+
+
+ Defines the event key containing the Custom Data of the event.
+
+
+ Defaults to Data key of Realtime API events (RaiseEvent): 245.
+ Can be set to any other value on demand.
+
+
+
+
+ Accesses the Custom Data of the event via the indexer and CustomDataKey. The result is cached.
+
+
+ Accesses this event's Parameters[CustomDataKey], which may be null.
+
+
+
+ ToString() override.
+ Short output of "Event" and it's Code.
+
+
+ Extensive output of the event content.
+ To be used in debug situations only, as it returns a string for each value.
+
+
+
+ Type of serialization methods to add custom type support.
+ Use PhotonPeer.ReisterType() to register new types with serialization and deserialization methods.
+
+ The method will get objects passed that were registered with it in RegisterType().
+ Return a byte[] that resembles the object passed in. The framework will surround it with length and type info, so don't include it.
+
+
+ Serialization method delegate. StreamBuffer based custom serialization methods must use this form.
+
+
+
+ Type of deserialization methods to add custom type support.
+ Use PhotonPeer.RegisterType() to register new types with serialization and deserialization methods.
+
+ The framwork passes in the data it got by the associated SerializeMethod. The type code and length are stripped and applied before a DeserializeMethod is called.
+ Return a object of the type that was associated with this method through RegisterType().
+
+
+ Deserialization method delegate. StreamBuffer based custom deserialization methods must use this form.
+
+
+
+ Provides tools for the Exit Games Protocol
+
+
+
+
+ Serialize creates a byte-array from the given object and returns it.
+
+ The object to serialize
+ The serialized byte-array
+
+
+
+ Deserialize returns an object reassembled from the given byte-array.
+
+ The byte-array to be Deserialized
+ The Deserialized object
+
+
+
+ Serializes a short typed value into a byte-array (target) starting at the also given targetOffset.
+ The altered offset is known to the caller, because it is given via a referenced parameter.
+
+ The short value to be serialized
+ The byte-array to serialize the short to
+ The offset in the byte-array
+
+
+
+ Serializes an int typed value into a byte-array (target) starting at the also given targetOffset.
+ The altered offset is known to the caller, because it is given via a referenced parameter.
+
+ The int value to be serialized
+ The byte-array to serialize the short to
+ The offset in the byte-array
+
+
+
+ Serializes an float typed value into a byte-array (target) starting at the also given targetOffset.
+ The altered offset is known to the caller, because it is given via a referenced parameter.
+
+ The float value to be serialized
+ The byte-array to serialize the short to
+ The offset in the byte-array
+
+
+
+ Deserialize fills the given int typed value with the given byte-array (source) starting at the also given offset.
+ The result is placed in a variable (value). There is no need to return a value because the parameter value is given by reference.
+ The altered offset is this way also known to the caller.
+
+ The int value to deserialize into
+ The byte-array to deserialize from
+ The offset in the byte-array
+
+
+
+ Deserialize fills the given short typed value with the given byte-array (source) starting at the also given offset.
+ The result is placed in a variable (value). There is no need to return a value because the parameter value is given by reference.
+ The altered offset is this way also known to the caller.
+
+ The short value to deserialized into
+ The byte-array to deserialize from
+ The offset in the byte-array
+
+
+
+ Deserialize fills the given float typed value with the given byte-array (source) starting at the also given offset.
+ The result is placed in a variable (value). There is no need to return a value because the parameter value is given by reference.
+ The altered offset is this way also known to the caller.
+
+ The float value to deserialize
+ The byte-array to deserialize from
+ The offset in the byte-array
+
+
+
+ Exit Games GpBinaryV16 protocol implementation
+
+
+
+
+ The gp type.
+
+
+
+
+ Unkown type.
+
+
+
+
+ An array of objects.
+
+
+ This type is new in version 1.5.
+
+
+
+
+ A boolean Value.
+
+
+
+
+ A byte value.
+
+
+
+
+ An array of bytes.
+
+
+
+
+ An array of objects.
+
+
+
+
+ A 16-bit integer value.
+
+
+
+
+ A 32-bit floating-point value.
+
+
+ This type is new in version 1.5.
+
+
+
+
+ A dictionary
+
+
+ This type is new in version 1.6.
+
+
+
+
+ A 64-bit floating-point value.
+
+
+ This type is new in version 1.5.
+
+
+
+
+ A Hashtable.
+
+
+
+
+ A 32-bit integer value.
+
+
+
+
+ An array of 32-bit integer values.
+
+
+
+
+ A 64-bit integer value.
+
+
+
+
+ A string value.
+
+
+
+
+ An array of string values.
+
+
+
+
+ A custom type. 0x63
+
+
+
+
+ Null value don't have types.
+
+
+
+
+ Calls the correct serialization method for the passed object.
+
+
+
+
+ DeserializeInteger returns an Integer typed value from the given stream.
+
+
+
+ Exception type for de/serialization issues. Used in Protocol 1.8.
+
+
+ Constructor for the exception.
+
+
+ Unkown. GpType: 0.
+
+
+ Boolean. GpType: 2. See: BooleanFalse, BooleanTrue.
+
+
+ Byte. GpType: 3.
+
+
+ Short. GpType: 4.
+
+
+ 32-bit floating-point value. GpType: 5.
+
+
+ 64-bit floating-point value. GpType: 6.
+
+
+ String. GpType: 7.
+
+
+ Null value don't have types. GpType: 8.
+
+
+ CompressedInt. GpType: 9.
+
+
+ CompressedLong. GpType: 10.
+
+
+ Int1. GpType: 11.
+
+
+ Int1_. GpType: 12.
+
+
+ Int2. GpType: 13.
+
+
+ Int2_. GpType: 14.
+
+
+ L1. GpType: 15.
+
+
+ L1_. GpType: 16.
+
+
+ L2. GpType: 17.
+
+
+ L2_. GpType: 18.
+
+
+ Custom Type. GpType: 19.
+
+
+ Custom Type Slim. GpType: 128 (0x80) and up.
+
+
+ Dictionary. GpType: 20.
+
+
+ Hashtable. GpType: 21.
+
+
+ ObjectArray. GpType: 23.
+
+
+ OperationRequest. GpType: 24.
+
+
+ OperationResponse. GpType: 25.
+
+
+ EventData. GpType: 26.
+
+
+ Boolean False. GpType: 27.
+
+
+ Boolean True. GpType: 28.
+
+
+ ShortZero. GpType: 29.
+
+
+ IntZero. GpType: 30.
+
+
+ LongZero. GpType: 3.
+
+
+ FloatZero. GpType: 32.
+
+
+ DoubleZero. GpType: 33.
+
+
+ ByteZero. GpType: 34.
+
+
+ Array for nested Arrays. GpType: 64 (0x40). Element count and type follows.
+
+
+
+ Writes integers as compressed. Either directly as zigzag-encoded or (when a type is written for this value) it can use an optimized sub-type.
+
+
+
+ Enum of the three options for reliability and sequencing in Photon's reliable-UDP.
+
+
+ The operation/message gets sent just once without acknowledgement or repeat. The sequence (order) of messages is guaranteed.
+
+
+ The operation/message asks for an acknowledgment. It's resent until an ACK arrived. The sequence (order) of messages is guaranteed.
+
+
+ The operation/message gets sent once (unreliable) and might arrive out of order. Best for your own sequencing (e.g. for streams).
+
+
+ The operation/message asks for an acknowledgment. It's resent until an ACK arrived and might arrive out of order. Best for your own sequencing (e.g. for streams).
+
+
+ Wraps up DeliveryMode, Encryption and Channel values for sending operations and messages.
+
+
+ Default SendOptions instance for reliable sending.
+
+
+ Default SendOptions instance for unreliable sending.
+
+
+ Chose the DeliveryMode for this operation/message. Defaults to Unreliable.
+
+
+ If true the operation/message gets encrypted before it's sent. Defaults to false.
+ Before encryption can be used, it must be established. Check PhotonPeer.IsEncryptionAvailable is true.
+
+
+ The Enet channel to send in. Defaults to 0.
+ Channels in Photon relate to "message channels". Each channel is a sequence of messages.
+
+
+ Sets the DeliveryMode either to true: Reliable or false: Unreliable, overriding any current value.
+ Use this to conveniently select reliable/unreliable delivery.
+
+
+ Encapsulates the network i/o functionality for the realtime library.
+
+
+ used by PhotonPeer*
+
+
+ Endless loop, run in Receive Thread.
+
+
+ Internal class to encapsulate the network i/o functionality for the realtime libary.
+
+
+ used by PhotonPeer*
+
+
+ Encapsulates the network i/o functionality for the realtime library.
+
+
+ used by PhotonPeer*
+
+
+ Endless loop, run in Receive Thread.
+
+
+ Internal class to encapsulate the network i/o functionality for the realtime libary.
+
+
+ used by PhotonPeer*
+
+
+
+ Allocates a new byte[] that is the exact used length. Use GetBuffer for nonalloc operations.
+
+
+
+
+ Allocates a new byte[] that is the exact used length. Use GetBuffer for nonalloc operations.
+
+
+
+
+ The bytes between Position and Length are copied to the beginning of the buffer. Length decreased by Position. Position set to 0.
+
+
+
+
+ Brings StreamBuffer to the state as after writing of 'length' bytes. Returned buffer and offset can be used to actually fill "written" segment with data.
+
+
+
+
+ Remaining bytes in this StreamBuffer. Returns 0 if len - pos is less than 0.
+
+
+
+
+ Sets stream length. If current position is greater than specified value, it's set to the value.
+
+
+ SetLength(0) resets the stream to initial state but preserves underlying byte[] buffer.
+
+
+
+
+ Guarantees that the buffer is at least neededSize bytes.
+
+
+
+
+ Contains several (more or less) useful static methods, mostly used for debugging.
+
+
+
+
+ Gets the local machine's "milliseconds since start" value (precision is described in remarks).
+
+
+ This method uses Environment.TickCount (cheap but with only 16ms precision).
+ PhotonPeer.LocalMsTimestampDelegate is available to set the delegate (unless already connected).
+
+ Fraction of the current time in Milliseconds (this is not a proper datetime timestamp).
+
+
+
+ Creates a background thread that calls the passed function in intervals, as long as that returns true.
+
+
+ With StopBackgroundCalls, you can stop threads started with this method.
+ The resulting ThreadAbortException is caught and discarded.
+
+ The function to call. Must return true, if it should be called again. Returning false ends the thread.
+ Milliseconds to sleep between calls of myThread. Default: 100ms.
+ An optional name for the task to help debugging. Null or empty won't set the thread.Name.
+
+
+
+ Calls Abort on the thread with the given id (= index of the thread list)
+
+
+ The resulting ThreadAbortException is caught and discarded.
+
+ The unique ID of the thread.
+ True if the thread is canceled and false otherwise, e.g. if the thread with the given ID does not exist.
+
+
+
+ Calls Abort on all threads that were started via StartBackgroundCalls.
+
+
+ The resulting ThreadAbortException is caught and discarded.
+
+ True if any thread got aborted.
+
+
+
+ Writes the exception's stack trace to the received stream.
+
+ Exception to obtain information from.
+ Output sream used to write to.
+
+
+
+ Writes the exception's stack trace to the received stream. Writes to: System.Diagnostics.Debug.
+
+ Exception to obtain information from.
+
+
+
+ This method returns a string, representing the content of the given IDictionary.
+ Returns "null" if parameter is null.
+
+ IDictionary to return as string.
+
+
+
+
+ Converts a byte-array to string (useful as debugging output).
+ Uses BitConverter.ToString(list) internally after a null-check of list.
+
+ Byte-array to convert to string.
+ Length of bytes to convert to string. If negative, list.Length is converted. Optional. Default: -1.
+
+ List of bytes as string.
+
+
+
+
+ Class to wrap static access to the random.Next() call in a thread safe manner.
+
+
+
+
+ An Attribute named "Preserve" tells Unity to not strip the code.
+
+
+
+ TCP "Package" header: 7 bytes
+
+
+ TCP "Message" header: 2 bytes
+
+
+ TCP header combined: 9 bytes
+
+
+ Defines if the (TCP) socket implementation needs to do "framing".
+ The WebSocket protocol (e.g.) includes framing, so when that is used, we set DoFraming to false.
+
+
+
+ Checks the incoming queue and Dispatches received data if possible. Returns if a Dispatch happened or
+ not, which shows if more Dispatches might be needed.
+
+
+
+
+ gathers commands from all (out)queues until udp-packet is full and sends it!
+
+
+
+ Sends a ping in intervals to keep connection alive (server will timeout connection if nothing is sent).
+ Always false in this case (local queues are ignored. true would be: "call again to send remaining data").
+
+
+ enqueues serialized operations to be sent as tcp stream / package
+
+
+ Sends a ping and modifies this.lastPingResult to avoid another ping for a while.
+
+
+ reads incoming tcp-packages to create and queue incoming commands*
+
+
+
+ Only in use as long as PhotonPeer.TrafficStatsEnabled = true;
+
+
+
+ Gets sum of outgoing operations in bytes.
+
+
+ Gets count of outgoing operations.
+
+
+ Gets sum of byte-cost of incoming operation-results.
+
+
+ Gets count of incoming operation-results.
+
+
+ Gets sum of byte-cost of incoming events.
+
+
+ Gets count of incoming events.
+
+
+
+ Gets longest time it took to complete a call to OnOperationResponse (in your code).
+ If such a callback takes long, it will lower the network performance and might lead to timeouts.
+
+
+
+ Gets OperationCode that causes the LongestOpResponseCallback. See that description.
+
+
+
+ Gets longest time a call to OnEvent (in your code) took.
+ If such a callback takes long, it will lower the network performance and might lead to timeouts.
+
+
+
+ Gets EventCode that caused the LongestEventCallback. See that description.
+
+
+
+ Gets longest time between subsequent calls to DispatchIncomgingCommands in milliseconds.
+ Note: This is not a crucial timing for the networking. Long gaps just add "local lag" to events that are available already.
+
+
+
+
+ Gets longest time between subsequent calls to SendOutgoingCommands in milliseconds.
+ Note: This is a crucial value for network stability. Without calling SendOutgoingCommands,
+ nothing will be sent to the server, who might time out this client.
+
+
+
+
+ Gets number of calls of DispatchIncomingCommands.
+
+
+
+
+ Gets number of calls of DispatchIncomingCommands.
+
+
+
+
+ Gets number of calls of SendOutgoingCommands.
+
+
+
+ Gets sum of byte-cost of all "logic level" messages.
+
+
+ Gets sum of counted "logic level" messages.
+
+
+ Gets sum of byte-cost of all incoming "logic level" messages.
+
+
+ Gets sum of counted incoming "logic level" messages.
+
+
+ Gets sum of byte-cost of all outgoing "logic level" messages (= OperationByteCount).
+
+
+ Gets sum of counted outgoing "logic level" messages (= OperationCount).
+
+
+
+ Resets the values that can be maxed out, like LongestDeltaBetweenDispatching. See remarks.
+
+
+ Set to 0: LongestDeltaBetweenDispatching, LongestDeltaBetweenSending, LongestEventCallback, LongestEventCallbackCode, LongestOpResponseCallback, LongestOpResponseCallbackOpCode.
+ Also resets internal values: timeOfLastDispatchCall and timeOfLastSendCall (so intervals are tracked correctly).
+
+
+
+ Gets the byte-size of per-package headers.
+
+
+
+ Counts commands created/received by this client, ignoring repeats (out command count can be higher due to repeats).
+
+
+
+ Gets count of bytes as traffic, excluding UDP/TCP headers (42 bytes / x bytes).
+
+
+ Timestamp of the last incoming ACK that has been read (every PhotonPeer.TimePingInterval milliseconds this client sends a PING which must be ACKd).
+
+
+ Timestamp of last incoming reliable command (every second we expect a PING).
+
+
+
diff --git a/Assets/Photon/PhotonLibs/Photon3Unity3D.xml.meta b/Assets/Photon/PhotonLibs/Photon3Unity3D.xml.meta
new file mode 100644
index 00000000..671d8243
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/Photon3Unity3D.xml.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 8d4f08d435c4b6343969d8af249460ff
+labels:
+- ExitGames
+- PUN
+- Photon
+- Networking
+TextScriptImporter:
+ userData:
diff --git a/Assets/Photon/PhotonLibs/WebSocket.meta b/Assets/Photon/PhotonLibs/WebSocket.meta
new file mode 100644
index 00000000..a02cf77c
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/WebSocket.meta
@@ -0,0 +1,5 @@
+fileFormatVersion: 2
+guid: 2f243ce0406bd1c40a9ff5fc2d78d905
+folderAsset: yes
+DefaultImporter:
+ userData:
diff --git a/Assets/Photon/PhotonLibs/WebSocket/SocketWebTcp.cs b/Assets/Photon/PhotonLibs/WebSocket/SocketWebTcp.cs
new file mode 100644
index 00000000..24b5e1f8
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/WebSocket/SocketWebTcp.cs
@@ -0,0 +1,433 @@
+#if UNITY_WEBGL || WEBSOCKET || WEBSOCKET_PROXYCONFIG
+
+// --------------------------------------------------------------------------------------------------------------------
+//
+// Copyright (c) Exit Games GmbH. All rights reserved.
+//
+//
+// Internal class to encapsulate the network i/o functionality for the realtime library.
+//
+// developer@exitgames.com
+// --------------------------------------------------------------------------------------------------------------------
+
+
+namespace ExitGames.Client.Photon
+{
+ using System;
+ using System.Collections;
+ using UnityEngine;
+ using SupportClassPun = SupportClass;
+
+
+ ///
+ /// Yield Instruction to Wait for real seconds. Very important to keep connection working if Time.TimeScale is altered, we still want accurate network events
+ ///
+ public sealed class WaitForRealSeconds : CustomYieldInstruction
+ {
+ private readonly float _endTime;
+
+ public override bool keepWaiting
+ {
+ get { return this._endTime > Time.realtimeSinceStartup; }
+ }
+
+ public WaitForRealSeconds(float seconds)
+ {
+ this._endTime = Time.realtimeSinceStartup + seconds;
+ }
+ }
+
+
+ ///
+ /// Internal class to encapsulate the network i/o functionality for the realtime libary.
+ ///
+ public class SocketWebTcp : IPhotonSocket, IDisposable
+ {
+ private WebSocket sock;
+
+ private readonly object syncer = new object();
+
+ public SocketWebTcp(PeerBase npeer) : base(npeer)
+ {
+ this.ServerAddress = npeer.ServerAddress;
+ this.ProxyServerAddress = npeer.ProxyServerAddress;
+ if (this.ReportDebugOfLevel(DebugLevel.INFO))
+ {
+ this.Listener.DebugReturn(DebugLevel.INFO, "new SocketWebTcp() for Unity. Server: " + this.ServerAddress + (String.IsNullOrEmpty(this.ProxyServerAddress) ? "" : ", Proxy: " + this.ProxyServerAddress));
+ }
+
+ //this.Protocol = ConnectionProtocol.WebSocket;
+ this.PollReceive = false;
+ }
+
+ public void Dispose()
+ {
+ this.State = PhotonSocketState.Disconnecting;
+
+ if (this.sock != null)
+ {
+ try
+ {
+ if (this.sock.Connected)
+ {
+ this.sock.Close();
+ }
+ }
+ catch (Exception ex)
+ {
+ this.EnqueueDebugReturn(DebugLevel.INFO, "Exception in SocketWebTcp.Dispose(): " + ex);
+ }
+ }
+
+ this.sock = null;
+ this.State = PhotonSocketState.Disconnected;
+ }
+
+ GameObject websocketConnectionObject;
+
+ public override bool Connect()
+ {
+ //bool baseOk = base.Connect();
+ //if (!baseOk)
+ //{
+ // return false;
+ //}
+
+
+ this.State = PhotonSocketState.Connecting;
+
+
+ if (this.websocketConnectionObject != null)
+ {
+ UnityEngine.Object.Destroy(this.websocketConnectionObject);
+ }
+
+ this.websocketConnectionObject = new GameObject("websocketConnectionObject");
+ MonoBehaviour mb = this.websocketConnectionObject.AddComponent();
+ this.websocketConnectionObject.hideFlags = HideFlags.HideInHierarchy;
+ UnityEngine.Object.DontDestroyOnLoad(this.websocketConnectionObject);
+
+
+ this.ConnectAddress += "&IPv6"; // this makes the Photon Server return a host name for the next server (NS points to MS and MS points to GS)
+
+
+ // earlier, we read the proxy address/scheme and failed to connect entirely, if that wasn't successful...
+ // it was either successful (using the resulting proxy address) or no connect at all...
+
+ // we want:
+ // WITH support: fail if the scheme is wrong or use it if possible
+ // WITHOUT support: use proxy address, if it's a direct value (not a scheme we provide) or fail if it's a scheme
+
+ string proxyServerAddress;
+ if (!this.ReadProxyConfigScheme(this.ProxyServerAddress, this.ServerAddress, out proxyServerAddress))
+ {
+ this.Listener.DebugReturn(DebugLevel.INFO, "ReadProxyConfigScheme() failed. Using no proxy.");
+ }
+
+
+ try
+ {
+ this.sock = new WebSocket(new Uri(this.ConnectAddress), proxyServerAddress, this.SerializationProtocol);
+ this.sock.DebugReturn = (DebugLevel l, string s) =>
+ {
+ if (this.State != PhotonSocketState.Disconnected)
+ {
+ this.Listener.DebugReturn(l, this.State + " " + s);
+ }
+ };
+
+ this.sock.Connect();
+ mb.StartCoroutine(this.ReceiveLoop());
+
+ return true;
+ }
+ catch (Exception e)
+ {
+ this.Listener.DebugReturn(DebugLevel.ERROR, "SocketWebTcp.Connect() caught exception: " + e);
+ return false;
+ }
+ }
+
+
+ ///
+ /// Attempts to read a proxy configuration defined by a address prefix. Only available to Industries Circle members on demand.
+ ///
+ ///
+ /// Extended proxy support is available to Industries Circle members. Where available, proxy addresses may be defined as 'auto:', 'pac:' or 'system:'.
+ /// In all other cases, the proxy address is used as is and fails to read configs (if one of the listed schemes is used).
+ ///
+ /// Requires file ProxyAutoConfig.cs and compile define: WEBSOCKET_PROXYCONFIG_SUPPORT.
+ ///
+ /// Proxy address from the server configuration.
+ /// Url to connect to (one of the Photon servers).
+ /// Resulting proxy URL to use.
+ /// False if there is some error and the resulting proxy address should not be used.
+ private bool ReadProxyConfigScheme(string proxyAddress, string url, out string proxyUrl)
+ {
+ proxyUrl = null;
+
+ #if !WEBSOCKET_PROXYCONFIG
+
+ if (!string.IsNullOrEmpty(proxyAddress))
+ {
+ if (proxyAddress.StartsWith("auto:") || proxyAddress.StartsWith("pac:") || proxyAddress.StartsWith("system:"))
+ {
+ this.Listener.DebugReturn(DebugLevel.WARNING, "Proxy configuration via auto, pac or system is only supported with the WEBSOCKET_PROXYCONFIG define. Using no proxy instead.");
+ return true;
+ }
+ proxyUrl = proxyAddress;
+ }
+
+ return true;
+
+ #else
+
+ if (!string.IsNullOrEmpty(proxyAddress))
+ {
+ var httpUrl = url.ToString().Replace("ws://", "http://").Replace("wss://", "https://"); // http(s) schema required in GetProxyForUrlUsingPac call
+ bool auto = proxyAddress.StartsWith("auto:", StringComparison.InvariantCultureIgnoreCase);
+ bool pac = proxyAddress.StartsWith("pac:", StringComparison.InvariantCultureIgnoreCase);
+
+ if (auto || pac)
+ {
+ string pacUrl = "";
+ if (pac)
+ {
+ pacUrl = proxyAddress.Substring(4);
+ if (pacUrl.IndexOf("://") == -1)
+ {
+ pacUrl = "http://" + pacUrl; //default to http
+ }
+ }
+
+ string processTypeStr = auto ? "auto detect" : "pac url " + pacUrl;
+
+ this.Listener.DebugReturn(DebugLevel.INFO, "WebSocket Proxy: " + url + " " + processTypeStr);
+
+ string errDescr = "";
+ var err = ProxyAutoConfig.GetProxyForUrlUsingPac(httpUrl, pacUrl, out proxyUrl, out errDescr);
+
+ if (err != 0)
+ {
+ this.Listener.DebugReturn(DebugLevel.ERROR, "WebSocket Proxy: " + url + " " + processTypeStr + " ProxyAutoConfig.GetProxyForUrlUsingPac() error: " + err + " (" + errDescr + ")");
+ return false;
+ }
+ }
+ else if (proxyAddress.StartsWith("system:", StringComparison.InvariantCultureIgnoreCase))
+ {
+ this.Listener.DebugReturn(DebugLevel.INFO, "WebSocket Proxy: " + url + " system settings");
+ string proxyAutoConfigPacUrl;
+ var err = ProxySystemSettings.GetProxy(out proxyUrl, out proxyAutoConfigPacUrl);
+ if (err != 0)
+ {
+ this.Listener.DebugReturn(DebugLevel.ERROR, "WebSocket Proxy: " + url + " system settings ProxySystemSettings.GetProxy() error: " + err);
+ return false;
+ }
+ if (proxyAutoConfigPacUrl != null)
+ {
+ if (proxyAutoConfigPacUrl.IndexOf("://") == -1)
+ {
+ proxyAutoConfigPacUrl = "http://" + proxyAutoConfigPacUrl; //default to http
+ }
+ this.Listener.DebugReturn(DebugLevel.INFO, "WebSocket Proxy: " + url + " system settings AutoConfigURL: " + proxyAutoConfigPacUrl);
+ string errDescr = "";
+ err = ProxyAutoConfig.GetProxyForUrlUsingPac(httpUrl, proxyAutoConfigPacUrl, out proxyUrl, out errDescr);
+
+ if (err != 0)
+ {
+ this.Listener.DebugReturn(DebugLevel.ERROR, "WebSocket Proxy: " + url + " system settings AutoConfigURLerror: " + err + " (" + errDescr + ")");
+ return false;
+ }
+ }
+ }
+ else
+ {
+ proxyUrl = proxyAddress;
+ }
+
+ this.Listener.DebugReturn(DebugLevel.INFO, "WebSocket Proxy: " + url + " -> " + (string.IsNullOrEmpty(proxyUrl) ? "DIRECT" : "PROXY " + proxyUrl));
+ }
+
+ return true;
+ #endif
+ }
+
+
+
+ public override bool Disconnect()
+ {
+ if (this.ReportDebugOfLevel(DebugLevel.INFO))
+ {
+ this.Listener.DebugReturn(DebugLevel.INFO, "SocketWebTcp.Disconnect()");
+ }
+
+ this.State = PhotonSocketState.Disconnecting;
+
+ lock (this.syncer)
+ {
+ if (this.sock != null)
+ {
+ try
+ {
+ this.sock.Close();
+ }
+ catch (Exception ex)
+ {
+ this.Listener.DebugReturn(DebugLevel.ERROR, "Exception in SocketWebTcp.Disconnect(): " + ex);
+ }
+
+ this.sock = null;
+ }
+ }
+
+ if (this.websocketConnectionObject != null)
+ {
+ UnityEngine.Object.Destroy(this.websocketConnectionObject);
+ }
+
+ this.State = PhotonSocketState.Disconnected;
+ return true;
+ }
+
+ ///
+ /// used by TPeer*
+ ///
+ public override PhotonSocketError Send(byte[] data, int length)
+ {
+ if (this.State != PhotonSocketState.Connected)
+ {
+ return PhotonSocketError.Skipped;
+ }
+
+ try
+ {
+ if (data.Length > length)
+ {
+ byte[] trimmedData = new byte[length];
+ Buffer.BlockCopy(data, 0, trimmedData, 0, length);
+ data = trimmedData;
+ }
+
+ //if (this.ReportDebugOfLevel(DebugLevel.ALL))
+ //{
+ // this.Listener.DebugReturn(DebugLevel.ALL, "Sending: " + SupportClassPun.ByteArrayToString(data));
+ //}
+
+ if (this.sock != null)
+ {
+ this.sock.Send(data);
+ }
+ }
+ catch (Exception e)
+ {
+ this.Listener.DebugReturn(DebugLevel.ERROR, "Cannot send to: " + this.ServerAddress + ". " + e.Message);
+
+ this.HandleException(StatusCode.Exception);
+ return PhotonSocketError.Exception;
+ }
+
+ return PhotonSocketError.Success;
+ }
+
+ public override PhotonSocketError Receive(out byte[] data)
+ {
+ data = null;
+ return PhotonSocketError.NoData;
+ }
+
+
+ internal const int ALL_HEADER_BYTES = 9;
+ internal const int TCP_HEADER_BYTES = 7;
+ internal const int MSG_HEADER_BYTES = 2;
+
+ public IEnumerator ReceiveLoop()
+ {
+ //this.Listener.DebugReturn(DebugLevel.INFO, "ReceiveLoop()");
+ if (this.sock != null)
+ {
+ while (this.sock != null && !this.sock.Connected && this.sock.Error == null)
+ {
+ yield return new WaitForRealSeconds(0.1f);
+ }
+
+ if (this.sock != null)
+ {
+ if (this.sock.Error != null)
+ {
+ this.Listener.DebugReturn(DebugLevel.ERROR, "Exiting receive thread. Server: " + this.ServerAddress + " Error: " + this.sock.Error);
+ this.HandleException(StatusCode.ExceptionOnConnect);
+ }
+ else
+ {
+ // connected
+ if (this.ReportDebugOfLevel(DebugLevel.ALL))
+ {
+ this.Listener.DebugReturn(DebugLevel.ALL, "Receiving by websocket. this.State: " + this.State);
+ }
+
+ this.State = PhotonSocketState.Connected;
+ this.peerBase.OnConnect();
+
+ while (this.State == PhotonSocketState.Connected)
+ {
+ if (this.sock != null)
+ {
+ if (this.sock.Error != null)
+ {
+ this.Listener.DebugReturn(DebugLevel.ERROR, "Exiting receive thread (inside loop). Server: " + this.ServerAddress + " Error: " + this.sock.Error);
+ this.HandleException(StatusCode.ExceptionOnReceive);
+ break;
+ }
+ else
+ {
+ byte[] inBuff = this.sock.Recv();
+ if (inBuff == null || inBuff.Length == 0)
+ {
+ // nothing received. wait a bit, try again
+ yield return new WaitForRealSeconds(0.02f);
+ continue;
+ }
+
+ //if (this.ReportDebugOfLevel(DebugLevel.ALL))
+ //{
+ // this.Listener.DebugReturn(DebugLevel.ALL, "TCP << " + inBuff.Length + " = " + SupportClassPun.ByteArrayToString(inBuff));
+ //}
+
+ if (inBuff.Length > 0)
+ {
+ try
+ {
+ this.HandleReceivedDatagram(inBuff, inBuff.Length, false);
+ }
+ catch (Exception e)
+ {
+ if (this.State != PhotonSocketState.Disconnecting && this.State != PhotonSocketState.Disconnected)
+ {
+ if (this.ReportDebugOfLevel(DebugLevel.ERROR))
+ {
+ this.EnqueueDebugReturn(DebugLevel.ERROR, "Receive issue. State: " + this.State + ". Server: '" + this.ServerAddress + "' Exception: " + e);
+ }
+
+ this.HandleException(StatusCode.ExceptionOnReceive);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ this.Disconnect();
+ }
+
+
+ private class MonoBehaviourExt : MonoBehaviour
+ {
+ }
+ }
+}
+
+
+#endif
\ No newline at end of file
diff --git a/Assets/Photon/PhotonLibs/WebSocket/SocketWebTcp.cs.meta b/Assets/Photon/PhotonLibs/WebSocket/SocketWebTcp.cs.meta
new file mode 100644
index 00000000..7f04d3c3
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/WebSocket/SocketWebTcp.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: ac953d6a57a9ea94e96ec689598995d5
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/Photon/PhotonLibs/WebSocket/WebSocket.cs b/Assets/Photon/PhotonLibs/WebSocket/WebSocket.cs
new file mode 100644
index 00000000..e8a4feba
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/WebSocket/WebSocket.cs
@@ -0,0 +1,252 @@
+#if UNITY_WEBGL || WEBSOCKET || WEBSOCKET_PROXYCONFIG
+
+// --------------------------------------------------------------------------------------------------------------------
+//
+// Provided originally by Unity to cover WebSocket support in WebGL and the Editor. Modified by Exit Games GmbH.
+//
+// developer@exitgames.com
+// --------------------------------------------------------------------------------------------------------------------
+
+
+namespace ExitGames.Client.Photon
+{
+ using System;
+ using System.Text;
+ using ExitGames.Client.Photon;
+
+ #if UNITY_WEBGL && !UNITY_EDITOR
+ using System.Runtime.InteropServices;
+ #else
+ using WebSocketSharp;
+ using System.Collections.Generic;
+ using System.Security.Authentication;
+ #endif
+
+
+ public class WebSocket
+ {
+ private Uri mUrl;
+ private string mProxyAddress;
+
+ /// Photon uses this to agree on a serialization protocol. Either: GpBinaryV16 or GpBinaryV18. Based on enum SerializationProtocol.
+ private string protocols = "GpBinaryV16";
+
+ public Action DebugReturn { get; set; }
+
+ public WebSocket(Uri url, string proxyAddress, string protocols = null)
+ {
+ this.mUrl = url;
+ this.mProxyAddress = proxyAddress;
+
+ if (protocols != null)
+ {
+ this.protocols = protocols;
+ }
+
+ string protocol = mUrl.Scheme;
+ if (!protocol.Equals("ws") && !protocol.Equals("wss"))
+ {
+ throw new ArgumentException("Unsupported protocol: " + protocol);
+ }
+ }
+
+ public string ProxyAddress
+ {
+ get { return mProxyAddress; }
+ }
+
+ public void SendString(string str)
+ {
+ Send(Encoding.UTF8.GetBytes(str));
+ }
+
+ public string RecvString()
+ {
+ byte[] retval = Recv();
+ if (retval == null)
+ return null;
+ return Encoding.UTF8.GetString(retval);
+ }
+
+ #if UNITY_WEBGL && !UNITY_EDITOR
+ [DllImport("__Internal")]
+ private static extern int SocketCreate (string url, string protocols);
+
+ [DllImport("__Internal")]
+ private static extern int SocketState (int socketInstance);
+
+ [DllImport("__Internal")]
+ private static extern void SocketSend (int socketInstance, byte[] ptr, int length);
+
+ [DllImport("__Internal")]
+ private static extern void SocketRecv (int socketInstance, byte[] ptr, int length);
+
+ [DllImport("__Internal")]
+ private static extern int SocketRecvLength (int socketInstance);
+
+ [DllImport("__Internal")]
+ private static extern void SocketClose (int socketInstance);
+
+ [DllImport("__Internal")]
+ private static extern int SocketError (int socketInstance, byte[] ptr, int length);
+
+ int m_NativeRef = 0;
+
+ public void Send(byte[] buffer)
+ {
+ SocketSend (m_NativeRef, buffer, buffer.Length);
+ }
+
+ public byte[] Recv()
+ {
+ int length = SocketRecvLength (m_NativeRef);
+ if (length == 0)
+ return null;
+ byte[] buffer = new byte[length];
+ SocketRecv (m_NativeRef, buffer, length);
+ return buffer;
+ }
+
+ public void Connect()
+ {
+ m_NativeRef = SocketCreate (mUrl.ToString(), this.protocols);
+
+ //while (SocketState(m_NativeRef) == 0)
+ // yield return 0;
+ }
+
+ public void Close()
+ {
+ SocketClose(m_NativeRef);
+ }
+
+ public bool Connected
+ {
+ get { return SocketState(m_NativeRef) != 0; }
+ }
+
+ public string Error
+ {
+ get {
+ const int bufsize = 1024;
+ byte[] buffer = new byte[bufsize];
+ int result = SocketError (m_NativeRef, buffer, bufsize);
+
+ if (result == 0)
+ return null;
+
+ return Encoding.UTF8.GetString (buffer);
+ }
+ }
+ #else
+ WebSocketSharp.WebSocket m_Socket;
+ Queue m_Messages = new Queue();
+ bool m_IsConnected = false;
+ string m_Error = null;
+
+
+ public void Connect()
+ {
+ m_Socket = new WebSocketSharp.WebSocket(mUrl.ToString(), new string[] {this.protocols});
+ m_Socket.Log.Output = (ld, f) =>
+ {
+ var s = string.Format("WebSocketSharp: {0}", ld.Message);
+ switch (ld.Level)
+ {
+ case WebSocketSharp.LogLevel.Trace:
+ case WebSocketSharp.LogLevel.Debug:
+ DebugReturn(DebugLevel.ALL, s);
+ break;
+ case WebSocketSharp.LogLevel.Info:
+ DebugReturn(DebugLevel.INFO, s);
+ break;
+ case WebSocketSharp.LogLevel.Warn:
+ DebugReturn(DebugLevel.WARNING, s);
+ break;
+ case WebSocketSharp.LogLevel.Error:
+ case WebSocketSharp.LogLevel.Fatal:
+ DebugReturn(DebugLevel.ERROR, s);
+ break;
+ }
+ };
+
+ string user = null;
+ string pass = null;
+
+ if (!String.IsNullOrEmpty(mProxyAddress))
+ {
+ var authDelim = mProxyAddress.IndexOf("@");
+ if (authDelim != -1)
+ {
+ user = mProxyAddress.Substring(0, authDelim);
+ mProxyAddress = mProxyAddress.Substring(authDelim + 1);
+ var passDelim = user.IndexOf(":");
+ if (passDelim != -1)
+ {
+ pass = user.Substring(passDelim + 1);
+ user = user.Substring(0, passDelim);
+ }
+ }
+
+ // throws an exception, if scheme not specified
+ m_Socket.SetProxy("http://" + mProxyAddress, user, pass);
+ }
+
+ if (m_Socket.IsSecure)
+ {
+ m_Socket.SslConfiguration.EnabledSslProtocols = m_Socket.SslConfiguration.EnabledSslProtocols | (SslProtocols)(3072 | 768);
+ }
+
+ m_Socket.OnMessage += (sender, e) => { m_Messages.Enqueue(e.RawData); };
+ m_Socket.OnOpen += (sender, e) => { m_IsConnected = true; };
+ m_Socket.OnError += (sender, e) => { m_Error = e.Message + (e.Exception == null ? "" : " / " + e.Exception); };
+
+ this.m_Socket.OnClose += SocketOnClose;
+
+ m_Socket.ConnectAsync();
+ }
+
+ private void SocketOnClose(object sender, CloseEventArgs e)
+ {
+ //UnityEngine.Debug.Log(e.Code.ToString());
+
+ // this code is used for cases when the socket failed to get created (specifically used to detect "blocked by Windows firewall")
+ // for some reason this situation is not calling OnError
+ if (e.Code == 1006)
+ {
+ this.m_Error = e.Reason;
+ this.m_IsConnected = false;
+ }
+ }
+
+ public bool Connected
+ {
+ get { return m_IsConnected; }
+ }
+
+
+ public void Send(byte[] buffer)
+ {
+ m_Socket.Send(buffer);
+ }
+
+ public byte[] Recv()
+ {
+ if (m_Messages.Count == 0)
+ return null;
+ return m_Messages.Dequeue();
+ }
+
+ public void Close()
+ {
+ m_Socket.Close();
+ }
+
+ public string Error
+ {
+ get { return m_Error; }
+ }
+ #endif
+ }
+}
+#endif
\ No newline at end of file
diff --git a/Assets/Photon/PhotonLibs/WebSocket/WebSocket.cs.meta b/Assets/Photon/PhotonLibs/WebSocket/WebSocket.cs.meta
new file mode 100644
index 00000000..241c9218
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/WebSocket/WebSocket.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b1bad04f7805f764dba77f0d4518e0f0
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/Photon/PhotonLibs/WebSocket/WebSocket.jslib b/Assets/Photon/PhotonLibs/WebSocket/WebSocket.jslib
new file mode 100644
index 00000000..a078b8e8
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/WebSocket/WebSocket.jslib
@@ -0,0 +1,117 @@
+var LibraryWebSockets = {
+$webSocketInstances: [],
+
+SocketCreate: function(url, protocols)
+{
+ var str = UTF8ToString(url);
+ var prot = UTF8ToString(protocols);
+ var socket = {
+ socket: new WebSocket(str, [prot]),
+ buffer: new Uint8Array(0),
+ error: null,
+ messages: []
+ }
+ socket.socket.binaryType = 'arraybuffer';
+ socket.socket.onmessage = function (e) {
+// if (e.data instanceof Blob)
+// {
+// var reader = new FileReader();
+// reader.addEventListener("loadend", function() {
+// var array = new Uint8Array(reader.result);
+// socket.messages.push(array);
+// });
+// reader.readAsArrayBuffer(e.data);
+// }
+ if (e.data instanceof ArrayBuffer)
+ {
+ var array = new Uint8Array(e.data);
+ socket.messages.push(array);
+ }
+ };
+ socket.socket.onclose = function (e) {
+ if (e.code != 1000)
+ {
+ if (e.reason != null && e.reason.length > 0)
+ socket.error = e.reason;
+ else
+ {
+ switch (e.code)
+ {
+ case 1001:
+ socket.error = "Endpoint going away.";
+ break;
+ case 1002:
+ socket.error = "Protocol error.";
+ break;
+ case 1003:
+ socket.error = "Unsupported message.";
+ break;
+ case 1005:
+ socket.error = "No status.";
+ break;
+ case 1006:
+ socket.error = "Abnormal disconnection.";
+ break;
+ case 1009:
+ socket.error = "Data frame too large.";
+ break;
+ default:
+ socket.error = "Error "+e.code;
+ }
+ }
+ }
+ }
+ var instance = webSocketInstances.push(socket) - 1;
+ return instance;
+},
+
+SocketState: function (socketInstance)
+{
+ var socket = webSocketInstances[socketInstance];
+ return socket.socket.readyState;
+},
+
+SocketError: function (socketInstance, ptr, bufsize)
+{
+ var socket = webSocketInstances[socketInstance];
+ if (socket.error == null)
+ return 0;
+ var str = socket.error.slice(0, Math.max(0, bufsize - 1));
+ writeStringToMemory(str, ptr, false);
+ return 1;
+},
+
+SocketSend: function (socketInstance, ptr, length)
+{
+ var socket = webSocketInstances[socketInstance];
+ socket.socket.send (HEAPU8.buffer.slice(ptr, ptr+length));
+},
+
+SocketRecvLength: function(socketInstance)
+{
+ var socket = webSocketInstances[socketInstance];
+ if (socket.messages.length == 0)
+ return 0;
+ return socket.messages[0].length;
+},
+
+SocketRecv: function (socketInstance, ptr, length)
+{
+ var socket = webSocketInstances[socketInstance];
+ if (socket.messages.length == 0)
+ return 0;
+ if (socket.messages[0].length > length)
+ return 0;
+ HEAPU8.set(socket.messages[0], ptr);
+ socket.messages = socket.messages.slice(1);
+},
+
+SocketClose: function (socketInstance)
+{
+ var socket = webSocketInstances[socketInstance];
+ socket.socket.close();
+}
+};
+
+autoAddDeps(LibraryWebSockets, '$webSocketInstances');
+mergeInto(LibraryManager.library, LibraryWebSockets);
diff --git a/Assets/Photon/PhotonLibs/WebSocket/WebSocket.jslib.meta b/Assets/Photon/PhotonLibs/WebSocket/WebSocket.jslib.meta
new file mode 100644
index 00000000..e5a1c7d0
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/WebSocket/WebSocket.jslib.meta
@@ -0,0 +1,21 @@
+fileFormatVersion: 2
+guid: 04bb5f307f2e48b4fbaa6da865fd4091
+PluginImporter:
+ serializedVersion: 1
+ iconMap: {}
+ executionOrder: {}
+ isPreloaded: 0
+ platformData:
+ Any:
+ enabled: 0
+ settings: {}
+ Editor:
+ enabled: 0
+ settings:
+ DefaultValueInitialized: true
+ WebGL:
+ enabled: 1
+ settings: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonLibs/WebSocket/websocket-sharp.README b/Assets/Photon/PhotonLibs/WebSocket/websocket-sharp.README
new file mode 100644
index 00000000..55690fba
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/WebSocket/websocket-sharp.README
@@ -0,0 +1,5 @@
+
+UPDATED: WebSocket/websocket-sharp.dll from our own Git Fork. Commit: 77f74bd
+forked from https://github.com/sta/websocket-sharp.git
+
+websocket-sharp is provided under The MIT License as mentioned here: https://github.com/sta/websocket-sharp#license
\ No newline at end of file
diff --git a/Assets/Photon/PhotonLibs/WebSocket/websocket-sharp.README.meta b/Assets/Photon/PhotonLibs/WebSocket/websocket-sharp.README.meta
new file mode 100644
index 00000000..47cc15d3
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/WebSocket/websocket-sharp.README.meta
@@ -0,0 +1,4 @@
+fileFormatVersion: 2
+guid: 3e262c2b04eaa8440987b50a91e86674
+DefaultImporter:
+ userData:
diff --git a/Assets/Photon/PhotonLibs/WebSocket/websocket-sharp.dll b/Assets/Photon/PhotonLibs/WebSocket/websocket-sharp.dll
new file mode 100644
index 00000000..c0414205
Binary files /dev/null and b/Assets/Photon/PhotonLibs/WebSocket/websocket-sharp.dll differ
diff --git a/Assets/Photon/PhotonLibs/WebSocket/websocket-sharp.dll.meta b/Assets/Photon/PhotonLibs/WebSocket/websocket-sharp.dll.meta
new file mode 100644
index 00000000..099f3fc6
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/WebSocket/websocket-sharp.dll.meta
@@ -0,0 +1,137 @@
+fileFormatVersion: 2
+guid: 748eb70bc0d7515498ef73fed155520a
+PluginImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ iconMap: {}
+ executionOrder: {}
+ isPreloaded: 0
+ isOverridable: 0
+ platformData:
+ - first:
+ '': Any
+ second:
+ enabled: 0
+ settings:
+ Exclude Android: 0
+ Exclude Editor: 0
+ Exclude Linux: 0
+ Exclude Linux64: 0
+ Exclude LinuxUniversal: 0
+ Exclude OSXUniversal: 0
+ Exclude WebGL: 1
+ Exclude Win: 0
+ Exclude Win64: 0
+ Exclude WindowsStoreApps: 1
+ - first:
+ '': OSXIntel
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ - first:
+ '': OSXIntel64
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ - first:
+ '': WP8
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ DontProcess: False
+ PlaceholderPath:
+ - first:
+ Android: Android
+ second:
+ enabled: 1
+ settings:
+ CPU: ARMv7
+ - first:
+ Any:
+ second:
+ enabled: 1
+ settings: {}
+ - first:
+ Editor: Editor
+ second:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ DefaultValueInitialized: true
+ OS: AnyOS
+ - first:
+ Facebook: Win
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ - first:
+ Facebook: Win64
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ - first:
+ Standalone: Linux
+ second:
+ enabled: 1
+ settings:
+ CPU: x86
+ - first:
+ Standalone: Linux64
+ second:
+ enabled: 1
+ settings:
+ CPU: x86_64
+ - first:
+ Standalone: LinuxUniversal
+ second:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ - first:
+ Standalone: OSXUniversal
+ second:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ - first:
+ Standalone: Win
+ second:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ - first:
+ Standalone: Win64
+ second:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ - first:
+ Windows Store Apps: WindowsStoreApps
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ DontProcess: False
+ PlaceholderPath:
+ SDK: AnySDK
+ ScriptingBackend: AnyScriptingBackend
+ - first:
+ XboxOne: XboxOne
+ second:
+ enabled: 0
+ settings: {}
+ - first:
+ iPhone: iOS
+ second:
+ enabled: 0
+ settings:
+ CompileFlags:
+ FrameworkDependencies:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonLibs/changes-library.txt b/Assets/Photon/PhotonLibs/changes-library.txt
new file mode 100644
index 00000000..5ef74b35
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/changes-library.txt
@@ -0,0 +1,1847 @@
+
+Photon C# Client Library - Changelog
+Exit Games GmbH - www.photonengine.com - forum.photonengine.com
+
+
+Version 4.1.6.17 (02. August 2022 - rev6472)
+ Changed: SequenceDeltaLimitResends to 100 and SequenceDeltaLimitSends to 75.
+
+Version 4.1.6.16 (20. June 2022)
+ Note: No notable changes.
+
+Version 4.1.6.15 (02. June 2022)
+ Note: No notable changes.
+
+Version 4.1.6.14 (26. April 2022 - rev6414)
+ Fixed: WSS PhotonClientWebSocket blocking the main thread when sending isn't possible. Without loss. This affects the RTT however.
+ Changed: PhotonClientWebSocket will return PhotonSocketError.Busy, if previous Task is not completed yet.
+ Changed: TPeer.SendData passes the inner result code (PhotonSocketError) to the calling method.
+ Changed: TPeer.SendOutgoingCommands() will skip sending, if SendData() returns PhotonSocketError.Busy.
+
+Version 4.1.6.13 (29. March 2022 - rev6399)
+ Fixed: Fragment length for Datagram Encryption gets recalculated when the encryption gets enabled.
+ Fixed: Resends will stop early, if the mtu-udpBufferIndex is less than 80.
+ Changed: Read for a specified GpType. If it is unknown, this will throw a InvalidDataException instead of reading data in undefined ways. The server is sending us the types, so in regular use, this should actually not happen. It is however cleaner to debug data this way.
+ Fixed: Several comments and log and exception messages.
+ Changed: Protocol18.WriteCustomTypeBody to use the size written by the serialize-method, instead of using the returned value.
+ Added: Short delay before closing a socket to give disconnect messages a better chance of being sent out.
+
+Version 4.1.6.12 (30. November 2021 - rev6299)
+ Changed: EnetPeer.Disconnect() sets state Disconnecting immediately.
+ Changed: EnetPeer.ReceiveIncomingCommands() will skip incoming datagrams when in state Disconnected.
+ Changed: EnetPeer.ReceiveIncomingCommands() checks the incoming challenge as early as possible to avoid using data from outdated connections.
+ Changed: How Datagram Encryption is enabled, when the first encrypted datagram arrives.
+ Changed: Some logged messages.
+ Added: Parameter "length" to SupportClass.ByteArrayToString to convert only a part of a byte[] to string.
+ Internal: Changed conversion from ParameterDictionary to Dictionary so that StructWrapper does not leak to resulting Dictionary.
+
+Version 4.1.6.11 (23. November 2021 - rev6288)
+ Fixed: Payload encryption initialization (without DiffieHellman) for TCP connection.
+ Fixed: Protocol16.DeserializeCustom() to check if length of read bytes is available (else, a byte[] is returned).
+ Changed: Custom Type arrays will return UnknownType[] if the array's item-type is unknown. If the custom type is known but items do not read properly, they will be null.
+ Added: Checks if each generated Custom Type instance can be assigned to the Custom Type array (and skips those that are null or can't be assigned).
+ Changed: Protocol18Read.ReadCustomType() and ReadCustomTypeArray() to throw error for size < 0. In that case, it is not possible to continue reading and the data is compromized.
+ Removed: Some logging code that was specific for Unity.
+ Removed: Exception handling for OnEvent and OnOperationResponse calls. This turned out somewhat inflexible and was hiding valuable debug information. Instead of the low level try/catch, projects should wrap DispatchIncomingCommands in try/catch blocks.
+
+Version 4.1.6.10 (21. October 2021 - rev6243)
+ Fixed: ReadCustomTypeArray to return an object[], if any item in the array is unreadable. This object[] contains any properly read custom types but also items of UnknownType. This is of course likely to cause exceptions in the dispatch callbacks.
+ Added: Exception handling to OnEvent and OnOperationResponse calls.
+
+Version 4.1.6.9 (12. October 2021 - rev6231)
+ Fixed: Reliable UDP protocol to send pings, if no reliable command was acknowledged or sent recently. This bug was preventing a client timeout in some cases.
+
+Version 4.1.6.8 (30. September 2021 - rev6222)
+ Fixed: ReadCustomType to not use custom deserialization methods, should the reported size be less than available bytes.
+ Fixed: ReadCustomType and ReadCustomTypeArray to also skip custom types when size is 0.
+
+Version 4.1.6.7 (27. September 2021 - rev6214)
+ Fixed: A bug in Protocol18 reader for very long arrays.
+
+Version 4.1.6.6 (21. September 2021 - rev6204)
+ Changed: Dns resolution. It is suspected to fail sometimes due to a Mono/Unity bug (issue 6940). Changing from only attempting Dns.GetHostEntry to first attempting Dns.GetHostAddresses followed by Dns.GetHostByName in case of an Exception (yes obsolete api but maybe a different implementation).
+ Removed: C# wrapper classes for native plugins (sockets and encryption). These classes will be part of the plugin packages.
+ Changed: PhotonPeer values NativeSocketLibAvailable, NativePayloadEncryptionLibAvailable and NativeDatagramEncryptionLibAvailable are now obsolete. Unity's IL2CPP does not implement PrelinkAll in IL2CPP and we moved the wrapper classes for native libs out of the assembly.
+ Added: PayloadEncryptorType and related usage to be able to set another Payload Encryption implementation. This is only for completeness. The managed implementation, which is used by default, is fine.
+ Fixed: TrafficStatsIncoming for PhotonClientWebSocket (used by default in WS/WSS connections in the .Net Standard 2.0 dll).
+
+Version 4.1.6.5 (24. August 2021 - rev6181)
+ Fixed: Protocol16 to throw a NotSupportedException when a length value can not be serialized as short (as defined). This affects arrays (except byte[]), strings, hashtables, dictionaries and other variable length values.
+ Updated: C# classes to the latest state of the native PhotonEncryptorPlugin API.
+
+Version 4.1.6.4 (26. July 2021 - rev6143)
+ Changed: ByteArraySlice and ByteArraySlicePool to achieve thread safety.
+ Changed: PhotonClientWebSocket.AsyncConnectAndReceive to reuse memory. It may still grow somewhat as memory allocated for very large messages is not released but rather held to receive as big messages. This class is not used for WebGL exports.
+ Removed: Surplus logging in PhotonClientWebSocket implementation.
+ Added: Null-check in PhotonClientWebSocket.Send() if the socket may be disconnecting already. Added fitting error log.
+ Changed: TCP implementation to avoid memory allocations. It now uses a Queue which is pooled and re-used. DispatchIncomingCommands() releases the StreamBuffers back into the pool.
+ Fixed: TrafficStats counting of ping-result command size. This was still counting the buffer size instead of received-data size (usually less).
+
+Version 4.1.6.3 (24. June 2021 - rev6099)
+ Fixed: An issue with deserialization of custom types.
+
+Version 4.1.6.2 (23. June 2021 - rev6092)
+ Fixed: Potential NullReferenceException in PhotonClientWebSocket.Disconnect(). If called before the connect-flow finished, the instance was null.
+
+Version 4.1.6.1 (09. June 2021 - rev6086)
+ Fixed: TPeer.TotalPacketCount and TotalCommandsInPackets counters. They were increased in two places for the Init message.
+ Fixed: TPeer.TrafficStatsOutgoing.TotalCommandsInPackets counting in SendData, which was adding the remaining count in queues instead of +1.
+ Changed: TPeer.SendOutgoingCommands(), which will now stop sending if more than MTU size of data was sent.
+ Note: Messages are not fragmented for TCP/WSS, so they can be well over MTU size as such. But SendOutgoingCommands() will now return if there are more messages, so sending can be limited somewhat.
+ Changed: PhotonClientWebSocket will pause the task only for 50ms if nothing was received.
+ Changed: Log level of PhotonClientWebSocket incoming bytes logging. It's now level "ALL".
+
+Version 4.1.6.0 (19. May 2021 - rev6070)
+ Changed: PhotonPeer.ClientVersion is now marked as obsolete. The value should be static and so we added PhotonPeer.Version instead as replacement.
+ Internal: EnetPeer.Reset() now sets the timeoutInt = 0 and does a sentReliableCommands.Clear() instead of replacing it.
+ Changed: PhotonPeer.IsSendingOnlyAcks is now obsolete. Use SendAcksOnly() where needed.
+ Changed: EnetPeer.QueueSentCommand will not set the timeoutInt. Instead, this should be set when the next resends are checked in SendOutgoing.
+ Changed: Resends of reliable commands are now done directly, without them ever leaving the sentReliableCommands list. This has the benefit of being able to resend those commands in sequence.
+ Internal: On resend, timeoutInt becomes the lowest value found in the sentReliableCommands. It stays unchanged, if any command wasn't resent.
+ Added: SerializeCommandToBuffer, which is split out of SerializeToBuffer(Queue commandList). Allows sending single commands.
+ Changed: QueueSentCommand will not add reliable commands to the sentReliableCommands list, if the parameter signals it was in there already.
+ Changed: PepareWebSocketUrl() will now write the parameter "libversion" instead of "clientversion". Renamed according to Slack discussion.
+ Changed: PhotonPeer time keeping to use a Stopwatch per peer, instead of one in the SupportClass.
+ Changed: PeerBase now has a Stopwatch and PeerBase.timeInt will use that.
+ Removed: All internal usages of SupportClass.GetTickCount().
+ Note: Socket implementations should replace their usage of SupportClass.GetTickCount() - peerBase.timeBase with this.peerBase.timeInt.
+ Changed: PhotonPeer.LocalMsTimestampDelegate, SupportClass.IntegerMillisecondsDelegate, .IntegerMilliseconds and .GetTickCount() are obsolete now.
+ Added: EnetPeer.QUICK_RESEND_QUEUELIMIT (value: 25) to suspend quick resending if the sent-queue is larger than that value.
+ Internal: Minor changes to NCommand.
+ Added: PhotonPeer SequenceDeltaLimitSends and SequenceDeltaLimitResends to prevent sending more commands, when the server does not keep up with acknowledging them. If those values are 0, this new logic is disabled.
+ Added: EnetChannel.highestReceivedAck to keep track of the highest sequence number ACKed by the server.
+ Changed: EnetPeer.SendOutgoingCommands() and .SendAcksOnly() to implement the limit.
+
+Version 4.1.5.5 (06. May 2021 - rev6050)
+ Changed: Protocol18 ReadCustomType to no longer throw an exception when a unknown custom type arrives. Instead pass UnknownType.
+ Added: Type "UnknownType", which is used to pass not-deserialized custom types to the game logic.
+ Changed: Protocol18 ReadCustomType to use a "boundedSize" to read remaining data if the incoming size value is > remaining message data.
+ Internal: StreamBuffer.Available to get remaining bytes in buffer. Returns value >= 0.
+ Fixed: Protocol18 WriteArraySegmentByte to not write any bytes, if count is 0.
+ Fixed: Potential deserialization issues in protocol 1.6, which could be exposed to crash clients.
+ Changed: String deserialization in protocol 1.6 avoids some memory allocation.
+ Changed: String deserialization in protocol 1.6 throws a NotSupportedException if the length is negative (was never supported but now it's a clear error).
+ Changed: DeserializeDictionary in Protocol16, will no longer allow key- or value-types Dictionary or Array. Both were read incorrectly.
+ Changed: DeserializeDictionaryType in Protocol16, will no longer allow key- or value-types Dictionary or Array. Both were read incorrectly.
+ Fixed: Error message in 1.8 GetAllowedDictionaryKeyTypes.
+
+Version 4.1.5.2 (12. March 2021 - rev6017)
+ Fixed: A compatibility issue of the Native Encryptor API v2 and Unity UWP exports using the .Net Runtime as runtime. The incompatibility made the reference rewriter fail. Introduced in the Metro build of the library in v4.1.5.0.
+ Fixed: EncryptorNative will not use the new "native-to-managed callback API" when compiling for NETFX_CORE (UWP Metro).
+
+Version 4.1.5.1 (01. March 2021 - rev5999)
+ Note: Release as SDK.
+
+Version 4.1.5.1 (25. February 2021 - rev5991)
+ Fixed: Handling of IPv6 addresses (bug was introduced in v4.1.5.0).
+
+Version 4.1.5.0 (23. February 2021 - rev5986)
+ Added: Optional parameter CustomInitData to Connect() methods. This data/object is used in InitV3.
+ Changed: Parameter name for photonToken (was "customdata" or similar).
+ Internal: PrepareInitV3ConnectData(...) is now WriteInitRequest() without the bunch of parameters which were all coming from the PeerBase anyways.
+ Fixed: NonAllocDictionary.Remove will also remove the value-reference by setting a default.
+ Changed: Handling of server IP addresses. IpAddress.TryParse has a few false positives. Those are double-checked and may cause ServerAddressInvalid.
+ Changed: Failed DNS lookup uses status code: DnsExceptionOnConnect. This clarifies a set of runtime errors, which were hard to identify.
+ Added: StatusCode ServerAddressInvalid = 1050 and DnsExceptionOnConnect = 1051. Used in IPhotonPeerListener.OnStatusChanged().
+ Changed: Native Encryptor API v2 is now required. This affects native Datagram Encryption plugins (and allows GCM / Mode 13).
+ Changed: PDB files are now in "portable" format. This should be equivalent to "full" (previously used) but compatible with latest Unity versions.
+
+Version 4.1.4.9 (11. January 2021 - rev5966)
+ Fixed: EnetPeer to reset values for unsequenced commands on connect. Before, clients would send illegal command numbers after switching connections.
+ Added: Special handling for StructWrapper in DictionaryToString(). Pretty-prints type and value.
+ Added: StructWrapper.ToString() and and ParameterDictionary.ToStringFull() to simplify logging.
+ Fixed: Add overload in ParameterDictionary was sending ints to byte, rather than object.
+ Changed: NonAllocDictionary now implements IDictionary.
+ Changed: ValueIterator and KeyIterator now implement IEnumerator, System.Collections.IEnumerator.
+ Changed: PairIterator now implement IEnumerator>.
+
+Version 4.1.4.8 (03. December 2020 - rev5915)
+ Fixed: Issue with DisconnectTimeout, which could be set to int.MaxValue and force a timeout.
+ Note: The maximum value that is applied as DisconnectTimeout is now 65535 (ushort.MaxValue). Negative values set to default timeout.
+ Added: PhotonPeer.RemoveAppIdFromWebSocketPath option to skip the appid in websocket connects. Defaults to false.
+ Internal: PeerBase.PepareWebSocketUrl to skip the appid when RemoveAppIdFromWebSocketPath is true. Changed order of parameters.
+ Note: The AppId is not mandatory on the PhotonCloud but might be needed to connect to Photon OnPremise when the port does not define the app type.
+
+Version 4.1.4.7 (26. November 2020 - rev5893)
+ Fixed: PhotonClientWebSocket handling of messages > MTU. Incoming messages may be incomplete and are now reassembled. Before the fix, common result was that deserialization failed with incorrect / incomplete data.
+ Added: ExitGames.Client.Photon.Hashtable Add() and Remove() for byte keys. This makes sure ht.Add(0, obj) and ht.Remove(0) match how the access via ht[0] works.
+
+Version 4.1.4.6 (17. November 2020 - rev5865)
+ Changed: The EventData.Paramters dictionary is now readonly. It does not need to be settable and can no longer be null. So null-checks are removed.
+ Changed: If the ByteArrayPool is used for reading events, the sender's actorNumber will not longer be in the EventData parameter-table. Instead, only the Sender property is used.
+ Note: This makes receiving EventData events non-alloc by not adding the Sender key/value to the Parameters (which would box the int value).
+ Note: The EventData.Sender property was available for a while and was a better way to access the event-sender's actornumber.
+ Changed: PhotonPeer.SendOperation() and PhotonPeer.SendMessage() will now check a few conditions (is connected, etc) and call PeerBase.SerializeOperationToMessage().
+ Internal: Changed the code path for operations and messages serialization. There are lots of internal changes for this but no externals.
+ Internal: Message header length is set in EnqueueMessageAsPayload along with other updates (was in TPeer.SerializeOperationToMessage()).
+ Removed: PhotonPeer.OpCustom(), which was already obsolete for a long time.
+ Added: PeerBase.IsTransportEncrypted() to help figure out if Payload Encryption should be skipped.
+ Changed: PeerBase.SerializeMessageToMessage no longer updates the header for TCP. Done in EnqueueMessageAsPayload, used by EnqueuePhotonMessage.
+ Changed: SerializeMessageToMessage to check existing value isRawMessage instead of re-checking the condition when applying message type.
+ Fixed: Detection of Generic-Dictionary-typed arrays. Was lacking a test if the element was of type Dictionary.
+ Changed: Connect(string serverAddress, string applicationName) to call variant with proxy-support directly.
+ Updated: Connect methods and their docs.
+ Removed: More of the RHTTP support.
+ Added: DisconnectMessage deserialization and an event for this case: PhotonPeer.OnDisconnectMessage. This does not break the dll's compatibility.
+ Changed: Connect() workflow. This simplified the TPeer and EnetPeer somewhat and unifies some actions that were scattered in the classes hierarchy.
+ Changed: PhotonPeer to create the SocketImplementationConfig in the constructor. Connect() will use this to create the actual IPhotonSocket.
+ Changed: TPeer.Connect and EnetPeer.Connect are a bit simpler now (don't have to create the actual IPhotonSocket).
+ Removed: PeerBase.SocketImplementation member.
+ Changed: Setter and handling for the Version.clientVersion (conditional for SERVERSDK).
+ Changed: Version.clientVersion is readonly, unless SERVERSDK is defined.
+ Changed: CreatePeerBase() will only create a new EnetPeer or TPeer on demand (if the protocol changed or there was no PeerBase implementation).
+ Added: Special treatment for byte-typed keys to the Photon Hashtable to avoid boxing. Pre-boxed items are stored in a static array.
+ Added: NonAllocDictionary support in SupportClass (DictionaryToString()).
+ Added: ParameterDictionary as type and support to de/serialize it.
+ Note: This is a WiP commit to get LoadBalancing non-allow (or less alloc).
+ Added: PhotonPeer.WrapIncomingStructs to control how to de-serialize responses and events. Setting this requires adjusted code.
+ Note: As long as WrapIncomingStructs is not set, code changes are not mandatory.
+ Fixed: Error message in SerializeDictionaryHeader to include the type of the value which failed (it was logging the key's type).
+ Changed: The PhotonClientWebSocket does a DNS request before connecting, to figure out if IPv6 should be requested by Photon servers.
+ Added: PhotonPeer.TargetFramework to identify the target framework that the dll was built-for. Might help identify the used variant.
+ Changed: Code order a little, to get obsolete fields up in the range for them.
+ Removed: RhttpMinConnections and RhttpMaxConnections, which were entirely obsolete.
+ Changed: OperationResponse indexer is not obsolete. This was used to detect where it's used.
+ Changed: ParameterDictionary now has a Get() method, so the API is analog to Unwrap() in this case.
+ Changed: EnetChannel to use NonAllocDictionary instead of Dictionary. Our replacement is internal and non-allocating for iteration.
+ Changed: the logging level of events possibly happening on each Service() call changed from INFO to ALL
+ Changed: EnqueueMessageAsPayload stats-keeping no longer throws an exception, when the delivery mode is "out of range".
+ Internal: Changed how the client writes acknowledgements.
+ Internal: TPeer.ReceiveIncomingCommands() will only log "Wrong MagicNumber", if the received length is more than 0. It also logs the length then.
+ Changed: PhotonClientWebSocket (in .Net Standard 2.0 dll) now checks if the clientWebSocket state is still "Open" before handling incoming data.
+ Changed: PhotonClientWebSocket logs INFO, when the received data has length 0 but the socket is still Open.
+
+
+Version 4.1.4.5 (04. September 2020 - rev5733)
+ Fixed: Serialization of a ByteArraySlice will now release it, as described in the docs. So you can pass a ByteArraySlice to RaiseEvent and control of it is passed over to the Photon API.
+ Fixed: Potential issues with SupportLogger.StartBackgroundCalls() when there were 255 threads running (and or stopped).
+ Changed: When PhotonClientWebSocket fails to connect, this will now correctly result in a disconnect with code/reason ExceptionOnConnect.
+ Changed: The socket reading-thread not call it's disconnect method, if already disconnecting/disconnected. This avoids a surplus call (and callback).
+ Internal: The thread locking object in SocketNative is no longers static.
+ Note: The next release will change the native datagram encryptor api. Most likely this is the last one compatible with the old native plugin.
+
+Version 4.1.4.4 (29. June 2020 - rev5625)
+ Fixed: NonAllocDict. Capacity change was broken. This is a critical fix.
+ Added: Indexer to NonAllocDict to allow Dict[key] get and set.
+ Added: NonAllocDict.Clear() method.
+
+Version 4.1.4.3 (24. June 2020 - rev5622)
+ Added: PhotonPeer.UseByteArraySlicePoolForEvents and PhotonPeer.ByteArraySlicePool to avoid memory garbage when events consist only of a byte-array. See comments / doc.
+ Added: Class NonAllocDictionary as replacement for the suboptimal implementation in Mono. Some of our code relies on Dictionaries and can be optimized with this. Note: This is neither documented well yet and considered "beta" until we got feedback on some use cases.
+ Added: PhotonPeer.TrafficRecorder and ITrafficRecorder. This can be used to capture traffic on UDP connections.
+ Changed: IPhotonSocket.ConnectAddress is now a local field. Before, it accessed the peer which might already connect to another server.
+ Changed: Debug log for DNS resolution (INFO level). This includes a count of IPs that were returned.
+ Added: Static PhotonPeer.NoNativeCallbacks to disable callbacks from native code to C#. SocketNative is the first class to use NoNativeCallbacks in DnsAndConnect().
+ Changed: SocketUdp and SocketTcp are now public, like other implementations. This means you can assign them to the SocketImplementationConfig and select these deliberately.
+ Internal: Datagram Encryption was updated and optimized. (rev5548+rev5550). Added PhotonPeer.NativeEncryptorApiVersion constant to be able to check which native encryptor API is being compiled into the assembly.
+ Changed: EnetPeer.ReceiveIncomingCommands(): bytesIn counter simplified: now it simply incremented by input data size.
+ Removed: "CommandLog" feature. It was replaced by Traffic Recording. Remaining setting values for this (in PhotonPeer) are now Obsolete and without function.
+ Changed: WebSocket init workflow to make it compatible with AuthOnce / AuthOnceWss. It can send an init request now.
+ Internal: WebSockets need to use the ConnectAddress, as the TPeer will setup the address and path as required.
+ Changed: The IPhotonSocket does not set the ConnectAddress again, so the Peer can set this address before connecting. This is used for WebSocket connects.
+ Fixed: NETFX_CORE variant of payload encryption initialization.
+ Added: PreserveAttribute and used it on IPhotonSocket constructors. This keeps Unity's code stripping from constructors which we need.
+ Fixed: A rare threading issue for UDP connections.
+ Internal: SupportClass.StartBackgroundCalls() and related methods are now locked. A proper cleanup of StartBackgroundCalls is pending.
+ Changed: SupportClass.StopBackgroundCalls(id) will now clear the reference to the used thread but not remove the entry in the list.
+ Changed: SupportClass.StopAllBackgroundCalls() will now clear all referenced threads. Could be used when disconnected / before another connect to reduce number of Threads.
+ Removed: SupportClass.CallInBackground, which was replaced by StartBackgroundCalls a while ago.
+
+
+Version 4.1.4.2 (08. May 2020 - rev5519)
+ Updated: DotNet SDK (net35, UWP and .Net Standard 2.0) and Unity SDK.
+Version 4.1.4.1 (30. April 2020 - rev5482)
+ Fixed: String serialization for characters with more bytes. UTF8.GetBytes was called with byte-count instead of character-count as parameter.
+Version 4.1.4.0 (28. April 2020 - rev5474)
+ Internal: Changed serialization of strings to produce no memory garbage. Strings that exceed a UTF8-encoded byte-length of 32767 (short.MaxValue) are not supported in either protocol (now throwing an exception).
+ Internal: Improved the serialization of float, double, float-array and double-array to produce less memory garbage with better performance.
+ Fixed: Cross platform serialization of float and double values in protocol 1.8 (which is used by default by PUN 2). Undiscovered, the C# client was using a wrong byte-order for network. The server and native clients were receiving a wrong value. Between C# clients, everything was fine.
+ Added: WebSocket support built-in to the Metro / UWP assembly. The PhotonMessageWebSocket is automatically used, unless some override is defined externally.
+ Changed: The socket implementations now disconnect when an exception happens due to sending. This uses the StatusCode.SendError, reported via OnStatusChanged callback. The LoadBalancingClient will handle this and report a DisconnectCause.Exception. Careful when updating only the library: Handle this in LoadBalancingClient.
+ Changed: The internal exception logging is now in log level INFO. This means the handled exception is no longer logged as if it's not.
+ Internal: Reverted to using the datagram encryption API v1. The new one is not fully implemented and should not be used yet (but was in v4.1.3.0).
+ Fixed: If a timeout message arrives after the client disconnected locally, the timeout is neither reported (via OnStatusChanged) nor does it trigger (another) disconnect. This avoids rare issues where clients would get stuck in Disconnecting state.
+ Added: Initial changes to support proxies for WSS. The PhotonPeer got a Connect overload which sets the proxy address and the IPhotonSocket got ProxyServerAddress. Higher level changes are upcoming.
+ Fixed: When the StreamBuffer for a large message got fragmented, this goes back to the StreamBuffer pool.
+ Changed: ExecuteCommand() for fragments. We now use a StreamBuffer from the pool and only adjust the buffered size if needed.
+ Added: Static PhotonPeer.MessageBufferPoolSize() to have access to the current StreamBuffer pool size.
+
+Version 4.1.3.0 (23. March 2020 - rev5399)
+ Internal: Changed Visual Studio projects which build the C# Photon libraries. Added a .Net Standard 2.0 assembly, which has built-in WebSocket support.
+ Added: IPhotonSocket.SerializationProtocol property. This provides the protocol of the current PhotonPeer.SerializationProtocolType as string.
+ Note: Some WebSocket implementations use a static value of the same name and need to be updated! Some projects contain SocketWebTcp.cs, SocketWebTcpThread.cs or similar files.
+ Changed: It is now possible to signal "on demand encryption" (known as Payload Encryption within Photon terms) even on secure connections (WSS / Datagram Encryption). This is important (only) for mixed connection types. A server update is required. The Photon Cloud is updated.
+ Added: PhotonPeer.SendInCreationOrder. This defaults to true, enabling the new behaviour explained below.
+ Changed: The send order of reliable and unreliable commands (UDP). This improves throughput of unreliable commands, when there are multiple datagrams of data. Before, a datagram got filled with the reliable commands first. Only when those were gone, unreliable commands were sent. The server was discarding some messages are too late.
+ Updated: Pool to be used in higher level APIs. Pool.Count is now also locked.
+ Internal: EnetPeer ocal variable fragmentLength to currentFragmentSize. It no longer hides EnetPeer.fragmentLength, which was probably causing issues in the Native Toolchain (Master builds for HoloLens 2).
+ Internal: Datagram Encryption now has a new mode: GCM. It can be used seamlessly with the Photon Cloud.
+ Internal: Native Datagram Encryption plugins and APIs are now more efficient.
+ Removed: rHttp support.
+
+Version 4.1.2.20 (12. December 2019 - rev5296)
+ Changed: DiffieHellmanCryptoProviderNative is now always compiled into the assembly using dynamic linking. If the payload encryption native library is present, it will be used automatically.
+ Changed: Extern methods with the DllImport attribute are now public. This allows a PrelinkAll() check if the dll is available and can be loaded.
+ Internal: EncryptorNative will no longer use native extern methods in static fields. This causes execptions in unexpected context.
+ Added: PhotonPeer NativePayloadEncryptionLibAvailable, NativeDatagramEncryptionLibAvailable and NativeSocketLibAvailable values.
+ Changed: SocketNative is autmatically used if the native socket lib is available, based on the checks above.
+ Changed: The wrappers for the native libraries (sockets and datagram encryption) will now setup a debug logging callback with debug level. This requires new native libraries.
+
+Version 4.1.2.19 (13. November 2019 - rev5271)
+ Internal: Handling for DllNotFoundException in the SocketNative.DnsAndConnect().
+ Internal: Added support for setting the serialization protocol when using native websocket.
+ Internal: Added logging to native plugins for sockets and encryptor.
+ Internal: Changed the access level of PeerBase.debugOut from 'internal' to 'public'.
+ Changed: UDP socket classes now trigger a disconnect in the send methods, should the lower-level socket be disconnected. This gives us a quicker "disconnected" state in some error cases. So far, only reading-errors triggered disconnects in UDP.
+ Changed: Logging in case of send errors.
+ Added: Exception handling to deserialization. This adds a safety layer for receiving messages, which can be skipped. Important: It will be unknown, what message got discarded and if it's important or if it was fake / surplus.
+ Fixed: Internal class EncryptorNet, which was not thread safe, so DatagramEncryption was failing sooner or later. This affected only v4.1.2.18, which was an internal release.
+
+Version 4.1.2.18 (1. October 2019 - rev5229)
+ Removed: Surplus logging "Deserializing OpResponse Ping." for TCP/WebSocket connections.
+ Changed: Datagram Encryption to use an interface for the encryptor.
+ Changed: PhotonPeer.Encryptor is now public and can be set before connect. Applications can switch to new Datagram Encryption implementations. InitDatagramEncryption will create an instance and use that or falls back to the managed encryptor.
+ Note: PhotonPeer.Encryptor replaces DgramEncryptor. Setting the class before connect is likely what the LoadBalancingClient will do anyways.
+ Changed: The EncryptorNative class is for dynamic linked libs. It can be present in all Unity projects.
+ Changed: PhotonPeer.NativeDatagramEncrypt is obsolete, as it's always true now. On demand, an alternative Encryptor can be set.
+ Internal: ClientSdkIdShifted is simplified (because it was causing an error in another compiler / in Unity).
+ Changed: Reading Hashtables and Dictionaries will now check if the read key is null. If so, the key-value pair will be dropped silently. This applies to Protocol 1.6 and 1.8 alike.
+ Changed: All built-in socket implementations which are now more alike to one another.
+ Changed: When DNS resolution provides more than one IP, the socket will use the IPv6 ones first. If there is no route to the remote IP, the next in list is used. It does not resolve strings with IPv4 (e.g. a local address).
+
+Version 4.1.2.17 (9. August 2019 - rev5187)
+ Removed: Obsolete StatusCode values: DisconnectByServer is now DisconnectByServerTimeout. Other values are simply removed.
+ Updated: Used StatusCode.DisconnectByServer to DisconnectByServerTimeout. A follow up to renaming and removing the code. Some implementations of IPhotonSocket can be in existing projects and may still use the old naming. Simply rename.
+ Changed: PeerBase.timeInt is now a property which calculates the current time: SupportClass.GetTickCount() - this.timeBase.
+ Fixed: The change for timeInt fixes a problem with TCP connections which go entirely silent and would no longer update the PhotonPeer.ConnectionTime.
+
+Version 4.1.2.16 (28. June 2019 - rev5168)
+ Changed: TrafficStats Stopwatch initialization. This keeps the Stopwatch but resets it. Also it's started on initialization, if trafficStatsEnabled.
+ Changed: VitalStatsToString() can now return a useful stats string, even if TrafficStatsGameLevel is null (which is never the case currently).
+ Added: VitalStatsToString() now logs the "Longest send" time. This is a new value to debug connections.
+ Changed: NETFX_CORE now also uses Activator.CreateInstance, if a SocketImplementation is set (as in other implementations).
+
+Version 4.1.2.16 (24. June 2019 - rev5154)
+ Fixed: DispatchIncomingCommands() for reliable UDP. In some cases, an unreliable command/message could dispatch before the related reliable command (which was written and sent earlier). This issue was introduced in v4.1.2.11, 15. April 2019.
+ Fixed: Each thread created via SupportClass.StartBackgroundCalls will now try-catch a ThreadAbortException. Apparently the handling of a ThreadAbortException changed with Unity 2019, which started to log the exceptions on Android, IL2CPP, 4.x runtime.
+
+Version 4.1.2.15 (07. June 2019 - rev5137)
+ Changed: Tcp messages with magic byte 0xF4 are no longer accepted (this was used on a deprecated platform).
+ Changed: An Internal Operation Response for OpPing is now executed right away, fixing timing problems when using Op Ping (in WSS, e.g. on Xbox).
+ Added: PhotonPeer.InitialResentTimeMax. It guarantees resends for commands, despite bad lag (which may be temporary).
+ Changed: NCommand.ToString() for slightly better organization and naming of values. This is mostly a debugging help for the Photonians.
+
+Version 4.1.2.14 (16. May 2019 - rev5128)
+ Changed: The single "release history" file is now split. There is one "changes" file per api/level. For example: changes-realtime.txt lists the LoadBalancing / Realtime API changes. Find them in the respective subfolders.
+ Changed: The structure of the Unity SDK. As in PUN 2, there is a "Photon" folder, which wraps up all apis and libraries within a Unity project.
+ Updated: The readme txt.
+Version 4.1.2.14 (6. May 2019 - rev5097)
+ Changed: EventData now has Sender or CustomData properties as well as SenderKey and CustomDataKey. The keys can be defines according to API. The default are the Realtime API values. Sender and CustomData access is cached. If an EventData instance is reused (PhotonPeer.ReuseEventInstance), the values will reset.
+
+Version 4.1.2.13 (3. May 2019 - rev5086)
+ Changed: EventData to not contain the Sender or CustomData properties anymore. They have been specific for the Realtime API and confusing for APIs like Chat.
+ Added: PhotonPeer.ReuseEventInstance as option to use a single EventData instance for all incoming events. This reduces memory garbage. The drawback is: An event provided via OnEvent(EventData photonEvent) is invalidated right after the callback finished. That event's content will get modified. Typically this is not a problem as events are rarely cached.
+ Internal: Added caching for a EventData instance (on demand).
+
+Version 4.1.2.12 (26. April 2019 - rev5046)
+ Fixed: A problem with the new EventData code of v4.1.2.11. It optimistically assumed that events with codes below 200 were always just containing Sender and CustomData. Photon Chat uses different codes, however.
+ Added: Access the Sender and CustomData via the EventData.Parameters dictionary, even if that is null (due to the new rules). In that case, the Sender and CustomData is accessed via the properties instead.
+
+Version 4.1.2.11 (15. April 2019 - rev5043)
+ Note: This version has a few changes that optimize memory usage mostly.
+ Internal: Changed EventData class (custom and Photon-defined events). Custom events set the Sender and Code and the CustomData but not Parameters (dict) now. EventData indexer checks if the "Parameters" are non-null. If the indexer is used to access non-existing Parameters, the result is null. Custom events are NOT setting Parameters anymore, saving the Dictionary<> use.
+ Internal: StreamBuffer.ReadByte() to return a byte or throw an exception when the end of the stream was reached. The -1 value was never used though.
+ Changed: EnetPeer.DispatchIncomingCommands() as optimization. When dispatching unreliable commands, the code now checks if the next command is available. If so, this is dispatched, without going through the keys of the dictionary (which was creating garbage to clean up).
+
+Version 4.1.2.10 (11. March 2019 - rev5023)
+ Fixed: A timeout issue for WS / WSS transport protocols by sending a ping.
+
+Version 4.1.2.9 (20. February 2019 - rev5003)
+ Note: Release .Net and Unity SDK from our page.
+
+Version 4.1.2.9 (13. February 2019 - rev4985)
+ Removed: Setting of Thread.Name for internally used threads. This was used for debugging only (since a while) but caused issues on a console platform (due to an issue in Unity IL2CPP exports).
+
+Version 4.1.2.8 (31. January 2019 - rev4975)
+ Fixed: The cap for the lastRoundtripTime. When the current roundTripTime was very low this meant the rtt wasn't going up again. This was a problem with local servers.
+ Fixed: Setting the roundTripTime when the connect-command gets acknowledged. This sets a minimum of 15ms now. Before, a local server could get a 0ms roundTripTime (due to using Environment.TickCount).
+
+Version 4.1.2.7 (25. January 2019 - rev4954)
+ Removed: CommandBufferSize and LimitOfUnreliableCommands. Technically, those are "Obsolete" but no longer used anywhere. See comments.
+ Fixed: MessageBufferPoolTrim() was not using a lock(), so this wasn't thread safe.
+
+
+Older Versions
+
+*** Version 4.1.2.6 (12. December 2018 - rev4935)
+ Changed: Unsequenced delivery is now available in all builds. Internally, this was wrapped in compile conditions.
+
+*** Version 4.1.2.5 (10. December 2018 - rev4911)
+ Added: PhotonPeer.SentReliableCommandsCount - reliable commands sent but not yet acknowledged. This can be used as indicator for the quality of service, aslong with ResentReliableCommands.
+ Note: This build include the "Best Region Ping" classes, to minimize changes when released with Quantum.
+
+*** Version 4.1.2.4 (23. October 2018 - rev4868)
+ Fixed: Fragment bug introduced in 4557 (12. March 2018). This kept one command per reassembled message in the incoming queue (without payload).
+ Added: An upper limit for the calculated lastRoundtripTime (per ack) to prevent uncontrolled rtt changes due to garbled incoming messages. Protecting the rtt timer improves resending commands if needed. INFO level logging starts with: "LastRoundtripTime is suspicious".
+ Added: SocketTcpAsync class, which is receiving with BeginReceive and EndReceive in callback. This should work for Unity's 4.x Runtime, which has a bug that blocks Socket.Receive() indefinitely.
+ Changed: TPeer.ReceiveIncomingCommands() will now use dataLength as indicator how much was received.
+ Internal: CalculateCrc() now uses a cached lookup table, which gives it much better performance (most obviously for longer datagrams).
+
+*** Version 4.1.2.3 (17. October 2018 - rev4847)
+ Fixed: Fragment handling. When a duplicate fragment arrived after the "original" was reassembled, this led to an exception and disconnect.
+
+*** Version 4.1.2.2 (16. October 2018 - rev4843)
+ Changed: Enum StatusCode values. DisconnectByServer is obsolete and replaced with DisconnectByServerTimeout.
+ Added: StatusCode.DisconnectByServerReasonUnknown, as a generic case (unknown reason).
+ Added: You can now send List, which gets de/serialized as object[].
+ Internal: PeerBase.MessageBufferPool is now a Queue, which means the usage changed minimally. This is faster than before.
+ Internal: When a client detects a timeout disconnect, it will enqueue the status-change, to allow the Disconnect()-call to finish first. This provides a clearer order of actions happening internally for a timeout.
+ Internal: Simplified the ExecuteCommand for a received Disconnect command. The StatusCallback is now enqueued, as Disconnect() also enqueues changes.
+ Updated: SocketUdpAsync class is now sending in blocking mode but receiving with BeginReceive and EndReceive in callback. This should work for Unity's 4.x Runtime, which has issues with blocking socket receive.
+
+*** Version 4.1.2.1 (31. July 2018 - rev4787)
+ Fixed: OutOfMemory exception while building 'Master' version on UWP with .Net Native Toolchain. This is a workaround for an alleged bug in ilc.exe.
+ Added: EventData.Sender to simplify access to this info. If there is no sender or if the server sent the event, the actorNumber is 0.
+LoadBalancing:
+ Changed: OnStateChangeAction is now named StateChanged and provides a "previous state" value. State changes only trigger the event-call when the value actually changes.
+ Renamed: OnEventAction to EventReceived and OnOpResponseAction to OpResponseReceived.
+ Added: LoadBalancingClient now has AddCallbackTarget and RemoveCallbackTarget to simplify registering for various callbacks.
+Chat:
+ Changed: Namespace from "ExitGames.Client.Photon.Chat" to "Photon.Chat".
+ Added: ConnectAndSetStatus method.
+
+*** Version 4.1.2.0 (3. May 2018 - rev4660)
+ Added: Unsequenced delivery for messages (reliable and unreliable). This way, operations and resulting responses and events can be sent as unsequenced, which is good for use cases like streaming voice, input and such.
+ Internal: The Photon library now re-uses memory for messages and commands. This avoids garbage collection in Unity, which can be a performance problem.
+ Changed: There is a new method to send operations: PhotonPeer.SendOperation. It uses the SendOptions struct to define the delivery mode, encryption, etc. This replaces the obsolete OpCustom().
+ Added: Optionally, the Serialization Protocol v1.8 can now be used. Consider it a pre-release/test version for which we could use feedback. Set PhotonPeer.SerializationProtocolType.
+ Internal: Replaced foreach with while in SerializeParameterTable, SerializeHashTable and SerializeDictionaryElements in SerializationProtocol v1.6.
+ Internal: Changed EnetPeer to have a CommandQueue. Instead of queueing ExecuteCommand(cmd) delegates, we now queue the commands. This is leaner.
+ Internal: The SendOptions.DeliveryMode enum's order changed.
+ Added: PeerBase.MessageBufferPool, MessageBufferPoolGet() and MessageBufferPoolPut(StreamBuffer buff) as a simple memory pool implementation.
+ Added: PhotonPeer.MessageBufferPoolTrim() to give an option to limit the amount of memory buffered.
+ Added: PhotonPeer.MessageBufferPoolGet() as a (brute force) way to externally debug the memory buffer. This is temporary. Don't rely on this.
+ Added: For TCP, a client-side timeout. This is based on checking timestampOfLastReceive in the DispatchIncomingCommands method (timeouts only get called when you dispatch).
+ Fixed: The TCP implementation only checks for a TimeoutDisconnect, while in ConnectionStateValue.Connected. Otherwise, no timeout can happen.
+ Internal: Renamed various values for more fitting names.
+ Internal: Added special handling of Arrays of int and byte to DeserializeArray() in Protocol 1.6, using DeserializeByteArray and DeserializeIntArray respectively.
+LoadBalancing:
+ Changed: The namespace to the simpler "Photon.Realtime".
+ Added: Various callbacks to signal specific situations / events. To get those, a class must implement the interface and be added to a list of "Targets". See: ILoadBalancingCallbacks.
+ Added: RegionHandler, which provides methods to ping a list of regions and to find the one with best ping. This moves PUN's "Best Region" feature to the LoadBalancing API.
+ Moved: The PhotonPing was part of the dll but is now part of LoadBalancing.
+ Added: LoadBalancingClient.UseAlternativeUdpPorts. This way, UDP may use ports of the Steam Multiplayer port-range by simply replacing existing port strings in addresses.
+ Changed: RaiseEvent now has an overload, that uses RaiseEventOptions and SendOptions. The old variant is obsolete but will still work.
+ Changed: CheckUserOnJoin is now set by default. The RoomOptions.CheckUserOnJoin got removed.
+ Added: Client-side checks and limits for OpFindFriends.
+ Added: Optional parameter sendAuthCookie to OpLeaveRoom. The app can control what's passed from Photon to a server via WebHook.
+ Changes: The room list for lobbies is no longer part of the LoadBalancingClient. Instead, implement the callback for the changed room list.
+ Added: AppSettings, a base class to host AppId and some settings for a title. This will help make it available across products. Right now, the LoadBalancingClient is not using it yet.
+ Changed: Player.ID is now .ActorNumber, which mirrors the server's naming.
+ Fixed: Unity compile defines to support Unity 2018,
+
+*** Version 4.1.1.19 (9. April 2018 - rev4590)
+ Fixed: WSS now sends an operation "ping" in SendAcksOnly() (and SendOutgoingCommands()) to avoid getting timed out. This happens right away, while other commands/operations stay in queue.
+
+*** Version 4.1.1.18 (19. December 2017 - rev4540)
+ Fixed: Exception in QueueOutgoingAcknowledgement() with a lock(). This avoids threading issues between Send- and Receive-thread. This was an issue mostly seen in Photon Voice, which uses the library multi-threaded.
+ Changed: Network Simulation now only stores the actual data of messages, instead of storing an action/delegate.
+ Note: The delegate IL code for Network Simulation was instantiating a "display class" instance and caused GC garbage, even if no simulation was running.
+LoadBalancing:
+ Changed: FriendInfo.Name is now "UserId", which is up to date with it's usage.
+ Changed: CheckUserOnJoin is now set by default. The RoomOptions.CheckUserOnJoin got removed.
+
+*** Version 4.1.1.17 (11. October 2017 - rev4465)
+ Fixed: Fetching the server timestamp now works for the "No C# Sockets"-library build for WebSockets. This affected libraries used for XB1 and as a result, the serve time was not synced. E.g. PhotonNetwork.time was locked at 0.
+ Changed: XML doc of PhotonPeer.DisconnectTimeout. This is no longer a UDP exclusive setting and clearly states that the unit is milliseconds.
+ Updated: Several documentation comments for the PhotonPeer. Using shorter summaries and remarks for the details.
+LoadBalancing:
+ Changed: OperationCode const byte Join = 255 is now marked obsolete. We use "JoinGame" instead.
+ Added: DisconnectCause.AuthenticationTicketExpired.
+ Fixed: DebugReturn call in Unity WebGL.
+Chat:
+ Fixed: Unity "6" compile define is now UNITY_2017.
+
+*** Version 4.1.1.16 (1. September 2017 - rev4349)
+ Fixed: The native implementations for "PhotonPing", which are used for PUN's "Best Region" selection in the "No Sockets" dlls (Android and iOS for Unity 4.x). Disposing the "dynamic" version was causing an exception (due to an attempted fix of a less-obvious memory leak). This caused the Best Region selection to stall.
+
+*** Version 4.1.1.15 (17. July 2017 - rev4232)
+WebSocket:
+ Changed: WebSockets are now treated like "addons", as their implementations are complex and potentially not running on some platforms (be it UWP or some Unity export). The Readme-Photon-WebSocket.txt tells you how to add them to your project and set them up.
+ Added: Folder "PhotonWebSocket" with SocketWebTcpCoroutine and SocketWebTcpThread classes, to support platforms with and without Thread API.
+ Added: PingHttp.cs for Unity WebGL exports, to support "Best Region" selection in PUN.
+LoadBalancing:
+ Added: LoadBalancingClient.TransportProtocol as shortcut to the use PhotonPeer's TransportProtocol value. This enables setting the protocol easily while not connected.
+ Added: LoadBalancingClient.SocketImplementationConfig as shortcut to modify PhotonPeer's SocketImplementationConfig. This enables you to setup which IPhotonSocket implementation to use for which network protocol.
+ Changed: LoadBalancingPeer.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().
+Chat:
+ 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.14 (5. July 2017 - rev4191)
+ Changed: SupportClass StartBackgroundCalls method now assigns an ID to each thread/task and enables you to cancel it explicitly via StopBackgroundCalls. CallInBackground is now obsolete due to renaming.
+LoadBalancing
+ Changed: The ClientState "Uninitialized" is now "PeerCreated". This is the initial state. ConnectedToMaster is now ConnectedToMasterserver (both use the same value).
+ Updated: ClientState values descriptions.
+ Internal: GameEnteredOnGameServer() first sets the local player's actorNumber, then updates the player lists.
+Chat:
+ Added: ChatClient can optionally run a thread to call SendOutgoingCommands in intervals. This makes sure the connection doesn't fail easily (e.g. when Unity is loading scenes, etc.). You still have to call Service to dispatch received messages.
+ Added: ChatClient.UseBackgroundWorkerForSending. Set this to true, to use the new background thread. Note: Do not use this in WebGL exports from Unity cause Threads are unavailable in them.
+WebSocket:
+ Changed: Updated enabled protocols for WebSocket.cs. Now it is posible to connect to a server which supports only either TLS 1.1 or TLS 1.2 or TLS 1.0 or any combination of them.
+
+*** Version 4.1.1.13 (2. June 2017 - rev4112)
+ Internal: Fixed StreamBuffer.Seek() which was throwing an exception when seeking position 0 in an empty stream.
+ Removed: The queue-length checks which were using OnStatusChanged to warn about the amount of data queued for sending. Several StatusCode values are now obsolete accordingly.
+ Removed: StatusCode InternalReceiveException = 1039 and TcpRouter* which were obsolete for a longer time.
+
+*** Version 4.1.1.12 (24. May 2017 - rev4086)
+ Fixed: Peer.timeLastSendOutgoing was set in SendAcksOnly and ReceiveIncomingCommands. This should not happen. In PUN, this led to an issue with the fallback thread, which could not keep the connection.
+ Fixed: DNS resolution in the UDP socket is no longer inside a lock. Even if it takes longer (without network), the socket can now be closed before it's even opened properly, avoiding a freeze.
+ Fixed: UWP clients can set a SocketImplementationConfig. This opens up the use of WebSockets or any IPhotonSocket implementation in UWP, too.
+ Internal: Acknowledgements are no longer created as "commands" and serialized on send. Instead, they are directly written to a byte[] buffer, which is using less memory.
+ Added: PhotonPeer.EnableServerTracing to enable UDP Datagram Tracing on server side. We might ask you to use this when debugging connection issues. Otherwise, don't use this, as you can't access the server's logs anyways.
+
+*** Version 4.1.1.11 (13. April 2017 - rev3922)
+ Fixed: Bug of v4.1.1.10, which caused disconnects after a short time.
+
+*** Version 4.1.1.10 (11. April 2017 - rev3916)
+ Internal: Memory Allocation for nCommand and EnetPeer within SendoutGoingCommand, and AreReliableCommandInTransit
+ Internal: Refactoring of SerializeToBuffer to prevent memory allocation and access udpBuffer directly instead of using BlockCopy.
+ Internal: EnetPeer.channels got removed and replaced by a simple array and a GetChannel() method to access all channels.
+
+*** Version 4.1.1.9 (15. March 2017 - rev3884)
+ Fixed: Size calculation for Datagram Encryption (used on one console only, so far), when the MTU was changed from default. In some cases, an Exception was thrown: ArgumentException: Offset and length were out of bounds [...] at System.Buffer.BlockCopy. Adjusted GetFragmentLength() and CalculateBufferLen() internally.
+
+*** Version 4.1.1.8 (24. February 2017 - rev3873)
+ Fixed: Handling of non-fatal "WouldBlock" SocketExceptions when receiving data via TCP. This led to disconnects before. This affects only TCP connections in libs other than Windows Store.
+ Changed: Memory usage for TCP socket usage. Less memory is being allocated per receive. As we have to queue incoming data, it still has to get copied once.
+ Changed: Memory usage for encrypting messages.
+ Changed: SupportClass.DictionaryToString() now logs the length of a byte-array (not the content).
+ Changed: Deserializing unknown "Custom Types" returns the sent byte[]. There is no warning/error log yet but deserialization won't fail entirely.
+ Changed: PeerBase.SerializeMessageToMessage() to use less memory for encryption. Also, Raw-Messages can now be de/encrypted successfully.
+ Internal: Added StreamBuffer.ToArrayFromPos(), enabling you to get a buffer copy, starting with some offset (position of the buffer).
+ Internal: Removed some NETFX special build cases (obsolete due to using our own SteamBuffer).
+LoadBalancing:
+ Added: Player.UserId field and code to read published UserIds from the player properties in CacheProperties(). When publishing the UserId in a room (RoomOptions.PublishUserId = true), the UserId becomes available for all players in a room. Good to find/make friends or follow a team player into another room.
+ Added: New matchmaking operation: OpGetGameList(typedLobby, sqlFilter). This fetches a list of rooms that match the filter. You can show lists of rooms with specific properties, if needed (or still use OpJoinRandom).
+ Fixed: WebFlags properties setters.
+
+*** Version 4.1.1.7 (16. December 2016)
+ Note: No new lib version. Just updated demos for the SDK.
+Demos:
+ Fixed: Demos with persistent (Turnbased) games. The Memory Demo was not setting up rooms correctly (which led to errors joining them) and used a "join" rather than a "rejoin" to get into saved games (getting added to the room once more).
+
+*** Version 4.1.1.6 (9. December 2016 - rev3801)
+ Changed: Default SentCountAllowance = 7.
+Loadbalancing:
+ Added: OpJoinRandom will now "remember" to send ExpectedUsers to the Game Server (by caching the value).
+ Added: AuthEvent and it's handling. This (internally sent) event can now update the client's token anytime (before that expires).
+ Added: LoadBalancingClient.OpChangeGroups().
+ Changed: LoadBalancingClient.Disconnect() no longer sets it's own State to Disconnected. It waits till the state-change callback gets called by the lib.
+
+*** Version 4.1.1.5 (18. November 2016 - rev3775)
+Internal:
+ Fixed: Photon-init request is now created by the factory method CreateAndEnqueueCommand to make sure we fragment the init if needed (for small MTU and more init-data).
+ Fixed: Bug in TrafficStatsReset method, which caused the averaged stats to go up infinitely after a reset.
+
+*** Version 4.1.1.4 (21. October 2016 - rev3737)
+ Internal: Added ArraySegment support for byte[]. This way, we can internally reuse more memory.
+ Changed: Implementations of PeerBase Disconnect() are now using EnqueueStatusCallback(StatusCode.Disconnect) to delay the "callback". That enables any thread to call Disconnect() while the status change correctly gets called in the main thread via DispatchIncomingCommands().
+ Changed: When a SocketImplementationConfig for UDP is set, this will be used via Activator.CreateInstance(socketImplementation, this).
+
+*** Version 4.1.1.3 (20. September 2016 - rev3673)
+ Changed: NETFX_CORE implementation for UDP. This no longer attempts to detach the stream after every single Send, which caused issues when connecting and getting a lot of messages.
+
+*** Version 4.1.1.2 (13. September 2016 - rev3652)
+ Changed: There are less variants of the Photon library now, which makes it easier to integrate, run and test. There is a general "DotNet" version and a Windows Store (universal) dll. These two also come as Unity build and in Debug and Release. UWP can use the Universal/WSA library.
+ Added: PhotonPeer.SocketImplementationConfig. This allows easier configuration of the IPhotonSocket type to use per protocol, so that switching protocols is easier (compared to having to set a SocketImplementation before connecting).
+ Changed: PhotonPeer.SocketImplementation can't be set public. Use the SocketImplementationConfig instead.
+ Internal: This release summarizes a lot of internal refactorings. It's easy now to switch protocols (internally), to set socket implementations (platform dependent) if needed, etc.
+LoadBalancing:
+ Removed: LoadBalancingClient.PlayerName and Player.Name. Were obsolete for more than a year. There is a NickName and the UserId can be set in the AuthValues.
+ Removed: OpJoinRoom() overload with actorNumber. This was obsolete. To enable clients to return to a room, set AuthValues and a userID.
+ Changed: LoadBalancingClient no longer overrides the protocol for Unity WebGL. This is done in the LoadBalancingPeer.ConfigUnitySockets().
+ Changed: GetNameServerAddress() is the same in Chat and LoadBalancing APIs now.
+ Added: DisconnectCause.DisconnectByServerLogic and handling for this case. You can check this DisconnectedCause when the LoadBalancingClient.State is ClientState.Disconnected.
+ 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.
+ Changed: OnStateChangeAction, OnEventAction and OnOpResponseAction are now events. To register a method in one of those, use += and to deregister you need to use -=. This prevents assigning a new method and de-registering any previously registered ones.
+Chat:
+ 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.1.1.1 (22. August 2016 - rev3549)
+ Fixed: IPv6 support. The init-message was missing it in 4.1.1.0.
+ Fixed: UWP build for Unity now has (Photon-)Hashtable class once more. Unlike Windows RT, UWP does support Hashtable (again). But in Unity, we always use ours.
+
+*** Version 4.1.1.0 (15. August 2016 - rev3536)
+ Changed: Unity exports now need to set the API Compatibility to ".Net 2.0". The ".Net 2.0 Subset" won't work anymore, due to need of some features for a new encryption mode.
+ Fixed: Windows Store implementation of TCP Socket. This is now compatible with 8.1 and 10 and the locally configured timeout is also applied while connecting initially.
+ Fixed: OpWebRPC documentation.
+LoadBalancing:
+ Fixed: Room.ClearExpectedUsers() is now sending it's current, local "expected users" to update the server with "CAS" (Check and Swap). This gives the client an update when the values become valid (which updates the local cache after the roundtrip).
+ Added: Support for the 'Server Side Master Client' feature. The Room will read master client updates from the server accordingly. Room.SetMasterClient() enables you to override the server's selection (provided it did not change before your operation gets executed).
+ Changed: Option for bool WebForward into the new "WebFlags". This allows fine control of which data is being sent to WebHooks. This affects all SetProperties, OpWebRPC and the RaiseEventOptions.
+ Added: WebRPC.cs to the LoadBalancing API folder (was available separately before). It contains WebFlags and WebRpcResponse.
+Internal:
+ Changed: Instead of Windows Phone 8.0 support, we now have a Windows 8.1 Universal library ("Metro") and one for Windows 10 Universal ("UWP").
+ Changed: Changed initialization of PhotonPeer and related classes.
+ Changed: Workflow to send Init command.
+ Added: Option for "Datagram Encryption" and a new Authentication Workflow ("AuthOnce" and "AuthOnceWss"). This is part of the LoadBalancing API.
+ Added: ClientSdkId, which is used internally for reference.
+
+*** Version 4.1.0.6 (30. June 2016 - rev3400)
+ Changed: ExchangeKeysForEncryption() and internally called DeriveSharedKey() can now be executed in their own Thread.
+ Added: static PhotonPeer.AsyncKeyExchange to define if encryption calculations are done in parallel.
+Internal:
+ Changed: NetworkSimulationSet.IsSimulationEnabled only does any work, if the value gets changed (saving some surplus work).
+
+*** Version 4.1.0.6 (21. June 2016 - rev3376)
+Internal:
+ Removed: The wrapper for the optional "native encryption library" from most assemblies. It didn't get certified for the Windows Store and caused problems in the Unity WebPlayer. This will be provided on demand instead.
+ Removed: Our upcoming protocol implementation until it's fully compatible with all supported platforms. Despite not being used, it also caused some issues on some Unity exports.
+ Changed: Usage of MemoryStream is being replaced with a StreamBuffer. This is our own implementation and always grants access to the underlying byte[] (which is not possible in Windows Phone / Store API in some cases). For your Custom Type serialization, replace MemoryStream with StreamBuffer. That's all.
+ Internal: Commands are now split into header and payload byte-arrays, instead of copying them into yet another buffer before sending them.
+ Added: Support for IPv6 adresses in Photon Ping classes. This supports "Best Region" usage in PUN.
+ Fixed: After DNS resolution, IPv6 adresses are preferred over IPv4 ones.
+LoadBalancing:
+ Fixed: LoadBalancingPeer.OpRaiseEvent(...) to send operations (and events) unencrypted again.
+
+*** Version 4.1.0.4 (19. May 2016 - rev3322)
+Internal:
+ Updated: For Unity, the usage of the optional "native sockets" library is now compatible with IPv6 addresses, as required by Apple.
+
+*** Version 4.1.0.3 (28. April 2016)
+Internal:
+ Added: An optional native library for encryption. This speeds up the (rarely used) key-exchange and encryption of messages. The usual case is to use the C# variant, as before.
+
+*** Version 4.1.0.2 (21. April 2016 - rev3283)
+Internal:
+ Changed: PeerBase: ipv6 flag set in INIT_BYTES[5] after dns lookup, when ip address type already known
+ Changed: PeerBase: INIT_BYTES[4] contains clientlibid and release flag (15)
+ Changed: PeerBase: client version packed in INIT_BYTES[5,7,6] bytes
+ Changed: pProtocol prefix and path parsed (and trimmed) in IPhotonSocket.TryParseAddress to support websocket urls
+ Changed: Client version moved to separate version.cs
+ Changed: Protocol static methods reworked to instance methods, IProtocol interface extracted
+ Changed: PeerBase.DeserializeMessageAndCallback() to use a variant of new MemoryStream that exists in Windows 10 Universal APIs, too.
+LoadBalancing:
+ Added: Expected Users. This affects the Room, LoadBalancingClient, JoinRoom, JoinOrCreateRoom and CreateRoom.
+ Added: null check in Extensions.StripToStringKeys().
+ Fixed: FriendInfo.IsInRoom, which returned the opposite of it's naming! Also changed FriendInfo ToString() according to PUN's.
+ Added: RoomInfo expectedUsersField, which is updated with room properties (well known ones).
+ Added: Room.ExpectedUsers and ClearExpectedUsers() to expose the list of expected players.
+ Added: RoomInfo.serverSideMasterClient and masterClientIdField (also updated with well known properties).
+ Changed: OpRaiseEvent now re-uses a Dictionary in the LoadBalancingPeer. It uses Clear(), rather than creating a new Dict each time.
+ Changed: AuthenticationValues to also use C# properties and and backup-fields. This is guaranteed to work in Unity.
+ Updated: EventCode ErrorInfo reference with a link to "WebHooks" doc online.
+ Changed: Disconnect handling in the LoadBalancingClient. The client should reset correctly and log info, if it's in a State where a disconnect is a proper error. Note: In some cases like "switching server", a disconnect is expected, so it's not an error then.
+ Fixed: PlayerProperties sent to game server will now include well-known properties again. This fixes the "NickName missing" bug.
+ Fixed: LoadBalancingClient.State value when the client fails to join or create a game on the Master Server. The state is correctly re-set to ClientState.JoinedLobby or ClientState.ConnectedToMaster.
+ Internal: Added private inLobby value, to store if the client was/is in a lobby on the Master Server.
+ Fixed: DemoClient (in demo-loadbalancing) now makes use of the Name Server by using: ConnectToRegionMaster("eu").
+ Added: DemoClient now has debug output when the connection times out or can't be established.
+
+
+*** Version 4.0.5.1 (18. January 2016 - rev3187)
+ Fixed: EnetPeer.ExecuteCommand(). Fixed: Receiving a Disconnect-command didn't clear the receive-buffers. However, it has to be the last command executed.
+ Note: The bug related to the Disconnect-command happened, when an app paused, queued incoming commands and executed the Disconnect while incoming commands were queued.
+ Fixed: Setting of DisconnectTimeout for TCP connections (ReceiveTimeout and SendTimeout).
+ Changed: Our protocol serializes Enums implicitly as their underlying Type. This means you can easily send them but will lose the Type info (they don't arrive as your Enum type). This is now also working in Windows Store libraries (NETFX_CORE).
+LoadBalancing:
+ Added: OpSetCustomPropertiesOfActor() and OpSetCustomPropertiesOfRoom() now check locally, if the client is currently in a room. It must be, to be able to set these properties. An exception exists for setting properties for the local player's actorNumber, but those are better set via LoadBalancingClient.LocalPlayer.
+Unity SDK:
+ Changed: The Unity condition which defines "using Hashtable = ExitGames.Client.Photon.Hashtable;". All versions of Unity 4 and up now define that Photon's Hashtable is needed. This is only in the LoadBalancing API, not in the demos.
+ Added: WebGL support
+
+*** Version 4.0.5.0 (3. December 2015 - rev3144)
+ Changed: Signature of SetCustomProperties methods. All overloads now include a final, optional "webForward" parameter. This enables you to update a WebHook when properties change. This is intended for turnbased games, not for high-frequency updates - use with care.
+ Internal: Added more debug output to error messages from the socket usage. This should now always include the ServerAddress to make things easier to debug server-side, if needed.
+ Added: Serveral new ErrorCode values, which will be used by v4RC5 and newer servers. See ErrorCode.JoinFailed***, HttpLimitReached and ExternalHttpCallFailed.
+ Fixed: LoadBalancing API now reads the correct "NickName" key from the server's authentication response. So far, it was reading a key that is never used. Note: This means you can set a user's NickName server-side to override the client's nickname.
+Chat
+ 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.12 (3. November 2015 - rev3112)
+ Added: Support for IPv6. Note: IPv6 does not work in Unity yet. It has issues with IPv6. (Case 740910)
+ Note: Host name resolution will prefer IPv4 over IPv6, if both IPs should be available. IPv6 Addresses must use brackets! Example: [::1]:5055. This separates the port from the address.
+ Added: Error logging when Addresses can not be resolved to IPs.
+ Changed: LoadBalancingClient OpJoinOrCreateRoom() no longer allows you to re-join a room. Simply remove the ActorNumber from the parameters. To re-join, use OpJoin with actorNumber (Player.ID that was assigned in the room).
+ Added: Support for PS4 in Unity LoadBalancing SDK. Note: The demos are not all updated with controller support, as we use the old UI, still. To test export, use the Particle Demo.
+
+*** Version 4.0.0.11 (28. October 2015 - rev3093)
+ Changed: Sending a generic Dictionary (with specific types) will now throw an Exception, if any key or value is null. This limitation does not include Dictionaries which use object as type. Those Exceptions are one of the few, which are not catched and turned into a debug message. Catch them by wrapping Operation calls, where needed (OpRaiseEvent()).
+ Changed: TrafficStatsGameLevel public properties are now settable. This enables you to reset individual values to (e.g.) show "LongestDeltaBetweenSending of the past second".
+ Added: CommandLog debugging option. This can be used to get a list of sent reliable commands and their ACKs (from the server). Default is 0 size ("off").
+ Added: CommandLogSize and CommandLogToString() to PhotonPeer. This is part of a LoadBalancingClient.loadBalancingPeer.
+ Added: Several PhotonPeer values to analyze connections: ConnectionTime, LastSendAckTime and LastSendOutgoingTime. PacketLossByChallenge is probably a tempoary addition to check if we have to drop corrupted packages due to bad "challenge" value.
+ Added: Log for incoming reliable commands. The most recent 200 entries will be logged with the CommandLogToString(). This is probably temporary.
+ Changed: Timing for resending reliable commands in RUDP. The peer will check the sent-queue more frequently now, no matter at what time some random command would have to be repeated. Repeats should be more timely, based on their dynamic resend-timing.
+ Changed: PhotonPeer.MaximumTransferUnit minimum is now 576 (was 520, which was lower than on the server).
+ Internal: Channels in the EnetPeer are now stored in an array, so we can replace some foreach-loops with for-loops.
+LoadBalancing (Realtime and Turnbased API)
+ Added: LeaveLobby handling in OnOperationResponse(), which sets the client's state correctly.
+ Changed: Order of execution for Ev Join. If user is known (inactive user rejoins), the player's props are read. The actor list is used, if available.
+ Changed: RoomOptions to use properties with backup-fields to avoid issues in Unity which has issues with Object Initializer (curly brackets).
+ Changed: JoinMode 2 is now "JoinOrRejoin". Was: "Rejoin".
+ Added: ErrorCode constant AuthenticationTicketExpired.
+ Internal: OpJoinRoom, OpCreateRoom and OpJoinRandomRoom no longer use a (growing) list of properties. Instead, classes were created to "sum up" their parameters. The api for games didn't change.
+ Internal: Related to the refactoring of Join/Create, the LoadBalancingClient now creates a Room instance when the client arrived on the GameServer (before, it got created in the initial "create" call).
+Chat
+ 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)
+ Removed: LitePeer class and complete "Lite" namespace. It's highly recommended to use the LoadBalancing API (LoadBalancingClient, etc). The (few) operations that were defined in Lite are no longer required really.
+ Refactored: Some "base" enumerations that were provided by the Lite peer. They are now in LoadBalancingPeer.
+ Added: support for RoomOptions.Plugins. Which we need now since we support multiple plugins per plugin dll - for testing purposes for instance.
+ Fixed: The wrapper classes for the native sockets now do a Sleep(15) when there's nothing to receive. This reduces CPU load considerably.
+ Fixed: Unity library SocketWebTcp class for websocket support. It requires a coroutine on a new GameObject which is now marked as DontDestroyOnLoad(go) and survives scene loading.
+ Fixed: The Windows 8 SDKs now include the release assemblies. This makes sure you can submit your app to the Windows Store.
+ Added: ConnectionProtocol WebSocket and WebSocketSecure. It's simply a different protocol, compared to UDP and TCP, so it should be separated.
+ Internal: DoFraming is now a part of TPeer (was in IPhotonSocket). It's set by the ConnectionProtocol which avoids misconfiguration.
+ Changed: SendPing can now send a ping binary message or enqueue the Ping Operation (when DoFraming is false).
+ Added: A null-check for TrafficStatsStopwatch to avoid NullReferenceExceptions.
+ Added: Compile condition for Ping result handling. It's only used when the client uses Sockets as well (for the time being).
+ Added: Unity WebGL export also sets a "using" Hashtable definition.
+ Fixed: An exception in Photon.Hashtable.ToString() if a value was null. The assumption was that there are no null-values.
+ Changed: SocketUdp and SocketTcp now implement IDisposable, which seems to help with infrequent freezes in the Unity Editor.
+ Added: PhotonPeer.QuickResendAttempts. Sets how many resend attempts for a reliable command will be done in quick succession (after RTT+4*Variance), before the time between repeats will be increased. Use with care and with low values.
+ Added: IP/Hostname to logged exceptions when Connect fails. This is easier to support (e.g. DNS lookup fails).
+ Fixed: Library for PUN+ export to WebGL. Originally, we forced UDP as protocol for PUN+ export, as the native sockets library doesn't support TCP. However, WebGL export introduced a new use case.
+ Added: LoadBalancingClient.EnableLobbyStatistics and .LobbyStatistics. They provide an overview which lobbies your game uses and how busy they are.
+ Fixed: The LB Demo should set CustomProperties instead of directly setting (any) properties.
+ Fixed: SocketWebTcp is completely empty, unless WEBSOCKET is defined. Before the file still contained the "using" part of the class.
+LoadBalancing (Realtime and Turnbased API)
+ Updated: Description for IsConnectedAndReady.
+ Changed: NameServerAddress to return a fitting address depending on protocol (including WebSocket but not yet RHTTP).
+ Updated: The only name server host is now "ns.exitgames.com", which gets turned into a proper address by protocol.
+ Changed: LoadBalancingClient.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: LoadBalancingClient.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).
+ Changed: PlayerName gets renamed to NickName, so PhotonPlayer.Name becomes .NickName and LoadBalancingClient.Name becomes .NickName, too. The old naming is marked as obsolete.
+ Changed: Particle Demo now connects to the Cloud by default (because it's easier to setup and try). You can define your own Master Server (Photon OnPremise) of course.
+ Added: GamePropertyKey.MasterClientId (248) and ParameterCode.MasterClientId (203)
+ Added: ParameterCode.ExpectedValues (231)
+ Added: ParameterCode.SuppressRoomEvents (237)
+Chat API:
+ 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.
+Photon Unity SDK
+ Changed: Organization of APIs and Assemblies in SDK. Now you can copy the content of folder "PhotonAssets" into your project's Assets folder and you have all APIs.
+ Added: PhotonAssets-U5 folder which includes only the Windows Universal DLL.
+
+*** Version 4.0.0.8 (14. January 2015 - rev2765)
+ Fixed: Serialization of custom types with nested Serialize-calls. In this case, re-using a specific memory stream breaks it.
+
+*** Version 4.0.0.7 (12. January 2015 - rev2763)
+ Fixed: Serialization of arrays of custom-types.
+Chat API
+ 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.6 (05. December 2014 - rev2758)
+ Added: ChatApi and LoadBalancingApi folders to Unity SDK. They are needed in any Photon project with Unity. When updating, copy and paste the files over existing ones and make sure to replace the assembly-files, too.
+ Changed: Protocol to save more memory or re-use it. The idea is to have less Garbage Collection (primarily for Unity/PUN and custom types).
+ Added: New CustomType de/serialization methods which provide the MemoryStream, instead of a byte[] COPY from the stream.
+ Changed: Now using one method to identify a Type. This was duplicated code before.
+ Changed: De/Serialization of some types.
+ Note: The drawback is now, that there are more places with: lock(). This is far from optimal but the alternative would be to make Protocol instances per thread. As most is static at the moment, this would not be an easy task.
+ Added: position check for DeserializeStreamFunction() call. Stream position must be "previous + customtype length". It gets corrected but at the moment no error is thrown.
+ Changed: DispatchIncomingCommands() no longer instantiates the commandsToRemove each call. This is reused and thus saves memory.
+ Changed: net_fx build will now check IsConstructedGenericType to detect if something is a dictionary
+LoadBalancing
+ Added: LoadBalancingClient.OpJoinOrCreateRoom overload which has lobby as parameter. If a room gets created, this defines in which lobby it belongs.
+ Changed: LoadBalancingPeer: Added new error code PluginMismatch, documentation for Plugins parameter code.
+
+*** Version 4.0.0.5 (23. September 2014 - rev2738)
+ Updated: AddFriends and RemoveFriends doc.
+ Changed: Logging level for two cases. Dropping a package due to failed CRC-check is now logged for INFO. It's expected and certainly not an error. Dropping a package when the incoming challenge does not match is also not an ERROR. It is expected when you switch servers and packages arrive late. This is now debug level ALL.
+
+*** Version 4.0.0.4 (19. September 2014 - rev2736)
+ Fixed: Fragmentation when CRC checks are enabled. This kept clients from sending fragmented commands when the additional 4 bytes CRC were included later on.
+ Fixed: An issue in the ChatClient which was referring to a class from Photon Unity networking. This caused compile issues in the Unity Chat Demo.
+ Updated: Reference doc generation.
+
+*** Version 4.0.0.3 (15. September 2014 - rev2731)
+ Updated: Doc generation settings and style.
+ Note: This version has no code changes to rev2728 described below. That version is already released in the Unity Asset Store in PUN.
+
+*** Version 4.0.0.3 (11. September 2014 - rev2728)
+ Fixed: A simple "order of things" issue when detecting a timeout (due to resends). We first have to set "Zombie" state so that any Disconnect() call created a disconnect-command with reserved byte = 2 = "due to timeout".
+ Fixed: Chat to be compatible with native sockets of PUN+ (iOS and Android exports from Unity).
+ Fixed: Access to native sockets (in classes SocketUdpNativeDynamic and SocketUdpNativeStatic) is now using a lock(). The native methods are not thread safe but we need more than one socket for PUN+ and Chat (with native sockets, too).
+ Changed: Logging for the case "Ignoring received package due to wrong challenge". This got logged on log-level ERROR but maybe is better as WARNING only. Now this should log less often.
+ Internal: Updated to a newer native-sockets interface.
+ Internal: Updated to a newer native-sockets interface (affects PUN+ only). Cleaned up precompile defines and #if usage.
+
+*** Version 4.0.0.2 (01. August 2014 - rev2715)
+ Added: PhotonPing class and subclasses per platform. Allows clients to use regular UDP messages to ping our servers and find the best region.
+ Added: Native and Win8 support for PhotonPing.
+ Known Issue: Native ping has to be done "one by one" and without any other connection in Unity. It's not yet thread safe (but that is ok as we don't want to ping most of the time but only rarely and out of game).
+ Added: PhotonPing class/file to Win8 platforms.
+ Changed: The extern static methods for the native libs are now internal (instead of private). Pings are using them, too.
+ Changed: WebRpcResponse.ReturnCode comment to include fail code.
+ Changed: OpWebRpc doc is now much more complete and helpful.
+ Updated: Unity SDK Particle Demo (more) and LoadBalancing Demo (just a bit).
+
+*** Version 4.0.0.1 (17. June 2014 - rev2663)
+ Fixed: DotNet assembly no longer contains classes that try to include our Unity native socket libs. This was causing issues in some cases.
+ Added: PhotonPeer.CommandInfoCurrentDispatch. This property gives you the debug string of the currently dispatched command (events or responses). Only useful for UDP.
+LoadBalancing:
+ Added: LoadBalancingClient.OpRaiseEvent(). Now that LoadBalancingClient USES a loadBalancingPeer (and doesn't extend it), things are much easier by offering this method, too!
+ Added: LoadBalancingClient.IsConnected and .IsConnectedAndReady to LB API. Going to be part of the API from now on.
+ Removed: Unused fields clientId and clientCount.
+ Changed: Field for internal use "lastJoinActorNumber" is now private as intended.
+ Changed: LoadBalancingClient.Disconnect is now setting it's own state to Disconnected if the connection got closed (as expected).
+Chat:
+ 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)
+ Changed: This version contains a few features that are not compatible with the Photon Server SDK v3.x. Notable features that are not in the Server SDK are: NameServer, WebHooks and Turnbased API features.
+ Changed: This SDK is the first that contains all current APIs for Realtime, Turnbased and Chat.
+ Fixed: Release build of the Unity assembly now also excludes native-socket using code, fixing a Unity Free export issue. We only use the debug assembly in our demos though and suggest you do the same.
+LoadBalancing:
+ Changed: LoadBalancingClient.FriendList creation/update is delayed until the server's response is available. This avoids cases where the friends are offline for the moment between requesting the update and getting it. Initially, it is null as before.
+ Added: some methods to Player to find next player, etc. Useful for turnbased games to find an opponent.
+ Added: LoadBalancingClient.UserId, which is the ID of a user(account). This is used in FindFriends and when you fetch account-related data (like save-games for Turnbased games). Set it before Connect*(). As fallback when empty during connect, the PlayerName is used instead.
+ Removed: LoadBalancingPeer.OpSetCustomPropertiesOfActor and OpSetPropertyOfRoom which were too special to be so low level. Could be implemented to LBClient.
+Turnbased:
+ Fixed: OpJoinRandomRoom and OpCreateRoom which didn't reset the ActorNr to claim when entering the room. Depending on previous actions, some calls of those methods did fail when the actorNumber wasn't available.
+ Changed: OperationCode.Rpc is now called OperationCode.WebRpc. It's simply much cleaner (considering PUN has RPCs as well but in a different context).
+ Changed: WebRpcResponse reading to be able to handle additional data.
+ Added: Parameter webForward to: OpSetCustomPropertiesOfRoom and OpSetPropertiesOfRoom. The "old" overloads of these methods are still there, too. If webForward is true, the properties are sent to the WebHooks.
+Chat:
+ 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.
+
+*** Version 3.2.2.6 (13. May - rev2575)
+ Fixed: Windows Store and Windows Phone libraries now only send the bytes they should send. This means we have to copy the payload from the "complete package buffer" in order to send it.
+ Fixed: SocketTcp now handles all exceptions during reading. Still, abort-by-server is treated as ServerDisconnect. Everything else as client side disconnect. This fix is especially for iOS exports from Unity. The iOS Power-button will immediately cut any connection. The Home-button allows us to keep the connection if we return the app to focus within a few seconds.
+ Fixed: TPeer.StopConnection() now clears the incoming queue when it disconnects. This avoids getting any more (already received) commands.
+ Changed: TPeer.Disconnect() now uses StopConnection instead of implementing the same code again.
+
+*** Version 3.2.2.5 (30. April - rev2566)
+LoadBalancing:
+ Added: TypedLobby class to replace lobby name/type pair.
+ Added: LoadbalancingClient.CurrentLobby property. CurrentLobbyName and CurrentLobbyType are obsolete.
+ Added: New overloads in LoadbalancingClient with TypedLobby parameter instead of separate lobby name and type: OpJoinLobby, OpJoinRandomRoom. Old methods marked obsolete.
+ Added: New overloads in LoadbalancingClient for OpJoinOrCreateRoom, OpCreateRoom, CreateRoom with parameters packed in RoomOptions class. Old methods marked obsolete.
+ Breaking: LoadbalancingClient.CreateRoom parameters changed to (string roomName, RoomOptions opt).
+ Internal: Removed obsolete LoadBalancingPeer overloads of OpCreateRoom and OpJoinRoom
+ Internal: Added 'onGameServer' parameter to LoadBalancingPeer OpCreateRoom, OpJoinRoom; used to avoid sending extra data to master (player- and room-props)
+ Internal: Loadbalancing Room constructor(string roomName, RoomOptions opt).
+ Internal: Added use of the "JoinMode" parameter which is used in context of Turnbased games.
+ Fixed: Bug in OpLeaveLobby which joined the default lobby instead of leaving any lobby.
+General:
+ Fixed: Server ports were read as short, which was wrong. We now use the correct unsigned short to convert from the address string).
+ Fixed: A minor issue in the SupportClass ToString conversion which used a Hashtable's key type instead of the value's type in one place.
+
+*** Version 3.2.2.4 (21. March 2014 - rev2519)
+ Internal: For Unity, the classes that handle native sockets can now be compiled in a variant that does not actually reference the native-socket-libs. The dll for PUN+ uses native sockets and need the native libs. Any regular dll will have the (not used and empty) classes for build-compatibility reasons.
+ Added: Values to enum EventCaching: SliceIncreaseIndex, SliceSetIndex, SlicePurgeIndex and SlicePurgeUpToIndex. They are in Lite but used in LoadBalancing. This is likely to be cleaned up in the next major release.
+ Changed: EventCaching MergeCache, ReplaceCache and RemoveCache as they belong to an outdated form of caching. The "RoomCache" is the better option in any case.
+LoadBalancing:
+ Added: RaiseEventOptions class. It's used for OpRaiseEvent to avoid further parameter- and overload-clutter for this operation. While it's still not optimal for all cases, the fields in the RaiseEventOptions class are hopefully more clear how to use. Maybe some constructors will be added soon.
+ Changed: All OpRaiseEvent variants, except the one with RaiseEventOptions is now obsolete.
+ Added: Event Cache Slicing. Cached events can now be organized into "slices" which allows you to handle them in chunks. You can purge events in specific slices (e.g. get rid of the previous game-rounds events).
+Turnbased:
+ Added: RaiseEventOptions.ForwardToWebhook which allows you to forward an event to a webhook (to be defined in Dashboard). Use this rarely, as it has an impact on (server) performance!
+
+*** Version 3.2.2.3 (18. February 2013 - rev2493)
+ Added: const PhotonPeer.NoSocket, so programs using our assemblies can detect if they must provide an external SocketImplementation. Some builds avoid using the Socket class (cause Unity Free doesn't support it on all platforms).
+ Added: PhotonPeer.SendMessage method in order to send any serializable object to server.
+ Added: IPhotonPeerListener.OnMessage in order to be notified about getting message from server.
+ Added: new 'Connect' method, which accepts as third parameter any serializable object. You may use this object on server before creating peer.
+ Added: OnMessage callback to samples
+ Changed: TCP and UDP both set the socket to null explicitly in Disconnect(). Hopefully this fixes a misbehaviour in Unity Editor which locked up often.
+ Changed: SocketTCP now has a syncer object and locks in Disconnect(), so only one Disconnect call can be made anytime.
+ Fixed: Nullreference when calling DispatchIncomingCommands() before Connect(). This was due to a (new) use of the socket wrapper. Commented this out until needed.
+ Fixed: Nullreference when calling SendAcksOnly() before Connect() with a new non-null check.
+ Fixed: breaking issue in Hashtable replacement class. Enumerators used in 2 "foreach" loops were breaking with a nullreference. Fix: No caching of enumerator.
+ Changed: AutoJoinLobby now uses this.CurrentLobbyName and this.CurrentLobbyType to join a specified lobby.
+ Changed: EnetPeer.StopConnection will always reset the state to be able to re-connect.
+ Changed: Disconnect() in SocketTcp and SocketUdp sets this.socket = null, even if socket.Close() caused an exception. This is what was expected.
+ Added: SocketUdpNativeDynamic and SocketUdpNativeStatic to "regular" Unity Lib, to improve compatibility in Unity for different export platforms (with and without native sockets).
+
+*** Version 3.2.2.1 (17. October 2013 - rev2335)
+ Note: This lib contains a lot of breaking changes and socket handling has been refactored. By now, this is well tested and confirmed working.
+ Changed: The way sockets are handled and added native-socket-lib support. There is a new IPhotonSocket interface which even allows to use external classes as socket wrapper.
+ Added: SocketImplementation property to set a class as socket implementation (Unity. sets native implementation or c# socket at compile time)
+ Changed: Win 8 RT and Phone now use fewer separate classes and files. Instead, more files from the (regular) DotNet client are used. RT and Phone are now part of the trunk folder in our SVN.
+ Added: TrafficStats.TimestampOfLastAck and .TimestampOfLastReliableCommand
+ Changed: Handling of server-side shutdown (a form of TCP disconnect) is now handled specifically as server-side-disconnect (was: generic receive exception)
+ Added: If a UDP connection times out in a client, it sends a special flag in it's disconnect command (to the server). This enables us to detect which side is triggering timeouts more often (and we can improve things).
+LoadBalancing API
+ Fixed: issue where we called a virtual member from a constructor (http://confluence.jetbrains.com/display/ReSharper/Virtual+method+call+in+constructor)
+ Changed: LocalPlayer is now a property which checks null and returns a new Player (via virtual CreatePlayer) on demand.
+ Added: OpJoinRoom now optionally creates a room if parameter "createIfNotExists" is set to true and the room didn't exist. Room properties can't be set "on create" this way. LocalPlayer.IsMasterClient will be true.
+ Added: When OpJoinRoom can create a room, it also won't define which properties go into the lobby. You can use the new Room.SetPropertiesListedInLobby().
+ Added: You can pass a actorNumber to OpJoinRoom when you re-enter a room and want to reclaim a specific actorNumber in that room. In best case, the client can re-join after a disconnect/crash and seamlessly go on playing.
+
+*** Version 3.2.1.6 (15. August 2013 - rev2272)
+ Changed: The library for Unity now contains a ExitGames.Client.Photon.Hashtable to be compatible with Win 8 exports. This must be used from now on!
+ Note: In Unity, the compiler will complain about ambiguous Hashtable definitions. To solve this, add this to the "using" part of your code: using Hashtable = ExitGames.Client.Photon.Hashtable;
+ Removed: Builds for Silverlight and Windows Phone 7.1 (this is not affecting Windows 8 RT and Windows 8 Phone SDKs which are of course supported)
+ Fixed: A null-reference check for a TCP connection's SendAcksOnly().
+
+*** Version 3.2.1.5 (06.08.2013 - rev2242)
+ Added: Steam and Facebook entries to CustomAuthenticationType enum.
+ Fixed: Potential nullreference exception in TCP SendAcksOnly() code. If called before Connect(), this always failed.
+ Updated: Replacement classes for datatypes not supported on some platforms (Hashtable mostly).
+ Added: Hashtable got a new GetEnumerator that returns a IDictionary just like the standard Hashtable does.
+ Changed: Constructor with int InitialSize now calls the matching base constructor.
+ Removed: Synchronized() method which didn't do much and is not used.
+ Changed: ToString is now an override instead a "new" method.
+ Changed: DataTypes.cs: the Stopwatch is only implemented for Silverlight (non Windows Phone 8)
+ Updated: Description.
+ Changed: Protocol to expect Hashtable always providing a DictionaryEntry. Related to change in DataTypes.cs.
+ Changed: Protocol now has conditional "Dictionary" detection. In WP8 the API is different for that. Uses #if WINDOWS_PHONE. same file now works in W8 and WP8.
+ Changed: Removed PRPCAttribute from SupportClass.cs. This is used only in PUN and needs conditional per-platform compilation anyways, so it gets implemented there.
+ Removed: surplus debug output in ReceiveIncomingCommands().
+ Fixed: Debug output in FetchServerTimestamp() depended on the Thread calling the method. Correct: The output is enqueued and dispatched later on.
+ Fixed: FetchServerTimestamp no longer fails with a SendError when the state is not "Connected".
+ Internal: Metro-Alike project now uses DataTypes.cs of Silverlight (like everyone else). Removed surplus copy.
+ Internal: DataTypes.cs and Protocol.cs files can now be used in DotNet 3.5, Windows Store and Windows 8 Phone.
+ Internal: outdated compiler-definitions "Photon" and "METROALIKE".
+
+*** Version 3.2.1.4 (10.07.2013 - rev2209)
+ Added: "Typed Lobby" API. Photon Cloud and Loadbalancing now support multiple lobbies per app/title. Also, different types of lobbies are now possible, each can have different options and different rules for matchmaking.
+ Added: enum LobbyType with "Default" and "SqlLobby". The SqlLobby is a new type of lobby that uses up to 10 room properties with sql-like filters. The filter being written like the "where" part of a sql query.
+ Changed: FetchServerTimestamp now enqueues callbacks (can be called by socket-receive-thread). also no longer causes a disconnect callback if offline
+ Changed: RemoveSentReliableCommand now enqueues callbacks (can be called by socket-receive-thread)
+ Internal: SendAcksOnly override in TCP's TPeer class. This now sends pings but nothing else. That resets the server's timeout for this peer
+LoadBalancing API
+ Updated: LoadBalancing API in the Unity demos (now gets copied over at build time, making sure it's identical to the DotNet "original")
+ Fixed: LoadBalancingClient now handles SecurityException and InternalReceiveExceptions and disconnects correctly. Before, especially Unity web clients would get stuck in "Disconnecting" state.
+ Fixed: LoadBalancingClient state on disconnect (no matter what caused the disconnect).
+
+*** Version 3.2.1.3 (19.06.2013 - rev2170)
+ Fixed: surplus conversion of incoming data to string, which was used in debugging.
+
+*** Version 3.2.1.2 (17.06.2013 - rev2160)
+ Fixed: custom auth will send custom auth parameters if any authentication params are set
+
+*** Version 3.2.1.1 (10.06.2013 - rev2148)
+ Added: new POST value for Custom Authentication. POST can carry more data than GET (usually used). AuthenticationValues has a setter for this.
+LoadBalancing API
+ Changed: LoadBalancingClient.AuthValues is renamed to CustomAuthenticationValues property (sets the custom authentication values).
+ Changed: Player class now compares by ActorNumer (assigned by server) instead of comparing the instance.
+ Internal: SupportClass.GetMethods() now returns type.GetRuntimeMethods(), filtered by attribute (if at all needed). This is used by Photon Unity Networking (PUN) internally. It also returns inherited methods now, not only Declared.
+
+*** Version 3.2.1.0 (24.05.2013 - rev2112)
+ Added: Feature "Custom Authentication" which lets you authorize players/users in the Photon Cloud with an external account/user service. More on that online: http://doc.photonengine.com/photon-cloud/CustomAuthentication
+ Added: LoadBalancing API Feature "Friend Finding" which enables a client to find friends in rooms by userId. If an external service provides a userID per player and a friend list, this can be used to find a friend's room (game) and join it (unless closed or full).
+ Added: CustomAuthenticationType enum to enable differnt types of custom auth later on (only one actually useful value so far).
+ Added: Class AuthenticationValues as container for authentication values.
+ Added: LoadBalancingClient.Connect overload which takes a AuthenticationValues parameter.
+ Added: LoadBalancingPeer.AuthValues property to set the custom authentication values.
+ Added: Parameter authValues to OpAuthenticate. This is used to provide the authentication parameters and or the secret/ticket provided by Photon.
+ Added: ErrorCode.CustomAuthenticationFailed to be used in switches for OperationResponse.ErrorCode (for OpAuthenticate).
+ Changed: LoadBalancingClient.PlayerName can be set before connecting to get a UserId which is "findable" by OpFindFriends(). Find friends does NOT use any values set for custom authentication!
+ Added: Class FriendInfo to contain a friend's name, online state and room name (if available and after using OpFindFriends()).
+ Added: OpFindFriends() to actually find the friends. Use on the Master Server only, not on a room.
+ Added: LoadBalancingClient.FriendList, a List of FriendInfo entries. Filled by using OpFindFriends (don't modify this list directly!).
+ Added: LoadBalancingClient.FriendListAge, to let you know how old the FriendList is. Only get updates when the list gets "old".
+ Fixed: OpRaiseEvent will no longer send "group" if it's 0 (which is the default).
+ Added: OpRaiseEvent overload to send object instead of Hashtable. This overload uses another parameter order to not mix up with the older implementation. You can send any serializable datatype now but must be aware if the event is Hashtable or something else.
+ Changed: Several variants of OpAuthenticate(), Connect() and ConnectToMaster() are now obsolete or removed. Use the alternative implementations (which should be cleaner).
+ Internal: Added several (operation) parameters to enum ParameterCode: ClientAuthenticationType, ClientAuthenticationParams, FindFriendsRequestList, FindFriendsResponseOnlineList, FindFriendsResponseRoomIdList.
+ Added: PhotonPeer.ResentReliableCommands to get count of re-sent commands (might be higher than out command count (as that counts created commands only)
+ Internal: Address (string) handling now uses string.Split instead of IndexOf to separate port from address and short.TryParse instead of short.Parse
+ Added: TrafficStatsGameLevel.ResetMaximumCounters() to reset those values that could max-out easily. Allows to get "longest delta between SendOutgoingCommands()-calls since last query".
+
+*** Version 3.2.0.2 (21.02.2013 - rev2066)
+ Fixed: Potential lock-up during sending. This could cause infinite blocking and thus a crash in some apps. (Win8 / Win Store api only)
+
+*** Version 3.2.0.1 (15.02.2013 - rev2060)
+ Fixed: Issue with delayed sending of operations in udp. The data could become overwritten before being sent. The bug was leading to high disconnect rates for clients using Windows Phone 7 and 8 and Silverlight or any client that used Network Simulation.
+
+*** Version 3.2.0.0 (13.02.2013 - rev2053)
+ Note: This release only changed the version, matching the new Server SDK v3.2.0.0
+ Updated: readme.txt
+ Fixed: Reference for Windows 8 RT and Windows Phone 8 SDKs.
+ Added: Particle Demo to Unity Client SDK.
+
+*** Version 3.0.1.18 (11.02.2013 - rev1998)
+ Added: Optional per package CRC checksums to filter out compromised packages (avoiding more issues, compared to reading bad values).
+ Added: PhotonPeer .CrcEnabled and .PacketLossByCrc to handle CRC and get the count of affected (incoming) packages.
+ Note: Checking packages with CRC will take some computation time. Consider this an option to detect if/why someone's connection is bad. It's likely not good to be enabled by default.
+Windows 8 RT & Windows 8 Phone:
+ Fixed: Serialization of foat and double values. These caused exceptions when used in object-arrays.
+
+*** Version 3.0.1.17 (19.12.2012 - rev1946)
+ Added: New Platform: Mono 4 Android. Please check the Readme.txt for hints how to build the demo in Mono 4 Android.
+ Changed: The referenced DotNet assemblies used by our libraries, which makes ours compatible with Mono 4 Android and others.
+ Changed: The Particle Demo Logic to also handle events sent by JavaScript clients. In case these are used, the types used in event differ from what DotNet or other clients send.
+ Changed: PhotonPeer.LocalTimeInMilliSeconds property now uses SupportClass.GetTickCount(). That method is using Environment.TickCount (which can be replaced if needed).
+ Changed: Any place that directly used Environment.TickCount (as the way SupportClass.GetTickCount() gets the value can be replaced).
+ Renamed: GetLocalMsTimestampDelegate is now: SupportClass.IntegerMillisecondsDelegate (rarely used if at all).
+
+*** Version 3.0.1.16 (29.11.2012 - rev1923)
+ Internal: A client timeout now internally sets connectionState to Zombie and then calls Disconnect() instead of stopping the connection right away.
+ Changed: Disconnect() sends a disconnect-command in any case (except not connected or disconnecting). If the connection is not in state connected anymore, said command is unsequenced (unreliable) and the disconnect is locally executed immediately as call to StopThread(). As before, disconnecting and disconnected clients won't send this.
+ Changed: Ping creation is now more strict and checks also if any reliable commands are outgoing AreReliableCommandsInTransit(). this avoids a few pings.
+ Fixed: NullReference exception in StopConnection() if it's called before being connected for the first time (late object creation made this fail).
+ Changed: PhotonPeer.LocalTimeInMilliSeconds property now uses SupportClass.GetTickCount(). That method is using Environment.TickCount (which can be replaced if needed).
+ Changed: Any place that directly used Environment.TickCount (as the way SupportClass.GetTickCount() gets the value can be replaced).
+ Renamed: GetLocalMsTimestampDelegate is now: SupportClass.IntegerMillisecondsDelegate (rarely used if at all).
+
+
+*** Version 3.0.1.15 (27.11.2012 - rev1917)
+ Note: Silverlight SDK release only!
+ Updated: Silverlight projects with proper references (hopefully). In case you wonder: Some projects are included even though only their (source) files are linked in Silverlight. We can't reference DotNet projects directly, so we use the (shared) files instead.
+ Updated: Silverlight Particle Demo now has a basic gui and hopefully helps with your first steps.
+
+*** Version 3.0.1.14 (16.11.2012 - rev1891)
+ Added: Interest Groups! In rooms, you might send events to an interest group, identified by a byte (255 groups are currently allowed). OpChangeGroups lets you add or remove groups you're interested in.
+ Added: New platform! Welcome Windows 8 RT and Windows Phone 8. Both are "preview" releases but based on the stable DotNet basis we have.
+ Note: The Windows Phone 8 SDK does not yet have a LoadBalancing demo but the API is available (Windows Phone 8 is separate from the still existing Windows Phone 7.1 SDK).
+ Added: Another new platform: Playstation Mobile! This is Sony's SDK for mobile platforms. Find out more about it: www.playstation.com/psm
+ Added: Silverlight 4 SDK is back. Now with LoadBalancing API (the demo implementation is not finished but the basic "logic" is running).
+ Fixed: Windows Phone 7 and Silverlight TCP error handling while connecting to the server. This should fix issues with failing connects due to missing policy settings.
+ Internal: Windows Phone 7 and Silverlight TCP connections now set their state a bit differently (this doesn't affect the workflow though).
+ Internal: Http implementation now checks if a Proxy was set deliberately. Check is: (WebRequest.DefaultWebProxy as WebProxy != null).
+ Internal: DispatchIncomingCommands() now avoids copying lists when checking for commands that need a repeat.
+ Internal: SendOutgoingCommands() now re-uses a buffer to create UDP packages in before sending. This should save a lot of memory allocation.
+LoadBalancing API:
+ Added: New demo "Particle". You will notice it's similar to the "Realtime Demo" but LoadBalancing- and Cloud-compatible and it makes better use of the default features. Check out Particle "Logic".
+ Added: LoadBalancingClient.DisconnectedCause to track certain disconnect causes (no matter if the connection or an operation caused the disconnect).
+ Added: DisconnectCause enum to enumerate those disconnection causes.
+ Changed: LoadBalancing OnOperationResponse() and OnStatusChanged() to track most disconnect reasons (in DisconnectedCause).
+ Removed: LoadBalancing Connect() variants that essentially were duplicates of others.
+ Changed: LoadBalancingClient debug output now goes to: Debug.WriteLine (which is available in debugger, while Console is not always).
+ Changed: CacheProperties method is now virtual for Room and Player. This allows you to override it and use this as callback to update props.
+ Added: Player.Tag to store arbitrary (game) data with the Player. Put in (e.g.) a player's representation/avatar or similar.
+ Added: ErrorCode constants MaxCcuReached and InvalidRegion. These are important for the Photon Cloud.
+ Added: Handling for DisconnectedByUserLimit. This is a status of OnStatusChanged when a Photon Server License's CCU limit is reached. This no longer will try to connect to a Game Server (where it gets rejected, too).
+ Changed: Debug output of loadBalancingClient now goes to Debug.WriteLine (which is available in debugger).
+ Changed: API now uses a factory method to create Room instances (this makes it possible to extend the Room class and instantiate the new class instead).
+ Changed: The Player constructor now has an "actorProperties" parameter and will cache the provided properties. This makes sure actor-props are available locally.
+Windows Phone 8:
+ Added: Demo for Cloud / LoadBalancing. The Particle Demo only has a special WP8 GUI and links it's logic from a separate project (read: folder).
+Windows 8 RT:
+ Added: Demo "Phong", which is a simplified, basic multiplayer game. It's focus is to show how to sync data, not to make it super smooth and error free. Let us know any issues but bear with us as it isn't fully featured.
+
+*** Version 3.0.1.13 (26.09.2012 - rev1731)
+ Fixed: Internals of method DispatchIncomingCommands() for UDP. In some cases this removed commands from a dictionary inside a foreach loop (which causes an Exception due to changing the dictionary)
+ Added: Support for Dictionary<,>[]. This is not a very lean way to send data (especially when using ) but if needed, it now works
+ Changed: Replaced several foreach loops with for loops (it doesn't change usage but in Unity exports to iOS, foreach uses more memory than for)
+ Added: Doc for public methods in Protocol class (they are useful to quickly write values into an existing byte-array)
+ Fixed: Unity UDP send code: iOS 5 devices will kill a socket when the power button is pressed (screen locked). This case was not detectable by checking socket.Connected.
+ Added: Unity UDP send code: Now tries to open another socket to refresh/keep the connection. This is affected by timeouts still, of course (as are all connections).
+ Internal: locked usage of UDP / enet channels
+
+*** Version 3.0.1.12 (26.07.2012 - rev1683)
+ Changed: The DotNet client libraries are now Thread safe! You could start a background Thread to keep calling SendOutgoingCommands in intervals and still call it from a game loop, too
+ Changed: Due to the thread safety, the demos no longer use excessive locks. This is now solved by the lib, more streamlined and hidden. One Thread is used instead of Timers (which could fire concurrently if execution was longer then their interval)
+ Changed: Moved the enable/disable property fro NetworkSimulationSettings to PhotonPeer.IsSimulationEnabled (this should now be thread safe)
+ Changed: NetworkSimulation will create and keep one thread when you first enable it in a (debug) client. Disabling it, will execute any delayed action immediately (in IsSimulationEnabled!) and pause the simulation thread
+ Changed: All demos are updated. We assigned new event codes (starting at 0, like any developer's code should) and extended the comments. Check them out
+ Changed: All Loadbalancing demos are now using the same DemoBasisCode linked in, so it can be changed in one position. Where needed an extension is made
+ Updated: comments / documentation for LoadBalancing API, Lite API and basic Photon API (basically anything public)
+ Changed: SupportClass.NumberToByteArray is now obsolete. It can be replaced with Protocol.Serialize() easily and that is performing better
+ Fixed: Windows Phone UDP socket was sending a full package of zeros on connect. It didn't break anything but is not needed, of course.
+ Fixed: SupportClass.StripKeysWithNullValues method was prone to throw an exception
+LoadBalancing API:
+ Changed: LoadBalancingClient.OpLeaveRoom() skips execution when the room is null or the server is not GameServer or the client is disconnecting from GS already
+ Note: LoadBalancingClient.OpLeaveRoom() returns false in those cases and won't change the state, so check return of this method
+ Fixed: workflow for authentication (which should be called only once per connection, instead of "any time we establish encryption)
+
+*** Version 3.0.1.11 (05.06.2012 - rev1569)
+ Fixed: Udp issue with channels and unreliable commands. Unreliable commands of one channel were discarded, when another channel had unreliable commands, too
+
+*** Version 3.0.1.10 (04.06.2012 - rev1561)
+ Fixed: TCP connection issues for DotNet and Unity (Silverlight and WindowsPhone are different)
+ Fixed: DotNet+Unity TCP send calls with 0 bytes to send (this was ignored by the socket but useless anyways)
+ Moved: DNS resolution and socket.Connect() are now handled in the connection thread (TCP in DotNet and Unity)
+ Fixed: Issue with (TCP) socket connections being closed directly while connecting. in this case, socket.Receive() might receive 0 bytes instead of blocking until more bytes are available. without sending anything, the socket never updates its .Connected state and never throws a Exception. now we send a ping and thus trigger a exception
+ Fixed: Some documentation errors (due to changed API, etc)
+Loadbalancing API:
+ Changed: LoadBalancingClient.OnEvent() now uses a join-event's actornumber-list to create Player instances for anyone who wasn't created as Player before
+ Fixed: LoadBalancingClient.OnEvent() handling for join-event does not expect any actor/player properties anymore (which fixes a potential null-reference exception when not even a name is set)
+
+*** Version 3.0.1.9 (10.05.2012 - rev1512)
+ Fixed: Reference to project in Windows Phone SDK
+
+*** Version 3.0.1.8 (09.05.2012 - rev1508)
+ Fixed: The OpJoinRandom of the LoadBalancingAPI failed to filter rooms for their custom room properties. Instead, any room matched. This is fixed now.
+ Added: New Demo for Windows Phone: Cloud Basics
+ Changed: The loadbalancing / cloud-based demos are refactored to share a similar codebase
+
+*** Version 3.0.1.6 (07.05.2012 - rev1489)
+ Note: This is a "stable" release, containing only a few updates. The bulk of changes are in the "odd" numbered releases. Read those updates carefully.
+
+*** Version 3.0.1.5
+ Changed: adopted the even/odd version numbering system. versions ending on a odd number = intermediate/in-development version, even number = released (that makes 3.0.1.5 a intermediate)
+ Fixed: When NetworkSimulation is disabled, all remaining packages are sent/received immediately (ignoring the former delays)
+ Note: NetworkSimulation should be working nicely now. Be aware that sudden, additional lag might (!) lead to a disconnect. Play with the settings to find out which ones work for you
+ Changed: Protocol class now has a few methods to (effectively) serialize some datatypes to arrays (and into existing arrays)
+ Removed: Surplus public methods from Protocol that were "type-named" like SerializeFloat. The functionality is in still with overloaded methods
+ Added: count of packages (requests) outgoing if TrafficStatsEnabled
+Demo Realtime:
+ Changed: The commandline arguments are now server:port, protocol (udp,tcp,http), reliable sending, interval dispatch, interval send, interval move. Example: localhost:5055 Udp false 15 25 15
+ Changed: Demo Realtime: If the commandline sets an unknown protocol, the client shows a message and closes gracefully
+ Changed: Demo Realtime: The demo now starts in the grid view (showing something). Local player and player list are created with the Game instance. Player startpoint is randomized.
+Loadbalancing API:
+ Renamed: LoadBalancingClient.lbPeer to .loadBalancingPeer
+ Fixed: LocalPlayer.SetCustomProperties() usage
+ Added: Service() method, which calls the LoadBalancingClient's Service simply
+ Changed: LoadBalancingClient is no longer extending LoadBalancingPeer but instead using one
+ Changed: the many overloads of Operations are gone in LoadBalancingPeer to streamline the api
+ Changed: ActorProperties are no longer set via JoinRoom, JoinRandomRoom or CreateRoom. instead, set the properties in the LocalPlayer and let the LoadBalancingClient send and sync them where necessary
+ Fixed: MasterClientId is now 0 when there are no more players in the room (it was set to int.max before)
+Internal:
+ Changed: all DispatchIncomingCommands now use a while loop to dispatch the ActionQueue (in the hope this is the fastest way to do it)
+ Changed: DispatchIncomingCommands now looks for the received unreliable command with lowest unreliable seqNr to dispatch this
+ Changed: DispatchIncomingCommands discards commands if the reliable OR unreliable sequence is beyond the command's sequences
+ Changed: DispatchIncomingCommands now truncates the incoming unreliable commands to limitOfUnreliableCommands (if that's > 0)
+ Changed: the next reliable command to dispatch is now fetched with Dictionary.TryGetValue() (for being faster)
+ Changed: no longer using BinaryReader streams anywhere (this should improve speed and reduce mem usage)
+ Changed: PeerBase accordingly
+ Changed: Unit test MyType de/serialization now supports null-references (as 1 byte being 0)
+ Changed: Protocol.SerializeOperationRequest is now used in the same way, no matter if request is "top level" or inside some other datatype
+ Changed: the peer bases accordingly to use only one SerializeMemStream and lock it
+ Changed: how encryption fits in to the new serialization (it is a special case, as only the operation bytes get encrypted)
+ Added: Protocol.SerializeParameterTable() as requests, events and responses all use the same way to write their parameters
+ Changed: SerializeOperationToMessage parameter order
+ Changed: Order of Protocol methods to make more sense (from byte to more complex types for serialization)
+ New: PhotonDotNet library prototype for windows 8 metro
+
+*** Version 3.0.1.3 (13.04.2012 - rev1430)
+ Known issues: The Network Simulation is currently not guaranteed to work properly. Please bear with us.
+ Note: the following change might be a breaking one:
+ Changed: When dispatching a server's disconnect-command, the state is changed to ConnectionStateValue.Disconnecting BEFORE any callback due to state change is called. This should disallow game-code from calling any operations immediately.
+ Changed: Many internals. This should result in better performance
+ Changed: Service() now calls SendOutgoingCommands() until send-queues are empty. This might take more time but gets important commands out. If you need more control, Service() can be replaced with DispatchIncomingCommands and SendOutgoingCommands!
+ Added: null check to GetEndpoint() to avoid issues when the host address is null
+ Fixed: queueIncomingCommand() debug out message when a command is being received AND in in-queue (the list it accesses is now a dict)
+ Added: new "vital" stats to TrafficStats
+ Added: LongestOpResponseCallback and LongestOpResponseCallbackOpCode (opcode and time of longest callback)
+ Added: LongestEventCallback and LongestEventCallbackCode (event code and time of longest callback)
+ Added: LongestDeltaBetweenDispatching and LongestDeltaBetweenSending to detect "gaps" between subsequent calls of those
+ Added: DispatchCalls and SendOutgoingCommandsCalls to measure average call-rate
+ Fixed: PeerBase.TrafficStatsEnabledTime now checks if a stopwatch is set, else it returns 0
+ Fixed: TrafficStatsReset() now works as intended (starting a new stopwatch, too)
+Internal:
+ Changed: name of variable timeLastReceive. is now: timeLastAckReceive (better fit with what it does)
+ Internal: queueOutgoingReliableCommand() to use a lock on the channel it accesses
+ Internal: SerializeOperationRequest() now locks the MemoryStream while using it (avoids threading-issues with calling OPs)
+ Internal: SendUdpPackage() now checks if socket is obsolete (and disconnected for a reason) or not. only if not, a error is logged
+ Internal: EnetChannel now uses Dictionary and Queue for commands (should be faster to access)
+ Internal: simplified access methods in EnetChannel according to changes
+ Internal: outgoingAcknowledgementsList is now a Queue
+ Internal: receiveIncomingCommands() no longer has a local variable sentTime. instead using this.serverSentTime directly
+ Internal: UDP sending is now done with a synchronous socket call (profiling told us: this is cheaper)
+ Internal: re-using the socket arguments for receiving packages (saves some buffer allocation)
+ Internal: socket to non-blocking (maybe not possible on all devices)
+ Removed: initial-HTTP-protocol support (HTTP support not public yet)
+ Added: support for encryption with HTTP protocol
+
+*** Version 3.0.1.2
+- Added: Rooms now have a "well known" property to list the custom properties that should be available in the lobby. This can be set per room (but most likely makes sense per title/application).
+- Added: LoadBalancingClient.OpCreateRoom() has a new parameter "propsListedInLobby" and Room.PropsListedInLobby is available to check this list (if needed at all).
+- Added: GameProperties.PropsListedInLobby as "well known property" key
+- Changed: LoadBalancingPeer.OpCreateRoom now sets ParameterCode.CleanupCacheOnLeave to true by default. This makes the server clean a player's event cache on leave.
+- Added: SupportClass.DictionaryToString() will now print values of string[] and optionally leaves out type information.
+- Note: 3.0.1.1 didn't get it's own SDK, so read that version's changes, too
+
+*** Version 3.0.1.1
+- Added: PhotonPeer.TrafficStatsElapsedMs, which gives you the milliseconds that the traffic stats are enabled. This internally uses a stopwatch (for now) which might not be available on all platforms. Please report if this new SDK causes issues.
+- Added: PhotonPeer.TrafficStatsReset() to reset the traffic stats and the timer. This could be useful to get stats of "in game" versus "out of game". Note: Loadbalancing includes frequent server-switching and each disconnect/reconnect causes a reset.
+- Changed: In LoadBalancingPeer EventCode.SetProperties is obsolete and replaced with EventCode.PropertiesChanged. Please switch to new constant.
+- Added: Support in LoadBalancingAPI for Player.IsMasterClient. For this, the Players now get a RoomReference set (when added). The active player with the lowest ID is the master (per room).
+- Added: Room.MasterClientId, which is updated when new players are added or the current master is removed.
+- Added: SupportClass.DictionaryToString() has an overload which doesn't "print" the Type per key/value.
+- Added: Loadbalancing API overload for OpJoinRandomRoom(...) taking additional parameter 'playerProperties'
+- Added: Loadbalancing API CacheProperties() and Room.GetPlayer() are public now
+- Added: LoadBalancingClient will now handle ExceptionOnConnect and keep clients from re-connecting if establishing a connection fails
+- Note: The following changes affect only HTTP, which is an upcoming option for connections. So far, the public server SDKs don't support this. Feel free to contact us about it.
+- Added: setter for PhotonPeer.ServerAddress to allow setting a http url (even while connected)
+- Added: PhotonPeer.HttpUrlParameters setting parameters to be added to end of url (must begin with '&')
+- Added: HttpUrlParameters to PeerBase
+- Added: HttpUrlParameters is now attached to the end of a URL in http usecase
+- Added: "Http2" support to Unity library
+- Internal: method HttpBase.ConnectAsync is no longer needed and Request() is now directly passed to thread
+
+*** Version 3.0.1.0
+- Added: Loadbalancing (Cloud) Features
+- Added: Project with the Loadbalancing sourcecode for DotNet, WindowsPhone and Unity3d (usable without PUN)
+- Added: Initial, simple Loadbalancing demos for each platform (will update and extend those)
+- Note: The API of the client libraries didn't change. The new features were added on top of the known API
+- Added: VS2010 solutions for DotNet and Windows Phone SDKs containing the demos and APIs in the package
+- Added: readme.txt with initial help to setup the Cloud/Loadbalancing demos
+- Added: default appId for Loadblanacing demos: ""
+
+*** Version 3.0.0.10
+- Added: When UDP StartConnection (internal method) fails, callbacks to OnStatusChanged(StatusCode.Disconnect) are now done additionally to the SecurityExceptionOnConnect and ExceptionOnConnect calls. This happens direcly inside PhotonPeer.Connect()!
+- Changed: When Unity UDP implementation fails to connect due to missing DNS resolution, it now also calls OnStatusChanged(StatusCode.ExceptionOnConnect)
+- Removed: StatusCode.Exception_Connect value (obsolete, replaced by ExceptionOnConnect, same value)
+- Fixed: Http connections (DotNet & Unity) now skip results while in disconnected state
+- Fixed: Http connections (DotNet & Unity) now ignore results after a disconnect and reconnect was done (this applies only to HttpBase, not HttpBase2)
+- Fixed: misleading debug out (pointing to WindowsPhone while the class is now in general use)
+- Changed: DotNet UDP connection now only logs socket errors if the connection isn't obsolete (disconnected) already
+
+*** Version 3.0.0.9
+- Fixed: issue with HTTP connections and EstablishEncryption()
+- Changed: ActionQueue is now a Queue, allowing Dequeue in a while loop instead of foreach(i in list) and clear()
+- Changed: Unity HttpBase DispatchIncomingCommands() to make use of the queue
+- Fixed: init byte[] length (internal. did not have consequences)
+- Fixed: LitePeer OpRaiseEvent() was sending encrypted
+- Internal: ContainsUnreliableSequenceNumber() check if reliable list needed sorting
+- Fixed: Unity/Silverlight bug with encryption. Their implementation of BigInteger.GetBytes() failed when the 2nd, 3rd or 4th of the first 4 bytes was 0 but the previous wasnt. This led to incompatible secrets.
+- Changed: TCP socket sending debug output now checks debuglevel (when send is skipped, cause the sender is obsolete already)
+- Added: caching option RemoveFromRoomCacheForActorsLeft = 7
+- Internal: Added another http-based communication protocol. Please note: The fitting server's are not yet publicly released. This does not affect UDP or TCP protocols.
+
+*** Version 3.0.0.8
+- Fixed: Udp fragment reassembly in case fragments are received out of order and incoming queue was not yet sorted
+- Fixed: Handling of incoming reliable commands (udp) which were skipped in some cases, if not received in order
+- Fixed: Network simulation issue which caused lost incoming commands
+- Fixed: Demo Realtime. protocol is now again Udp, fitting the default server address "localhost:5055" (make sure to build the demo with your server's address if Photon is not on the same machine)
+
+*** Version 3.0.0.7
+- Changed: Udp socket usage for Unity 3d lib. Both threads (send (in game loop) and receive (separate)) now have minimal locks while using the socket
+- Fixed: SendOutgoingCommands now returns true if anything didn't make it into the outgoing UDP package
+- Internal: TCP connections also skip network simulation when it's turned off
+
+*** Version 3.0.0.6
+- Fixed: SendOutgoingCommands now returns true if commands are remaining in outgoing queues (UDP only sends one package per call, TCP will send anything outgoing).
+- Added: New "RoomCache" for Events. The EventCaching enum allows you to use it. Events in this cache will keep the order in which they arrived in the server. A filter makes deleting them very flexible.
+- Internal: Ability to make lib send only ACKs and nothing else. This is probably a temp solution as it might be better to make sending and calling ops completely thread safe.
+- Internal: PhotonPeer.IsSendingOnlyAcks, which is locked with the sending (not changing while sending). This makes SendOutgoingCommands() thread safe, which is good if you need a separate thread to keep connection. You could call operations while sending.
+- Internal: Unity3d's connection now also syncs socket usage
+
+*** Version 3.0.0.5
+- Fixed: ObjectDisposedException in DotNet UDP workflow. This was caused by disconnecting while incoming data was processed (and before the next datagram was accepted)
+- Added: PhotonPeer.LimitOfUnreliableCommands property. This helps you skip potentially "outdated" unreliable commands (events), which helps if you couldn't dispatch for a while
+- Internal: Minor performance improvements. Example: The check if network simulation is turned on is done earlier in the workflow, which avoids a bit of overhead
+
+*** Version 3.0.0.4
+- Fixed: Tcp connections have been throwing ArgumentNullException in DispatchIncomgingCommands() if they were not connected yet
+- Internal: Adjusted Http client to server rev2360
+
+*** Version 3.0.0.3 RC2
+- Internal: Communication with HTTP server is WIP (Work In Progress - not a publicly available feature)
+
+*** Version 3.0.0.2
+- Fixed: OpRaiseEvent overload with EventCaching and ReceiverGroup parameters was not sending the customEventContent as expected. This was always null.
+- Fixed: Time fetching case where no time was accepted. Servertime is now accepted, if the fetch-time-command was less or equal as the current roundtrip time. Avoids issues if rtt is exceptionally low immediately.
+- Internal: When using multiple channels, dispatching incoming commands now will continue with the next channel, if one doesn't yet have the next reliable command (reliable sequence of one channel does not affect others)
+- Internal: Changed protocol for TCP and message headers. This will support bigger message sizes. Also changed debug out related to unknown headers.
+- Internal: Changed handling of TCP receive-callbacks for unfinished messages in Silverlight and WP. This should fix handling of very big data that's received in multiple "chunks"
+- Internal: Http messages are now deserialized the same way that content in tcp or udp is handled
+
+*** Version 3.0.0.1 RC1
+- Fixed: Packaging of SDK now includes all files in demo folders, except a list of ignored file-endings (xaml and jpg files were missing in previous Silverlight and WindowsPhone SDKs)
+
+*** Version 3.0.0.0 RC1
+- Changed: Filenames! Now include a '3' for Photon v3. Update your references! Also, Silverlight libraries now use "Silverlight" in the filename (was: SL)
+- Changed: Versioning. A dll's version has now 4 digits. The first 2 match Major and Minor number of the Server SDK. The latter 2 are Release and Build respectively
+- Changed: Silverlight DataTypes (like Hashtable) are now in namespace ExitGames.Client.Photon. This is easier to include (as that namespace is in "using" in most cases)
+
+*** Version 6.4.5
+- Changed: Parameters for OpCustom are now of type Dictionary, making sure that only byte-codes are used for parameters
+- Changed: Most IPhotonPeer names (to match those in server code): EventAction -> OnEvent, OperationResult -> OnOperationResponse, PeerStatusCallback -> OnStatusChanged
+- Added: SupportClass.DictionaryToString(), which converts the content to string (includes support for Hashtables)
+- Moved: Definitions of Lite and Lite Lobby specific codes for Parameters, operations and events are now in LitePeer. Will be available as source and could be replaced
+- Changed: Usage of codes in Lite and Lite Lobby. Now pre-defined codes are starting at 255 and go down. Your events, operations and operation-parameters can now start at 0 and go up without clashing with pre-defined ones
+- Changed: Constants that are non-exclusive (like event codes and OpKeys, which can be extended) are no longer "defined" as enums but as class of const byte values. Less casting but also less convenient "name" representation in debug output
+- Added: LiteEventKey.CustomContent as key to access the content you sent via OpRaiseEvent ("Data" seems a bit misleading but is also available)
+- Changed: Namespace of LitePeer to ExitGames.Client.Photon.Lite (the Lite-specific class is still compiled into the library for convenience but can be ignored quite easily this way)
+- Added: Property MaximumTransferUnit. The default is 1200 bytes. Usually this is ok. In few cases, it might make sense to lower this value to ~520, which is commonly assumed the minimum MTU. Don't change this, if you don't know why.
+- Added: New classes to wrap up op-requests (OperationRequest), op-results (OperationResponse) and events (EventData). Those new classes are now used in callback methods OnEvent and OnOperationResponse
+- Changed: by using the new classes (note above), the client is a bit more like the server in its naming. We didn't want to change every last bit though.
+- Internal: Changed protocol (to 1.6) so that it does not require any parameter codes internally. Any application can now define any operation, parameter and event codes it wants to.
+- Changed: Encryption is now triggered by you and resolved by the library. You don't have to look out for the result of EstablishEncryption and use it. Instead: wait for OnPeerStateChanged call with either EncryptionEstablished or EncryptionFailedToEstablish
+- Removed: InvocationId. This concept was very rarely used but confusing. It's easy to implement, if needed. If you don't know what this means: Nevermind.
+- Changed: Operation calls now return bool: if they could be enqueued or not. If enqueued (cause you are connected and the data was serializable), then SendOutgoingCommands will send those operations (as before).
+- Added: Support to de/serialize Dictionary. If the types are more specific than object, the serialization writes the type-code only once (lean byte usage in protocol)
+- Added: Support to de/serialize null. Enables you to send a null value, e.g. in a Hashtable
+- Added: ReceiverGroup enum to select a range of players that get an event via Operation Raise Event
+- Added: Event Caching. Any event sent via RaiseEvent can now be buffered on the server side and is "repeated" when a new player is joining a room. This is similar to Properties but lets you categorize your info better and works just like regular events, too.
+- Added: EventCaching enum to select if an event is to be cached and how it's cached: either "not at all" (default), replacing anything cached so far (fast) or "merge" (which will add new and replace old keys with new values). Optionally, a event can be raise with option "remove".
+- Added: new overload of OpRaiseEvent() with the two new parameters noted above
+- Added: Support for custom de/serializer methods. By writing 2 methods to convert a object into a byte-array (and back from that), Photon now supports any custom object type (standard datatypes are still supported out of the box)
+- Added: PhotonPeer.RegisterType() to register serializer and deserialize methods for a certain type. Per object, a length and one byte 'type code' are added to the serialized data
+- Added: Support for non-strict object[]. Unlike strictly-typed array, here each element will carry its own type.
+- Note: If you want to use the new Custom Types or the object[], you have to update your server! Older Servers don't support the new features. As long as you don't use these features, the library is compatible with previous servers.
+- Added: ByteCountCurrentDispatch and ByteCountLastOperation properties to PhotonPeer (the ancestor of LiteGame, etc). A game can now access the size of operation-results and events as well as operation-call size.
+- Added: Traffic statistic set: PhotonPeer.TrafficStatsGameLevel as "high level" game-related traffic statistic. Counts bytes used by operations, their results and events. This includes overhead for these types of messages, but excludes connection-related overhead
+- Added: Traffic statistic set: PhotonPeer.TrafficStatsIncoming and PhotonPeer.TrafficStatsOutgoing as low level statistics of the traffic
+- Added: PhotonPeer.TrafficStatsEnabled which enables two sets of traffic statistics. By default, statistics are turned off.
+- Added: Classes TrafficStats and TrafficStatsGameLevel for the two statistic cases metioned above
+- Changed: NetworkSimulation now starts a Thread when it becomes enabled and the thread ends on simulation disable. Disable the NetworkSimulation to stop the thread, as Disconnect does not change the simulation settings!
+- Internal: Cleanup and renaming of several properties
+- Internal: Each new peer increases the PeerCount but it is no longer reduced on disconnect (it is existing still, after all)
+- Internal: Udp commands will be buffered when serialized. This saves some work when re-sending a reliable command
+- Added: TCP Routing code (not in Silverlight). To be used when running Photon on Azure (can be ignored in regular use)
+- Added: to StatusCode: TcpRouterResponseOk = 1044, TcpRouterResponseNodeIdUnknown = 1045, TcpRouterResponseEndpointUnknown = 1046 and TcpRouterResponseNodeNotReady = 1047,
+- Added: override for PhotonPeer.Connect() with node
+- Internal: DotNet now reads the 2 bytes routing response, if a routing request was made (also, not in Silverlight)
+- Internal: If TConnect sent a routing request, nothing else will be sent until 2 bytes response are read.
+- Internal: If the routing-response does not start with ProxyResponseMarkerByte = 0xF1, a debug message is enqueued and TCP will disconnect
+- Internal: Init request for TCP is now always enqueued instead sent directly. This way, it can be delayed if a routing node is selected
+- Internal: TPeer EnqueueInit() and SendProxyInit() now create init and routing request respectively
+- Internal: TConnect.sendTcp() checks isRunning before it tries to send (the socket might close before the NetSim does). This won't be an issue anytime, still INFO-level callback to DebugReturn is done.
+- Removed: debug out for "send package" situation (even on ALL-level, this is more or less spam)
+- Internal: updated version numbers of init to 6.4.5
+- Changed: SupportClass HashtableToString() returns "null" if parameter is null
+- Internal: Removed SortedCommandList and CommandList classes. Replaced by List and a Sort() where necessary
+- Internal: EnetPeer.channels is now a Dictionary instead of a SortedList
+- Internal: the channels are initialized with channel 0xff first - this makes 0xff high prio in all foreach usaged
+- Internal: NCommand class is now IComparable for usage in Sort()
+
+
+*** Version 6.4.4
+- Added: PhotonPeer.TimestampOfLastSocketReceive now provides the time when something was received. Can be used warn players of bad communication-timing even before the disconnect timeout will be happening
+- Fixed: OpGetPropertiesOfActor did use the actorNrList correctly, which always got you all properties of all players
+
+*** Version 6.4.3
+- Changed: A udp connection timeout in Unity will now end the socket-handling thread correctly
+- Changed: The thread for Network simulation is now stopped when the client disconnects and started on connection (instead of keeping it per peer)
+- Fixed: Exceptions in network simulation, when Disconnect() was called soon after Connect() but before the connection was established.
+
+*** Version 6.4.2
+- Fixed: It was possible to send PhotonPeer.FetchServerTimestamp() before being connected properly. Now the method triggers debug output (INFO level) and the callback PeerStatusCallback(StatusCode.SendError)
+- Internal: Added a lock in the UDP version of SendOutgoingCommands(). It's still illegal to access a peer from multiple threads but the follow-up issues this lock avoids are very difficult to track.
+- Internal: to stay compatible with all exports of Unity, the use of System.Threading.Interlocked.Exchange was replaced by simply replacing the list's reference instead
+
+*** Version 6.4.1
+- Changed: The Unity library now uses the WWW class for Http based requests. Results are checked within DispatchIncomingCommands(). Important: Unity allows handling WWW requests only on the MainThread, so dispatch must be called from this context!
+- Note: Photon does not support Http requests out of the box. Customers get access to a fitting server on demand
+- Changed: outgoing list is now replaced on send, instead of calling remove(0) repeatedly (which takes longer). Internal: this uses System.Threading.Interlocked.Exchange to switch to a new outgoing list in one step
+
+*** Version 6.4.0
+- Fixed: TCP handling of incoming data. This avoids loss of data (operation-results or events) when a lot of data is incoming.
+- Changed: PeerStatusCallback() is less often called for queue-length warnings (e.g.: StatusCode.QueueIncomingReliableWarning). Only if a queue has a multiple of PhotonPeer.WarningSize items.
+- Changed: WarningSize is now 100 by default
+- Changed: Description of PhotonPeer.WarningSize and PhotonPeer.CommandBufferSize, which really is just the initial size of any buffer. The warnings are there to avoid situations where all heap is used up.
+- Changed: Naming: StatusCode.Exception_Connect is now Obsolete and replaced with StatusCode.ExceptionOnConnect
+- Added: Missing summary for StatusCode.SecurityExceptionOnConnect
+- Added: NetworkSimulationSet.ToString override to provide a better overview
+- Added: Support for arrays of Hashtables
+
+*** Version 6.3.1
+- Fixed: Network simulation now delays incoming packages by IncomingLag and IncomingJitter as expected (it was using the outgoing values, too)
+
+*** Version 6.3.0
+- Added: Network simulation (lag, jitter and drop rate) to debug builds
+- Added: class NetworkSimulationSet with properties to control network simulation
+- Added: NetworkSimulationSettings.NetworkSimulationSettings property to get current simulation settings
+- Changed: only the first peerId of a VerifyConnect is accepted in client (avoids surplus peerID changes)
+- Internal: added PeerBase.SendNetworkSimulated() and PeerBase.ReceiveNetworkSimulated() and a Thread to run delay simulation
+Siverlight:
+- Updated: to Silverlight v4.0
+- Added: Encryption to Silverlight library
+- Internal: updated internal BigInteger class for Silverlight
+- Internal: DiffieHellmanCryptoProvider in Silverlight, so it uses AesManaged instead of Rijndael (which is not part of Silverlight 3)
+- Added: Stopwatch class to DataTypes.cs (for Silverlight only)
+
+*** Version 6.2.0
+- Added: "Demo LiteLobby Chatroom" to Unity SDK
+- Updated: Demo Realtime in Unity client SDK. It's still compatible with the demo on other platforms but cleaned up and much better commented
+- Updated: Documentation is now clearer on where the Lite logic is used (it runs on Photon but is not the only application logic)
+- Updated: Documentation for the enumerations in IPhotonListener. The Lite application based ones are better described and it's now clear which ones are essential to the Photon client (not only in Lite)
+- Updated: Documentation in several other places
+- Added: StatusCode.SecurityExceptionOnConnect which is thrown if a security exception keeps a socket from connecting (happens in Unity when it's missing a policy file)
+- Added: PhotonEventKey and PhotonOpParameterKey which contain the fixed byte keys that cannot be re-assigned by applications at will (as these keys are used in the clients and server in their respective context)
+- Change: PhotonPeer.PeerState is no longer a byte but of type PhotonPeer.PeerStateValue, which makes checking the state simpler. The PeerStateCallback() for state changes is still called as before.
+- Changed: Property PhotonPeer.PeerState. It now converts the low level ConnectionStateValue to a PeerStateValue, which now includes a state InitializingApplication. See reference for PeerStateValue.
+- Changed: PeerStateValue enum is now part of the ExitGames.Client.Photon namespace, making it more accessible
+- Internal: NConnect in DotNet and Unity to catch security exceptions
+- Internal: from using var to explicit type usage in DiffieHellmanCryptoProvider.cs (Mono Develop friendly)
+- Internal: made const: ENET_PEER_PACKET_LOSS_SCALE, ENET_PEER_DEFAULT_ROUND_TRIP_TIME and ENET_PEER_PACKET_THROTTLE_INTERVAL
+- Internal: PeerBase "PeerStateValue peerState" is now: "ConnectionStateValue peerConnectionState" (holding the low level connection state, nothing more)
+- Internal: added PeerBase.ApplicationIsInitialized, which stores if the init command was answered by Photon (reset on connect/disconnect)
+- Removed: PhotonDemoServerUrlPort and PhotonDemoServerIpPort of PhotonPeer. All demos now use "localhost:5055" and you should run your own server.
+- Added: enum ConnectionProtocol to get rid of the "useTcp" parameter in the PhotonPeer constructor (which was less clear than the explicit enum now in use)
+- Added: overload of PhotonPeer constructor, which is still compatible with the "useTcp" bool parameter (to avoid a breaking change for the time being)
+- Added: PhotonPeer.UsedProtocol property to find out this peer's protcol
+- Added: LitePeer.OpLeave() overload without the gameName parameter. That name is not checked in the Lite application (on the server), so it's not really needed
+
+*** Version 6.1.0
+- Added: Encryption for Unity and DotNet. Operations (and their responses) can be encrypted after exchanging the public keys with the server
+- Added: OpExchangeKeysForEncryption(), DeriveSharedKey() and IsEncryptionAvailable to PhotonPeer (and LitePeer inherits these)
+- Added: OpCustom() will throw an ArgumentException if the operation should be encrypted but keys are not yet exchanged (exchange keys first)
+- Added: LiteOpCode.ExchangeKeysForEncryption = (byte)95
+- Added: Overloaded PhotonPeer.OpCustom() with new "encrypt" parameter
+- Added: property PhotonPeer.IsEncryptionAvailable is true if public-keys are exchanged and the secret is compiled from them
+- Added: Encryption demo to Realtime Demo. Press E to exchange keys and R to toggle encrypted sending for the move data (even though events are never encrypted)
+- Changed: PeerBase methods: sendOperation()->EnqueueOperation(...,encrypt), updateRoundTripTimeAndVariance()->UpdateRoundTripTimeAndVariance()
+- Updated: the Unity client is now a Unity v3.1 project. Make sure to change the server address before you build for iPhone (localhost:5055 won't work on the mobile)
+- Removed: the outdated, separate iPhone demo (was: Unity v1.7 for iPhone)
+- Updated: PhotonPeer documentation for Service(), DispatchIncomingCommands() and SendOutgoingCommands()
+- Added: OpRaiseEvent() overload with parameter TargetActors. Sends optional list of actors that will receive the event (if null, all *other* actors will receive the event, as default)
+- Internal: Added source BigInteger.cs, DiffieHellmanCryptoProvider.cs and OakleyGroups.cs
+- Internal: PeerBase.CryptoProvider, PeerBase.ExchangeKeysForEncryption() and PeerBase.DeriveSharedKey()
+- Internal: EnetPeer.initPhotonPeer() and TPeer.initPhotonPeer() are setting PeerBase.isEncryptionAvailable = false
+- Internal: De/Serialization methods (and some variables for it) are moved from NConnect to PeerBase and renamed to: SerializeOperationToMessage() and DeserializeMessageAndCallback()
+- Internal: switched project to allow "unsafe" functions (used by BigInteger)
+- Internal: renamed PhotonPeer.sendOperation()->EnqueueOperation
+- Internal: changed assembly version to 6.1.0 and "client version" in init-byte-block to 6,1,0
+- Internal: moved protocol handling to EnetPeer and TPeer classes (where encryption is added)
+- Internal: moved InitBlock to (shared) PeerBase (same for UDP/TCP)
+- Internal: serialization is now done by Protocol.SerializeOpParameters(), which excludes the message header. this makes encryption simpler
+
+*** Version 6.0.0
+- Changed: This library requires Photon v2.2.0 and up! (in other words: the libraries are not compatible with older Photon servers, due to servertime changes)
+- Added: Support for arrays in arrays. Any serializable datatype can now be used in nested arrays. Even arrays of Hashtables are possible.
+- Added: Realtime Demo optional command line arguments for game config. set all or none: serverAddress, useTcp (true/false), useReliable (true/false), int intervalDispatch, intervalSend (ms), intervalMove (ms)
+- Note: Realtime Demo commandline might look like this: start demo-realtime.exe localhost:5055 false true 5 25 100
+- Changed: renamed GetLocalMsTimestamp property to LocalMsTimestampDelegate (it does not have a getter, despite the old name's implication)
+- Added: PhotonPeer.LocalTimeInMilliSeconds property to use the timestamp delegate to get the current client milliseconds (by default this is Environment.TickCount)
+- Changed: UDP: The default value for PhotonPeer.RoundTripTime (300ms, used before connecting) is now replaced with the turnaround time of connect. This should lead to accurate RTT values much sooner
+- Changed: PhotonPeer.ServerTimeInMilliSeconds is no longer updated all the time. Instead it's fetched soon after connect (when initialization won't affect rountrips anymore) and extrapolated. It should be better to be off by a constant value than by a changing value
+- Changed: PhotonPeer.ServerTimeInMilliSeconds now returns 0 until the server's timestamp is fetched. Updated the documentation with some internals for this.
+- Added: PhotonPeer.FetchServerTimestamp() to send the time fetch command (this is done automatically as well. this method is here for completeness)
+- Fixed: roundtrip time calculation is no longer affected by long intervals between Service() or DispatchIncomingCommands() calls (bug of v5.9.0, caused by internal action queues)
+- Added: internally for UDP, we use a new command to fetch the timestamp which minimizes the latency for that roundtrip. this one is excluded in roundtrip time measuring
+- Changed: internal: ACKs by the server are again directly executed (other commands which are put into the action queue and dispatched)
+- Fixed: Peers with TCP as protocol will no longer try to disconnect while not being connected (does not do anything of disconnected or disconnecting)
+- Changed: Peers with TCP as protocol will clear the outgoing queue when disconnect() is called (while connected. see fix above)
+- Updated: Silverlight Realtime Demo slightly
+- Added: PhotonPeer.Listener property to give subclasses access to the IPhotonPeerListener (set in constructor). Can be useful to call Listener.DebugReturn()
+- Added: LitePeer-Source.cs to demo-realtime. This is the source of a LitePeer and could be used as sample to create custom operations on the client side
+
+*** Version 5.9.0
+- Release: of changes in 5.7.6 and 5.7.5
+
+*** Version 5.7.6
+- Fixed: a debug output line for TCP connections which did not heed the debug-level.
+- Changed: PhotonPeer uses less locking internally and will handle incoming data in the game thread (inside DispatchIncomingCommands() or Service()).
+- Changed: Internally, all commands are put into a (locked) queue which is processed within DispatchIncomingCommands(). Your dispatch interval affects local lag but not the PhotonPeer.RoundTripTime value.
+- Note: Don't use a peer from multiple threads! It's not thread safe. All callbacks to IPhotonPeerListener methods are happening in your game thread (again: inside DispatchIncomingCommands()).
+- Changed: removed locks inside the callbacks (according to above change).
+- Changed: DNS resolution is now done in Connect() unless you provide a valid IP address (if IPAddress.Parse(address) is successful, the IP is used directly).
+- Fixed: PhotonPeer.Connect() should fail if the IP is unknown or unavailable. Exception: using a localhost might succeed but fail when we try to receive anything.
+- Updated: Game.cs now initialized the timing intervals. This avoids issues if the client system is having a negative TickCount.
+- Added: ServerAddress property to PhotonPeer, which might help while developing with several servers and peers.
+- Changed: This version includes GetLocalMsTimestampDelegate and the PhotonPeer property GetLocalMsTimestamp to set the delegate for local timestamp.
+
+*** Version 5.7.5
+- Changed: All precompiled demos now connect to localhost! From now on, you need to run Photon before trying any of the demos (as we don't guarantee that udp.exitgames.com is online anyways)
+- Changed: OpCustom() now accepts null as parameter Hashtable, which is a shortcut to "no parameters" for simple operations (an empty hashtable is sent though, it does not reduce bandwidth)
+- Added: new feature: UDP timeout definition by setting PhotonPeer.DisconnectTimeout (individual per command, set in milliseconds, checked when a command is repeated)
+- Renamed: enum ReturnCode to StatusCode. The StatusCode values are only used for status callbacks (not as operation results)
+- Changed: parameter type of PeerStatusCallback() from int to StatusCode (to differentiate them from operation ReturnCodes, which are customizable)
+- Removed: StatusCode.Ok (as it was actually an Operation ReturnCode)
+- Added: new StatusCallback value: StatusCode.SendError. Used for sending error cases: "not connected" and "channel not available"
+- Changed: sendOperation() (Udp and Tcp) does not throw an exception while disconnected or for wrong channel (using StatusCode.SendError instead)
+- Changed: callback DebugReturn() now has the additional parameter (DebugLevel)level, analog to logging
+- Changed: UDP connection is disconnected when a read exception happens (before we tried to read despite this until a timeout ended it)
+- Changed: EnetPeer.Disconnect() now ignores calls when peer is disconnected or disconnecting already
+- Fixed: TCP code tried to detect socket issues by checking for IOExceptions but now checks SocketException instead
+- Changed: internal threading: Callbacks due to incoming packages and commands are now queued and triggered by dispatch (in game loop)
+- Changed: dispatch of action-queue as added to DispatchIncomingCommands (in EnetPeer and TPeer)
+- Changed: internally, there is no locking for outgoing reliable and unreliable command lists anymore
+- Changed: Realtime Demo timer usage to avoid nullref on form-close
+- Changed: Realtime Demo propety isReliable is now in the Player class
+- Changed: Game.cs and Player.cs for all realtime demos. There is now something like a gameloop (Update()) which must be called regularly and makes (pretty) sure just one thread accesses the peer
+- Changed: all realtime demos to use the new Update() method and use more similar Game and Player classes (cleanup for less differences)
+- Fixed: RoundtripTimeVariance is now also reset on connect / init, so the resend-timing of reliable udp does not suffer when a peer connects after a disconnect
+- Fixed: typo in ExitGames.Client.Photon.StatusCode.QueueIncomingUnreliableWarning (was QueueIncomingUneliableWarning)
+
+*** Version 5.7.4 RC3
+- Changed: Unity3D lib again has it's own UDP handling (the DotNet one causes browser crashes on web-player exit)
+
+*** Version 5.7.3 RC3
+- Changed: Unity3D lib is now identical to DotNet lib (Unity iPhone is compatible with DotNet 2.0 now and this got tested)
+- Fixed: DNS resolution (did not work for "localhost", which gave two results (IPv4 and IPv6), mixing up things
+
+*** Version 5.7.2 RC3
+- Changed: Unity3D lib: the receive thread will now receive until no data is available, then sleep 5ms and check again
+- Changed: serverTime is now a signed int (as on server) and adds averaged rountripTime/2 when it gets an update
+- Changed: ServerTimeInMilliSeconds doc (more concrete, explains how server time works)
+- Added: support for serverTime, RountripTime and RoundtripTimeVariance when using TCP (Silverlight does not allow UDP)
+- Added: Silverlight supports either URL:Port and IP:Port as server url string
+
+*** Version 5.7.1 RC2
+- Added: DotNet "Lobby Demo" which uses the "LiteLobby" application of the server SDK to show running games and their player-count
+- Changed: the realtime demos to use the more similar Game and Player classes
+
+*** Version 5.7.0 RC1
+- Added: documentation: project for Silverlight Hashtable and ArrayList substitutes.
+- Changed: RealtimeDemo uses same classes Game and Player for Unity3 + Silverlight
+- Changed: Silverlight: Hashtable and ArrayList are now a separate project / lib
+- Internal: Silverlight: listener interfaces (Photon and Neutron) now conditionally use ExitGames.Client datatypes from lib
+- Changed: Photon: connect callback is now deferred to on-init-response (instead of enet-connect) which ensures "no ops before init"
+- Changed: Unity Realtime demo: using game and player classes merged over from silverlight and re-wrote sample code to display players
+- Internal: photon projects now have a pre-compile setting "Photon"
+- Changed: SupportClass Namespace is now compiling into either ExitGames.Client .Photon or .Neutron (to avoid ambiguation)
+- Added: LitePeer as Lite Application specific peer (with OpJoin and the rest)
+- Changed: demos accordingly
+- Changed: case of PhotonPeer methods to first-letter-is-uppercase (as usual in C#)
+- Removed: nNet-prefix (Connect and Disconnect are self-explanatory)
+- Renamed: PropertyTypes are now LitePropertyTypes (as they belong to the Lite application)
+- Changed: Peer state constants with PS_* converted into enum "PeerStateValue"
+- Removed: URL_RT_SERVER, URL_RT_SERVER_DEV, IP_RT_SERVER and IP_RT_SERVER_DEV
+- Added: PhotonDemoServerUrlPort and PhotonDemoServerIpPort
+- Renamed: NPeer to PhotonPeer
+- Renamed: PhotonPeerListener to IPhotonListener (class and file)
+- Changed: namespace from Com.ExitGames to ExitGames and ExitGames.Client, ExitGames.Client.Photon and ExitGames.Client.Neutron
+- Removed: QueueOutgoingUnreliableError, QueueOutgoingAcksError, QueueIncomingReliableError, QueueIncomingUneliableError, QueueSentError (no errors, only warnings)
+- Removed: error "report" when TCP incoming queue getts fuller
+- Internal: updates Neutron part to run with Protocol.cs de/serialization (added a serializeParametersNeutron() as there are multiple differences to UDP part)
+- Changed: projects and scripts to build documentation xml in debug builds
+- Renamed: demo-photon-SL to demo-realtime-SL (according to other demo realtime implementations)
+- Changed: many classes and properties are now internal. e.g. Protocol, EnetChannel, EnetPeer (and inner classes), TPeer, SuppportClass.ReadInput()
+- Updated: AssemblyInfo.cs for photon dotnet and silverlight
+- Internal: projects to have precompile-flags also in release builds
+- Updated: build scripts for SDK building
+- Removed: Compact Framework support
+
+*** Version 5.6.1
+- Fixed: 0 element arrays caused bugs
+- Fixed: double type was cast incorrectly after being read
+
+*** Version 5.6.0
+- Added: more supported datatypes: float, double and arrays of all basic datatypes (no arrays of hashtable or arrays)
+- Internal: changed Photon protocol internally to 1.5. (needs a server update to Photon Server SDK 1.6.1+)!
+- Changed: Channels for Photon UDP are now priorized (from low to high) getting the lower channels out first
+- Internal: switched de/serialization at several places from manual shifting to a support function, which should provide endian-correctness (Photon Unity PPC compatibility)
+- Added: Unity info about "Application.runInBackground = true;" to Unity Appendix in doc
+- Changed: Photon return values are put into a NEW hashtable on receive. not just a cleared one which was not reference-safe (no more need to deep-copy the data of events)
+- Added: Photon support for "disconnect-reason" which is sent by server in the enet "reserved" byte
+- Added: Photon ReturnCode.DisconnectByServerUserLimit and .DisconnectByServerLogic
+- Removed: NPeer.IncomingReliableCommands (was more or less useless)
+- Added: QueuedIncomingCommands and QueuedOutgoingCommands as metric for how effective send and dispatch is done
+- Changed: now throwing exceptions when trying to set init-values at runtime (to be fixed at development-time)
+- Added: doc for sequencing and updated channel doc, (too) short chapter on custom operations, topic "opCodes: byte versus short", doc for property-related functions
+- Added: overloaded functions for opGetProperties*() for byte-keys
+- Fixed: Realtime Demo keypress in input-fields have been used as in-game actions, too
+- Changed: Realtime Demo game-name is now that of the native samples ("play" with other platform SDKs)
+- Changed: Silverlight SDK has a different port in the constants NPeer.URL_RT_SERVER* and .IP_RT_SERVER* (as Silverlight uses TCP port 4350)
+
+*** Version 5.4.1
+- Added: missing documentation in Unity3d SDK
+
+*** Version 5.4.0
+- Change: The timespan until a sent and unacknowledged reliable command is considered lost, is now calculated by
+ current roundTripTime + 4 * roundTripTimeVariance
+ The result of this calculation is doubled with every following resend. The maximum number of retries can still be defined by calling SetSentCountAllowance.
+- Change: Removed TimeAllowanceInt
+- Change: removed surplus debug out, adjusted levels for other, output of command sent-time from hex to decimal
+- Added: fragmentation support: bigger data is now placed into multiple packages and reassembled
+- Internal: command-buffers are replaced with CommandList and SortedCommandList (major change, but fully internal)
+- Fixed: possibility of command buffer overflow. now everything is stored and warnings are used as hint for temporary problems
+- Added: property NPeer.IncomingReliableCommands, which returns the count of reliable commands currently queued
+- Added: callback on NCommand.CT_DISCONNECT to inform the NPeerListener about a disconnect from server (see above)
+- Added: disconnect command will be sent by server in case of timeout, connection-limitations or other issues
+- Added: NPeer ReturnCode.DisconnectByServer is called on server-side disconnect (see description)
+- Added: call to StopConnection() on disconnect (by server)
+- Added: NPeer.PeerID property to get ENet's peerID (useful while debugging)
+- Internal: SupportClass.WriteIntToByteArray() to ease writing ints to byte[]
+- Internal: added several values to NCommand to store fragments
+- Added: support for channels. read more about this in the documentation
+- Added: NPeer.ChannelCount which sets the number of channels while not connected (default: 2)
+- Changed: opRaiseEvent() and opCustom() now optionally have a channel parameter
+- Added: Photon properties functions to NPeer (available with Photon Server SDK v1.5.0) and doc
+- Added: LiteEventKey.SetProperties = 92 for broadcasted property set
+- Added: LiteOpKey.Broadcast = 13 and .Properties = 12
+- Added: LiteEventKey.TargetActorNr = 10 (actorNr the properties are attached to) and .Properties = 12 (changed properties)
+
+
+*** Version 5.3.11
+- Change: all bytes sent to and from server are treated as unsigned bytes (standard for c#). same for byte-arrays
+- Change: updated realtime demo to use int for posx,posy but still sending just a byte-value (the field is 16x16, after all)
+
+*** Version 5.3.10
+- Change: switched from sbyte-array to byte-array in de/serialization! important: bytes (ev-keys etc) are sbyte. arrays of bytes are unsigned (on client and server)
+- Change: NeutronListener functions getShadowReturn() and HasbadwordsReturn() now have byte-array return values. please adjust, even if you don't use those
+- Internal: changed SupportClass for Compact Framework
+- Internal: getting ticks sitched from expensive "System.DateTime.Now.Ticks / 10000" to cheap "Environment.TickCount"
+- Change: Unity lib will now give more debug out if serialisation fails
+
+*** Version 5.3.9
+- Fixed: result-queue, timeouts and customOps work also fine for Unity build again (were broken due to Neutron Unity webplayer compatibility changes in 5.3.8 for Unity)
+- Fixed: if the browser is closed and the unity webplayer immediatly can't use http anymore, Neutron now informs the application via NetworkStatusReturn()
+
+*** Version 5.3.8
+- Fixed: Neutron Unity now also works fine in webplayer -> Neutron and Photon now both support all platforms of Unity und Unity iPhone
+- Fixed: default value for parameter encrypt of NeutronGame::RaiseEvent() now is false like for all other RaiseEvent methods and like on all other platforms, instead of true, as it was before
+
+*** Version 5.3.7
+- Fixed: .Net UDP issue, where standard MTU settings caused dropped UDP packages
+- Internal: refactored ACK queue to arraylist
+
+*** Version 5.3.6
+- Fixed: NPeer issue with ACKs for repeated commands. this enhances handling of lost packages
+- Changed: NPeer.opJoin() no longer needs the SID
+
+*** Version 5.3.5
+- Known issues: to use Photon on iPhone device, you do need Unity iPhone 1.0.2b1 or higher (current official release is 1.0.1, so please ask for a prerelease or wait until next official release), but of course you can use Photon with Unity iPhone 1.0.1 IDE
+- Merged: renamed .NET 1.1 NeutronUnity3DiPhone into NeutronUnity3D to replace the old .NET 2.0 lib of that name, which means, that you can use the same .NET 1.1 based lib for Unity and for Unity iPhone now, since 1.1 cpmpatibility fixes are all done now
+- Fixed: photon is fully compatible to .NET 1.1 now
+- Internal: optimized UDP package size in Unity3D library (was sending surplus bytes, which were ignored)
+- Fixed: NPeer.opCustom() now sends the operation given by parameter
+- Changed: IP_RT_SERVER points to new server IP of udp.exitgames.com
+- Changed: a new NeutronSession now clears the NetworkLoss state and the sendQueue
+- Changed: timeout of a HTTP request to 10 seconds. it triggers
+
+*** Version 5.3.4
+- Added: prealpha Unity3DiPhone version of Neutron .NET: core lib already functional, but realtime part not usable on device yet
+- Internal: there are 4 different versions of Neutron.NET now:
+ - Full .NET: .NET 2.0 based, with asnyc realtime part
+ - Compact Framework: .NET 2.0 based, with threaded realtime part
+ - Unity3D: .NET 2.0 based, with Unity www-class based http part and threaded realtime part
+ - Unity3DiPhone: .NET 1.1 based, with Unity www-class based http part and threaded realtime part
+
+*** Version 5.3.3
+- New: ReturnCode.RC_RT_EXCEPTION_CONNECT, which covers the cases where a server is not running
+- New: NPeer can now be created with UDP or TCP (by new bool parameter)
+- Change: renamed most of the constants for NPeer (in INPeerListener structs)
+- Note: TCP does not offer ServerTime or RoundTripTime jet
+
+*** Version 5.3.2
+- Internal: reverted to threaded model in NConnect (as async UDP is not supported by Unity3D)
+
+*** Version 5.3.1
+- New: login(), register(), customOperation() and raiseEvent() (all variants) can be encrypted with additional parameter "encrypt" (overloaded function)
+- New: encryption uses HTTPs as transfer, by changing the "http:" url to a "https:" url
+- New: returnCode for failure of encrypted HTTPs requests: RC_SSL_AUTHENTICATION_FAILED (if certificate is not found, valid or expired)
+- Fixed: Realtime Demo using the older Realtime Server
+
+*** Version 5.3.0
+- New: separated libraries into "Compact Framework" (CF) and "Regular Framework" (no name postfix)
+- Change: libraries are now in "libs" folder as debug/release and in libs/CompactFramework debug/release
+- Change: libs default URL set to EU/Test. use setServerURL() with Neutron.URL_NEUTRON_* for other Neutron instances
+- Internal: lib now uses async UDP communication now with "regular" framework
+- Added: properties serverTimeInMilliSeconds, serverTimeAsTimeSpan and serverTimeAsDateTime for getting the current server time
+- Removed: serverTimeOffset is now internal only and removed from the API (was only needed to calculate the servertime by yourself, before neutron could do this for you)
+- Change: debug out for realtime classes is now layered
+- Change: debug level NPeer.DebugOut is now a NPeer.DebugLevel enum and will include all lower levels in output, default: DebugLevel.ERROR
+- Fixed: size of realtime demo board
+- Change: NPeer constructor now always throws an exception if listener is null
+- Change: EventAction() parameter eventCode is now of type sbyte (was int), which corresponds to type of RaiseEvent (and server-side used type)
+- Internal: NPeer.opRaiseEvent() now treats eventCode as parameter of operation RaiseEvent (as changed in latest RT server)
+- Change: NPeer has its own listener (INPeerListener) and several (better named) structs for the constants used with NPeer / realtime
+- Added: LiteOpKey and LiteOpKey.ActorNumber to have a constant for the only OP key of interest
+- Change: EventAction() always returns the complete event, which contains a code, the ActorNumber (if any given) and data from raiseEvent (see below)
+- Change: in custom events, the data from opRaiseEvent() is in placed as value of key: LiteEventKey.EV_RT_KEY_DATA. to get the data use: Hashtable data = (Hashtable)neutronEvent[LiteEventKey.EV_RT_KEY_DATA];
+
+*** Version 5.2.0
+- changed library filename to neutron-lib__.dll with server "test" and "run" (no debug out) and billing "dummy" and "none"
+- removed US build of library. please use NeutronSession.SetServerUrl() and the constants: Neutron.URL_NEUTRON_SERVER_*.
+
+*** Version 5.1.0
+- added realtime classes to DotNet library: ported NPeer (and internal: NCommand and NConnect) classes
+- added nPeerReturn() to NeutronListener interface
+- added constants for realtime returnCodes (RC_RT_*): RC_RT_CONNECT, RC_RT_DISCONNECT and RC_RT_EXCEPTION
+- added constants for realtime eventCodes (EV_RT_*)
+- added constants for Neutron servers to Neutron class: URL_NEUTRON_*
+- added Reamtime Demo
+- updated samples
+- added test for UDP to NUnit
+
+*** Version 5.0.1
+- New: operation Spectate (including new SpectateReturn) to get events from any game (as admin)
+- New: SetServerUrl and SetCustomServerUrl now return the URL to debugReturn
+- Internal: constant "DEBUG_- InternalS" to be used for intern debugging output
+
+*** Version 5.0.0
+- New: hasBadwords() as OP and return. Server side check of strings for badwords
+
+*** Version 5.0.0 RC3
+- Internal: changed constant values: EV_KEY_PROPERTIES = "Data", EV_KEY_REVISION = "Rev"
+- New: EV_KEY_CHANNELTYPE for channel-type in property-change events
+- New: constants for default channels, CHANNEL_APPLICATION_LONGLIFE, CHANNEL_ACTOR_SHORTLIFE, CHANNEL_ACTOR_LONGLIFE and CHANNEL_APPINSTANCE
+- Change: operations that fail due to missing moderation-rights now return RC_MODERATION_DENIED instead of RC_COMMAND_ACCESS_DENIED
+- Change: actor-properties can no longer be broadcasted in any way - removed "broadcast" parameter from setActorProperties()
+- Change: properties now have a revision which is increased on each change. this way outdated updates might be skipped
+- Change: parameters of GetPropertiesReturn(). property-type is replaced by channel. added revision
+- Change: EV_PROPERTIES_CHANGE now has a key EV_KEY_OWNERNR if it's a "player property" (the key is missing if it's a game-property)
+- Internal: changed setProperties and getProperties to new operation-codes using different parameters (with similar results)
+- New: parameter "textMessage" for NeutronGame.invite() adds personal message to invited players (in EV_INV and gameListInvitations())
+- New: key EV_KEY_INFO will be added to EV_INV if "textMessage" was used in NeutronGame.invite() (it's not there otherwise)
+- New: gameListInvitations() has new value parameter {t} to get "textMessage" from NeutronGame.invite()
+- New: RC_APPINSTANCE_NOT_OPEN is now used for "singleton namebased pools" where a game is full (not able to join / instanciate)
+- New: gameCreate() with invitations will fail if the chosen game-name is already taken in a "singleton namebased pool"
+- New: RC_APPINSTANCE_ALREADY_EXISTS for the case above
+
+*** Version 5.0.0 RC2
+- Change: gameCreateReturn() now returns RC_APPINSTANCE_NOT_OPEN (instead of RC_AI_TOO_MANY_ACTORSESSIONS) for full games in "singleton" pools
+- Change: obsolete events EV_TURN, EV_TXTMSG and EV_DATA which could be sent by raiseEvent*() and still handled
+- Change: switched Neutron URLs to "[..].neutron5.[..]" for test/run libs
+- Fix: Polling (getEvents operation) again calls sendGameDataReturn() for all errors (as intended for v4.9.2 already)
+- New: constant NeutronListener.EV_KEY_TYPE as part of event EV_BUDDNOTICE
+
+*** Version 5.0.0 RC1
+- New: RaiseEvent (all functions of this name) now has a "filter" parameter. If filter is true, all String-typed values in an event are badword filtered
+- Change: signature of NeutronGame.raiseEvent(), NeutronGame.raiseEventInChannel(), NeutronSession.raiseEventInChannel(), NeutronSession.raiseEventForActor() start with: byte eventCode, Hashtable event, boolean filter
+- Change: signature of NeutronSession.raiseEventForActor() is changed to "byte eventCode, Hashtable eventData, boolean filter, String userID, int minutesValid, byte maxTypeCount, byte channel"
+- Change: NeutronGame.doModerate() is now isModerator()
+- Change: moved GpOperation.SerializeData() and GpOperation.DeserializeData() to Neutron.SerializeData() and Neutron.DeserializeData().
+- New: errorCode RC_INVALID_TARGET and RC_PARAMETER_NOT_SUPPLIED added as constant.
+
+*** Version 4.9.3
+- New: Errors constants in NeutronListener: RC_FATAL_LOGIC, RC_MATCHMAKING_NOT_COMPLETED, RC_CHANNEL_ACCESS_VIOLATION
+- New: for game-creation you can now reserve "spots", which are not filled up by Neutron matchmaking. players can be invited to fill the spots, or they can be deblocked later on
+- New: Parameter reservedSpots in NeutronSession.gameCreate()
+- New: NeutronGame.setReservedSpots() to modify the number of reserved slots (to make them available to matchmaking again, or block/reserve them)
+- New: event EV_RESERVED_SPOTS will update the NeutronGame.reservedSpots value after a call to NeutronGame.setReservedSpots()
+- New: NeutronSession.listBannedPlayers() gives you the list of banned players for a known game - only usable by "admin" users
+- New: NeutronSession.unbanPlayer() is a modified "kick" operation which allows the respective user to join a certain game again - only usable by "admin" users
+- New: the event invitation includes now the game's name (in the new key EV_KEY_NAME)
+- New: NeutronSession.gameListPerPool() has now three options to sort the results: by game-name, player-count or "persistent games first"
+- Removed: NeutronGame: handoverTurn(), sendData(), sendTextMsg(), getEventHistory() and getEventHistoryReturn(). Obsolete events: EV_TURN, EV_TXTMSG, EV_DATA. Session: getScorePosition()+getScorePositionReturn()
+- Update: release_history.txt was updated from v4.0. All changes up to v4.0.4 are added to v4.9.3
+
+*** Version 4.9.2
+- New: Players can be admins (by list of logins on server) or moderator (by being the first active player of a game)
+- New: Players may request and become moderator for game: NeutronSession.gameCanModerate(boolean), NeutronSession.canModerate, NeutronGame.doModerate() and NeutronGame.moderatorActorNr
+- Change: the new value NeutronSession.canModerate will be sent with gameCreate() operations (if set to true)
+- New: Event key NeutronListener.EV_KEY_MODERATOR to get moderator's actorNr from events
+- Change: EV_QUIT and EV_KICKED now carry the new key EV_KEY_MODERATOR which tells all players who is the current moderator (by actorNr); this is stored into NeutronGame.moderatorActorNr
+- New: Players in NeutronGame can have new state PLAYER_KICKED (player-data is updated with EV_KICKED)
+- New: NeutronGame.kickPlayer() (for moderators) and NeutronSession.kickPlayer() (for admin's who are not active in the game to shutdown)
+- New: NeutronSession.shutdownGame() can be used by admin-players (for others, this operation will fail)
+- New: Namebased pools can now be defined as "singleton": only one instance per pool and name will be created; if such a game is full players get an error instead of a new game
+- New: Errors constants in NeutronListener: RC_ACTORSESSION_KICKED, RC_ACTORSESSION_BANNED, RC_APPINSTANCE_CLOSED, RC_ACTORSESSION_ALREADY_JOINED
+- Change: NeutronGame.raiseEvent() accepts a "targetActorNr" which defines a single player to get the raised event; leave 0 to target "all players in game" (as before)
+- New: NeutronGame.quitLocally() to release a NeutronGame instance locally (without having to quit()); used after a player was kicked or game shutdown
+- Update: NeutronGame.playerGetCount() is updated to simply count all active or inactive players (excluding quit and kicked ones)
+- Internal: NeutronGame constructor reads new parameter: P_MODERATOR
+- Change: Polling (getEvents operation) now calls sendGameDataReturn() for all errors (not just RC_ACTORSESSION_EXPIRED and RC_ACTORSESSION_NOT_FOUND); takes care of kicked/banned errors
+- Fix: Fatal server errors cause a returnCode of NeutronListener.RC_OP_SERVER again; debug test-server libs print out debug text! (during development fatal errors could happen in case of not matching client/server setups)
+- Change: removed (already deprecated) NeutronListener.gameListPerPoolReturn()
+- Change / Internal: canModerate is sent as Byte (not bool) as in definition; Code: if ( canModerate ) op.addParameter(Neutron.P_MODERATOR , new Byte((byte)1));
+- Add: NeutronGame.PLAYER_KICKED is now listed in JavaDoc for NeutronGame.playerGetStatus()
+- Update: JavaDoc package.html, gameCreateReturn(), gamesListReturn(), EV_DEACTIVATE, kickPlayer(), quitLocally(), RC_ACTORSESSION_KICKED, RC_ACTORSESSION_BANNED, RC_APPINSTANCE_CLOSED, RC_ACTORSESSION_ALREADY_JOINED
+- Added: Event EV_STATUS (50) includes a key EV_KEY_ISADMIN if the current player has administrator rights; the value is (byte)1 in that case. The key does not exist in any other case (normal users)
+- Update: JavaDoc gameCreateReturn;
+- New: Added constant RC_APPINSTANCE_NOT_FOUND = 137 for shutdownGameReturn()
+- Fix: serializable datatypes are now completely listed in NeutronSession JavaDoc
+- New: Constant for property-change events: EV_PROPERTIES_CHANGE including new keys: EV_KEY_PROPERTY_TYPE, EV_KEY_PROPERTIES, EV_KEY_ISDIFF
+- Update: JavaDoc for properties in NeutronSession
+
+*** Version 4.1.1
+- Fix: gameListPerPool() defaults to 10 games and no offset if the values are less than 1
+- Fix: gamesListReturn() JavaDoc description for "listType" is now: 0 = open games; 1 = invitations; 2 = pool's open games list
+- Update: gameListPerPool() sends "{gn}" as values-parameter if it's null
+- Update: getPropertiesReturn() gets new parameters: actorNr, userID. These are optional and are available in certain situations only. See JavaDoc
+- Update: gameListPerPoolReturn() is now deprecated and merged into gamesListReturn() which in turn got a "type" to identify the list-type
+- New: getListBuddyIgnore() got one more value: 't'. This requests the type of relation to users. useful when getting lists of type "both". this is buddies and ignores.
+- Change: renamed returned parameters to: count and countOnline. These values are referring to the number in the returned list
+- Internal: parameter P_USERID = 85; used in getProperties
+- New: made methods nullpointer resistant: getListBuddyIgnore, buddySet, get/set PlayerProperties, get/set ActorProperties, get/set GameProperties; some methods throw exceptions in debug version
+
+*** Version 4.1.0
+- New: Properties. NeutronSession: setActorProperties(), getActorProperties(). NeutronGame: setLocalPlayerProperties(), getPlayerProperties(), getGameProperties(), setGameProperties()
+- New: Buddylist and Ignorelist in NeutronSession: listBuddies(), listIgnored(), getListBuddyIgnore(), buddySet()
+- New: Listing of games per pool in NeutronSession: NeutronSession gameListPerPool()
+- New: Games with password (only usable for named games)
+- Internal: Changed parameter in buddySet from P_STATUS to P_TYPE
+
+*** Version 4.0.4
+- Change: NeutronGame.handoverTurn() and NeutronGame.sendData() are now getting a Hashtable parameter instead of Object
+- New: RC_ACTORSESSION_BUSY (121) constant to help identify common development error! check in gameCreateReturn()
+
+*** Version 4.0.3
+- New: RC_INVALID_CONNECTIONSTRING (74) constant to help identify a common error! check in loginReturn()
+- Update: list of serializable datatypes in NeutronSession JavaDoc
+- Fix: Fatal server errors cause a returnCode of NeutronListener.RC_OP_SERVER again; debug test-server libs print out debug text! (during development fatal errors could happen in case of not matching client/server setups)
+
+*** Version 4.0.2
+- Internal: Neutron.deserializeData() now returns either the P_DATA part of the deserialized data (if available / serialized by serializeData()) or the resulting hashtable itself
+
+*** Version 4.0.1
+- New: NConnectSE connects to server defined by parameter: ipPort (before: fixed host)
+- New: SE version is now completely independent from Java ME classes (were not used, but had to be present)
+- Fix: Changed versioning for "ClientLibVersion" in Login/CC
+*** Version 4.0.0.0
+
+- Removed methods:
+ - NeutronSession.BuggyGetList - replaced by new GetListBuddyIgnore method;
+ - NeutronSession.ReSubscribe;
+ - NeutrinSession.ConfirmBilling;
+ - NeutronListener.ResubscribeReturn;
+
+- Added methods:
+ - NeutronSession.GameCreateNamed with password parameter;
+ - NeutronSession.GameListPerPool;
+ - NeutronSession.GetActorProperties;
+ - NeutronSession.SetActorProperties;
+ - NeutronSession.GetListBuddyIgnore - replaces removed BuggyGetList;
+ - NeutronSession.ListBuddies;
+ - NeutronSession.ListIgnore;
+ - NeutronSession.BillingInitPayment;
+ - NeutronSession.BillingProcessPayment;
+ - NeutronGame.Invite;
+ - NeutronGame.GetGameProperties;
+ - NeutronGame.SetGameProperties;
+ - NeutronGame.GetPlayerProperties;
+ - NeutronGame.SetLocatPlayerProperties;
+ - NeutronListener.GameInviteReturn;
+ - NeutronListener.GetPropertiesReturn;
+ - NeutronListener.SetPropertiesReturn;
+
+- Changed argument list:
+ - NeutronSession.GameCreate - added password parameter;
+ - NeutronListener.GamesListReturn added listType parameter;
+ - NeutronListener.BuddyGetListReturn all buddy related info now in passing in one strings array parrameter;
+ - NeutronListener.BuddySetReturn added type parameter;
+ - NeutronListener.BillingInitPaymentReturn;
+
+
+- added constants:
+ - OPC_INVITE
+ - OPC_TELLAFRIEND
+ - OPC_LISTGAMES
+ - OPC_SETPROPERTIES
+ - OPC_GETPROPERTIES
+ - P_USERID
+ - P_RESERVE
+ - P_RESULT
+ - P_PROPERTIES
+ - P_BROADCAST
+ - P_ISDIFF
+ - RCB_CHARGING_ERROR
+ - RCB_POST_CHARGING_ERROR
+ - RCB_TIMEOUT
+ - RCB_PRICE_- Changed
+ - RCB_PRICE_INVALID
+ - RCB_FATAL_SERVER_ERROR
+ - RCB_FATAL_LOGIC_ERROR
+ - RCB_NOT_INCLUDED
+ - RCB_WMA_UNAVAILABLE
+
+*** Version 3.0.2.2
+- CLS-specifications largely corrected
+
+*** Version 3.0.1.1
+- changes in neutron-java-lib integrated
+
+***
+- Removed: NeutronGame: playerNames, playerIDs, playerLobbies, playerStats
+- Change: removed GpOperation.roundtripTime, now using public Neutron.roundtripTime
+ to be sent in operation headers (GpOperation.serializeParameters(), internal)
+- Change: channelRaiseEvent() is now raiseEventInChannel() and gets the eventCode
+ as seperate parameter value - analog to raiseEventForActor()
+- Fix: renamed EV_KEY_M_MIPLAYERS to EV_KEY_M_MINPLAYERS (number of min players of game, before start)
+- Fix: values for EV_KEY_M_MINPLAYERS and EV_KEY_M_MAXPLAYERS corrected (wrong case so far)
+- Changed: Neutron.millisecondsToWait (current value of polling-interval) is now
+ set in Neutron.receiveResponse() for login, register and alike
diff --git a/Assets/Photon/PhotonLibs/changes-library.txt.meta b/Assets/Photon/PhotonLibs/changes-library.txt.meta
new file mode 100644
index 00000000..85684b76
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/changes-library.txt.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: d8040d310df77714a90a561261bfb2cb
+timeCreated: 1557919981
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonLibs/netstandard2.0.meta b/Assets/Photon/PhotonLibs/netstandard2.0.meta
new file mode 100644
index 00000000..c52d1331
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/netstandard2.0.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: beb9d2a25c882b54ab2fd9adaec2b53c
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.deps.json b/Assets/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.deps.json
new file mode 100644
index 00000000..57ca7141
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.deps.json
@@ -0,0 +1,47 @@
+{
+ "runtimeTarget": {
+ "name": ".NETStandard,Version=v2.0/",
+ "signature": ""
+ },
+ "compilationOptions": {},
+ "targets": {
+ ".NETStandard,Version=v2.0": {},
+ ".NETStandard,Version=v2.0/": {
+ "Photon3Unity3D/4.1.6.17": {
+ "dependencies": {
+ "NETStandard.Library": "2.0.3"
+ },
+ "runtime": {
+ "Photon3Unity3D.dll": {}
+ }
+ },
+ "Microsoft.NETCore.Platforms/1.1.0": {},
+ "NETStandard.Library/2.0.3": {
+ "dependencies": {
+ "Microsoft.NETCore.Platforms": "1.1.0"
+ }
+ }
+ }
+ },
+ "libraries": {
+ "Photon3Unity3D/4.1.6.17": {
+ "type": "project",
+ "serviceable": false,
+ "sha512": ""
+ },
+ "Microsoft.NETCore.Platforms/1.1.0": {
+ "type": "package",
+ "serviceable": true,
+ "sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==",
+ "path": "microsoft.netcore.platforms/1.1.0",
+ "hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512"
+ },
+ "NETStandard.Library/2.0.3": {
+ "type": "package",
+ "serviceable": true,
+ "sha512": "sha512-st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
+ "path": "netstandard.library/2.0.3",
+ "hashPath": "netstandard.library.2.0.3.nupkg.sha512"
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.deps.json.meta b/Assets/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.deps.json.meta
new file mode 100644
index 00000000..c26136a5
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.deps.json.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: a966b98b651e18748abf2829786b5899
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.dll b/Assets/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.dll
new file mode 100644
index 00000000..4f8b44eb
Binary files /dev/null and b/Assets/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.dll differ
diff --git a/Assets/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.dll.meta b/Assets/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.dll.meta
new file mode 100644
index 00000000..e507b85b
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.dll.meta
@@ -0,0 +1,165 @@
+fileFormatVersion: 2
+guid: 6a558ae793155af4b9b9ab945fc64a0f
+PluginImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ iconMap: {}
+ executionOrder: {}
+ defineConstraints: []
+ isPreloaded: 0
+ isOverridable: 0
+ isExplicitlyReferenced: 0
+ validateReferences: 1
+ platformData:
+ - first:
+ '': Any
+ second:
+ enabled: 0
+ settings:
+ Exclude Android: 0
+ Exclude Editor: 0
+ Exclude GameCoreScarlett: 0
+ Exclude GameCoreXboxOne: 0
+ Exclude Linux: 0
+ Exclude Linux64: 0
+ Exclude LinuxUniversal: 0
+ Exclude Lumin: 0
+ Exclude OSXUniversal: 0
+ Exclude PS4: 0
+ Exclude PS5: 0
+ Exclude Switch: 0
+ Exclude WebGL: 0
+ Exclude Win: 0
+ Exclude Win64: 0
+ Exclude WindowsStoreApps: 0
+ Exclude XboxOne: 0
+ Exclude iOS: 0
+ Exclude tvOS: 0
+ - first:
+ Android: Android
+ second:
+ enabled: 1
+ settings:
+ CPU: ARMv7
+ - first:
+ Any:
+ second:
+ enabled: 1
+ settings: {}
+ - first:
+ Editor: Editor
+ second:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ DefaultValueInitialized: true
+ OS: AnyOS
+ - first:
+ Facebook: Win
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ - first:
+ Facebook: Win64
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ - first:
+ Standalone: Linux
+ second:
+ enabled: 1
+ settings:
+ CPU: x86
+ - first:
+ Standalone: Linux64
+ second:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ - first:
+ Standalone: LinuxUniversal
+ second:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ - first:
+ Standalone: OSXUniversal
+ second:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ - first:
+ Standalone: Win
+ second:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ - first:
+ Standalone: Win64
+ second:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ - first:
+ WebGL: WebGL
+ second:
+ enabled: 1
+ settings: {}
+ - first:
+ Windows Store Apps: WindowsStoreApps
+ second:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ DontProcess: false
+ PlaceholderPath:
+ SDK: AnySDK
+ ScriptingBackend: Il2Cpp
+ - first:
+ iPhone: iOS
+ second:
+ enabled: 1
+ settings:
+ AddToEmbeddedBinaries: false
+ CompileFlags:
+ FrameworkDependencies:
+ - first:
+ PS4: PS4
+ second:
+ enabled: 1
+ settings: {}
+ - first:
+ PS5: PS5
+ second:
+ enabled: 1
+ settings: {}
+ - first:
+ Nintendo Switch: Switch
+ second:
+ enabled: 1
+ settings: {}
+ - first:
+ XboxOne: XboxOne
+ second:
+ enabled: 1
+ settings: {}
+ - first:
+ GameCoreScarlett: GameCoreScarlett
+ second:
+ enabled: 1
+ settings: {}
+ - first:
+ GameCoreXboxOne: GameCoreXboxOne
+ second:
+ enabled: 1
+ settings: {}
+ - first:
+ Lumin: Lumin
+ second:
+ enabled: 1
+ settings: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.xml b/Assets/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.xml
new file mode 100644
index 00000000..f85d60c5
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.xml
@@ -0,0 +1,2767 @@
+
+
+
+ Photon3Unity3D
+
+
+
+
+ Initializes a new instance of the class.
+
+
+
+
+ Gets the public key that can be used by another DiffieHellmanCryptoProvider object
+ to generate a shared secret agreement.
+
+
+
+
+ Derives the shared key is generated from the secret agreement between two parties,
+ given a byte array that contains the second party's public key.
+
+
+ The second party's public key.
+
+
+
+ Interface for Photon's DiffieHellman/Payload Encryption.
+
+
+
+ Provides classical Diffie-Hellman Modular Exponentiation Groups defined by the
+ OAKLEY Key Determination Protocol (RFC 2412).
+
+
+
+
+ Gets the genrator (N) used by the the well known groups 1,2 and 5.
+
+
+
+
+ Gets the 768 bit prime for the well known group 1.
+
+
+
+
+ Gets the 1024 bit prime for the well known group 2.
+
+
+
+
+ Gets the 1536 bit prime for the well known group 5.
+
+
+
+ A slice of memory that should be pooled and reused. Wraps a byte-array.
+
+ This is a serializable datatype for the .Net clients. It will serialize and transfer as byte[].
+ If PhotonPeer.UseByteArraySlicePoolForEvents is enabled, byte-arrays in (incoming) events will be deserialized as
+ ByteArraySlice.
+
+ Adjust your OnEvent code accordingly.
+
+
+
+ The buffer for the slice.
+
+
+ The position where the content starts in Buffer.
+
+
+ The length of the data in the Buffer.
+
+
+
+ Internal constructor - these instances will be part of the pooling system.
+
+ The pool to return to.
+ The index to return to (in the related returnPool).
+
+
+
+ Create a new ByteArraySlice. The buffer supplied will be used. Usage is similar to ArraySegment.
+
+ Not part of pooling.
+
+
+
+ Creates a ByteArraySlice, which is not pooled. It has no Buffer.
+
+ Not part of pooling.
+
+
+
+ If this item was fetched from a ByteArraySlicePool, this will return it.
+
+
+ True if this was a pooled item and it successfully was returned.
+ If it does not belong to a pool nothing will happen, and false will be returned.
+
+
+
+ Resets Count and Offset to 0 each.
+
+
+ Tiered pool for ByteArraySlices. Reduces the allocations once enough slices are available.
+
+
+
+ Requests for buffers smaller than 2^minStackIndex will use 2^minStackIndex. This value avoids allocations of smaller rarely used buffers.
+ Set this to a lower value if you will never need sizes larger than byte[2^minStackIndex]
+
+
+
+ Count of allocations this pool did.
+
+
+ Creates a new pool.
+
+
+
+ Get a ByteArraySlice from pool. This overload handles user supplied byte[] and byte count and can be used as a non-boxing alternative to ArraySegment<byte>.
+
+
+ This effectively pools the ByteArraySlice instances but not their data.
+ ByteArraySlice.Release() will return the slice itself to the pool but delete the reference to the buffer supplied here.
+
+
+
+
+ Get byte[] wrapper from pool. This overload accepts a bytecount and will return a wrapper with a byte[] that size or greater.
+
+
+
+ Pops a slice from the stack or creates a new slice for that stack.
+ The stack to use. Lock that stack before calling PopOrCreate for thread safety.
+
+ A slice.
+
+
+
+ Releasing a ByteArraySlice, will put it back into the pool, if it was acquired from one.
+
+ The ByteArraySlice to return to the pool.
+ The stackIndex for this slice.
+ True if this slice was returned to some pool. False if not (null or stackIndex < 0.
+
+
+
+ Clears all pool items with byte array sizes between lower and upper inclusively.
+
+
+ Use this if you sent some unusually large RaiseEvents and believe the buffers of that size
+ will not be needed again, and you would like to free up the buffer memory.
+
+
+
+
+ Replacement for Dictionary<K,V> which does not allocate memory during usage.
+
+ Key type.
+ Value type.
+
+
+
+ This is a substitute for the Hashtable class, missing in: Win8RT and Windows Phone. It uses a Dictionary<object,object> as base.
+
+
+ Please be aware that this class might act differently than the Hashtable equivalent.
+ As far as Photon is concerned, the substitution is sufficiently precise.
+
+
+
+
+ Translates the byte key into the pre-boxed byte before doing the lookup.
+
+
+
+
+
+
+ Creates a shallow copy of the Hashtable.
+
+
+ A shallow copy of a collection copies only the elements of the collection, whether they are
+ reference types or value types, but it does not copy the objects that the references refer
+ to. The references in the new collection point to the same objects that the references in
+ the original collection point to.
+
+ Shallow copy of the Hashtable.
+
+
+
+ Used as container for unknown types the client could not deserialize.
+
+
+
+
+ The type code which was read for this type.
+
+
+
+
+ The size/length value that was read for this type.
+
+ May be larger than Data.Length, if the Size exceeded the remaining message content.
+
+
+
+ Container for the data that arrived.
+
+ If the Size exceeded the remaining message length, only the remaining data is read. This may be null, if the size was somehow less than 1.
+
+
+ Interface for DatagramEncryptor implementations.
+
+
+ Initialize the encryptor.
+
+
+
+ Encryption/decryption algorithm implementation
+
+
+
+
+ Packet authentication algorithm impelmenation
+
+
+
+ Number for reliable unsequenced commands (separate from "standard" reliable sequenced). Used to avoid duplicates.
+
+
+ The highest number of reliable unsequenced commands that arrived (and all commands before).
+
+
+ Any reliable unsequenced number that's been received, which is higher than the current highest in complete sequence (reliableUnsequencedNumbersCompletelyReceived).
+
+
+ To store the highest acknowledged sequence number (and get some impression what the server already received and stored).
+
+
+ Checks and queues incoming reliable unsequenced commands ("send" or "fragment"), if they haven't been received yet.
+ The command to check and queue.
+ True if the command is new and got queued (or could be executed/dispatched).
+
+
+ Quick Resends are suspended if the sent queue is this size or larger.
+
+
+ One list for all channels keeps sent commands (for re-sending).
+
+
+ One pool of ACK byte arrays ( 20 bytes each) for all channels to keep acknowledgements.
+
+
+ Gets enabled by "request" from server (not by client).
+
+
+ Initial PeerId as used in Connect command. If EnableServerTracing is false.
+
+
+ Initial PeerId to enable Photon Tracing, as used in Connect command. See: EnableServerTracing.
+
+
+
+ Checks the incoming queue and Dispatches received data if possible.
+
+ If a Dispatch happened or not, which shows if more Dispatches might be needed.
+
+
+ Gets the target size for fragments.
+
+ Caches the result for a specific MTU value.
+ Fragment length is different, when datagram encryption is used (so this caches two values in fact).
+
+
+
+
+
+ gathers acks until udp-packet is full and sends it!
+
+
+
+ Queue of received commands. ReceiveIncomingCommands will queue commands, except ACKs which Execute immediately.
+
+
+
+ gathers commands from all (out)queues until udp-packet is full and sends it!
+
+
+
+
+ Checks connected state and channel before operation is serialized and enqueued for sending.
+
+ if operation could be enqueued
+
+
+ reliable-udp-level function to send some byte[] to the server via un/reliable command
+ only called when a custom operation should be send
+ the invocation ID for this operation (the payload)
+
+
+ reads incoming udp-packages to create and queue incoming commands*
+
+
+ Queues incoming commands in the correct order as either unreliable, reliable or unsequenced.
+ If queued or not.
+
+
+ removes commands which are acknowledged
+
+
+
+ Enumeration of situations that change the peers internal status.
+ Used in calls to OnStatusChanged to inform your application of various situations that might happen.
+
+
+ Most of these codes are referenced somewhere else in the documentation when they are relevant to methods.
+
+
+
+ the PhotonPeer is connected. See {@link PhotonListener#OnStatusChanged}*
+
+
+ the PhotonPeer just disconnected. See {@link PhotonListener#OnStatusChanged}*
+
+
+ the PhotonPeer encountered an exception and will disconnect, too. See {@link PhotonListener#OnStatusChanged}*
+
+
+ Exception while opening the incoming connection to the server. Followed by Disconnect.
+ The server could be down / not running or the client has no network or a misconfigured DNS. See {@link PhotonListener#OnStatusChanged}*
+
+
+ Used on platforms that throw a security exception on connect. Unity3d does this, e.g., if a webplayer build could not fetch a policy-file from a remote server.
+
+
+ Sending command failed. Either not connected, or the requested channel is bigger than the number of initialized channels.
+
+
+ Exception, if a server cannot be connected. Followed by Disconnect.
+ Most likely, the server is not responding. Ask user to try again later.
+
+
+ Disconnection due to a timeout (client did no longer receive ACKs from server). Followed by Disconnect.
+
+
+ Timeout disconnect by server. The server didn't receive necessary ACKs in time. Followed by Disconnect.
+
+
+ Disconnect by server due to concurrent user limit reached (received a disconnect command).
+
+
+ (1043) Disconnect by server due to server's logic. Followed by Disconnect.
+
+
+ Disconnect by server due to unspecified reason. Followed by Disconnect.
+
+
+ (1048) Value for OnStatusChanged()-call, when the encryption-setup for secure communication finished successfully.
+
+
+ (1049) Value for OnStatusChanged()-call, when the encryption-setup failed for some reason. Check debug logs.
+
+
+
+ Callback interface for the Photon client side. Must be provided to a new PhotonPeer in its constructor.
+
+
+ These methods are used by your PhotonPeer instance to keep your app updated. Read each method's
+ description and check out the samples to see how to use them.
+
+
+
+
+ Provides textual descriptions for various error conditions and noteworthy situations.
+ In cases where the application needs to react, a call to OnStatusChanged is used.
+ OnStatusChanged gives "feedback" to the game, DebugReturn provies human readable messages
+ on the background.
+
+
+ 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. Use PhotonPeer.DebugOut to select how verbose the output is.
+
+ DebugLevel (severity) of the message.
+ Debug text. Print to System.Console or screen.
+
+
+
+ Callback method which gives you (async) responses for called operations.
+
+
+ Similar to method-calling, operations can have a result.
+ Because operation-calls are non-blocking and executed on the server, responses are provided
+ after a roundtrip as call to this method.
+
+ Example: Trying to create a room usually succeeds but can fail if the room's name is already
+ in use (room names are their IDs).
+
+ This method is used as general callback for all operations. Each response corresponds to a certain
+ "type" of operation by its OperationCode.
+
+
+
+ When you join a room, the server will assign a consecutive number to each client: the
+ "actorNr" or "player number". This is sent back in the operation result.
+
+ Fetch your actorNr of a Join response like this:
+ int actorNr = (int)operationResponse[(byte)OperationCode.ActorNr];
+
+ The response to an operation\-call.
+
+
+
+ OnStatusChanged is called to let the game know when asynchronous actions finished or when errors happen.
+
+
+ Not all of the many StatusCode values will apply to your game. Example: If you don't use encryption,
+ the respective status changes are never made.
+
+ The values are all part of the StatusCode enumeration and described value-by-value.
+
+ A code to identify the situation.
+
+
+
+ Called whenever an event from the Photon Server is dispatched.
+
+
+ Events are used for communication between clients and allow the server to update clients anytime.
+ The creation of an event is often triggered by an operation (called by this client or an other).
+
+ Each event carries a Code plus optional content in its Parameters.
+ Your application should identify which content to expect by the event's Code.
+
+ Events can be defined and modified server-side.
+
+ If you use the LoadBalancing api as basis, several events like EvJoin and EvLeave are pre-defined.
+ The LoadBalancing api provides the EventCode and ParameterCode classes for pre-defined events.
+
+ Photon also allows you to come up with custom events on the fly, purely client-side.
+ To do so, use OpRaiseEvent.
+
+ Events are incoming messages and as such buffered in the peer.
+ Calling PhotonPeer.DispatchIncomingCommands will call IPhotonPeerListener.OnEvent, to hand over received events.
+
+ PhotonPeer.ReuseEventInstance is an option to optimize memory usage by reusing one EventData instance.
+
+ The event currently being dispatched.
+
+
+ The protocol for this socket, defined in constructor.
+
+
+ Address, as defined via a Connect() call. Including protocol, port and or path.
+ This is set in the constructor and in Connect() again. Typically the address does not change after the IPhotonSocket is instantiated.
+
+
+ Contains only the server's hostname (stripped protocol, port and or path). Set in IPhotonSocket.Connect().
+
+
+ Contains the IP address of the previously resolved ServerAddress (or empty, if GetIpAddress wasn't used).
+
+
+ Contains only the server's port address (as string). Set in IphotonSocket.Connect().
+
+
+ Where available, this exposes if the server's address was resolved into an IPv6 address or not.
+
+
+
+ Provides the protocol string, of the current PhotonPeer.SerializationProtocolType to be used for WebSocket connections.
+
+
+ Any WebSocket wrapper could access this to get the desired binary protocol for the connection.
+ Some WebSocket implementations use a static value of the same name and need to be updated.
+
+ The value is not cached and each call will create the needed string on the fly.
+
+
+
+
+ Separates the given address into address (host name or IP) and port. Port must be included after colon!
+
+
+ This method expects any address to include a port. The final ':' in addressAndPort has to separate it.
+ IPv6 addresses have multiple colons and must use brackets to separate address from port.
+
+ Examples:
+ ns.exitgames.com:5058
+ http://[2001:db8:1f70::999:de8:7648:6e8]:100/
+ [2001:db8:1f70::999:de8:7648:6e8]:100
+ See:
+ http://serverfault.com/questions/205793/how-can-one-distinguish-the-host-and-the-port-in-an-ipv6-url
+
+
+
+ Wraps a DNS call to provide an array of addresses, sorted to have the IPv6 ones first.
+
+ This skips a DNS lookup, if the hostname is an IPv4 address. Then only this address is used as is.
+ The DNS lookup may take a while, so it is recommended to do this in a thread. Also, it may fail entirely.
+
+
+ IPAddress array for hostname, sorted to put any IPv6 addresses first.
+ If the DNS lookup fails, HandleException(StatusCode.ExceptionOnConnect) gets called and null returned.
+ Then the socket should not attempt to connect.
+
+
+
+
+ Returns null or the IPAddress representing the address, doing Dns resolution if needed.
+
+ Only returns IPv4 or IPv6 adresses, no others.
+ The string address of a server (hostname or IP).
+ IPAddress for the string address or null, if the address is neither IPv4, IPv6 or some hostname that could be resolved.
+
+
+ Variants of the Photon specific serialization protocol used for operations, responses, events and data.
+
+
+ Version 1.6 (outdated).
+
+
+ Version 1.8.
+
+
+
+
+
+
+ Serialize creates a byte-array from the given object and returns it.
+
+ The object to serialize
+ The serialized byte-array
+
+
+
+ Deserialize returns an object reassembled from the given StreamBuffer.
+
+ The buffer to be Deserialized
+ The Deserialized object
+
+
+
+ Deserialize returns an object reassembled from the given byte-array.
+
+ The byte-array to be Deserialized
+ The Deserialized object
+
+
+
+ Interface for (UDP) traffic capturing.
+
+
+
+ Indicates if the PhotonPeer should call Record or not.
+
+
+ Implement to record network traffic. Called by PhotonPeer for each UDP message sent and received.
+
+ The buffer will not contain Ethernet Header, IP, UDP level data. Only the payload received by the client.
+
+ It is advised to not use NetworkSimulation when recording traffic.
+ The recording is done on the timing of actual receive- and send-calls and internal simulation would offset the timing.
+
+ Buffer to be sent or received. Check length value for actual content length.
+ Length of the network data.
+ Indicates incoming (true) or outgoing (false) traffic.
+ The local peerId for the connection. Defaults to 0xFFFF until assigned by the Server.
+ The currently used IPhotonSocket of this Peer. Enables you to track the connection endpoint.
+
+
+ Internal class for "commands" - the package in which operations are sent.
+
+
+ Size of the Payload, which may be null.
+
+
+ Checks commandFlags & FV_UNRELIABLE_UNSEQUENCED.
+
+
+ Checks commandFlags & FV_RELIABLE.
+
+
+
+ ACKs should never be created as NCommand. use CreateACK to wrtie the serialized ACK right away...
+
+
+
+
+
+
+
+
+ this variant does only create outgoing commands and increments . incoming ones are created from a DataInputStream
+
+
+ this variant does only create outgoing commands and increments . incoming ones are created from a DataInputStream
+
+
+ reads the command values (commandHeader and command-values) from incoming bytestream and populates the incoming command*
+
+
+
+ A simulation item is an action that can be queued to simulate network lag.
+
+
+
+ With this, the actual delay can be measured, compared to the intended lag.
+
+
+ Timestamp after which this item must be executed.
+
+
+ Action to execute when the lag-time passed.
+
+
+ Starts a new Stopwatch
+
+
+
+ A set of network simulation settings, enabled (and disabled) by PhotonPeer.IsSimulationEnabled.
+
+
+ For performance reasons, the lag and jitter settings can't be produced exactly.
+ In some cases, the resulting lag will be up to 20ms bigger than the lag settings.
+ Even if all settings are 0, simulation will be used. Set PhotonPeer.IsSimulationEnabled
+ to false to disable it if no longer needed.
+
+ All lag, jitter and loss is additional to the current, real network conditions.
+ If the network is slow in reality, this will add even more lag.
+ The jitter values will affect the lag positive and negative, so the lag settings
+ describe the medium lag even with jitter. The jitter influence is: [-jitter..+jitter].
+ Packets "lost" due to OutgoingLossPercentage count for BytesOut and LostPackagesOut.
+ Packets "lost" due to IncomingLossPercentage count for BytesIn and LostPackagesIn.
+
+
+
+ internal
+
+
+ internal
+
+
+ internal
+
+
+ internal
+
+
+ internal
+
+
+ internal
+
+
+ internal
+
+
+ This setting overrides all other settings and turns simulation on/off. Default: false.
+
+
+ Outgoing packages delay in ms. Default: 100.
+
+
+ Randomizes OutgoingLag by [-OutgoingJitter..+OutgoingJitter]. Default: 0.
+
+
+ Percentage of outgoing packets that should be lost. Between 0..100. Default: 1. TCP ignores this setting.
+
+
+ Incoming packages delay in ms. Default: 100.
+
+
+ Randomizes IncomingLag by [-IncomingJitter..+IncomingJitter]. Default: 0.
+
+
+ Percentage of incoming packets that should be lost. Between 0..100. Default: 1. TCP ignores this setting.
+
+
+ Counts how many outgoing packages actually got lost. TCP connections ignore loss and this stays 0.
+
+
+ Counts how many incoming packages actually got lost. TCP connections ignore loss and this stays 0.
+
+
+ Provides an overview of the current values in form of a string.
+ String summary.
+
+
+
+ The pool this wrapper should return to when released/disposed.
+
+
+
+
+ Gets value and if it belongs to the static pool, returns the wrapper to pool.
+
+
+
+
+
+ Boxes the value and returns boxed object. Releases the wrapper.
+
+
+
+
+
+ Removes this WrapperStruct from pooling.
+
+
+
+ Returns a String which represents the value of this instance.
+ String which represents the value of this instance.
+
+
+ Returns a String which represents the type (in brackets and value of this instance.
+ String which represents the type (in brackets) and value of this instance.
+
+
+
+ staticPool is used for implicit casting. This is not threadsafe, so casting between T and StructWrapper should only be done on the Unity main thread.
+
+
+
+
+ Replacement for object.GetType() that first checks to see if object is a WrappedStruct.
+ If so returns the StructWrapper T type, otherwise just returns object.GetType().
+
+
+
+
+
+
+ Wrap a struct in a pooled StructWrapper.
+
+
+
+
+ Wrap a struct in a pooled StructWrapper. Pulls wrapper from the static pool. Wrapper is returned to pool when Unwrapped.
+ Slighty faster version of Wrap() that is hard wired to pull from the static pool. Use the persistant bool argument to make a permanent unpooled wrapper.
+
+
+
+
+ Tests if object is either a cast T, or a wrapped T
+
+
+
+
+ Remove all wrappers in hashtable from pooling, so they can remain cached and used later.
+
+
+
+
+
+ Unwraps any WrapperStructs, boxes their value, releases hashtable entry with the boxed value. Releases the wrappers.
+
+
+
+
+ If object is a StructWrapper, the value will be extracted. If not, the object will be cast to T.
+ Wrapper is returned to the wrapper pool if applicable, so it is not considered safe to Unwrap multiple times, as the wrapper may be recycled.
+
+
+
+
+ If object is a StructWrapper, the value will be extracted. If not, the object will be cast to T.
+ Wrapper is will not be returned to its pool until it is Unwrapped, or the pool is cleared.
+
+
+
+
+ If object is a StructWrapper, the value will be extracted. If not, the object will be cast to T.
+ Wrapper is returned to the wrapper pool if applicable, so it is not considered safe to Unwrap multiple times, as the wrapper may be recycled.
+
+
+
+
+ If object is a StructWrapper, the value will be extracted. If not, the object will be cast to T.
+ Wrapper is returned to the wrapper pool if applicable, so it is not considered safe to Unwrap multiple times, as the wrapper may be recycled.
+
+
+
+
+ If object is a StructWrapper, the value will be extracted. If not, the object will be cast to T.
+
+
+
+
+ If object is a StructWrapper, the value will be extracted. If not, the object will be cast to T.
+
+
+
+
+ If object is a StructWrapper, the value will be extracted. If not, the object will be cast to T.
+ Wrapper is returned to the wrapper pool if applicable, so it is not considered safe to Unwrap multiple times, as the wrapper may be recycled.
+
+
+
+
+ If object is a StructWrapper, the value will be extracted. If not, the object will be cast to T.
+ Wrapper is returned to the wrapper pool if applicable, so it is not considered safe to Unwrap multiple times, as the wrapper may be recycled.
+
+
+
+
+ If object is a StructWrapper, the value will be extracted. If not, the object will be cast to T.
+ Wrapper is will not be returned to its pool until it is Unwrapped, or the pool is cleared.
+
+
+
+
+
+
+
+
+
+
+ Will get the object using the key. If the key is invalid, will return null.
+
+
+
+
+
+ Dictionary content as string.
+ If true, type-info is also included.
+ Full content of dictionary as string.
+
+
+ Param code. Used in internal op: InitEncryption.
+
+
+ Encryption-Mode code. Used in internal op: InitEncryption.
+
+
+ Param code. Used in internal op: InitEncryption.
+
+
+ Code of internal op: InitEncryption.
+
+
+ TODO: Code of internal op: Ping (used in PUN binary websockets).
+
+
+ Result code for any (internal) operation.
+
+
+
+ This is the replacement for the const values used in eNet like: PS_DISCONNECTED, PS_CONNECTED, etc.
+
+
+
+ No connection is available. Use connect.
+
+
+ Establishing a connection already. The app should wait for a status callback.
+
+
+
+ The low level connection with Photon is established. On connect, the library will automatically
+ send an Init package to select the application it connects to (see also PhotonPeer.Connect()).
+ When the Init is done, IPhotonPeerListener.OnStatusChanged() is called with connect.
+
+ Please note that calling operations is only possible after the OnStatusChanged() with StatusCode.Connect.
+
+
+ Connection going to be ended. Wait for status callback.
+
+
+ Acknowledging a disconnect from Photon. Wait for status callback.
+
+
+ Connection not properly disconnected.
+
+
+ The server's address, as set by a Connect() call, including any protocol, ports and or path.
+ If rHTTP is used, this can be set directly.
+
+
+
+ This is the (low level) connection state of the peer. It's internal and based on eNet's states.
+
+ Applications can read the "high level" state as PhotonPeer.PeerState, which uses a different enum.
+
+
+ Byte count of last sent operation (set during serialization).
+
+
+ Byte count of last dispatched message (set during dispatch/deserialization).
+
+
+ The command that's currently being dispatched.
+
+
+ This ID is assigned by the Realtime Server upon connection.
+ The application does not have to care about this, but it is useful in debugging.
+
+
+
+ The serverTimeOffset is serverTimestamp - localTime. Used to approximate the serverTimestamp with help of localTime
+
+
+
+
+ Count of all bytes going out (including headers)
+
+
+
+
+ Count of all bytes coming in (including headers)
+
+
+
+ Set via Connect(..., customObject) and sent in Init-Request.
+
+
+ Sent on connect in an Init Request.
+
+
+ Temporary cache of AppId. Used in Connect() to keep the AppId until we send the Init-Request (after the network-level (and Enet) connect).
+
+
+ Set to timeInt, whenever SendOutgoingCommands actually checks outgoing queues to send them. Must be connected.
+
+
+ Maximum Transfer Unit to be used for UDP+TCP
+
+
+ If IPhotonSocket.Connected is true, this value shows if the server's address resolved as IPv6 address.
+
+ You must check the socket's IsConnected state. Otherwise, this value is not initialized.
+ Sent to server in Init-Request.
+
+
+
+
+ Writes and "Init Request", which initializes the connection / application used server-side.
+
+ Uses this.ServerAddress, this.AppId, this.PhotonToken and CustomInitData and some more values.
+ Bytes of the init request.
+
+
+ Called when the server's Init Response arrived.
+
+
+ Serializes an operation into our binary messages (magic number, msg-type byte and message). Optionally encrypts.
+ This method is mostly the same in EnetPeer, TPeer and HttpPeerBase. Also, for raw messages, we have another variant.
+
+
+ Serializes an operation into our binary messages (magic number, msg-type byte and message). Optionally encrypts.
+ This method is mostly the same in EnetPeer, TPeer and HttpPeerBase. Also, for raw messages, we have another variant.
+
+
+ Returns the UDP Payload starting with Magic Number for binary protocol
+
+
+
+ Checks outgoing queues for commands to send and puts them on their way.
+ This creates one package per go in UDP.
+
+ If commands are not sent, cause they didn't fit into the package that's sent.
+
+
+
+ Checks the incoming queue and Dispatches received data if possible.
+
+ If a Dispatch happened or not, which shows if more Dispatches might be needed.
+
+
+
+ Internally uses an operation to exchange encryption keys with the server.
+
+ If the op could be sent.
+
+
+
+ Gets the currently used settings for the built-in network simulation.
+ Please check the description of NetworkSimulationSet for more details.
+
+
+
+
+ Core of the Network Simulation, which is available in Debug builds.
+ Called by a timer in intervals.
+
+
+
+ EnetPeer will set this value, so trafficstats can use it. TCP has 0 bytes per package extra
+
+
+ See PhotonPeer value.
+
+
+ See PhotonPeer value.
+
+
+ See PhotonPeer value.
+
+
+ See PhotonPeer value.
+
+
+
+ Value range for a Peer's connection and initialization state, as returned by the PeerState property.
+
+
+ While this is not the same as the StatusCode of IPhotonPeerListener.OnStatusChanged(), it directly relates to it.
+ In most cases, it makes more sense to build a game's state on top of the OnStatusChanged() as you get changes.
+
+
+
+ The peer is disconnected and can't call Operations. Call Connect().
+
+
+ The peer is establishing the connection: opening a socket, exchanging packages with Photon.
+
+
+ The connection is established and now sends the application name to Photon.
+ You set the "application name" by calling PhotonPeer.Connect().
+
+
+ The peer is connected and initialized (selected an application). You can now use operations.
+
+
+ The peer is disconnecting. It sent a disconnect to the server, which will acknowledge closing the connection.
+
+
+
+ These are the options that can be used as underlying transport protocol.
+
+
+
+ Use UDP to connect to Photon, which allows you to send operations reliable or unreliable on demand.
+
+
+ Use TCP to connect to Photon.
+
+
+ A TCP-based protocol commonly supported by browsers.For WebGL games mostly. Note: No WebSocket IPhotonSocket implementation is in this Assembly.
+ This protocol is only available in Unity exports to WebGL.
+
+
+ A TCP-based, encrypted protocol commonly supported by browsers. For WebGL games mostly. Note: No WebSocket IPhotonSocket implementation is in this Assembly.
+ This protocol is only available in Unity exports to WebGL.
+
+
+
+ Level / amount of DebugReturn callbacks. Each debug level includes output for lower ones: OFF, ERROR, WARNING, INFO, ALL.
+
+
+
+ No debug out.
+
+
+ Only error descriptions.
+
+
+ Warnings and errors.
+
+
+ Information about internal workflows, warnings and errors.
+
+
+ Most complete workflow description (but lots of debug output), info, warnings and errors.
+
+
+ Build target framework supported by this dll.
+
+
+
+ Instances of the PhotonPeer class are used to connect to a Photon server and communicate with it.
+
+
+ A PhotonPeer instance allows communication with the Photon Server, which in turn distributes messages
+ to other PhotonPeer clients.
+ An application can use more than one PhotonPeer instance, which are treated as separate users on the
+ server. Each should have its own listener instance, to separate the operations, callbacks and events.
+
+
+
+
+ No effect anymore. Removed without replacement.
+
+
+ This value was used to get/set the initial capacities of command-lists.
+ These grow on demand but knowing their capacity is of very limited use.
+ Also, various command-lists grow their capacity independent from one another.
+
+
+
+
+ No effect anymore. Removed without replacement.
+
+
+ This was used to skip some received (and buffered) unreliable commands, to avoid situations
+ where the peer has aggregated a lot of (old) messages.
+
+
+
+
+ The WarningSize was used test all message queues for congestion.
+
+
+
+
+ Gets a local timestamp in milliseconds by calling SupportClass.GetTickCount().
+ See LocalMsTimestampDelegate.
+
+
+
+ Where dynamic linking is available, this library will attempt to load a native Photon "Encryptor" plugin library for "Datagram Encryption".
+ Fallback to a managed implementation. This value is always true.
+
+
+ Obsolete and ignored. Size of CommandLog. Default is 0, no logging.
+
+
+ Obsolete and ignored. Converts the CommandLog into a readable table-like string with summary.
+
+
+ False if this library build contains C# Socket code. If true, you must set some type as SocketImplementation before connecting.
+
+
+ True if the library was compiled with DEBUG setting.
+
+
+ Version of the Native Encryptor API compiled into this assembly. Defines which PhotonEncryptorPlugin needs to be used.
+
+
+ Target framework this dll was built for.
+
+
+ Global toggle to avoid callbacks from native plugins. Defaults to false, meaning: "callbacks enabled".
+ Callbacks from native code will fail on some platforms, which is why you can disable them.
+
+
+ Can be used to remove/hide the AppId from websocket connect paths.
+
+
+ A simplified identifier for client SDKs. Photon's APIs might modify this (as a dll can be used in more than one product). Helps debugging.
+
+
+ For the Init-request, we shift the ClientId by one and the last bit signals a "debug" (0) or "release" build (1).
+
+
+ Version of this library as string.
+
+
+ Version of this library as string.
+
+
+ A Native Socket implementation is no longer part of this DLL but delivered in a separate add-on. This value always returns false.
+
+
+ Native Payload Encryption is no longer part of this DLL but delivered in a separate add-on. This value always returns false.
+
+
+ Native Datagram Encryption is no longer part of this DLL but delivered in a separate add-on. This value always returns false.
+
+
+ Enables selection of a (Photon-)serialization protocol. Used in Connect methods.
+ Defaults to SerializationProtocol.GpBinaryV16;
+
+
+ Optional definition of IPhotonSocket type per ConnectionProtocol.
+
+ Several platforms have special Socket implementations and slightly different APIs.
+ Customizing the SocketImplementationConfig helps to accomodate this.
+ By default, UDP and TCP have socket implementations assigned.
+
+ If a native socket plugin is available set the SocketNativeSource class as Type definition here.
+
+ You only need to set the SocketImplementationConfig once, after creating a PhotonPeer
+ and before connecting. If you switch the TransportProtocol, the correct implementation is being used.
+
+
+
+
+ Can be used to read the IPhotonSocket implementation at runtime (before connecting).
+
+
+ Use the SocketImplementationConfig to define which IPhotonSocket is used per ConnectionProtocol.
+
+
+
+
+ Sets the level (and amount) of debug output provided by the library.
+
+
+ This affects the callbacks to IPhotonPeerListener.DebugReturn.
+ Default Level: Error.
+
+
+
+
+ Gets the IPhotonPeerListener of this instance (set in constructor).
+ Can be used in derived classes for Listener.DebugReturn().
+
+
+
+
+ Called when the client received a Disconnect Message from the server. Signals an error and provides a message to debug the case.
+
+
+
+
+ Option to make the PhotonPeer reuse a single EventData instance for all incoming events.
+
+
+ This reduces memory garbage.
+ If enabled, the event provided via OnEvent(EventData photonEvent) is invalid once the callback finished.
+ That event's content will get modified. Typically this is not a problem as events are rarely cached.
+
+ Changing this value acquires the same lock that DispatchIncomingCommands() uses.
+
+
+
+
+ Enables a deserialization optimization for incoming events. Defaults to false.
+
+
+ When enabled, byte-arrays in incoming Photon events are deserialized into pooled ByteArraySlice instances (wrappers for byte[]).
+ This improves the memory footprint for receiving byte-arrays in events.
+
+ When used, you have to release the (pooled) ByteArraySlice instances.
+
+ Adjust your handling of EventData accordingly:
+
+ The ByteArraySlice.Buffer will usually be bigger than the send/received byte-array.
+ Check the ByteArraySlice.Count and read only the actually received bytes.
+ The Buffer is reused and not cleared. The Offset will be 0 for incoming events.
+
+ Important:
+ While the peer will acquire the ByteArraySlice and passes it to OnEvent, the game code has to call ByteArraySlice.Release()
+ when the slice is no longer needed.
+
+ Send either byte[], ArraySegment or use the ByteArraySlicePool to acquire ByteArraySlices to send.
+
+
+
+
+ Instance of a ByteArraySlicePool. UseByteArraySlicePoolForEvents defines if this PhotonPeer is using the pool for deserialization of byte[] in Photon events.
+
+ ByteArraySlice is a serializable datatype of the Photon .Net client library.
+ It helps avoid allocations by being pooled and (optionally) used in incoming Photon events (see: UseByteArraySlicePoolForEvents).
+
+ You can also use the pool to acquire ByteArraySlice instances for serialization.
+ RaiseEvent will auto-release all ByteArraySlice instances passed in.
+
+
+
+
+ This debug setting enables a new send-ordering for commands. Defaults to true and commands are sent in the order they are created. Set to false to use Enet ordering.
+
+
+
+ Skips resending (individual) commands if their reliable sequence number is this amount larger than the highest acknowledged sequence number.
+
+ This puts focus on resending commands that are older and are needed on the receiver side to dispatch commands.
+ It queues more on the client side than on the server.
+ Affects only reliable UDP (based on enet).
+
+
+
+ Skips sending reliable and unreliable commands if their reliable sequence number is this amount larger than the highest acknowledged sequence number.
+
+ This puts focus on resending commands that are older and are needed on the receiver side to dispatch commands.
+ It queues more on the client side than on the server.
+ Affects only reliable UDP (based on enet).
+
+
+
+
+ Gets count of all bytes coming in (including headers, excluding UDP/TCP overhead)
+
+
+
+
+ Gets count of all bytes going out (including headers, excluding UDP/TCP overhead)
+
+
+
+
+ Gets the size of the dispatched event or operation-result in bytes.
+ This value is set before OnEvent() or OnOperationResponse() is called (within DispatchIncomingCommands()).
+
+
+ Get this value directly in OnEvent() or OnOperationResponse(). Example:
+ void OnEvent(...) {
+ int eventSizeInBytes = this.peer.ByteCountCurrentDispatch;
+ //...
+
+ void OnOperationResponse(...) {
+ int resultSizeInBytes = this.peer.ByteCountCurrentDispatch;
+ //...
+
+
+
+ Returns the debug string of the event or operation-response currently being dispatched or string. Empty if none.
+ In a release build of the lib, this will always be empty.
+
+
+
+ Gets the size of the last serialized operation call in bytes.
+ The value includes all headers for this single operation but excludes those of UDP, Enet Package Headers and TCP.
+
+
+ Get this value immediately after calling an operation.
+ Example:
+
+ this.loadbalancingClient.OpJoinRoom("myroom");
+ int opjoinByteCount = this.loadbalancingClient.ByteCountLastOperation;
+
+
+
+ If set, the TrafficRecorder will be used to capture all traffic.
+
+ If null or not Enabled, the recorder is not being used.
+ Release builds of this library will never record traffic for performance reasons.
+
+ See ITrafficRecorder docs.
+
+
+
+
+ Debugging option to tell the Photon Server to log all datagrams.
+
+
+
+
+ Up to 4 resend attempts for a reliable command can be done in quick succession (after RTT+4*Variance).
+
+
+ By default 0. Any later resend attempt will then double the time before the next resend.
+ Max value = 4;
+ Make sure to adjust SentCountAllowance to a slightly higher value, as more repeats will get done.
+
+
+
+
+ This is the (low level) state of the connection to the server of a PhotonPeer. Managed internally and read-only.
+
+
+ Don't mix this up with the StatusCode provided in IPhotonListener.OnStatusChanged().
+ Applications should use the StatusCode of OnStatusChanged() to track their state, as
+ it also covers the higher level initialization between a client and Photon.
+
+
+
+
+ This peer's ID as assigned by the server or 0 if not using UDP. Will be 0xFFFF before the client connects.
+
+ Used for debugging only. This value is not useful in everyday Photon usage.
+
+
+
+ Count of all currently received but not-yet-Dispatched reliable commands
+ (events and operation results) from all channels.
+
+
+
+
+ Count of all commands currently queued as outgoing, including all channels and reliable, unreliable.
+
+
+
+
+ Sets a new (temporary) size of the MessageBufferPool to reuse memory where possible.
+
+
+ The MessageBufferPool is a Queue<StreamBuffer> for performance reasons.
+ This methods dequeues from the MessageBufferPool to get the Count equal to countOfBuffers,
+ then it calls MessageBufferPool.TrimExcess().
+
+ New size of the pool. Clears the pool if <= 0.
+
+
+
+ Gets / sets the number of channels available in UDP connections with Photon.
+ Photon Channels are only supported for UDP.
+ The default ChannelCount is 2. Channel IDs start with 0 and 255 is a internal channel.
+
+
+
+
+ Enables the client so send the "encrypted" flag on secure connections. Incompatible with Server SDK 4.x.
+
+
+
+
+ While not connected, this controls if the next connection(s) should use a per-package CRC checksum.
+
+
+ While turned on, the client and server will add a CRC checksum to every sent package.
+ The checksum enables both sides to detect and ignore packages that were corrupted during transfer.
+ Corrupted packages have the same impact as lost packages: They require a re-send, adding a delay
+ and could lead to timeouts.
+
+ Building the checksum has a low processing overhead but increases integrity of sent and received data.
+ Packages discarded due to failed CRC cecks are counted in PhotonPeer.PacketLossByCrc.
+
+
+
+
+ Count of packages dropped due to failed CRC checks for this connection.
+
+
+
+
+
+ Count of packages dropped due to wrong challenge for this connection.
+
+
+
+
+ Gets the count of sent but not yet acknowledged commands (for UDP connections).
+
+
+
+
+ Count of commands that got repeated (due to local repeat-timing before an ACK was received).
+
+
+
+
+ Number of send retries before a peer is considered lost/disconnected. Default: 7.
+
+
+ The initial timeout countdown of a command is calculated by the current roundTripTime + 4 * roundTripTimeVariance.
+ Please note that the timeout span until a command will be resent is not constant, but based on
+ the roundtrip time at the initial sending, which will be doubled with every failed retry.
+
+ DisconnectTimeout and SentCountAllowance are competing settings: either might trigger a disconnect on the
+ client first, depending on the values and Roundtrip Time.
+
+
+
+
+ Caps the initial timing for repeats of reliable commands. In milliseconds. Default: 400ms.
+
+
+ Unless acknowledged, reliable commands are repeated initially after: current roundTripTime + 4 * roundTripTimeVariance.
+
+ As this value can be very high when there was exceptional lag, InitialResendTimeMax makes sure that commands
+ get repeated several times before they may trigger a timeout.
+
+
+
+
+ Sets the time between pings being sent automatically. They measure the roundtrip time and keep connections from closing. Default: 1000.
+
+
+ For Photon's reliable UDP connections, pings are skipped if any reliable command was sent during the specified TimePingInterval.
+ Any reliable command is used to update the RoundTripTime and RoundTripTimeVariance.
+
+ When using TCP and WebSockets, the ping is of interest to measure the roundtrip and to keep a connection open, should nothing else
+ With those two protocols, the ping is used to update the RoundTripTime and RoundTripTimeVariance.
+
+
+
+
+ Time in milliseconds before any sent reliable command triggers a timeout disconnect, unless acknowledged by the receiver. Default: 10000.
+
+
+ DisconnectTimeout is not an exact value for a timeout. The exact timing of the timeout depends on the frequency
+ of Service() calls and the roundtrip time. Commands sent with long roundtrip-times and variance are checked less
+ often for re-sending.
+
+ DisconnectTimeout and SentCountAllowance are competing settings: either might trigger a disconnect on the
+ client first, depending on the values and Roundtrip Time.
+
+ Default: 10000 ms. Maximum setting: 65535.
+ Setting a negative value will apply the default timeout.
+
+
+
+
+ Approximated Environment.TickCount value of server (while connected).
+
+
+ UDP: The server's timestamp is automatically fetched after connecting (once). This is done
+ internally by a command which is acknowledged immediately by the server.
+ TCP: The server's timestamp fetched with each ping but set only after connecting (once).
+
+ The approximation will be off by +/- 10ms in most cases. Per peer/client and connection, the
+ offset will be constant (unless FetchServerTimestamp() is used). A constant offset should be
+ better to adjust for. Unfortunately there is no way to find out how much the local value
+ differs from the original.
+
+ The approximation adds RoundtripTime / 2 and uses this.LocalTimeInMilliSeconds to calculate
+ in-between values (this property returns a new value per tick).
+
+ The value sent by Photon equals Environment.TickCount in the logic layer.
+
+
+ 0 until connected.
+ While connected, the value is an approximation of the server's current timestamp.
+
+
+
+
+ This setter for the (local-) timestamp delegate replaces the default Environment.TickCount with any equal function.
+
+
+
+ The internally used per PhotonPeer time value.
+
+ Returns the integer part of a Stopwatch ElapsedMilliseconds value.
+ If the PhotonPeer runs continuously the ClientTime will increment from zero to Int32..::.MaxValue
+ for approximately 24.9 days, then jump to Int32..::.MinValue (a negative number), then increment
+ back to zero during the next 24.9 days.
+
+ It is recommended to use this int only for delta times, to avoid handling the overflow.
+
+
+
+ The last ConnectionTime value, when some ACKs were sent out by this client.
+ Only applicable to UDP connections.
+
+
+ The last ConnectionTime value, when SendOutgoingCommands actually checked outgoing queues to send them. Must be connected.
+ Available for UDP and TCP connections.
+
+
+ Measures the maximum milliseconds spent in PhotonSocket.Send().
+
+
+ Time until a reliable command is acknowledged by the server.
+
+ The value measures network latency and for UDP it includes the server's ACK-delay (setting in config).
+ In TCP, there is no ACK-delay, so the value is slightly lower (if you use default settings for Photon).
+
+ RoundTripTime is updated constantly. Every reliable command will contribute a fraction to this value.
+
+ This is also the approximate time until a raised event reaches another client or until an operation
+ result is available.
+
+
+
+
+ Changes of the roundtriptime as variance value. Gives a hint about how much the time is changing.
+
+
+
+ The last measured roundtrip time for this connection.
+
+
+
+ Timestamp of the last time anything (!) was received from the server (including low level Ping, ACKs, events and operation-returns).
+
+
+ This is not the time when something was dispatched. If you enable NetworkSimulation, this value is affected as well.
+
+
+
+
+ The server address which was used in PhotonPeer.Connect() or null (before Connect() was called).
+
+
+
+ Contains the IP address of the previously resolved ServerAddress (or empty, if address wasn't resolved with the internal methods).
+
+
+ The protocol this peer is currently connected/connecting with (or 0).
+
+
+ This is the transport protocol to be used for next connect (see remarks).
+ The TransportProtocol can be changed anytime but it will not change the
+ currently active connection. Instead, TransportProtocol will be applied on next Connect.
+
+
+
+
+ Gets or sets the network simulation "enabled" setting.
+ Changing this value also locks this peer's sending and when setting false,
+ the internally used queues are executed (so setting to false can take some cycles).
+
+
+
+
+ Gets the settings for built-in Network Simulation for this peer instance
+ while IsSimulationEnabled will enable or disable them.
+ Once obtained, the settings can be modified by changing the properties.
+
+
+
+
+ Defines the initial size of an internally used StreamBuffer for Tcp.
+ The StreamBuffer is used to aggregate operation into (less) send calls,
+ which uses less resoures.
+
+
+ The size is not restricing the buffer and does not affect when outgoing data is actually sent.
+
+
+
+
+ The Maximum Trasfer Unit (MTU) defines the (network-level) packet-content size that is
+ guaranteed to arrive at the server in one piece. The Photon Protocol uses this
+ size to split larger data into packets and for receive-buffers of packets.
+
+
+ This value affects the Packet-content. The resulting UDP packages will have additional
+ headers that also count against the package size (so it's bigger than this limit in the end)
+ Setting this value while being connected is not allowed and will throw an Exception.
+ Minimum is 576. Huge values won't speed up connections in most cases!
+
+
+
+
+ This property is set internally, when OpExchangeKeysForEncryption successfully finished.
+ While it's true, encryption can be used for operations.
+
+
+
+
+ While true, the peer will not send any other commands except ACKs (used in UDP connections).
+
+
+
+ Defines if Key Exchange for Encryption is done asynchronously in another thread.
+
+
+ Indicates if sequence numbers should be randomized.
+
+
+ Initialization array, used to modify the sequence numbers of channels.
+
+
+ If GCM is used for DatagramEncryption.
+ If true, the randomization-value gets added to the current value, else (CBC/old style) the randomization-value replaces the current value.
+
+
+
+ Gets the byte-count of incoming "low level" messages, which are either Enet Commands or Tcp Messages.
+ These include all headers, except those of the underlying internet protocol Udp or Tcp.
+
+
+
+
+ Gets the byte-count of outgoing "low level" messages, which are either Enet Commands or Tcp Messages.
+ These include all headers, except those of the underlying internet protocol Udp or Tcp.
+
+
+
+
+ Gets a statistic of incoming and outgoing traffic, split by operation, operation-result and event.
+
+
+ Operations are outgoing traffic, results and events are incoming.
+ Includes the per-command header sizes (Udp: Enet Command Header or Tcp: Message Header).
+
+
+
+
+ Returns the count of milliseconds the stats are enabled for tracking.
+
+
+
+
+ Enables or disables collection of statistics in TrafficStatsIncoming, TrafficStatsOutgoing and TrafficstatsGameLevel.
+
+
+ Setting this to true, also starts the stopwatch to measure the timespan the stats are collected.
+ Enables the traffic statistics of a peer: TrafficStatsIncoming, TrafficStatsOutgoing and TrafficstatsGameLevel (nothing else).
+ Default value: false (disabled).
+
+
+
+
+ Creates new instances of TrafficStats and starts a new timer for those.
+
+
+
+
+ Creates new TrafficStats values and the related Stopwatch instance. To be called when the peer is created / reset.
+
+
+
+
+ Returns a string of the most interesting connection statistics.
+ When you have issues on the client side, these might contain hints about the issue's cause.
+
+ If true, Incoming and Outgoing low-level stats are included in the string.
+ Stats as string.
+
+
+ Implements the message-protocol, based on the underlying network protocol (udp, tcp, http).
+
+
+ Setter for the Payload Encryptor type. Used for next connection.
+
+ If null, the PhotonPeer will create a DiffieHellmanCryptoProvider, which is the default.
+ This is only needed in rare cases, where using native payload encryption makes sense.
+
+ Get in touch about this, if you got questions: developer@photonengine.com
+
+
+
+ PayloadEncryption Secret. Message payloads get encrypted with it individually and on demand.
+
+
+ Setter for the Datagram Encryptor type. Used at next connect.
+
+ If null, the PhotonPeer will create a default datagram encryptor instance.
+
+
+
+ The datagram encryptor used for the current connection. Applied internally in InitDatagramEncryption.
+
+
+ Count of unreliable commands being discarded in case this client already dispatched a command that was newer (higher sequence number).
+
+
+ Set per dispatch in DispatchIncomingCommands to: commandUnreliableSequenceNumber - channel.incomingUnreliableSequenceNumber. Indicates how big the (sequence)gap is, compared to the last dispatched unreliable command.
+
+
+ Creates a new PhotonPeer with specified transport protocol (without a IPhotonPeerListener).
+ Make sure to set the Listener, before using the peer.
+
+
+
+ Creates a new PhotonPeer instance to communicate with Photon and selects the transport protocol. We recommend UDP.
+
+ a IPhotonPeerListener implementation
+ Protocol to use to connect to Photon.
+
+
+
+ Starts connecting to the given Photon server. Non-blocking.
+
+
+ Connecting to the Photon server is done asynchronous.
+ Unless an error happens right away (and this returns false), wait for the call of IPhotonPeerListener.OnStatusChanged.
+
+
+ Address of a Photon server as IP:port or hostname. WebSocket connections must contain a scheme (ws:// or wss://).
+
+
+ The ID of the app to use. Typically this is a guid (for the Photon Cloud). Max 32 characters.
+
+
+ Optional custom data to be used by server during peer creation.
+ If used for authentication, the server is able to reject a client without creating a peer.
+ Must be a serializable data type of Photon.
+
+ Custom data to send to the server in the Init request. Might be used to identify a client / user.
+
+ True if a connection attempt will be made. False if some error could be detected early-on.
+
+
+
+
+ Starts connecting to the given Photon server. Non-blocking.
+
+
+ Connecting to the Photon server is done asynchronous.
+ Unless an error happens right away (and this returns false), wait for the call of IPhotonPeerListener.OnStatusChanged.
+
+
+ Address of a Photon server as IP:port or hostname. WebSocket connections must contain a scheme (ws:// or wss://).
+
+
+ Optional address of a proxy server. Only used by WebSocket connections. Set null to use none.
+
+
+ The ID of the app to use. Typically this is a guid (for the Photon Cloud). Max 32 characters.
+
+
+ Optional Photon token data to be used by server during peer creation.
+ If used for authentication, the server is able to reject a client without creating a peer.
+ Must be of type string or byte[] (as provided by server).
+
+ Custom data to send to the server in the Init request. Might be used to identify a client / user.
+
+ True if a connection attempt will be made. False if some error could be detected early-on.
+
+
+
+
+ This method initiates a mutual disconnect between this client and the server.
+
+
+ Calling this method does not immediately close a connection. Disconnect lets the server
+ know that this client is no longer listening. For the server, this is a much faster way
+ to detect that the client is gone but it requires the client to send a few final messages.
+
+ On completion, OnStatusChanged is called with the StatusCode.Disconnect.
+
+ If the client is disconnected already or the connection thread is stopped, then there is no callback.
+
+ The default server logic will leave any joined game and trigger the respective event.
+
+
+
+
+ This method immediately closes a connection (pure client side) and ends related listening Threads.
+
+
+ Unlike Disconnect, this method will simply stop to listen to the server. Udp connections will timeout.
+ If the connections was open, this will trigger a callback to OnStatusChanged with code StatusCode.Disconnect.
+
+
+
+
+ This will fetch the server's timestamp and update the approximation for property ServerTimeInMilliseconds.
+
+
+ The server time approximation will NOT become more accurate by repeated calls. Accuracy currently depends
+ on a single roundtrip which is done as fast as possible.
+
+ The command used for this is immediately acknowledged by the server. This makes sure the roundtrip time is
+ low and the timestamp + rountriptime / 2 is close to the original value.
+
+
+
+
+ This method creates a public key for this client and exchanges it with the server.
+
+
+ Encryption is not instantly available but calls OnStatusChanged when it finishes.
+ Check for StatusCode EncryptionEstablished and EncryptionFailedToEstablish.
+
+ Calling this method sets IsEncryptionAvailable to false.
+ This method must be called before the "encrypt" parameter of OpCustom can be used.
+
+ If operation could be enqueued for sending
+
+
+
+ Initializes Datagram Encryption. Optionally, the EncryptorType is being used, if set.
+
+ Secret used to cipher udp packets.
+ Secret used for authentication of udp packets.
+ Sets if enet Sequence Numbers will be randomized or not. Preferably should be true.
+ Sets if the chaining mode should be CBC (false, default) or GCM (true). GCM mode is only available with a native encryption plugin.
+
+
+
+ Photon's Payload Encryption secret may be set by a response from the server.
+
+ The secret in form of a byte[].
+
+
+
+ This method excutes DispatchIncomingCommands and SendOutgoingCommands in your application Thread-context.
+
+
+ The Photon client libraries are designed to fit easily into a game or application. The application
+ is in control of the context (thread) in which incoming events and responses are executed and has
+ full control of the creation of UDP/TCP packages.
+
+ Sending packages and dispatching received messages are two separate tasks. Service combines them
+ into one method at the cost of control. It calls DispatchIncomingCommands and SendOutgoingCommands.
+
+ Call this method regularly (2..20 times a second).
+
+ This will Dispatch ANY remaining buffered responses and events AND will send queued outgoing commands.
+ Fewer calls might be more effective if a device cannot send many packets per second, as multiple
+ operations might be combined into one package.
+
+
+ You could replace Service by:
+
+ while (DispatchIncomingCommands()); //Dispatch until everything is Dispatched...
+ SendOutgoingCommands(); //Send a UDP/TCP package with outgoing messages
+
+
+
+
+
+
+ Creates and sends a UDP/TCP package with outgoing commands (operations and acknowledgements). Also called by Service().
+
+
+ As the Photon library does not create any UDP/TCP packages by itself. Instead, the application
+ fully controls how many packages are sent and when. A tradeoff, an application will
+ lose connection, if it is no longer calling SendOutgoingCommands or Service.
+
+ If multiple operations and ACKs are waiting to be sent, they will be aggregated into one
+ package. The package fills in this order:
+ ACKs for received commands
+ A "Ping" - only if no reliable data was sent for a while
+ Starting with the lowest Channel-Nr:
+ Reliable Commands in channel
+ Unreliable Commands in channel
+
+ This gives a higher priority to lower channels.
+
+ A longer interval between sends will lower the overhead per sent operation but
+ increase the internal delay (which adds "lag").
+
+ Call this 2..20 times per second (depending on your target platform).
+
+ The if commands are not yet sent. Udp limits it's package size, Tcp doesnt.
+
+
+
+ Dispatching received messages (commands), causes callbacks for events, responses and state changes within a IPhotonPeerListener.
+
+
+ DispatchIncomingCommands only executes a single received
+ command per call. If a command was dispatched, the return value is true and the method
+ should be called again.
+
+ This method is called by Service() until currently available commands are dispatched.
+ In general, this method should be called until it returns false. In a few cases, it might
+ make sense to pause dispatching (if a certain state is reached and the app needs to load
+ data, before it should handle new events).
+
+ The callbacks to the peer's IPhotonPeerListener are executed in the same thread that is
+ calling DispatchIncomingCommands. This makes things easier in a game loop: Event execution
+ won't clash with painting objects or the game logic.
+
+
+
+
+ Prepares your operation (code and parameters) to be sent to the Photon Server with specified SendOptions.
+
+
+ This method serializes and enqueues the operation right away while the actual sending happens later.
+ To be able to aggregate operations/messages, the Photon client sends packages only when you call SendOutgoingCommands().
+
+ The sendOptions specify how the operation gets sent exactly.
+ Keep in mind that some transport protocols don't support unreliable or unsequenced transport.
+ In that case, the sendOptions might be ignored.
+
+ The operationCode must be known by the server's logic or won't be processed.
+ In almost all cases, sending an operation will result in a OperationResponse (see: IPhotonPeerListener.OnOperationResponse).
+
+ Operations are handled by their byte\-typed code. The codes are defined in the Realtime API (a.k.a. LoadBalancing API).
+ Containing parameters as key\-value pair. The key is byte\-typed, while the value is any serializable datatype.
+ Wraps up DeliveryMode (reliability), Encryption and Channel values for sending.
+ If operation could be enqueued for sending.
+
+
+
+ Registers new types/classes for de/serialization and the fitting methods to call for this type.
+
+
+ SerializeMethod and DeserializeMethod are complementary: Feed the product of serializeMethod to
+ the constructor, to get a comparable instance of the object.
+
+ After registering a Type, it can be used in events and operations and will be serialized like
+ built-in types.
+
+ Type (class) to register.
+ A byte-code used as shortcut during transfer of this Type.
+ Method delegate to create a byte[] from a customType instance.
+ Method delegate to create instances of customType's from byte[].
+ If the Type was registered successfully.
+
+
+
+ Container for an Operation request, which is a code and parameters.
+
+
+ On the lowest level, Photon only allows byte-typed keys for operation parameters.
+ The values of each such parameter can be any serializable datatype: byte, int, hashtable and many more.
+
+
+
+ Byte-typed code for an operation - the short identifier for the server's method to call.
+
+
+ The parameters of the operation - each identified by a byte-typed code in Photon.
+
+
+
+ Contains the server's response for an operation called by this peer.
+ The indexer of this class actually provides access to the Parameters Dictionary.
+
+
+ The OperationCode defines the type of operation called on Photon and in turn also the Parameters that
+ are set in the request. Those are provided as Dictionary with byte-keys.
+ There are pre-defined constants for various codes defined in the LoadBalancing application.
+ Check: OperationCode, ParameterCode, etc.
+
+ An operation's request is summarized by the ReturnCode: a short typed code for "Ok" or
+ some different result. The code's meaning is specific per operation. An optional DebugMessage can be
+ provided to simplify debugging.
+
+ Each call of an operation gets an ID, called the "invocID". This can be matched to the IDs
+ returned with any operation calls. This way, an application could track if a certain OpRaiseEvent
+ call was successful.
+
+
+
+ The code for the operation called initially (by this peer).
+ Use enums or constants to be able to handle those codes, like OperationCode does.
+
+
+ A code that "summarizes" the operation's success or failure. Specific per operation. 0 usually means "ok".
+
+
+ An optional string sent by the server to provide readable feedback in error-cases. Might be null.
+
+
+ A Dictionary of values returned by an operation, using byte-typed keys per value.
+
+
+
+ Alternative access to the Parameters, which wraps up a TryGetValue() call on the Parameters Dictionary.
+
+ The byte-code of a returned value.
+ The value returned by the server, or null if the key does not exist in Parameters.
+
+
+ ToString() override.
+ Relatively short output of OpCode and returnCode.
+
+
+ Extensive output of operation results.
+ To be used in debug situations only, as it returns a string for each value.
+
+
+ A Photon Event consists of a Code value and a Parameters Dictionary with the event's content (if any).
+
+ The indexer of this class provides access to the values in Parameters.
+ It wraps the null check for Parameters and uses TryGetValue() for the provided key.
+
+ Photon servers use events to send information which is not triggered by a client's operation requests (those get responses).
+ The Realtime API allows you to send custom events with any Code and content via OpRaiseEvent.
+
+
+
+ The event code identifies the type of event.
+
+
+ The Parameters of an event is a Dictionary<byte, object>.
+
+
+
+ Access to the Parameters of a Photon-defined event. Custom Events only use Code, Sender and CustomData.
+
+ The key byte-code of a Photon event value.
+ The Parameters value, or null if the key does not exist in Parameters.
+
+
+
+ Defines the event key containing the Sender of the event.
+
+
+ Defaults to Sender key of Realtime API events (RaiseEvent): 254.
+ Can be set to Chat API's ChatParameterCode.Sender: 5.
+
+
+
+
+ Accesses the Sender of the event via the indexer and SenderKey. The result is cached.
+
+
+ Accesses this event's Parameters[CustomDataKey], which may be null.
+ In that case, this returns 0 (identifying the server as sender).
+
+
+
+
+ Defines the event key containing the Custom Data of the event.
+
+
+ Defaults to Data key of Realtime API events (RaiseEvent): 245.
+ Can be set to any other value on demand.
+
+
+
+
+ Accesses the Custom Data of the event via the indexer and CustomDataKey. The result is cached.
+
+
+ Accesses this event's Parameters[CustomDataKey], which may be null.
+
+
+
+ ToString() override.
+ Short output of "Event" and it's Code.
+
+
+ Extensive output of the event content.
+ To be used in debug situations only, as it returns a string for each value.
+
+
+
+ Type of serialization methods to add custom type support.
+ Use PhotonPeer.ReisterType() to register new types with serialization and deserialization methods.
+
+ The method will get objects passed that were registered with it in RegisterType().
+ Return a byte[] that resembles the object passed in. The framework will surround it with length and type info, so don't include it.
+
+
+ Serialization method delegate. StreamBuffer based custom serialization methods must use this form.
+
+
+
+ Type of deserialization methods to add custom type support.
+ Use PhotonPeer.RegisterType() to register new types with serialization and deserialization methods.
+
+ The framwork passes in the data it got by the associated SerializeMethod. The type code and length are stripped and applied before a DeserializeMethod is called.
+ Return a object of the type that was associated with this method through RegisterType().
+
+
+ Deserialization method delegate. StreamBuffer based custom deserialization methods must use this form.
+
+
+
+ Provides tools for the Exit Games Protocol
+
+
+
+
+ Serialize creates a byte-array from the given object and returns it.
+
+ The object to serialize
+ The serialized byte-array
+
+
+
+ Deserialize returns an object reassembled from the given byte-array.
+
+ The byte-array to be Deserialized
+ The Deserialized object
+
+
+
+ Serializes a short typed value into a byte-array (target) starting at the also given targetOffset.
+ The altered offset is known to the caller, because it is given via a referenced parameter.
+
+ The short value to be serialized
+ The byte-array to serialize the short to
+ The offset in the byte-array
+
+
+
+ Serializes an int typed value into a byte-array (target) starting at the also given targetOffset.
+ The altered offset is known to the caller, because it is given via a referenced parameter.
+
+ The int value to be serialized
+ The byte-array to serialize the short to
+ The offset in the byte-array
+
+
+
+ Serializes an float typed value into a byte-array (target) starting at the also given targetOffset.
+ The altered offset is known to the caller, because it is given via a referenced parameter.
+
+ The float value to be serialized
+ The byte-array to serialize the short to
+ The offset in the byte-array
+
+
+
+ Deserialize fills the given int typed value with the given byte-array (source) starting at the also given offset.
+ The result is placed in a variable (value). There is no need to return a value because the parameter value is given by reference.
+ The altered offset is this way also known to the caller.
+
+ The int value to deserialize into
+ The byte-array to deserialize from
+ The offset in the byte-array
+
+
+
+ Deserialize fills the given short typed value with the given byte-array (source) starting at the also given offset.
+ The result is placed in a variable (value). There is no need to return a value because the parameter value is given by reference.
+ The altered offset is this way also known to the caller.
+
+ The short value to deserialized into
+ The byte-array to deserialize from
+ The offset in the byte-array
+
+
+
+ Deserialize fills the given float typed value with the given byte-array (source) starting at the also given offset.
+ The result is placed in a variable (value). There is no need to return a value because the parameter value is given by reference.
+ The altered offset is this way also known to the caller.
+
+ The float value to deserialize
+ The byte-array to deserialize from
+ The offset in the byte-array
+
+
+
+ Exit Games GpBinaryV16 protocol implementation
+
+
+
+
+ The gp type.
+
+
+
+
+ Unkown type.
+
+
+
+
+ An array of objects.
+
+
+ This type is new in version 1.5.
+
+
+
+
+ A boolean Value.
+
+
+
+
+ A byte value.
+
+
+
+
+ An array of bytes.
+
+
+
+
+ An array of objects.
+
+
+
+
+ A 16-bit integer value.
+
+
+
+
+ A 32-bit floating-point value.
+
+
+ This type is new in version 1.5.
+
+
+
+
+ A dictionary
+
+
+ This type is new in version 1.6.
+
+
+
+
+ A 64-bit floating-point value.
+
+
+ This type is new in version 1.5.
+
+
+
+
+ A Hashtable.
+
+
+
+
+ A 32-bit integer value.
+
+
+
+
+ An array of 32-bit integer values.
+
+
+
+
+ A 64-bit integer value.
+
+
+
+
+ A string value.
+
+
+
+
+ An array of string values.
+
+
+
+
+ A custom type. 0x63
+
+
+
+
+ Null value don't have types.
+
+
+
+
+ Calls the correct serialization method for the passed object.
+
+
+
+
+ DeserializeInteger returns an Integer typed value from the given stream.
+
+
+
+ Exception type for de/serialization issues. Used in Protocol 1.8.
+
+
+ Constructor for the exception.
+
+
+ Unkown. GpType: 0.
+
+
+ Boolean. GpType: 2. See: BooleanFalse, BooleanTrue.
+
+
+ Byte. GpType: 3.
+
+
+ Short. GpType: 4.
+
+
+ 32-bit floating-point value. GpType: 5.
+
+
+ 64-bit floating-point value. GpType: 6.
+
+
+ String. GpType: 7.
+
+
+ Null value don't have types. GpType: 8.
+
+
+ CompressedInt. GpType: 9.
+
+
+ CompressedLong. GpType: 10.
+
+
+ Int1. GpType: 11.
+
+
+ Int1_. GpType: 12.
+
+
+ Int2. GpType: 13.
+
+
+ Int2_. GpType: 14.
+
+
+ L1. GpType: 15.
+
+
+ L1_. GpType: 16.
+
+
+ L2. GpType: 17.
+
+
+ L2_. GpType: 18.
+
+
+ Custom Type. GpType: 19.
+
+
+ Custom Type Slim. GpType: 128 (0x80) and up.
+
+
+ Dictionary. GpType: 20.
+
+
+ Hashtable. GpType: 21.
+
+
+ ObjectArray. GpType: 23.
+
+
+ OperationRequest. GpType: 24.
+
+
+ OperationResponse. GpType: 25.
+
+
+ EventData. GpType: 26.
+
+
+ Boolean False. GpType: 27.
+
+
+ Boolean True. GpType: 28.
+
+
+ ShortZero. GpType: 29.
+
+
+ IntZero. GpType: 30.
+
+
+ LongZero. GpType: 3.
+
+
+ FloatZero. GpType: 32.
+
+
+ DoubleZero. GpType: 33.
+
+
+ ByteZero. GpType: 34.
+
+
+ Array for nested Arrays. GpType: 64 (0x40). Element count and type follows.
+
+
+
+ Writes integers as compressed. Either directly as zigzag-encoded or (when a type is written for this value) it can use an optimized sub-type.
+
+
+
+ Enum of the three options for reliability and sequencing in Photon's reliable-UDP.
+
+
+ The operation/message gets sent just once without acknowledgement or repeat. The sequence (order) of messages is guaranteed.
+
+
+ The operation/message asks for an acknowledgment. It's resent until an ACK arrived. The sequence (order) of messages is guaranteed.
+
+
+ The operation/message gets sent once (unreliable) and might arrive out of order. Best for your own sequencing (e.g. for streams).
+
+
+ The operation/message asks for an acknowledgment. It's resent until an ACK arrived and might arrive out of order. Best for your own sequencing (e.g. for streams).
+
+
+ Wraps up DeliveryMode, Encryption and Channel values for sending operations and messages.
+
+
+ Default SendOptions instance for reliable sending.
+
+
+ Default SendOptions instance for unreliable sending.
+
+
+ Chose the DeliveryMode for this operation/message. Defaults to Unreliable.
+
+
+ If true the operation/message gets encrypted before it's sent. Defaults to false.
+ Before encryption can be used, it must be established. Check PhotonPeer.IsEncryptionAvailable is true.
+
+
+ The Enet channel to send in. Defaults to 0.
+ Channels in Photon relate to "message channels". Each channel is a sequence of messages.
+
+
+ Sets the DeliveryMode either to true: Reliable or false: Unreliable, overriding any current value.
+ Use this to conveniently select reliable/unreliable delivery.
+
+
+ Encapsulates the network i/o functionality for the realtime library.
+
+
+ used by PhotonPeer*
+
+
+ Endless loop, run in Receive Thread.
+
+
+ Internal class to encapsulate the network i/o functionality for the realtime libary.
+
+
+ used by PhotonPeer*
+
+
+ Encapsulates the network i/o functionality for the realtime library.
+
+
+ used by PhotonPeer*
+
+
+ Endless loop, run in Receive Thread.
+
+
+ Internal class to encapsulate the network i/o functionality for the realtime libary.
+
+
+ used by PhotonPeer*
+
+
+
+ Allocates a new byte[] that is the exact used length. Use GetBuffer for nonalloc operations.
+
+
+
+
+ Allocates a new byte[] that is the exact used length. Use GetBuffer for nonalloc operations.
+
+
+
+
+ The bytes between Position and Length are copied to the beginning of the buffer. Length decreased by Position. Position set to 0.
+
+
+
+
+ Brings StreamBuffer to the state as after writing of 'length' bytes. Returned buffer and offset can be used to actually fill "written" segment with data.
+
+
+
+
+ Remaining bytes in this StreamBuffer. Returns 0 if len - pos is less than 0.
+
+
+
+
+ Sets stream length. If current position is greater than specified value, it's set to the value.
+
+
+ SetLength(0) resets the stream to initial state but preserves underlying byte[] buffer.
+
+
+
+
+ Guarantees that the buffer is at least neededSize bytes.
+
+
+
+
+ Contains several (more or less) useful static methods, mostly used for debugging.
+
+
+
+
+ Gets the local machine's "milliseconds since start" value (precision is described in remarks).
+
+
+ This method uses Environment.TickCount (cheap but with only 16ms precision).
+ PhotonPeer.LocalMsTimestampDelegate is available to set the delegate (unless already connected).
+
+ Fraction of the current time in Milliseconds (this is not a proper datetime timestamp).
+
+
+
+ Creates a background thread that calls the passed function in intervals, as long as that returns true.
+
+
+ With StopBackgroundCalls, you can stop threads started with this method.
+ The resulting ThreadAbortException is caught and discarded.
+
+ The function to call. Must return true, if it should be called again. Returning false ends the thread.
+ Milliseconds to sleep between calls of myThread. Default: 100ms.
+ An optional name for the task to help debugging. Null or empty won't set the thread.Name.
+
+
+
+ Calls Abort on the thread with the given id (= index of the thread list)
+
+
+ The resulting ThreadAbortException is caught and discarded.
+
+ The unique ID of the thread.
+ True if the thread is canceled and false otherwise, e.g. if the thread with the given ID does not exist.
+
+
+
+ Calls Abort on all threads that were started via StartBackgroundCalls.
+
+
+ The resulting ThreadAbortException is caught and discarded.
+
+ True if any thread got aborted.
+
+
+
+ Writes the exception's stack trace to the received stream.
+
+ Exception to obtain information from.
+ Output sream used to write to.
+
+
+
+ Writes the exception's stack trace to the received stream. Writes to: System.Diagnostics.Debug.
+
+ Exception to obtain information from.
+
+
+
+ This method returns a string, representing the content of the given IDictionary.
+ Returns "null" if parameter is null.
+
+ IDictionary to return as string.
+
+
+
+
+ Converts a byte-array to string (useful as debugging output).
+ Uses BitConverter.ToString(list) internally after a null-check of list.
+
+ Byte-array to convert to string.
+ Length of bytes to convert to string. If negative, list.Length is converted. Optional. Default: -1.
+
+ List of bytes as string.
+
+
+
+
+ Class to wrap static access to the random.Next() call in a thread safe manner.
+
+
+
+
+ An Attribute named "Preserve" tells Unity to not strip the code.
+
+
+
+ TCP "Package" header: 7 bytes
+
+
+ TCP "Message" header: 2 bytes
+
+
+ TCP header combined: 9 bytes
+
+
+ Defines if the (TCP) socket implementation needs to do "framing".
+ The WebSocket protocol (e.g.) includes framing, so when that is used, we set DoFraming to false.
+
+
+
+ Checks the incoming queue and Dispatches received data if possible. Returns if a Dispatch happened or
+ not, which shows if more Dispatches might be needed.
+
+
+
+
+ gathers commands from all (out)queues until udp-packet is full and sends it!
+
+
+
+ Sends a ping in intervals to keep connection alive (server will timeout connection if nothing is sent).
+ Always false in this case (local queues are ignored. true would be: "call again to send remaining data").
+
+
+ enqueues serialized operations to be sent as tcp stream / package
+
+
+ Sends a ping and modifies this.lastPingResult to avoid another ping for a while.
+
+
+ reads incoming tcp-packages to create and queue incoming commands*
+
+
+
+ Only in use as long as PhotonPeer.TrafficStatsEnabled = true;
+
+
+
+ Gets sum of outgoing operations in bytes.
+
+
+ Gets count of outgoing operations.
+
+
+ Gets sum of byte-cost of incoming operation-results.
+
+
+ Gets count of incoming operation-results.
+
+
+ Gets sum of byte-cost of incoming events.
+
+
+ Gets count of incoming events.
+
+
+
+ Gets longest time it took to complete a call to OnOperationResponse (in your code).
+ If such a callback takes long, it will lower the network performance and might lead to timeouts.
+
+
+
+ Gets OperationCode that causes the LongestOpResponseCallback. See that description.
+
+
+
+ Gets longest time a call to OnEvent (in your code) took.
+ If such a callback takes long, it will lower the network performance and might lead to timeouts.
+
+
+
+ Gets EventCode that caused the LongestEventCallback. See that description.
+
+
+
+ Gets longest time between subsequent calls to DispatchIncomgingCommands in milliseconds.
+ Note: This is not a crucial timing for the networking. Long gaps just add "local lag" to events that are available already.
+
+
+
+
+ Gets longest time between subsequent calls to SendOutgoingCommands in milliseconds.
+ Note: This is a crucial value for network stability. Without calling SendOutgoingCommands,
+ nothing will be sent to the server, who might time out this client.
+
+
+
+
+ Gets number of calls of DispatchIncomingCommands.
+
+
+
+
+ Gets number of calls of DispatchIncomingCommands.
+
+
+
+
+ Gets number of calls of SendOutgoingCommands.
+
+
+
+ Gets sum of byte-cost of all "logic level" messages.
+
+
+ Gets sum of counted "logic level" messages.
+
+
+ Gets sum of byte-cost of all incoming "logic level" messages.
+
+
+ Gets sum of counted incoming "logic level" messages.
+
+
+ Gets sum of byte-cost of all outgoing "logic level" messages (= OperationByteCount).
+
+
+ Gets sum of counted outgoing "logic level" messages (= OperationCount).
+
+
+
+ Resets the values that can be maxed out, like LongestDeltaBetweenDispatching. See remarks.
+
+
+ Set to 0: LongestDeltaBetweenDispatching, LongestDeltaBetweenSending, LongestEventCallback, LongestEventCallbackCode, LongestOpResponseCallback, LongestOpResponseCallbackOpCode.
+ Also resets internal values: timeOfLastDispatchCall and timeOfLastSendCall (so intervals are tracked correctly).
+
+
+
+ Gets the byte-size of per-package headers.
+
+
+
+ Counts commands created/received by this client, ignoring repeats (out command count can be higher due to repeats).
+
+
+
+ Gets count of bytes as traffic, excluding UDP/TCP headers (42 bytes / x bytes).
+
+
+ Timestamp of the last incoming ACK that has been read (every PhotonPeer.TimePingInterval milliseconds this client sends a PING which must be ACKd).
+
+
+ Timestamp of last incoming reliable command (every second we expect a PING).
+
+
+
diff --git a/Assets/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.xml.meta b/Assets/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.xml.meta
new file mode 100644
index 00000000..b58d8aa6
--- /dev/null
+++ b/Assets/Photon/PhotonLibs/netstandard2.0/Photon3Unity3D.xml.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 7015e500cd5b71244af56448dfb59804
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonNetworking-Documentation.chm b/Assets/Photon/PhotonNetworking-Documentation.chm
new file mode 100644
index 00000000..72971dc5
Binary files /dev/null and b/Assets/Photon/PhotonNetworking-Documentation.chm differ
diff --git a/Assets/Photon/PhotonNetworking-Documentation.chm.meta b/Assets/Photon/PhotonNetworking-Documentation.chm.meta
new file mode 100644
index 00000000..e6fd407e
--- /dev/null
+++ b/Assets/Photon/PhotonNetworking-Documentation.chm.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 6923098d409554f57bedd5a4fa66e3ad
+timeCreated: 1527163075
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonNetworking-Documentation.pdf b/Assets/Photon/PhotonNetworking-Documentation.pdf
new file mode 100644
index 00000000..b25429e2
Binary files /dev/null and b/Assets/Photon/PhotonNetworking-Documentation.pdf differ
diff --git a/Assets/Photon/PhotonNetworking-Documentation.pdf.meta b/Assets/Photon/PhotonNetworking-Documentation.pdf.meta
new file mode 100644
index 00000000..32343cba
--- /dev/null
+++ b/Assets/Photon/PhotonNetworking-Documentation.pdf.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c285a840e88d74462a18710772dc4bfb
+timeCreated: 1527163075
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonRealtime.meta b/Assets/Photon/PhotonRealtime.meta
new file mode 100644
index 00000000..5ddf0d6c
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: b54c221855bde4a4ba511877e7b6b904
+folderAsset: yes
+timeCreated: 1505899913
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonRealtime/Code.meta b/Assets/Photon/PhotonRealtime/Code.meta
new file mode 100644
index 00000000..fe279808
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 028784b24103cfd46a9d2eadba4c285f
+folderAsset: yes
+timeCreated: 1523525776
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonRealtime/Code/AppSettings.cs b/Assets/Photon/PhotonRealtime/Code/AppSettings.cs
new file mode 100644
index 00000000..9cf874db
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/AppSettings.cs
@@ -0,0 +1,198 @@
+// -----------------------------------------------------------------------
+//
+// Loadbalancing Framework for Photon - Copyright (C) 2018 Exit Games GmbH
+//
+// Settings for Photon application(s) and the server to connect to.
+// developer@photonengine.com
+// ----------------------------------------------------------------------------
+
+#if UNITY_2017_4_OR_NEWER
+#define SUPPORTED_UNITY
+#endif
+
+namespace Photon.Realtime
+{
+ using System;
+ using ExitGames.Client.Photon;
+
+ #if SUPPORTED_UNITY || NETFX_CORE
+ using Hashtable = ExitGames.Client.Photon.Hashtable;
+ using SupportClass = ExitGames.Client.Photon.SupportClass;
+ #endif
+
+
+ ///
+ /// Settings for Photon application(s) and the server to connect to.
+ ///
+ ///
+ /// This is Serializable for Unity, so it can be included in ScriptableObject instances.
+ ///
+ #if !NETFX_CORE || SUPPORTED_UNITY
+ [Serializable]
+ #endif
+ public class AppSettings
+ {
+ /// AppId for Realtime or PUN.
+ public string AppIdRealtime;
+
+ /// AppId for Photon Fusion.
+ public string AppIdFusion;
+
+ /// AppId for Photon Chat.
+ public string AppIdChat;
+
+ /// AppId for Photon Voice.
+ public string AppIdVoice;
+
+ /// The AppVersion can be used to identify builds and will split the AppId distinct "Virtual AppIds" (important for matchmaking).
+ public string AppVersion;
+
+
+ /// If false, the app will attempt to connect to a Master Server (which is obsolete but sometimes still necessary).
+ /// if true, Server points to a NameServer (or is null, using the default), else it points to a MasterServer.
+ public bool UseNameServer = true;
+
+ /// Can be set to any of the Photon Cloud's region names to directly connect to that region.
+ /// if this IsNullOrEmpty() AND UseNameServer == true, use BestRegion. else, use a server
+ public string FixedRegion;
+
+ /// Set to a previous BestRegionSummary value before connecting.
+ ///
+ /// This is a value used when the client connects to the "Best Region".
+ /// If this is null or empty, all regions gets pinged. Providing a previous summary on connect,
+ /// speeds up best region selection and makes the previously selected region "sticky".
+ ///
+ /// Unity clients should store the BestRegionSummary in the PlayerPrefs.
+ /// You can store the new result by implementing .
+ /// If is not null, store this string.
+ /// To avoid storing the value multiple times, you could set SummaryToCache to null.
+ ///
+ #if SUPPORTED_UNITY
+ [NonSerialized]
+ #endif
+ public string BestRegionSummaryFromStorage;
+
+ /// The address (hostname or IP) of the server to connect to.
+ public string Server;
+
+ /// If not null, this sets the port of the first Photon server to connect to (that will "forward" the client as needed).
+ public int Port;
+
+ /// The address (hostname or IP and port) of the proxy server.
+ public string ProxyServer;
+
+ /// The network level protocol to use.
+ public ConnectionProtocol Protocol = ConnectionProtocol.Udp;
+
+ /// Enables a fallback to another protocol in case a connect to the Name Server fails.
+ /// See: LoadBalancingClient.EnableProtocolFallback.
+ public bool EnableProtocolFallback = true;
+
+ /// Defines how authentication is done. On each system, once or once via a WSS connection (safe).
+ public AuthModeOption AuthMode = AuthModeOption.Auth;
+
+ /// If true, the client will request the list of currently available lobbies.
+ public bool EnableLobbyStatistics;
+
+ /// Log level for the network lib.
+ public DebugLevel NetworkLogging = DebugLevel.ERROR;
+
+ /// If true, the Server field contains a Master Server address (if any address at all).
+ public bool IsMasterServerAddress
+ {
+ get { return !this.UseNameServer; }
+ }
+
+ /// If true, the client should fetch the region list from the Name Server and find the one with best ping.
+ /// See "Best Region" in the online docs.
+ public bool IsBestRegion
+ {
+ get { return this.UseNameServer && string.IsNullOrEmpty(this.FixedRegion); }
+ }
+
+ /// If true, the default nameserver address for the Photon Cloud should be used.
+ public bool IsDefaultNameServer
+ {
+ get { return this.UseNameServer && string.IsNullOrEmpty(this.Server); }
+ }
+
+ /// If true, the default ports for a protocol will be used.
+ public bool IsDefaultPort
+ {
+ get { return this.Port <= 0; }
+ }
+
+ /// ToString but with more details.
+ public string ToStringFull()
+ {
+ return string.Format(
+ "appId {0}{1}{2}{3}" +
+ "use ns: {4}, reg: {5}, {9}, " +
+ "{6}{7}{8}" +
+ "auth: {10}",
+ String.IsNullOrEmpty(this.AppIdRealtime) ? string.Empty : "Realtime/PUN: " + this.HideAppId(this.AppIdRealtime) + ", ",
+ String.IsNullOrEmpty(this.AppIdFusion) ? string.Empty : "Fusion: " + this.HideAppId(this.AppIdFusion) + ", ",
+ String.IsNullOrEmpty(this.AppIdChat) ? string.Empty : "Chat: " + this.HideAppId(this.AppIdChat) + ", ",
+ String.IsNullOrEmpty(this.AppIdVoice) ? string.Empty : "Voice: " + this.HideAppId(this.AppIdVoice) + ", ",
+ String.IsNullOrEmpty(this.AppVersion) ? string.Empty : "AppVersion: " + this.AppVersion + ", ",
+ "UseNameServer: " + this.UseNameServer + ", ",
+ "Fixed Region: " + this.FixedRegion + ", ",
+ //this.BestRegionSummaryFromStorage,
+ String.IsNullOrEmpty(this.Server) ? string.Empty : "Server: " + this.Server + ", ",
+ this.IsDefaultPort ? string.Empty : "Port: " + this.Port + ", ",
+ String.IsNullOrEmpty(ProxyServer) ? string.Empty : "Proxy: " + this.ProxyServer + ", ",
+ this.Protocol,
+ this.AuthMode
+ //this.EnableLobbyStatistics,
+ //this.NetworkLogging,
+ );
+ }
+
+
+ /// Checks if a string is a Guid by attempting to create one.
+ /// The potential guid to check.
+ /// True if new Guid(val) did not fail.
+ public static bool IsAppId(string val)
+ {
+ try
+ {
+ new Guid(val);
+ }
+ catch
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+
+ private string HideAppId(string appId)
+ {
+ return string.IsNullOrEmpty(appId) || appId.Length < 8
+ ? appId
+ : string.Concat(appId.Substring(0, 8), "***");
+ }
+
+ public AppSettings CopyTo(AppSettings d)
+ {
+ d.AppIdRealtime = this.AppIdRealtime;
+ d.AppIdFusion = this.AppIdFusion;
+ d.AppIdChat = this.AppIdChat;
+ d.AppIdVoice = this.AppIdVoice;
+ d.AppVersion = this.AppVersion;
+ d.UseNameServer = this.UseNameServer;
+ d.FixedRegion = this.FixedRegion;
+ d.BestRegionSummaryFromStorage = this.BestRegionSummaryFromStorage;
+ d.Server = this.Server;
+ d.Port = this.Port;
+ d.ProxyServer = this.ProxyServer;
+ d.Protocol = this.Protocol;
+ d.AuthMode = this.AuthMode;
+ d.EnableLobbyStatistics = this.EnableLobbyStatistics;
+ d.NetworkLogging = this.NetworkLogging;
+ d.EnableProtocolFallback = this.EnableProtocolFallback;
+ return d;
+ }
+ }
+}
diff --git a/Assets/Photon/PhotonRealtime/Code/AppSettings.cs.meta b/Assets/Photon/PhotonRealtime/Code/AppSettings.cs.meta
new file mode 100644
index 00000000..ab5e5c1d
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/AppSettings.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 272beb7315eb9fc4daecafe2ff373baf
+timeCreated: 1521804700
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonRealtime/Code/ConnectionHandler.cs b/Assets/Photon/PhotonRealtime/Code/ConnectionHandler.cs
new file mode 100644
index 00000000..8a535760
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/ConnectionHandler.cs
@@ -0,0 +1,199 @@
+// ----------------------------------------------------------------------------
+//
+// Loadbalancing Framework for Photon - Copyright (C) 2018 Exit Games GmbH
+//
+//
+// If the game logic does not call Service() for whatever reason, this keeps the connection.
+//
+// developer@photonengine.com
+// ----------------------------------------------------------------------------
+
+
+#if UNITY_4_7 || UNITY_5 || UNITY_5_3_OR_NEWER
+#define SUPPORTED_UNITY
+#endif
+
+
+namespace Photon.Realtime
+{
+ using System;
+ using System.Diagnostics;
+ using SupportClass = ExitGames.Client.Photon.SupportClass;
+
+ #if SUPPORTED_UNITY
+ using UnityEngine;
+ #endif
+
+
+ #if SUPPORTED_UNITY
+ public class ConnectionHandler : MonoBehaviour
+ #else
+ public class ConnectionHandler
+ #endif
+ {
+ ///
+ /// Photon client to log information and statistics from.
+ ///
+ public LoadBalancingClient Client { get; set; }
+
+ /// Option to let the fallback thread call Disconnect after the KeepAliveInBackground time. Default: false.
+ ///
+ /// If set to true, the thread will disconnect the client regularly, should the client not call SendOutgoingCommands / Service.
+ /// This may happen due to an app being in background (and not getting a lot of CPU time) or when loading assets.
+ ///
+ /// If false, a regular timeout time will have to pass (on top) to time out the client.
+ ///
+ public bool DisconnectAfterKeepAlive = false;
+
+ /// Defines for how long the Fallback Thread should keep the connection, before it may time out as usual.
+ /// We want to the Client to keep it's connection when an app is in the background (and doesn't call Update / Service Clients should not keep their connection indefinitely in the background, so after some milliseconds, the Fallback Thread should stop keeping it up.
+ public int KeepAliveInBackground = 60000;
+
+ /// Counts how often the Fallback Thread called SendAcksOnly, which is purely of interest to monitor if the game logic called SendOutgoingCommands as intended.
+ public int CountSendAcksOnly { get; private set; }
+
+ /// True if a fallback thread is running. Will call the client's SendAcksOnly() method to keep the connection up.
+ public bool FallbackThreadRunning
+ {
+ get { return this.fallbackThreadId < 255; }
+ }
+
+ /// Keeps the ConnectionHandler, even if a new scene gets loaded.
+ public bool ApplyDontDestroyOnLoad = true;
+
+ /// Indicates that the app is closing. Set in OnApplicationQuit().
+ [NonSerialized]
+ public static bool AppQuits;
+
+
+ private byte fallbackThreadId = 255;
+ private bool didSendAcks;
+ private readonly Stopwatch backgroundStopwatch = new Stopwatch();
+
+
+ #if SUPPORTED_UNITY
+
+ #if UNITY_2019_4_OR_NEWER
+
+ ///
+ /// Resets statics for Domain Reload
+ ///
+ [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
+ static void StaticReset()
+ {
+ AppQuits = false;
+ }
+
+ #endif
+
+
+ /// Called by Unity when the application gets closed. The UnityEngine will also call OnDisable, which disconnects.
+ protected void OnApplicationQuit()
+ {
+ AppQuits = true;
+ }
+
+
+ ///
+ protected virtual void Awake()
+ {
+ if (this.ApplyDontDestroyOnLoad)
+ {
+ DontDestroyOnLoad(this.gameObject);
+ }
+ }
+
+ /// Called by Unity when the application gets closed. Disconnects if OnApplicationQuit() was called before.
+ protected virtual void OnDisable()
+ {
+ this.StopFallbackSendAckThread();
+
+ if (AppQuits)
+ {
+ if (this.Client != null && this.Client.IsConnected)
+ {
+ this.Client.Disconnect(DisconnectCause.ApplicationQuit);
+ this.Client.LoadBalancingPeer.StopThread();
+ }
+
+ SupportClass.StopAllBackgroundCalls();
+ }
+ }
+
+ #endif
+
+
+ public void StartFallbackSendAckThread()
+ {
+ #if !UNITY_WEBGL
+ if (this.FallbackThreadRunning)
+ {
+ return;
+ }
+
+ #if UNITY_SWITCH
+ this.fallbackThreadId = SupportClass.StartBackgroundCalls(this.RealtimeFallbackThread, 50); // as workaround, we don't name the Thread.
+ #else
+ this.fallbackThreadId = SupportClass.StartBackgroundCalls(this.RealtimeFallbackThread, 50, "RealtimeFallbackThread");
+ #endif
+ #endif
+ }
+
+ public void StopFallbackSendAckThread()
+ {
+ #if !UNITY_WEBGL
+ if (!this.FallbackThreadRunning)
+ {
+ return;
+ }
+
+ SupportClass.StopBackgroundCalls(this.fallbackThreadId);
+ this.fallbackThreadId = 255;
+ #endif
+ }
+
+
+ /// A thread which runs independent from the Update() calls. Keeps connections online while loading or in background. See .
+ public bool RealtimeFallbackThread()
+ {
+ if (this.Client != null)
+ {
+ if (!this.Client.IsConnected)
+ {
+ this.didSendAcks = false;
+ return true;
+ }
+
+ if (this.Client.LoadBalancingPeer.ConnectionTime - this.Client.LoadBalancingPeer.LastSendOutgoingTime > 100)
+ {
+ if (!this.didSendAcks)
+ {
+ backgroundStopwatch.Reset();
+ backgroundStopwatch.Start();
+ }
+
+ // check if the client should disconnect after some seconds in background
+ if (backgroundStopwatch.ElapsedMilliseconds > this.KeepAliveInBackground)
+ {
+ if (this.DisconnectAfterKeepAlive)
+ {
+ this.Client.Disconnect();
+ }
+ return true;
+ }
+
+
+ this.didSendAcks = true;
+ this.CountSendAcksOnly++;
+ this.Client.LoadBalancingPeer.SendAcksOnly();
+ }
+ else
+ {
+ this.didSendAcks = false;
+ }
+ }
+
+ return true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonRealtime/Code/ConnectionHandler.cs.meta b/Assets/Photon/PhotonRealtime/Code/ConnectionHandler.cs.meta
new file mode 100644
index 00000000..961a59c3
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/ConnectionHandler.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f0b3ce6748186d3468e0dbaecb38b04c
+timeCreated: 1527243846
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonRealtime/Code/CustomTypesUnity.cs b/Assets/Photon/PhotonRealtime/Code/CustomTypesUnity.cs
new file mode 100644
index 00000000..fafdb352
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/CustomTypesUnity.cs
@@ -0,0 +1,167 @@
+// ----------------------------------------------------------------------------
+//
+// PhotonNetwork Framework for Unity - Copyright (C) 2018 Exit Games GmbH
+//
+//
+// Sets up support for Unity-specific types. Can be a blueprint how to register your own Custom Types for sending.
+//
+// developer@exitgames.com
+// ----------------------------------------------------------------------------
+
+#if UNITY_4_7 || UNITY_5 || UNITY_5_3_OR_NEWER
+#define SUPPORTED_UNITY
+#endif
+
+#if SUPPORTED_UNITY
+namespace Photon.Realtime
+{
+ using Photon.Realtime;
+ using ExitGames.Client.Photon;
+ using UnityEngine;
+ using Debug = UnityEngine.Debug;
+
+
+ ///
+ /// Internally used class, containing de/serialization methods for various Unity-specific classes.
+ /// Adding those to the Photon serialization protocol allows you to send them in events, etc.
+ ///
+ internal static class CustomTypesUnity
+ {
+ private const int SizeV2 = 2 * 4;
+ private const int SizeV3 = 3 * 4;
+ private const int SizeQuat = 4 * 4;
+
+
+ /// Register de/serializer methods for Unity specific types. Makes the types usable in RaiseEvent and PUN.
+ internal static void Register()
+ {
+ PhotonPeer.RegisterType(typeof(Vector2), (byte) 'W', SerializeVector2, DeserializeVector2);
+ PhotonPeer.RegisterType(typeof(Vector3), (byte) 'V', SerializeVector3, DeserializeVector3);
+ PhotonPeer.RegisterType(typeof(Quaternion), (byte) 'Q', SerializeQuaternion, DeserializeQuaternion);
+ }
+
+
+ #region Custom De/Serializer Methods
+
+ public static readonly byte[] memVector3 = new byte[SizeV3];
+
+ private static short SerializeVector3(StreamBuffer outStream, object customobject)
+ {
+ Vector3 vo = (Vector3) customobject;
+
+ int index = 0;
+ lock (memVector3)
+ {
+ byte[] bytes = memVector3;
+ Protocol.Serialize(vo.x, bytes, ref index);
+ Protocol.Serialize(vo.y, bytes, ref index);
+ Protocol.Serialize(vo.z, bytes, ref index);
+ outStream.Write(bytes, 0, SizeV3);
+ }
+
+ return SizeV3;
+ }
+
+ private static object DeserializeVector3(StreamBuffer inStream, short length)
+ {
+ Vector3 vo = new Vector3();
+ if (length != SizeV3)
+ {
+ return vo;
+ }
+
+ lock (memVector3)
+ {
+ inStream.Read(memVector3, 0, SizeV3);
+ int index = 0;
+ Protocol.Deserialize(out vo.x, memVector3, ref index);
+ Protocol.Deserialize(out vo.y, memVector3, ref index);
+ Protocol.Deserialize(out vo.z, memVector3, ref index);
+ }
+
+ return vo;
+ }
+
+
+ public static readonly byte[] memVector2 = new byte[SizeV2];
+
+ private static short SerializeVector2(StreamBuffer outStream, object customobject)
+ {
+ Vector2 vo = (Vector2) customobject;
+ lock (memVector2)
+ {
+ byte[] bytes = memVector2;
+ int index = 0;
+ Protocol.Serialize(vo.x, bytes, ref index);
+ Protocol.Serialize(vo.y, bytes, ref index);
+ outStream.Write(bytes, 0, SizeV2);
+ }
+
+ return SizeV2;
+ }
+
+ private static object DeserializeVector2(StreamBuffer inStream, short length)
+ {
+ Vector2 vo = new Vector2();
+ if (length != SizeV2)
+ {
+ return vo;
+ }
+
+ lock (memVector2)
+ {
+ inStream.Read(memVector2, 0, SizeV2);
+ int index = 0;
+ Protocol.Deserialize(out vo.x, memVector2, ref index);
+ Protocol.Deserialize(out vo.y, memVector2, ref index);
+ }
+
+ return vo;
+ }
+
+
+ public static readonly byte[] memQuarternion = new byte[SizeQuat];
+
+ private static short SerializeQuaternion(StreamBuffer outStream, object customobject)
+ {
+ Quaternion o = (Quaternion) customobject;
+
+ lock (memQuarternion)
+ {
+ byte[] bytes = memQuarternion;
+ int index = 0;
+ Protocol.Serialize(o.w, bytes, ref index);
+ Protocol.Serialize(o.x, bytes, ref index);
+ Protocol.Serialize(o.y, bytes, ref index);
+ Protocol.Serialize(o.z, bytes, ref index);
+ outStream.Write(bytes, 0, SizeQuat);
+ }
+
+ return 4 * 4;
+ }
+
+ private static object DeserializeQuaternion(StreamBuffer inStream, short length)
+ {
+ Quaternion o = Quaternion.identity;
+ if (length != SizeQuat)
+ {
+ return o;
+ }
+
+ lock (memQuarternion)
+ {
+ inStream.Read(memQuarternion, 0, SizeQuat);
+ int index = 0;
+ Protocol.Deserialize(out o.w, memQuarternion, ref index);
+ Protocol.Deserialize(out o.x, memQuarternion, ref index);
+ Protocol.Deserialize(out o.y, memQuarternion, ref index);
+ Protocol.Deserialize(out o.z, memQuarternion, ref index);
+ }
+
+ return o;
+ }
+
+ #endregion
+ }
+}
+#endif
\ No newline at end of file
diff --git a/Assets/Photon/PhotonRealtime/Code/CustomTypesUnity.cs.meta b/Assets/Photon/PhotonRealtime/Code/CustomTypesUnity.cs.meta
new file mode 100644
index 00000000..660c3f07
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/CustomTypesUnity.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c41ee868d8540674982e160cf16e0775
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonRealtime/Code/Extensions.cs b/Assets/Photon/PhotonRealtime/Code/Extensions.cs
new file mode 100644
index 00000000..3c7a531f
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/Extensions.cs
@@ -0,0 +1,269 @@
+// ----------------------------------------------------------------------------
+//
+// Photon Extensions - Copyright (C) 2018 Exit Games GmbH
+//
+//
+// Provides some helpful methods and extensions for Hashtables, etc.
+//
+// developer@photonengine.com
+// ----------------------------------------------------------------------------
+
+#if UNITY_4_7 || UNITY_5 || UNITY_5_3_OR_NEWER
+#define SUPPORTED_UNITY
+#endif
+
+
+namespace Photon.Realtime
+{
+ using System.Collections;
+ using System.Collections.Generic;
+ using ExitGames.Client.Photon;
+
+ #if SUPPORTED_UNITY
+ using UnityEngine;
+ using Debug = UnityEngine.Debug;
+ #endif
+ #if SUPPORTED_UNITY || NETFX_CORE
+ using Hashtable = ExitGames.Client.Photon.Hashtable;
+ using SupportClass = ExitGames.Client.Photon.SupportClass;
+ #endif
+
+
+ ///
+ /// This static class defines some useful extension methods for several existing classes (e.g. Vector3, float and others).
+ ///
+ public static class Extensions
+ {
+ ///
+ /// Merges all keys from addHash into the target. Adds new keys and updates the values of existing keys in target.
+ ///
+ /// The IDictionary to update.
+ /// The IDictionary containing data to merge into target.
+ public static void Merge(this IDictionary target, IDictionary addHash)
+ {
+ if (addHash == null || target.Equals(addHash))
+ {
+ return;
+ }
+
+ foreach (object key in addHash.Keys)
+ {
+ target[key] = addHash[key];
+ }
+ }
+
+ ///
+ /// Merges keys of type string to target Hashtable.
+ ///
+ ///
+ /// Does not remove keys from target (so non-string keys CAN be in target if they were before).
+ ///
+ /// The target IDictionary passed in plus all string-typed keys from the addHash.
+ /// A IDictionary that should be merged partly into target to update it.
+ public static void MergeStringKeys(this IDictionary target, IDictionary addHash)
+ {
+ if (addHash == null || target.Equals(addHash))
+ {
+ return;
+ }
+
+ foreach (object key in addHash.Keys)
+ {
+ // only merge keys of type string
+ if (key is string)
+ {
+ target[key] = addHash[key];
+ }
+ }
+ }
+
+ /// Helper method for debugging of IDictionary content, including type-information. Using this is not performant.
+ /// Should only be used for debugging as necessary.
+ /// Some Dictionary or Hashtable.
+ /// String of the content of the IDictionary.
+ public static string ToStringFull(this IDictionary origin)
+ {
+ return SupportClass.DictionaryToString(origin, false);
+ }
+
+ /// Helper method for debugging of List content. Using this is not performant.
+ /// Should only be used for debugging as necessary.
+ /// Any List where T implements .ToString().
+ /// A comma-separated string containing each value's ToString().
+ public static string ToStringFull(this List data)
+ {
+ if (data == null) return "null";
+
+ string[] sb = new string[data.Count];
+ for (int i = 0; i < data.Count; i++)
+ {
+ object o = data[i];
+ sb[i] = (o != null) ? o.ToString() : "null";
+ }
+
+ return string.Join(", ", sb);
+ }
+
+ /// Helper method for debugging of object[] content. Using this is not performant.
+ /// Should only be used for debugging as necessary.
+ /// Any object[].
+ /// A comma-separated string containing each value's ToString().
+ public static string ToStringFull(this object[] data)
+ {
+ if (data == null) return "null";
+
+ string[] sb = new string[data.Length];
+ for (int i = 0; i < data.Length; i++)
+ {
+ object o = data[i];
+ sb[i] = (o != null) ? o.ToString() : "null";
+ }
+
+ return string.Join(", ", sb);
+ }
+
+
+ ///
+ /// This method copies all string-typed keys of the original into a new Hashtable.
+ ///
+ ///
+ /// Does not recurse (!) into hashes that might be values in the root-hash.
+ /// This does not modify the original.
+ ///
+ /// The original IDictonary to get string-typed keys from.
+ /// New Hashtable containing only string-typed keys of the original.
+ public static Hashtable StripToStringKeys(this IDictionary original)
+ {
+ Hashtable target = new Hashtable();
+ if (original != null)
+ {
+ foreach (object key in original.Keys)
+ {
+ if (key is string)
+ {
+ target[key] = original[key];
+ }
+ }
+ }
+
+ return target;
+ }
+
+ ///
+ /// This method copies all string-typed keys of the original into a new Hashtable.
+ ///
+ ///
+ /// Does not recurse (!) into hashes that might be values in the root-hash.
+ /// This does not modify the original.
+ ///
+ /// The original IDictonary to get string-typed keys from.
+ /// New Hashtable containing only string-typed keys of the original.
+ public static Hashtable StripToStringKeys(this Hashtable original)
+ {
+ Hashtable target = new Hashtable();
+ if (original != null)
+ {
+ foreach (DictionaryEntry entry in original)
+ {
+ if (entry.Key is string)
+ {
+ target[entry.Key] = original[entry.Key];
+ }
+ }
+ }
+
+ return target;
+ }
+
+
+ /// Used by StripKeysWithNullValues.
+ ///
+ /// By making keysWithNullValue a static variable to clear before using, allocations only happen during the warm-up phase
+ /// as the list needs to grow. Once it hit the high water mark for keys you need to remove.
+ ///
+ private static readonly List keysWithNullValue = new List();
+
+ /// Removes all keys with null values.
+ ///
+ /// Photon properties are removed by setting their value to null. Changes the original IDictionary!
+ /// Uses lock(keysWithNullValue), which should be no problem in expected use cases.
+ ///
+ /// The IDictionary to strip of keys with null value.
+ public static void StripKeysWithNullValues(this IDictionary original)
+ {
+ lock (keysWithNullValue)
+ {
+ keysWithNullValue.Clear();
+
+ foreach (DictionaryEntry entry in original)
+ {
+ if (entry.Value == null)
+ {
+ keysWithNullValue.Add(entry.Key);
+ }
+ }
+
+ for (int i = 0; i < keysWithNullValue.Count; i++)
+ {
+ var key = keysWithNullValue[i];
+ original.Remove(key);
+ }
+ }
+ }
+
+ /// Removes all keys with null values.
+ ///
+ /// Photon properties are removed by setting their value to null. Changes the original IDictionary!
+ /// Uses lock(keysWithNullValue), which should be no problem in expected use cases.
+ ///
+ /// The IDictionary to strip of keys with null value.
+ public static void StripKeysWithNullValues(this Hashtable original)
+ {
+ lock (keysWithNullValue)
+ {
+ keysWithNullValue.Clear();
+
+ foreach (DictionaryEntry entry in original)
+ {
+ if (entry.Value == null)
+ {
+ keysWithNullValue.Add(entry.Key);
+ }
+ }
+
+ for (int i = 0; i < keysWithNullValue.Count; i++)
+ {
+ var key = keysWithNullValue[i];
+ original.Remove(key);
+ }
+ }
+ }
+
+
+ ///
+ /// Checks if a particular integer value is in an int-array.
+ ///
+ /// This might be useful to look up if a particular actorNumber is in the list of players of a room.
+ /// The array of ints to check.
+ /// The number to lookup in target.
+ /// True if nr was found in target.
+ public static bool Contains(this int[] target, int nr)
+ {
+ if (target == null)
+ {
+ return false;
+ }
+
+ for (int index = 0; index < target.Length; index++)
+ {
+ if (target[index] == nr)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+ }
+}
+
diff --git a/Assets/Photon/PhotonRealtime/Code/Extensions.cs.meta b/Assets/Photon/PhotonRealtime/Code/Extensions.cs.meta
new file mode 100644
index 00000000..2025f005
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/Extensions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 3c0464991e33a70498abdd85c150cc59
+labels:
+- ExitGames
+- PUN
+- Photon
+- Networking
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
diff --git a/Assets/Photon/PhotonRealtime/Code/FriendInfo.cs b/Assets/Photon/PhotonRealtime/Code/FriendInfo.cs
new file mode 100644
index 00000000..378e9201
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/FriendInfo.cs
@@ -0,0 +1,48 @@
+// ----------------------------------------------------------------------------
+//
+// Loadbalancing Framework for Photon - Copyright (C) 2018 Exit Games GmbH
+//
+//
+// Collection of values related to a user / friend.
+//
+// developer@photonengine.com
+// ----------------------------------------------------------------------------
+
+#if UNITY_4_7 || UNITY_5 || UNITY_5_3_OR_NEWER
+#define SUPPORTED_UNITY
+#endif
+
+
+namespace Photon.Realtime
+{
+ using ExitGames.Client.Photon;
+
+ #if SUPPORTED_UNITY || NETFX_CORE
+ using Hashtable = ExitGames.Client.Photon.Hashtable;
+ using SupportClass = ExitGames.Client.Photon.SupportClass;
+ #endif
+
+
+ ///
+ /// Used to store info about a friend's online state and in which room he/she is.
+ ///
+ public class FriendInfo
+ {
+ [System.Obsolete("Use UserId.")]
+ public string Name { get { return this.UserId; } }
+ public string UserId { get; internal protected set; }
+
+ public bool IsOnline { get; internal protected set; }
+ public string Room { get; internal protected set; }
+
+ public bool IsInRoom
+ {
+ get { return this.IsOnline && !string.IsNullOrEmpty(this.Room); }
+ }
+
+ public override string ToString()
+ {
+ return string.Format("{0}\t is: {1}", this.UserId, (!this.IsOnline) ? "offline" : this.IsInRoom ? "playing" : "on master");
+ }
+ }
+}
diff --git a/Assets/Photon/PhotonRealtime/Code/FriendInfo.cs.meta b/Assets/Photon/PhotonRealtime/Code/FriendInfo.cs.meta
new file mode 100644
index 00000000..b810efc6
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/FriendInfo.cs.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 94ba1138c322ea04c8c37cfbcf87f468
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
diff --git a/Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs b/Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs
new file mode 100644
index 00000000..0ec77f89
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs
@@ -0,0 +1,4469 @@
+// -----------------------------------------------------------------------
+//
+// Loadbalancing Framework for Photon - Copyright (C) 2018 Exit Games GmbH
+//
+//
+// Provides the operations and a state for games using the
+// Photon LoadBalancing server.
+//
+// developer@photonengine.com
+// ----------------------------------------------------------------------------
+
+#if UNITY_4_7 || UNITY_5 || UNITY_5_3_OR_NEWER
+#define SUPPORTED_UNITY
+#endif
+
+
+namespace Photon.Realtime
+{
+ using System;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Diagnostics;
+ using ExitGames.Client.Photon;
+
+ #if SUPPORTED_UNITY
+ using UnityEngine;
+ using Debug = UnityEngine.Debug;
+ #endif
+ #if SUPPORTED_UNITY || NETFX_CORE
+ using Hashtable = ExitGames.Client.Photon.Hashtable;
+ using SupportClass = ExitGames.Client.Photon.SupportClass;
+ #endif
+
+
+ #region Enums
+
+ ///
+ /// State values for a client, which handles switching Photon server types, some operations, etc.
+ ///
+ /// \ingroup publicApi
+ public enum ClientState
+ {
+ /// Peer is created but not used yet.
+ PeerCreated,
+
+ /// Transition state while connecting to a server. On the Photon Cloud this sends the AppId and AuthenticationValues (UserID).
+ Authenticating,
+
+ /// Not Used.
+ Authenticated,
+
+ /// The client sent an OpJoinLobby and if this was done on the Master Server, it will result in. Depending on the lobby, it gets room listings.
+ JoiningLobby,
+
+ /// The client is in a lobby, connected to the MasterServer. Depending on the lobby, it gets room listings.
+ JoinedLobby,
+
+ /// Transition from MasterServer to GameServer.
+ DisconnectingFromMasterServer,
+ [Obsolete("Renamed to DisconnectingFromMasterServer")]
+ DisconnectingFromMasterserver = DisconnectingFromMasterServer,
+
+ /// Transition to GameServer (client authenticates and joins/creates a room).
+ ConnectingToGameServer,
+ [Obsolete("Renamed to ConnectingToGameServer")]
+ ConnectingToGameserver = ConnectingToGameServer,
+
+ /// Connected to GameServer (going to auth and join game).
+ ConnectedToGameServer,
+ [Obsolete("Renamed to ConnectedToGameServer")]
+ ConnectedToGameserver = ConnectedToGameServer,
+
+ /// Transition state while joining or creating a room on GameServer.
+ Joining,
+
+ /// The client entered a room. The CurrentRoom and Players are known and you can now raise events.
+ Joined,
+
+ /// Transition state when leaving a room.
+ Leaving,
+
+ /// Transition from GameServer to MasterServer (after leaving a room/game).
+ DisconnectingFromGameServer,
+ [Obsolete("Renamed to DisconnectingFromGameServer")]
+ DisconnectingFromGameserver = DisconnectingFromGameServer,
+
+ /// Connecting to MasterServer (includes sending authentication values).
+ ConnectingToMasterServer,
+ [Obsolete("Renamed to ConnectingToMasterServer.")]
+ ConnectingToMasterserver = ConnectingToMasterServer,
+
+ /// The client disconnects (from any server). This leads to state Disconnected.
+ Disconnecting,
+
+ /// The client is no longer connected (to any server). Connect to MasterServer to go on.
+ Disconnected,
+
+ /// Connected to MasterServer. You might use matchmaking or join a lobby now.
+ ConnectedToMasterServer,
+ [Obsolete("Renamed to ConnectedToMasterServer.")]
+ ConnectedToMasterserver = ConnectedToMasterServer,
+ [Obsolete("Renamed to ConnectedToMasterServer.")]
+ ConnectedToMaster = ConnectedToMasterServer,
+
+ /// Client connects to the NameServer. This process includes low level connecting and setting up encryption. When done, state becomes ConnectedToNameServer.
+ ConnectingToNameServer,
+
+ /// Client is connected to the NameServer and established encryption already. You should call OpGetRegions or ConnectToRegionMaster.
+ ConnectedToNameServer,
+
+ /// Clients disconnects (specifically) from the NameServer (usually to connect to the MasterServer).
+ DisconnectingFromNameServer,
+
+ /// Client was unable to connect to Name Server and will attempt to connect with an alternative network protocol (TCP).
+ ConnectWithFallbackProtocol
+ }
+
+
+ ///
+ /// Internal state, how this peer gets into a particular room (joining it or creating it).
+ ///
+ internal enum JoinType
+ {
+ /// This client creates a room, gets into it (no need to join) and can set room properties.
+ CreateRoom,
+ /// The room existed already and we join into it (not setting room properties).
+ JoinRoom,
+ /// Done on Master Server and (if successful) followed by a Join on Game Server.
+ JoinRandomRoom,
+ /// Done on Master Server and (if successful) followed by a Join or Create on Game Server.
+ JoinRandomOrCreateRoom,
+ /// Client is either joining or creating a room. On Master- and Game-Server.
+ JoinOrCreateRoom
+ }
+
+ /// Enumeration of causes for Disconnects (used in LoadBalancingClient.DisconnectedCause).
+ /// Read the individual descriptions to find out what to do about this type of disconnect.
+ public enum DisconnectCause
+ {
+ /// No error was tracked.
+ None,
+
+ /// OnStatusChanged: The server is not available or the address is wrong. Make sure the port is provided and the server is up.
+ ExceptionOnConnect,
+
+ /// OnStatusChanged: Dns resolution for a hostname failed. The exception for this is being caught and logged with error level.
+ DnsExceptionOnConnect,
+
+ /// OnStatusChanged: The server address was parsed as IPv4 illegally. An illegal address would be e.g. 192.168.1.300. IPAddress.TryParse() will let this pass but our check won't.
+ ServerAddressInvalid,
+
+ /// OnStatusChanged: Some internal exception caused the socket code to fail. This may happen if you attempt to connect locally but the server is not available. In doubt: Contact Exit Games.
+ Exception,
+
+ /// OnStatusChanged: The server disconnected this client due to timing out (missing acknowledgement from the client).
+ ServerTimeout,
+
+ /// OnStatusChanged: This client detected that the server's responses are not received in due time.
+ ClientTimeout,
+
+ /// OnStatusChanged: The server disconnected this client from within the room's logic (the C# code).
+ DisconnectByServerLogic,
+
+ /// OnStatusChanged: The server disconnected this client for unknown reasons.
+ DisconnectByServerReasonUnknown,
+
+ /// OnOperationResponse: Authenticate in the Photon Cloud with invalid AppId. Update your subscription or contact Exit Games.
+ InvalidAuthentication,
+
+ /// OnOperationResponse: Authenticate in the Photon Cloud with invalid client values or custom authentication setup in Cloud Dashboard.
+ CustomAuthenticationFailed,
+
+ /// The authentication ticket should provide access to any Photon Cloud server without doing another authentication-service call. However, the ticket expired.
+ AuthenticationTicketExpired,
+
+ /// OnOperationResponse: Authenticate (temporarily) failed when using a Photon Cloud subscription without CCU Burst. Update your subscription.
+ MaxCcuReached,
+
+ /// OnOperationResponse: Authenticate when the app's Photon Cloud subscription is locked to some (other) region(s). Update your subscription or master server address.
+ InvalidRegion,
+
+ /// OnOperationResponse: Operation that's (currently) not available for this client (not authorized usually). Only tracked for op Authenticate.
+ OperationNotAllowedInCurrentState,
+
+ /// OnStatusChanged: The client disconnected from within the logic (the C# code).
+ DisconnectByClientLogic,
+
+ /// The client called an operation too frequently and got disconnected due to hitting the OperationLimit. This triggers a client-side disconnect, too.
+ /// To protect the server, some operations have a limit. When an OperationResponse fails with ErrorCode.OperationLimitReached, the client disconnects.
+ DisconnectByOperationLimit,
+
+ /// The client received a "Disconnect Message" from the server. Check the debug logs for details.
+ DisconnectByDisconnectMessage,
+
+ /// Used in case the application quits. Can be useful to not load new scenes or re-connect in OnDisconnected.
+ /// ConnectionHandler.OnDisable() will use this, if the Unity engine already called OnApplicationQuit (ConnectionHandler.AppQuits = true).
+ ApplicationQuit
+ }
+
+ /// Available server (types) for internally used field: server.
+ /// Photon uses 3 different roles of servers: Name Server, Master Server and Game Server.
+ public enum ServerConnection
+ {
+ /// This server is where matchmaking gets done and where clients can get lists of rooms in lobbies.
+ MasterServer,
+ /// This server handles a number of rooms to execute and relay the messages between players (in a room).
+ GameServer,
+ /// This server is used initially to get the address (IP) of a Master Server for a specific region. Not used for Photon OnPremise (self hosted).
+ NameServer
+ }
+
+ /// Defines which sort of app the LoadBalancingClient is used for: Realtime or Voice.
+ public enum ClientAppType
+ {
+ /// Realtime apps are for gaming / interaction. Also used by PUN 2.
+ Realtime,
+ /// Voice apps stream audio.
+ Voice,
+ /// Fusion clients are for matchmaking and relay in Photon Fusion.
+ Fusion
+ }
+
+ ///
+ /// Defines how the communication gets encrypted.
+ ///
+ public enum EncryptionMode
+ {
+ ///
+ /// This is the default encryption mode: Messages get encrypted only on demand (when you send operations with the "encrypt" parameter set to true).
+ ///
+ PayloadEncryption,
+ ///
+ /// With this encryption mode for UDP, the connection gets setup and all further datagrams get encrypted almost entirely. On-demand message encryption (like in PayloadEncryption) is unavailable.
+ ///
+ DatagramEncryption = 10,
+ ///
+ /// With this encryption mode for UDP, the connection gets setup with random sequence numbers and all further datagrams get encrypted almost entirely. On-demand message encryption (like in PayloadEncryption) is unavailable.
+ ///
+ DatagramEncryptionRandomSequence = 11,
+ /////
+ ///// Same as above except that GCM mode is used to encrypt data.
+ /////
+ //DatagramEncryptionGCMRandomSequence = 12,
+ ///
+ /// Datagram Encryption with GCM.
+ ///
+ DatagramEncryptionGCM = 13,
+ }
+
+ /// Container for port definitions.
+ public struct PhotonPortDefinition
+ {
+ public static readonly PhotonPortDefinition AlternativeUdpPorts = new PhotonPortDefinition() { NameServerPort = 27000, MasterServerPort = 27001, GameServerPort = 27002};
+
+ /// Typical ports: UDP: 5058 or 27000, TCP: 4533, WSS: 19093 or 443.
+ public ushort NameServerPort;
+ /// Typical ports: UDP: 5056 or 27002, TCP: 4530, WSS: 19090 or 443.
+ public ushort MasterServerPort;
+ /// Typical ports: UDP: 5055 or 27001, TCP: 4531, WSS: 19091 or 443.
+ public ushort GameServerPort;
+ }
+
+
+ #endregion
+
+
+ ///
+ /// This class implements the Photon LoadBalancing workflow by using a LoadBalancingPeer.
+ /// It keeps a state and will automatically execute transitions between the Master and Game Servers.
+ ///
+ ///
+ /// This class (and the Player class) should be extended to implement your own game logic.
+ /// You can override CreatePlayer as "factory" method for Players and return your own Player instances.
+ /// The State of this class is essential to know when a client is in a lobby (or just on the master)
+ /// and when in a game where the actual gameplay should take place.
+ /// Extension notes:
+ /// An extension of this class should override the methods of the IPhotonPeerListener, as they
+ /// are called when the state changes. Call base.method first, then pick the operation or state you
+ /// want to react to and put it in a switch-case.
+ /// We try to provide demo to each platform where this api can be used, so lookout for those.
+ ///
+ public class LoadBalancingClient : IPhotonPeerListener
+ {
+ ///
+ /// The client uses a LoadBalancingPeer as API to communicate with the server.
+ /// This is public for ease-of-use: Some methods like OpRaiseEvent are not relevant for the connection state and don't need a override.
+ ///
+ public LoadBalancingPeer LoadBalancingPeer { get; private set; }
+
+ ///
+ /// Gets or sets the binary protocol version used by this client
+ ///
+ ///
+ /// Use this always instead of setting it via
+ /// ( ) directly, especially when WSS protocol is used.
+ ///
+ public SerializationProtocol SerializationProtocol
+ {
+ get
+ {
+ return this.LoadBalancingPeer.SerializationProtocolType;
+ }
+ set
+ {
+ this.LoadBalancingPeer.SerializationProtocolType = value;
+ }
+ }
+
+ /// The version of your client. A new version also creates a new "virtual app" to separate players from older client versions.
+ public string AppVersion { get; set; }
+
+ /// The AppID as assigned from the Photon Cloud. If you host yourself, this is the "regular" Photon Server Application Name (most likely: "LoadBalancing").
+ public string AppId { get; set; }
+
+ /// The ClientAppType defines which sort of AppId should be expected. The LoadBalancingClient supports Realtime and Voice app types. Default: Realtime.
+ public ClientAppType ClientType { get; set; }
+
+ /// User authentication values to be sent to the Photon server right after connecting.
+ /// Set this property or pass AuthenticationValues by Connect(..., authValues).
+ public AuthenticationValues AuthValues { get; set; }
+
+ /// Enables the new Authentication workflow.
+ public AuthModeOption AuthMode = AuthModeOption.Auth;
+
+ /// Defines how the communication gets encrypted.
+ public EncryptionMode EncryptionMode = EncryptionMode.PayloadEncryption;
+
+ /// Optionally contains a protocol which will be used on Master- and GameServer.
+ ///
+ /// When using AuthMode = AuthModeOption.AuthOnceWss, the client uses a wss-connection on the NameServer but another protocol on the other servers.
+ /// As the NameServer sends an address, which is different per protocol, it needs to know the expected protocol.
+ ///
+ /// This is nullable by design. In many cases, the protocol on the NameServer is not different from the other servers.
+ /// If set, the operation AuthOnce will contain this value and the OpAuth response on the NameServer will execute a protocol switch.
+ ///
+ public ConnectionProtocol? ExpectedProtocol { get; set; }
+
+
+ ///Simplifies getting the token for connect/init requests, if this feature is enabled.
+ private object TokenForInit
+ {
+ get
+ {
+ if (this.AuthMode == AuthModeOption.Auth)
+ {
+ return null;
+ }
+ return (this.AuthValues != null) ? this.AuthValues.Token : null;
+ }
+ }
+
+ /// Internally used cache for the server's token. Identifies a user/session and can be used to rejoin.
+ private object tokenCache;
+
+
+ /// True if this client uses a NameServer to get the Master Server address.
+ /// This value is public, despite being an internal value, which should only be set by this client.
+ public bool IsUsingNameServer { get; set; }
+
+ /// Name Server Host Name for Photon Cloud. Without port and without any prefix.
+ public string NameServerHost = "ns.photonengine.io";
+
+ /// 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.
+ public string NameServerAddress { get { return this.GetNameServerAddress(); } }
+
+ /// Name Server port per protocol (the UDP port is different than TCP, etc).
+ private static readonly Dictionary ProtocolToNameServerPort = new Dictionary() { { ConnectionProtocol.Udp, 5058 }, { ConnectionProtocol.Tcp, 4533 }, { ConnectionProtocol.WebSocket, 9093 }, { ConnectionProtocol.WebSocketSecure, 19093 } }; //, { ConnectionProtocol.RHttp, 6063 } };
+
+
+ /// Replaced by ServerPortOverrides.
+ [Obsolete("Set port overrides in ServerPortOverrides. Not used anymore!")]
+ public bool UseAlternativeUdpPorts { get; set; }
+
+
+ /// Defines overrides for server ports. Used per server-type if > 0. Important: You must change these when the protocol changes!
+ ///
+ /// Typical ports are listed in PhotonPortDefinition.
+ ///
+ /// Instead of using the port provided from the servers, the specified port is used (independent of the protocol).
+ /// If a value is 0 (default), the port is not being replaced.
+ ///
+ /// Different protocols have different typical ports per server-type.
+ /// https://doc.photonengine.com/en-us/pun/current/reference/tcp-and-udp-port-numbers
+ ///
+ /// In case of using the AuthMode AutOnceWss, the name server's protocol is wss, while udp or tcp will be used on the master server and game server.
+ /// Set the ports accordingly per protocol and server.
+ ///
+ public PhotonPortDefinition ServerPortOverrides;
+
+
+ /// Enables a fallback to another protocol in case a connect to the Name Server fails.
+ ///
+ /// When connecting to the Name Server fails for a first time, the client will select an alternative
+ /// network protocol and re-try to connect.
+ ///
+ /// The fallback will use the default Name Server port as defined by ProtocolToNameServerPort.
+ ///
+ /// The fallback for TCP is UDP. All other protocols fallback to TCP.
+ ///
+ public bool EnableProtocolFallback { get; set; }
+
+ /// The currently used server address (if any). The type of server is define by Server property.
+ public string CurrentServerAddress { get { return this.LoadBalancingPeer.ServerAddress; } }
+
+ /// Your Master Server address. In PhotonCloud, call ConnectToRegionMaster() to find your Master Server.
+ ///
+ /// In the Photon Cloud, explicit definition of a Master Server Address is not best practice.
+ /// The Photon Cloud has a "Name Server" which redirects clients to a specific Master Server (per Region and AppId).
+ ///
+ public string MasterServerAddress { get; set; }
+
+ /// The game server's address for a particular room. In use temporarily, as assigned by master.
+ public string GameServerAddress { get; protected internal set; }
+
+ /// The server this client is currently connected or connecting to.
+ ///
+ /// Each server (NameServer, MasterServer, GameServer) allow some operations and reject others.
+ ///
+ public ServerConnection Server { get; private set; }
+
+ ///
+ /// Defines a proxy URL for WebSocket connections. Can be the proxy or point to a .pac file.
+ ///
+ ///
+ /// This URL supports various definitions:
+ ///
+ /// "user:pass@proxyaddress:port"
+ /// "proxyaddress:port"
+ /// "system:"
+ /// "pac:"
+ /// "pac:http://host/path/pacfile.pac"
+ ///
+ /// Important: Don't define a protocol, except to point to a pac file. the proxy address should not begin with http:// or https://.
+ ///
+ public string ProxyServerAddress;
+
+ /// Backing field for property.
+ private ClientState state = ClientState.PeerCreated;
+
+ /// Current state this client is in. Careful: several states are "transitions" that lead to other states.
+ public ClientState State
+ {
+ get
+ {
+ return this.state;
+ }
+
+ set
+ {
+ if (this.state == value)
+ {
+ return;
+ }
+ ClientState previousState = this.state;
+ this.state = value;
+ if (StateChanged != null) StateChanged(previousState, this.state);
+ }
+ }
+
+ /// Returns if this client is currently connected or connecting to some type of server.
+ /// This is even true while switching servers. Use IsConnectedAndReady to check only for those states that enable you to send Operations.
+ public bool IsConnected { get { return this.LoadBalancingPeer != null && this.State != ClientState.PeerCreated && this.State != ClientState.Disconnected; } }
+
+
+ ///
+ /// A refined version of IsConnected which is true only if your connection is ready to send operations.
+ ///
+ ///
+ /// Not all operations can be called on all types of servers. If an operation is unavailable on the currently connected server,
+ /// this will result in a OperationResponse with ErrorCode != 0.
+ ///
+ /// Examples: The NameServer allows OpGetRegions which is not available anywhere else.
+ /// The MasterServer does not allow you to send events (OpRaiseEvent) and on the GameServer you are unable to join a lobby (OpJoinLobby).
+ ///
+ /// To check which server you are on, use: .
+ ///
+ public bool IsConnectedAndReady
+ {
+ get
+ {
+ if (this.LoadBalancingPeer == null)
+ {
+ return false;
+ }
+
+ switch (this.State)
+ {
+ case ClientState.PeerCreated:
+ case ClientState.Disconnected:
+ case ClientState.Disconnecting:
+ case ClientState.DisconnectingFromGameServer:
+ case ClientState.DisconnectingFromMasterServer:
+ case ClientState.DisconnectingFromNameServer:
+ case ClientState.Authenticating:
+ case ClientState.ConnectingToGameServer:
+ case ClientState.ConnectingToMasterServer:
+ case ClientState.ConnectingToNameServer:
+ case ClientState.Joining:
+ case ClientState.Leaving:
+ return false; // we are not ready to execute any operations
+ }
+
+ return true;
+ }
+ }
+
+
+ /// Register a method to be called when this client's ClientState gets set.
+ /// This can be useful to react to being connected, joined into a room, etc.
+ public event Action StateChanged;
+
+ /// Register a method to be called when an event got dispatched. Gets called after the LoadBalancingClient handled the internal events first.
+ ///
+ /// This is an alternative to extending LoadBalancingClient to override OnEvent().
+ ///
+ /// Note that OnEvent is calling EventReceived after it handled internal events first.
+ /// That means for example: Joining players will already be in the player list but leaving
+ /// players will already be removed from the room.
+ ///
+ public event Action EventReceived;
+
+ /// Register a method to be called when an operation response is received.
+ ///
+ /// This is an alternative to extending LoadBalancingClient to override OnOperationResponse().
+ ///
+ /// Note that OnOperationResponse gets executed before your Action is called.
+ /// That means for example: The OpJoinLobby response already set the state to "JoinedLobby"
+ /// and the response to OpLeave already triggered the Disconnect before this is called.
+ ///
+ public event Action OpResponseReceived;
+
+
+ /// Wraps up the target objects for a group of callbacks, so they can be called conveniently.
+ /// By using Add or Remove, objects can "subscribe" or "unsubscribe" for this group of callbacks.
+ public ConnectionCallbacksContainer ConnectionCallbackTargets;
+
+ /// Wraps up the target objects for a group of callbacks, so they can be called conveniently.
+ /// By using Add or Remove, objects can "subscribe" or "unsubscribe" for this group of callbacks.
+ public MatchMakingCallbacksContainer MatchMakingCallbackTargets;
+
+ /// Wraps up the target objects for a group of callbacks, so they can be called conveniently.
+ /// By using Add or Remove, objects can "subscribe" or "unsubscribe" for this group of callbacks.
+ internal InRoomCallbacksContainer InRoomCallbackTargets;
+
+ /// Wraps up the target objects for a group of callbacks, so they can be called conveniently.
+ /// By using Add or Remove, objects can "subscribe" or "unsubscribe" for this group of callbacks.
+ internal LobbyCallbacksContainer LobbyCallbackTargets;
+
+ /// Wraps up the target objects for a group of callbacks, so they can be called conveniently.
+ /// By using Add or Remove, objects can "subscribe" or "unsubscribe" for this group of callbacks.
+ internal WebRpcCallbacksContainer WebRpcCallbackTargets;
+
+
+ /// Wraps up the target objects for a group of callbacks, so they can be called conveniently.
+ /// By using Add or Remove, objects can "subscribe" or "unsubscribe" for this group of callbacks.
+ internal ErrorInfoCallbacksContainer ErrorInfoCallbackTargets;
+
+ /// Summarizes (aggregates) the different causes for disconnects of a client.
+ ///
+ /// A disconnect can be caused by: errors in the network connection or some vital operation failing
+ /// (which is considered "high level"). While operations always trigger a call to OnOperationResponse,
+ /// connection related changes are treated in OnStatusChanged.
+ /// The DisconnectCause is set in either case and summarizes the causes for any disconnect in a single
+ /// state value which can be used to display (or debug) the cause for disconnection.
+ ///
+ public DisconnectCause DisconnectedCause { get; protected set; }
+
+
+ /// Internal value if the client is in a lobby.
+ /// This is used to re-set this.State, when joining/creating a room fails.
+ public bool InLobby
+ {
+ get { return this.State == ClientState.JoinedLobby; }
+ }
+
+ /// The lobby this client currently uses. Defined when joining a lobby or creating rooms
+ public TypedLobby CurrentLobby { get; internal set; }
+
+ ///
+ /// If enabled, the client will get a list of available lobbies from the Master Server.
+ ///
+ ///
+ /// Set this value before the client connects to the Master Server. While connected to the Master
+ /// Server, a change has no effect.
+ ///
+ /// Implement OptionalInfoCallbacks.OnLobbyStatisticsUpdate, to get the list of used lobbies.
+ ///
+ /// The lobby statistics can be useful if your title dynamically uses lobbies, depending (e.g.)
+ /// on current player activity or such.
+ /// In this case, getting a list of available lobbies, their room-count and player-count can
+ /// be useful info.
+ ///
+ /// ConnectUsingSettings sets this to the PhotonServerSettings value.
+ ///
+ public bool EnableLobbyStatistics;
+
+ /// Internal lobby stats cache, used by LobbyStatistics.
+ private readonly List lobbyStatistics = new List();
+
+
+ /// The local player is never null but not valid unless the client is in a room, too. The ID will be -1 outside of rooms.
+ public Player LocalPlayer { get; internal set; }
+
+ ///
+ /// The nickname of the player (synced with others). Same as client.LocalPlayer.NickName.
+ ///
+ public string NickName
+ {
+ get
+ {
+ return this.LocalPlayer.NickName;
+ }
+
+ set
+ {
+ if (this.LocalPlayer == null)
+ {
+ return;
+ }
+
+ this.LocalPlayer.NickName = value;
+ }
+ }
+
+
+ /// An ID for this user. Sent in OpAuthenticate when you connect. If not set, the PlayerName is applied during connect.
+ ///
+ /// On connect, if the UserId is null or empty, the client will copy the PlayName to UserId. If PlayerName is not set either
+ /// (before connect), the server applies a temporary ID which stays unknown to this client and other clients.
+ ///
+ /// The UserId is what's used in FindFriends and for fetching data for your account (with WebHooks e.g.).
+ ///
+ /// By convention, set this ID before you connect, not while being connected.
+ /// There is no error but the ID won't change while being connected.
+ ///
+ public string UserId
+ {
+ get
+ {
+ if (this.AuthValues != null)
+ {
+ return this.AuthValues.UserId;
+ }
+ return null;
+ }
+ set
+ {
+ if (this.AuthValues == null)
+ {
+ this.AuthValues = new AuthenticationValues();
+ }
+ this.AuthValues.UserId = value;
+ }
+ }
+
+ /// The current room this client is connected to (null if none available).
+ public Room CurrentRoom { get; set; }
+
+
+ /// Is true while being in a room (this.state == ClientState.Joined).
+ ///
+ /// Aside from polling this value, game logic should implement IMatchmakingCallbacks in some class
+ /// and react when that gets called.
+ /// OpRaiseEvent, OpLeave and some other operations can only be used (successfully) when the client is in a room..
+ ///
+ public bool InRoom
+ {
+ get
+ {
+ return this.state == ClientState.Joined && this.CurrentRoom != null;
+ }
+ }
+
+ /// Statistic value available on master server: Players on master (looking for games).
+ public int PlayersOnMasterCount { get; internal set; }
+
+ /// Statistic value available on master server: Players in rooms (playing).
+ public int PlayersInRoomsCount { get; internal set; }
+
+ /// Statistic value available on master server: Rooms currently created.
+ public int RoomsCount { get; internal set; }
+
+
+ /// Internally used to decide if a room must be created or joined on game server.
+ private JoinType lastJoinType;
+
+ /// Used when the client arrives on the GS, to join the room with the correct values.
+ private EnterRoomParams enterRoomParamsCache;
+
+ /// Used to cache a failed "enter room" operation on the Game Server, to return to the Master Server before calling a fail-callback.
+ private OperationResponse failedRoomEntryOperation;
+
+
+ /// Maximum of userIDs that can be sent in one friend list request.
+ private const int FriendRequestListMax = 512;
+
+ /// Contains the list of names of friends to look up their state on the server.
+ private string[] friendListRequested;
+
+ /// Internal flag to know if the client currently fetches a friend list.
+ public bool IsFetchingFriendList { get { return this.friendListRequested != null; } }
+
+
+ /// The cloud region this client connects to. Set by ConnectToRegionMaster(). Not set if you don't use a NameServer!
+ public string CloudRegion { get; private set; }
+
+ /// The cluster name provided by the Name Server.
+ ///
+ /// The value is provided by the OpResponse for OpAuthenticate/OpAuthenticateOnce.
+ /// Default: null. This value only ever updates from the Name Server authenticate response.
+ ///
+ public string CurrentCluster { get; private set; }
+
+ /// Contains the list if enabled regions this client may use. Null, unless the client got a response to OpGetRegions.
+ public RegionHandler RegionHandler;
+
+ /// Stores the best region summary of a previous session to speed up connecting.
+ private string bestRegionSummaryFromStorage;
+
+ /// Set when the best region pinging is done.
+ public string SummaryToCache;
+
+ /// Internal connection setting/flag. If the client should connect to the best region or not.
+ ///
+ /// It's set in the Connect...() methods. Only ConnectUsingSettings() sets it to true.
+ /// If true, client will ping available regions and select the best.
+ /// A bestRegionSummaryFromStorage can be used to cut the ping time short.
+ ///
+ private bool connectToBestRegion = true;
+
+
+ /// Definition of parameters for encryption data (included in Authenticate operation response).
+ private class EncryptionDataParameters
+ {
+ ///
+ /// Key for encryption mode
+ ///
+ public const byte Mode = 0;
+ ///
+ /// Key for first secret
+ ///
+ public const byte Secret1 = 1;
+ ///
+ /// Key for second secret
+ ///
+ public const byte Secret2 = 2;
+ }
+
+
+ private class CallbackTargetChange
+ {
+ public readonly object Target;
+ /// Add if true, remove if false.
+ public readonly bool AddTarget;
+
+ public CallbackTargetChange(object target, bool addTarget)
+ {
+ this.Target = target;
+ this.AddTarget = addTarget;
+ }
+ }
+
+ private readonly Queue callbackTargetChanges = new Queue();
+ private readonly HashSet callbackTargets = new HashSet();
+
+
+ /// Creates a LoadBalancingClient with UDP protocol or the one specified.
+ /// Specifies the network protocol to use for connections.
+ public LoadBalancingClient(ConnectionProtocol protocol = ConnectionProtocol.Udp)
+ {
+ this.ConnectionCallbackTargets = new ConnectionCallbacksContainer(this);
+ this.MatchMakingCallbackTargets = new MatchMakingCallbacksContainer(this);
+ this.InRoomCallbackTargets = new InRoomCallbacksContainer(this);
+ this.LobbyCallbackTargets = new LobbyCallbacksContainer(this);
+ this.WebRpcCallbackTargets = new WebRpcCallbacksContainer(this);
+ this.ErrorInfoCallbackTargets = new ErrorInfoCallbacksContainer(this);
+
+ this.LoadBalancingPeer = new LoadBalancingPeer(this, protocol);
+ this.LoadBalancingPeer.OnDisconnectMessage += this.OnDisconnectMessageReceived;
+ this.SerializationProtocol = SerializationProtocol.GpBinaryV18;
+ this.LocalPlayer = this.CreatePlayer(string.Empty, -1, true, null); //TODO: Check if we can do this later
+
+
+ #if SUPPORTED_UNITY
+ CustomTypesUnity.Register();
+ #endif
+
+ #if UNITY_WEBGL
+ if (this.LoadBalancingPeer.TransportProtocol == ConnectionProtocol.Tcp || this.LoadBalancingPeer.TransportProtocol == ConnectionProtocol.Udp)
+ {
+ this.LoadBalancingPeer.Listener.DebugReturn(DebugLevel.WARNING, "WebGL requires WebSockets. Switching TransportProtocol to WebSocketSecure.");
+ this.LoadBalancingPeer.TransportProtocol = ConnectionProtocol.WebSocketSecure;
+ }
+ #endif
+
+ this.State = ClientState.PeerCreated;
+ }
+
+
+ /// Creates a LoadBalancingClient, setting various values needed before connecting.
+ /// The Master Server's address to connect to. Used in Connect.
+ /// The AppId of this title. Needed for the Photon Cloud. Find it in the Dashboard.
+ /// A version for this client/build. In the Photon Cloud, players are separated by AppId, GameVersion and Region.
+ /// Specifies the network protocol to use for connections.
+ public LoadBalancingClient(string masterAddress, string appId, string gameVersion, ConnectionProtocol protocol = ConnectionProtocol.Udp) : this(protocol)
+ {
+ this.MasterServerAddress = masterAddress;
+ this.AppId = appId;
+ this.AppVersion = gameVersion;
+ }
+
+ public int NameServerPortInAppSettings;
+
+ ///
+ /// Gets the NameServer Address (with prefix and port), based on the set protocol (this.LoadBalancingPeer.UsedProtocol).
+ ///
+ /// NameServer Address (with prefix and port).
+ private string GetNameServerAddress()
+ {
+ var protocolPort = 0;
+ ProtocolToNameServerPort.TryGetValue(this.LoadBalancingPeer.TransportProtocol, out protocolPort);
+
+ if (this.NameServerPortInAppSettings != 0)
+ {
+ this.DebugReturn(DebugLevel.INFO, string.Format("Using NameServerPortInAppSettings: {0}", this.NameServerPortInAppSettings));
+ protocolPort = this.NameServerPortInAppSettings;
+ }
+
+ if (this.ServerPortOverrides.NameServerPort > 0)
+ {
+ protocolPort = this.ServerPortOverrides.NameServerPort;
+ }
+
+ switch (this.LoadBalancingPeer.TransportProtocol)
+ {
+ case ConnectionProtocol.Udp:
+ case ConnectionProtocol.Tcp:
+ return string.Format("{0}:{1}", NameServerHost, protocolPort);
+ 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();
+ }
+ }
+
+
+ #region Operations and Commands
+
+
+ // needed connect variants:
+ // connect to Name Server only (could include getregions) -> end after getregions
+ // connect to Region Master via Name Server (specific region/cluster) -> no getregions! authenticates and ends after on connected to master
+ // connect to Best Region via Name Server
+ // connect to Master Server (no Name Server, no appid)
+
+ public virtual bool ConnectUsingSettings(AppSettings appSettings)
+ {
+ if (this.LoadBalancingPeer.PeerState != PeerStateValue.Disconnected)
+ {
+ this.DebugReturn(DebugLevel.WARNING, "ConnectUsingSettings() failed. Can only connect while in state 'Disconnected'. Current state: " + this.LoadBalancingPeer.PeerState);
+ return false;
+ }
+
+ if (appSettings == null)
+ {
+ this.DebugReturn(DebugLevel.ERROR, "ConnectUsingSettings failed. The appSettings can't be null.'");
+ return false;
+ }
+
+ switch (this.ClientType)
+ {
+ case ClientAppType.Realtime:
+ this.AppId = appSettings.AppIdRealtime;
+ break;
+ case ClientAppType.Voice:
+ this.AppId = appSettings.AppIdVoice;
+ break;
+ case ClientAppType.Fusion:
+ this.AppId = appSettings.AppIdFusion;
+ break;
+ }
+
+ this.AppVersion = appSettings.AppVersion;
+
+ this.IsUsingNameServer = appSettings.UseNameServer;
+ this.CloudRegion = appSettings.FixedRegion;
+ this.connectToBestRegion = string.IsNullOrEmpty(this.CloudRegion);
+
+ this.EnableLobbyStatistics = appSettings.EnableLobbyStatistics;
+ this.LoadBalancingPeer.DebugOut = appSettings.NetworkLogging;
+
+ this.AuthMode = appSettings.AuthMode;
+ if (appSettings.AuthMode == AuthModeOption.AuthOnceWss)
+ {
+ this.LoadBalancingPeer.TransportProtocol = ConnectionProtocol.WebSocketSecure;
+ this.ExpectedProtocol = appSettings.Protocol;
+ }
+ else
+ {
+ this.LoadBalancingPeer.TransportProtocol = appSettings.Protocol;
+ this.ExpectedProtocol = null;
+ }
+
+ this.EnableProtocolFallback = appSettings.EnableProtocolFallback;
+
+ this.bestRegionSummaryFromStorage = appSettings.BestRegionSummaryFromStorage;
+ this.DisconnectedCause = DisconnectCause.None;
+
+
+ this.CheckConnectSetupWebGl();
+
+
+ if (this.IsUsingNameServer)
+ {
+ this.Server = ServerConnection.NameServer;
+ if (!appSettings.IsDefaultNameServer)
+ {
+ this.NameServerHost = appSettings.Server;
+ }
+
+ this.ProxyServerAddress = appSettings.ProxyServer;
+ this.NameServerPortInAppSettings = appSettings.Port;
+ if (!this.LoadBalancingPeer.Connect(this.NameServerAddress, this.ProxyServerAddress, this.AppId, this.TokenForInit))
+ {
+ return false;
+ }
+
+ this.State = ClientState.ConnectingToNameServer;
+ }
+ else
+ {
+ this.Server = ServerConnection.MasterServer;
+ int portToUse = appSettings.IsDefaultPort ? 5055 : appSettings.Port; // TODO: setup new (default) port config
+ this.MasterServerAddress = string.Format("{0}:{1}", appSettings.Server, portToUse);
+
+ if (!this.LoadBalancingPeer.Connect(this.MasterServerAddress, this.ProxyServerAddress, this.AppId, this.TokenForInit))
+ {
+ return false;
+ }
+
+ this.State = ClientState.ConnectingToMasterServer;
+ }
+
+ return true;
+ }
+
+
+ [Obsolete("Use ConnectToMasterServer() instead.")]
+ public bool Connect()
+ {
+ return this.ConnectToMasterServer();
+ }
+
+ ///
+ /// Starts the "process" to connect to a Master Server, using MasterServerAddress and AppId properties.
+ ///
+ ///
+ /// To connect to the Photon Cloud, use ConnectUsingSettings() or ConnectToRegionMaster().
+ ///
+ /// The process to connect includes several steps: the actual connecting, establishing encryption, authentification
+ /// (of app and optionally the user) and connecting to the MasterServer
+ ///
+ /// Users can connect either anonymously or use "Custom Authentication" to verify each individual player's login.
+ /// Custom Authentication in Photon uses external services and communities to verify users. While the client provides a user's info,
+ /// the service setup is done in the Photon Cloud Dashboard.
+ /// The parameter authValues will set this.AuthValues and use them in the connect process.
+ ///
+ /// Connecting to the Photon Cloud might fail due to:
+ /// - Network issues (OnStatusChanged() StatusCode.ExceptionOnConnect)
+ /// - Region not available (OnOperationResponse() for OpAuthenticate with ReturnCode == ErrorCode.InvalidRegion)
+ /// - Subscription CCU limit reached (OnOperationResponse() for OpAuthenticate with ReturnCode == ErrorCode.MaxCcuReached)
+ ///
+ public virtual bool ConnectToMasterServer()
+ {
+ if (this.LoadBalancingPeer.PeerState != PeerStateValue.Disconnected)
+ {
+ this.DebugReturn(DebugLevel.WARNING, "ConnectToMasterServer() failed. Can only connect while in state 'Disconnected'. Current state: " + this.LoadBalancingPeer.PeerState);
+ return false;
+ }
+
+ // when using authMode AuthOnce or AuthOnceWSS, the token must be available for the init request. if it's null in that case, don't connect
+ if (this.AuthMode != AuthModeOption.Auth && this.TokenForInit == null)
+ {
+ this.DebugReturn(DebugLevel.ERROR, "Connect() failed. Can't connect to MasterServer with Token == null in AuthMode: " + this.AuthMode);
+ return false;
+ }
+
+ this.CheckConnectSetupWebGl();
+
+ if (this.LoadBalancingPeer.Connect(this.MasterServerAddress, this.ProxyServerAddress, this.AppId, this.TokenForInit))
+ {
+ this.DisconnectedCause = DisconnectCause.None;
+ this.connectToBestRegion = false;
+ this.State = ClientState.ConnectingToMasterServer;
+ this.Server = ServerConnection.MasterServer;
+ return true;
+ }
+
+ return false;
+ }
+
+
+ ///
+ /// Connects to the NameServer for Photon Cloud, where a region and server list can be obtained.
+ ///
+ ///
+ /// If the workflow was started or failed right away.
+ public bool ConnectToNameServer()
+ {
+ if (this.LoadBalancingPeer.PeerState != PeerStateValue.Disconnected)
+ {
+ this.DebugReturn(DebugLevel.WARNING, "ConnectToNameServer() failed. Can only connect while in state 'Disconnected'. Current state: " + this.LoadBalancingPeer.PeerState);
+ return false;
+ }
+
+ this.IsUsingNameServer = true;
+ this.CloudRegion = null;
+
+
+ this.CheckConnectSetupWebGl();
+
+
+ if (this.AuthMode == AuthModeOption.AuthOnceWss)
+ {
+ if (this.ExpectedProtocol == null)
+ {
+ this.ExpectedProtocol = this.LoadBalancingPeer.TransportProtocol;
+ }
+ this.LoadBalancingPeer.TransportProtocol = ConnectionProtocol.WebSocketSecure;
+ }
+
+ if (this.LoadBalancingPeer.Connect(this.NameServerAddress, this.ProxyServerAddress, "NameServer", this.TokenForInit))
+ {
+ this.DisconnectedCause = DisconnectCause.None;
+ this.connectToBestRegion = false;
+ this.State = ClientState.ConnectingToNameServer;
+ this.Server = ServerConnection.NameServer;
+ return true;
+ }
+
+ return false;
+ }
+
+ ///
+ /// Connects you to a specific region's Master Server, using the Name Server to get the IP.
+ ///
+ ///
+ /// If the region is null or empty, no connection will be made.
+ /// If the region (code) provided is not available, the connection process will fail on the Name Server.
+ /// This method connects only to the region defined. Any "Best Region" pinging should get done beforehand.
+ ///
+ /// To support "sharding", a region string may contain a "/*" to pick a random cluster or "/clustername"
+ /// to connect to a specific cluster.
+ /// With a "/" or no cluster postfix, the client connects to the default cluster (a specific one
+ /// for a region).
+ ///
+ /// By default, the region string provided by the Name Server does not contain a cluster (and only the
+ /// default cluster is used).
+ ///
+ /// If the operation could be sent. If false, no operation was sent.
+ public bool ConnectToRegionMaster(string region)
+ {
+ if (string.IsNullOrEmpty(region))
+ {
+ this.DebugReturn(DebugLevel.ERROR, "ConnectToRegionMaster() failed. The region can not be null or empty.");
+ return false;
+ }
+
+ this.IsUsingNameServer = true;
+
+ if (this.State == ClientState.Authenticating)
+ {
+ if (this.LoadBalancingPeer.DebugOut >= DebugLevel.INFO)
+ {
+ this.DebugReturn(DebugLevel.INFO, "ConnectToRegionMaster() will skip calling authenticate, as the current state is 'Authenticating'. Just wait for the result.");
+ }
+ return true;
+ }
+
+ if (this.State == ClientState.ConnectedToNameServer)
+ {
+ this.CloudRegion = region;
+
+ bool authenticating = this.CallAuthenticate();
+ if (authenticating)
+ {
+ this.State = ClientState.Authenticating;
+ }
+
+ return authenticating;
+ }
+
+
+ this.LoadBalancingPeer.Disconnect();
+
+ //if (!string.IsNullOrEmpty(region) && !region.Contains("/"))
+ //{
+ // region = region + "/*";
+ //}
+ this.CloudRegion = region;
+
+
+ this.CheckConnectSetupWebGl();
+
+
+ if (this.AuthMode == AuthModeOption.AuthOnceWss)
+ {
+ if (this.ExpectedProtocol == null)
+ {
+ this.ExpectedProtocol = this.LoadBalancingPeer.TransportProtocol;
+ }
+ this.LoadBalancingPeer.TransportProtocol = ConnectionProtocol.WebSocketSecure;
+ }
+
+ this.connectToBestRegion = false;
+ this.DisconnectedCause = DisconnectCause.None;
+ if (!this.LoadBalancingPeer.Connect(this.NameServerAddress, this.ProxyServerAddress, "NameServer", null))
+ {
+ return false;
+ }
+
+ this.State = ClientState.ConnectingToNameServer;
+ this.Server = ServerConnection.NameServer;
+ return true;
+ }
+
+ [Conditional("UNITY_WEBGL")]
+ private void CheckConnectSetupWebGl()
+ {
+ #if UNITY_WEBGL
+ if (this.LoadBalancingPeer.TransportProtocol != ConnectionProtocol.WebSocket && this.LoadBalancingPeer.TransportProtocol != ConnectionProtocol.WebSocketSecure)
+ {
+ this.DebugReturn(DebugLevel.WARNING, "WebGL requires WebSockets. Switching TransportProtocol to WebSocketSecure.");
+ this.LoadBalancingPeer.TransportProtocol = ConnectionProtocol.WebSocketSecure;
+ }
+
+ this.EnableProtocolFallback = false; // no fallback on WebGL
+ #endif
+ }
+
+ ///
+ /// Privately used only for reconnecting.
+ ///
+ private bool Connect(string serverAddress, string proxyServerAddress, ServerConnection serverType)
+ {
+ // TODO: Make sure app doesn't quit right now
+
+ if (this.State == ClientState.Disconnecting)
+ {
+ this.DebugReturn(DebugLevel.ERROR, "Connect() failed. Can't connect while disconnecting (still). Current state: " + this.State);
+ return false;
+ }
+
+ // when using authMode AuthOnce or AuthOnceWSS, the token must be available for the init request. if it's null in that case, don't connect
+ if (this.AuthMode != AuthModeOption.Auth && serverType != ServerConnection.NameServer && this.TokenForInit == null)
+ {
+ this.DebugReturn(DebugLevel.ERROR, "Connect() failed. Can't connect to " + serverType + " with Token == null in AuthMode: " + this.AuthMode);
+ return false;
+ }
+
+ // connect might fail, if the DNS name can't be resolved or if no network connection is available, etc.
+ bool connecting = this.LoadBalancingPeer.Connect(serverAddress, proxyServerAddress, this.AppId, this.TokenForInit);
+
+ if (connecting)
+ {
+ this.DisconnectedCause = DisconnectCause.None;
+ this.Server = serverType;
+
+ switch (serverType)
+ {
+ case ServerConnection.NameServer:
+ State = ClientState.ConnectingToNameServer;
+ break;
+ case ServerConnection.MasterServer:
+ State = ClientState.ConnectingToMasterServer;
+ break;
+ case ServerConnection.GameServer:
+ State = ClientState.ConnectingToGameServer;
+ break;
+ }
+ }
+
+ return connecting;
+ }
+
+
+ /// Can be used to reconnect to the master server after a disconnect.
+ /// Common use case: Press the Lock Button on a iOS device and you get disconnected immediately.
+ public bool ReconnectToMaster()
+ {
+ if (this.LoadBalancingPeer.PeerState != PeerStateValue.Disconnected)
+ {
+ this.DebugReturn(DebugLevel.WARNING, "ReconnectToMaster() failed. Can only connect while in state 'Disconnected'. Current state: " + this.LoadBalancingPeer.PeerState);
+ return false;
+ }
+
+ if (string.IsNullOrEmpty(this.MasterServerAddress))
+ {
+ this.DebugReturn(DebugLevel.WARNING, "ReconnectToMaster() failed. MasterServerAddress is null or empty.");
+ return false;
+ }
+ if (this.tokenCache == null)
+ {
+ this.DebugReturn(DebugLevel.WARNING, "ReconnectToMaster() failed. It seems the client doesn't have any previous authentication token to re-connect.");
+ return false;
+ }
+
+ if (this.AuthValues == null)
+ {
+ this.DebugReturn(DebugLevel.WARNING, "ReconnectToMaster() with AuthValues == null is not correct!");
+ this.AuthValues = new AuthenticationValues();
+ }
+ this.AuthValues.Token = this.tokenCache;
+
+ return this.Connect(this.MasterServerAddress, this.ProxyServerAddress, ServerConnection.MasterServer);
+ }
+
+ ///
+ /// Can be used to return to a room quickly by directly reconnecting to a game server to rejoin a room.
+ ///
+ ///
+ /// Rejoining room will not send any player properties. Instead client will receive up-to-date ones from server.
+ /// If you want to set new player properties, do it once rejoined.
+ ///
+ /// False, if the conditions are not met. Then, this client does not attempt the ReconnectAndRejoin.
+ public bool ReconnectAndRejoin()
+ {
+ if (this.LoadBalancingPeer.PeerState != PeerStateValue.Disconnected)
+ {
+ this.DebugReturn(DebugLevel.WARNING, "ReconnectAndRejoin() failed. Can only connect while in state 'Disconnected'. Current state: " + this.LoadBalancingPeer.PeerState);
+ return false;
+ }
+
+ if (string.IsNullOrEmpty(this.GameServerAddress))
+ {
+ this.DebugReturn(DebugLevel.WARNING, "ReconnectAndRejoin() failed. It seems the client wasn't connected to a game server before (no address).");
+ return false;
+ }
+ if (this.enterRoomParamsCache == null)
+ {
+ this.DebugReturn(DebugLevel.WARNING, "ReconnectAndRejoin() failed. It seems the client doesn't have any previous room to re-join.");
+ return false;
+ }
+ if (this.tokenCache == null)
+ {
+ this.DebugReturn(DebugLevel.WARNING, "ReconnectAndRejoin() failed. It seems the client doesn't have any previous authentication token to re-connect.");
+ return false;
+ }
+
+ if (this.AuthValues == null)
+ {
+ this.AuthValues = new AuthenticationValues();
+ }
+ this.AuthValues.Token = this.tokenCache;
+
+
+ if (!string.IsNullOrEmpty(this.GameServerAddress) && this.enterRoomParamsCache != null)
+ {
+ this.lastJoinType = JoinType.JoinRoom;
+ this.enterRoomParamsCache.JoinMode = JoinMode.RejoinOnly;
+ return this.Connect(this.GameServerAddress, this.ProxyServerAddress, ServerConnection.GameServer);
+ }
+
+ return false;
+ }
+
+
+ /// Disconnects the peer from a server or stays disconnected. If the client / peer was connected, a callback will be triggered.
+ ///
+ /// Disconnect will attempt to notify the server of the client closing the connection.
+ ///
+ /// Clients that are in a room, will leave the room. If the room's playerTTL > 0, the player will just become inactive (and may rejoin).
+ ///
+ /// This method will not change the current State, if this client State is PeerCreated, Disconnecting or Disconnected.
+ /// In those cases, there is also no callback for the disconnect. The DisconnectedCause will only change if the client was connected.
+ ///
+ public void Disconnect(DisconnectCause cause = DisconnectCause.DisconnectByClientLogic)
+ {
+ if (this.State == ClientState.Disconnecting || this.State == ClientState.PeerCreated)
+ {
+ this.DebugReturn(DebugLevel.INFO, "Disconnect() call gets skipped due to State " + this.State + ". DisconnectedCause: " + this.DisconnectedCause + " Parameter cause: " + cause);
+ return;
+ }
+
+ if (this.State != ClientState.Disconnected)
+ {
+ this.State = ClientState.Disconnecting;
+ this.DisconnectedCause = cause;
+ this.LoadBalancingPeer.Disconnect();
+ }
+ }
+
+
+ ///
+ /// Private Disconnect variant that sets the state, too.
+ ///
+ private void DisconnectToReconnect()
+ {
+ switch (this.Server)
+ {
+ case ServerConnection.NameServer:
+ this.State = ClientState.DisconnectingFromNameServer;
+ break;
+ case ServerConnection.MasterServer:
+ this.State = ClientState.DisconnectingFromMasterServer;
+ break;
+ case ServerConnection.GameServer:
+ this.State = ClientState.DisconnectingFromGameServer;
+ break;
+ }
+
+ this.LoadBalancingPeer.Disconnect();
+ }
+
+ ///
+ /// Useful to test loss of connection which will end in a client timeout. This modifies LoadBalancingPeer.NetworkSimulationSettings. Read remarks.
+ ///
+ ///
+ /// Use with care as this sets LoadBalancingPeer.IsSimulationEnabled.
+ /// Read LoadBalancingPeer.IsSimulationEnabled to check if this is on or off, if needed.
+ ///
+ /// If simulateTimeout is true, LoadBalancingPeer.NetworkSimulationSettings.IncomingLossPercentage and
+ /// LoadBalancingPeer.NetworkSimulationSettings.OutgoingLossPercentage will be set to 100.
+ /// Obviously, this overrides any network simulation settings done before.
+ ///
+ /// If you want fine-grained network simulation control, use the NetworkSimulationSettings.
+ ///
+ /// The timeout will lead to a call to , as usual in a client timeout.
+ ///
+ /// You could modify this method (or use NetworkSimulationSettings) to deliberately run into a server timeout by
+ /// just setting the OutgoingLossPercentage = 100 and the IncomingLossPercentage = 0.
+ ///
+ /// If true, a connection loss is simulated. If false, the simulation ends.
+ public void SimulateConnectionLoss(bool simulateTimeout)
+ {
+ this.DebugReturn(DebugLevel.WARNING, "SimulateConnectionLoss() set to: "+simulateTimeout);
+
+ if (simulateTimeout)
+ {
+ this.LoadBalancingPeer.NetworkSimulationSettings.IncomingLossPercentage = 100;
+ this.LoadBalancingPeer.NetworkSimulationSettings.OutgoingLossPercentage = 100;
+ }
+
+ this.LoadBalancingPeer.IsSimulationEnabled = simulateTimeout;
+ }
+
+ private bool CallAuthenticate()
+ {
+ if (this.IsUsingNameServer && this.Server != ServerConnection.NameServer && (this.AuthValues == null || this.AuthValues.Token == null))
+ {
+ this.DebugReturn(DebugLevel.ERROR, "Authenticate without Token is only allowed on Name Server. Connecting to: " + this.Server + " on: " + this.CurrentServerAddress + ". State: " + this.State);
+ return false;
+ }
+
+ if (this.AuthMode == AuthModeOption.Auth)
+ {
+ if (!this.CheckIfOpCanBeSent(OperationCode.Authenticate, this.Server, "Authenticate"))
+ {
+ return false;
+ }
+ return this.LoadBalancingPeer.OpAuthenticate(this.AppId, this.AppVersion, this.AuthValues, this.CloudRegion, (this.EnableLobbyStatistics && this.Server == ServerConnection.MasterServer));
+ }
+ else
+ {
+ if (!this.CheckIfOpCanBeSent(OperationCode.AuthenticateOnce, this.Server, "AuthenticateOnce"))
+ {
+ return false;
+ }
+
+ ConnectionProtocol targetProtocolPastNameServer = this.ExpectedProtocol != null ? (ConnectionProtocol) this.ExpectedProtocol : this.LoadBalancingPeer.TransportProtocol;
+ return this.LoadBalancingPeer.OpAuthenticateOnce(this.AppId, this.AppVersion, this.AuthValues, this.CloudRegion, this.EncryptionMode, targetProtocolPastNameServer);
+ }
+ }
+
+
+ ///
+ /// This method dispatches all available incoming commands and then sends this client's outgoing commands.
+ /// It uses DispatchIncomingCommands and SendOutgoingCommands to do that.
+ ///
+ ///
+ /// The Photon client libraries are designed to fit easily into a game or application. The application
+ /// is in control of the context (thread) in which incoming events and responses are executed and has
+ /// full control of the creation of UDP/TCP packages.
+ ///
+ /// Sending packages and dispatching received messages are two separate tasks. Service combines them
+ /// into one method at the cost of control. It calls DispatchIncomingCommands and SendOutgoingCommands.
+ ///
+ /// Call this method regularly (10..50 times a second).
+ ///
+ /// This will Dispatch ANY received commands (unless a reliable command in-order is still missing) and
+ /// events AND will send queued outgoing commands. Fewer calls might be more effective if a device
+ /// cannot send many packets per second, as multiple operations might be combined into one package.
+ ///
+ ///
+ /// You could replace Service by:
+ ///
+ /// while (DispatchIncomingCommands()); //Dispatch until everything is Dispatched...
+ /// SendOutgoingCommands(); //Send a UDP/TCP package with outgoing messages
+ ///
+ ///
+ ///
+ public void Service()
+ {
+ if (this.LoadBalancingPeer != null)
+ {
+ this.LoadBalancingPeer.Service();
+ }
+ }
+
+
+ ///
+ /// While on the NameServer, this gets you the list of regional servers (short names and their IPs to ping them).
+ ///
+ /// If the operation could be sent. If false, no operation was sent (e.g. while not connected to the NameServer).
+ private bool OpGetRegions()
+ {
+ if (!this.CheckIfOpCanBeSent(OperationCode.GetRegions, this.Server, "GetRegions"))
+ {
+ return false;
+ }
+
+ bool sent = this.LoadBalancingPeer.OpGetRegions(this.AppId);
+ return sent;
+ }
+
+
+ ///
+ /// Request the rooms and online status for a list of friends. All clients should set a unique UserId before connecting. The result is available in this.FriendList.
+ ///
+ ///
+ /// Used on Master Server to find the rooms played by a selected list of users.
+ /// The result will be stored in LoadBalancingClient.FriendList, which is null before the first server response.
+ ///
+ /// Users identify themselves by setting a UserId in the LoadBalancingClient instance.
+ /// This will send the ID in OpAuthenticate during connect (to master and game servers).
+ /// Note: Changing a player's name doesn't make sense when using a friend list.
+ ///
+ /// The list of usernames must be fetched from some other source (not provided by Photon).
+ ///
+ ///
+ /// Internal:
+ /// The server response includes 2 arrays of info (each index matching a friend from the request):
+ /// ParameterCode.FindFriendsResponseOnlineList = bool[] of online states
+ /// ParameterCode.FindFriendsResponseRoomIdList = string[] of room names (empty string if not in a room)
+ ///
+ /// The options may be used to define which state a room must match to be returned.
+ ///
+ /// Array of friend's names (make sure they are unique).
+ /// Options that affect the result of the FindFriends operation.
+ /// If the operation could be sent (requires connection).
+ public bool OpFindFriends(string[] friendsToFind, FindFriendsOptions options = null)
+ {
+ if (!this.CheckIfOpCanBeSent(OperationCode.FindFriends, this.Server, "FindFriends"))
+ {
+ return false;
+ }
+
+ if (this.IsFetchingFriendList)
+ {
+ this.DebugReturn(DebugLevel.WARNING, "OpFindFriends skipped: already fetching friends list.");
+ return false; // fetching friends currently, so don't do it again (avoid changing the list while fetching friends)
+ }
+
+ if (friendsToFind == null || friendsToFind.Length == 0)
+ {
+ this.DebugReturn(DebugLevel.ERROR, "OpFindFriends skipped: friendsToFind array is null or empty.");
+ return false;
+ }
+
+ if (friendsToFind.Length > FriendRequestListMax)
+ {
+ this.DebugReturn(DebugLevel.ERROR, string.Format("OpFindFriends skipped: friendsToFind array exceeds allowed length of {0}.", FriendRequestListMax));
+ return false;
+ }
+
+ List friendsList = new List(friendsToFind.Length);
+ for (int i = 0; i < friendsToFind.Length; i++)
+ {
+ string friendUserId = friendsToFind[i];
+ if (string.IsNullOrEmpty(friendUserId))
+ {
+ this.DebugReturn(DebugLevel.WARNING,
+ string.Format(
+ "friendsToFind array contains a null or empty UserId, element at position {0} skipped.",
+ i));
+ }
+ else if (friendUserId.Equals(UserId))
+ {
+ this.DebugReturn(DebugLevel.WARNING,
+ string.Format(
+ "friendsToFind array contains local player's UserId \"{0}\", element at position {1} skipped.",
+ friendUserId,
+ i));
+ }
+ else if (friendsList.Contains(friendUserId))
+ {
+ this.DebugReturn(DebugLevel.WARNING,
+ string.Format(
+ "friendsToFind array contains duplicate UserId \"{0}\", element at position {1} skipped.",
+ friendUserId,
+ i));
+ }
+ else
+ {
+ friendsList.Add(friendUserId);
+ }
+ }
+
+ if (friendsList.Count == 0)
+ {
+ this.DebugReturn(DebugLevel.ERROR, "OpFindFriends skipped: friends list to find is empty.");
+ return false;
+ }
+
+ string[] filteredArray = friendsList.ToArray();
+ bool sent = this.LoadBalancingPeer.OpFindFriends(filteredArray, options);
+ this.friendListRequested = sent ? filteredArray : null;
+
+ return sent;
+ }
+
+ /// If already connected to a Master Server, this joins the specified lobby. This request triggers an OnOperationResponse() call and the callback OnJoinedLobby().
+ /// The lobby to join. Use null for default lobby.
+ /// If the operation could be sent. False, if the client is not IsConnectedAndReady or when it's not connected to a Master Server.
+ public bool OpJoinLobby(TypedLobby lobby)
+ {
+ if (!this.CheckIfOpCanBeSent(OperationCode.JoinLobby, this.Server, "JoinLobby"))
+ {
+ return false;
+ }
+
+ if (lobby == null)
+ {
+ lobby = TypedLobby.Default;
+ }
+ bool sent = this.LoadBalancingPeer.OpJoinLobby(lobby);
+ if (sent)
+ {
+ this.CurrentLobby = lobby;
+ this.State = ClientState.JoiningLobby;
+ }
+
+ return sent;
+ }
+
+
+ /// Opposite of joining a lobby. You don't have to explicitly leave a lobby to join another (client can be in one max, at any time).
+ /// If the operation could be sent (has to be connected).
+ public bool OpLeaveLobby()
+ {
+ if (!this.CheckIfOpCanBeSent(OperationCode.LeaveLobby, this.Server, "LeaveLobby"))
+ {
+ return false;
+ }
+ return this.LoadBalancingPeer.OpLeaveLobby();
+ }
+
+
+ ///
+ /// Joins a random room that matches the filter. Will callback: OnJoinedRoom or OnJoinRandomFailed.
+ ///
+ ///
+ /// Used for random matchmaking. You can join any room or one with specific properties defined in opJoinRandomRoomParams.
+ ///
+ /// You can use expectedCustomRoomProperties and expectedMaxPlayers as filters for accepting rooms.
+ /// If you set expectedCustomRoomProperties, a room must have the exact same key values set at Custom Properties.
+ /// You need to define which Custom Room Properties will be available for matchmaking when you create a room.
+ /// See: OpCreateRoom(string roomName, RoomOptions roomOptions, TypedLobby lobby)
+ ///
+ /// This operation fails if no rooms are fitting or available (all full, closed or not visible).
+ /// It may also fail when actually joining the room which was found. Rooms may close, become full or empty anytime.
+ ///
+ /// This method can only be called while the client is connected to a Master Server so you should
+ /// implement the callback OnConnectedToMaster.
+ /// Check the return value to make sure the operation will be called on the server.
+ /// Note: There will be no callbacks if this method returned false.
+ ///
+ ///
+ /// This client's State is set to ClientState.Joining immediately, when the operation could
+ /// be called. In the background, the client will switch servers and call various related operations.
+ ///
+ /// When you're in the room, this client's State will become ClientState.Joined.
+ ///
+ ///
+ /// When entering a room, this client's Player Custom Properties will be sent to the room.
+ /// Use LocalPlayer.SetCustomProperties to set them, even while not yet in the room.
+ /// Note that the player properties will be cached locally and are not wiped when leaving a room.
+ ///
+ /// More about matchmaking:
+ /// https://doc.photonengine.com/en-us/realtime/current/reference/matchmaking-and-lobby
+ ///
+ /// You can define an array of expectedUsers, to block player slots in the room for these users.
+ /// The corresponding feature in Photon is called "Slot Reservation" and can be found in the doc pages.
+ ///
+ /// Optional definition of properties to filter rooms in random matchmaking.
+ /// If the operation could be sent currently (requires connection to Master Server).
+ public bool OpJoinRandomRoom(OpJoinRandomRoomParams opJoinRandomRoomParams = null)
+ {
+ if (!this.CheckIfOpCanBeSent(OperationCode.JoinRandomGame, this.Server, "JoinRandomGame"))
+ {
+ return false;
+ }
+
+ if (opJoinRandomRoomParams == null)
+ {
+ opJoinRandomRoomParams = new OpJoinRandomRoomParams();
+ }
+
+ this.enterRoomParamsCache = new EnterRoomParams();
+ this.enterRoomParamsCache.Lobby = opJoinRandomRoomParams.TypedLobby;
+ this.enterRoomParamsCache.ExpectedUsers = opJoinRandomRoomParams.ExpectedUsers;
+
+
+ bool sending = this.LoadBalancingPeer.OpJoinRandomRoom(opJoinRandomRoomParams);
+ if (sending)
+ {
+ this.lastJoinType = JoinType.JoinRandomRoom;
+ this.State = ClientState.Joining;
+ }
+ return sending;
+ }
+
+
+ ///
+ /// Attempts to join a room that matches the specified filter and creates a room if none found.
+ ///
+ ///
+ /// This operation is a combination of filter-based random matchmaking with the option to create a new room,
+ /// if no fitting room exists.
+ /// The benefit of that is that the room creation is done by the same operation and the room can be found
+ /// by the very next client, looking for similar rooms.
+ ///
+ /// There are separate parameters for joining and creating a room.
+ ///
+ /// This method can only be called while connected to a Master Server.
+ /// This client's State is set to ClientState.Joining immediately.
+ ///
+ /// Either IMatchmakingCallbacks.OnJoinedRoom or IMatchmakingCallbacks.OnCreatedRoom get called.
+ ///
+ /// More about matchmaking:
+ /// https://doc.photonengine.com/en-us/realtime/current/reference/matchmaking-and-lobby
+ ///
+ /// Check the return value to make sure the operation will be called on the server.
+ /// Note: There will be no callbacks if this method returned false.
+ ///
+ /// If the operation will be sent (requires connection to Master Server).
+ public bool OpJoinRandomOrCreateRoom(OpJoinRandomRoomParams opJoinRandomRoomParams, EnterRoomParams createRoomParams)
+ {
+ if (!this.CheckIfOpCanBeSent(OperationCode.JoinRandomGame, this.Server, "OpJoinRandomOrCreateRoom"))
+ {
+ return false;
+ }
+
+ if (opJoinRandomRoomParams == null)
+ {
+ opJoinRandomRoomParams = new OpJoinRandomRoomParams();
+ }
+ if (createRoomParams == null)
+ {
+ createRoomParams = new EnterRoomParams();
+ }
+
+ createRoomParams.JoinMode = JoinMode.CreateIfNotExists;
+ this.enterRoomParamsCache = createRoomParams;
+ this.enterRoomParamsCache.Lobby = opJoinRandomRoomParams.TypedLobby;
+ this.enterRoomParamsCache.ExpectedUsers = opJoinRandomRoomParams.ExpectedUsers;
+
+
+ bool sending = this.LoadBalancingPeer.OpJoinRandomOrCreateRoom(opJoinRandomRoomParams, createRoomParams);
+ if (sending)
+ {
+ this.lastJoinType = JoinType.JoinRandomOrCreateRoom;
+ this.State = ClientState.Joining;
+ }
+ return sending;
+ }
+
+
+
+ ///
+ /// Creates a new room. Will callback: OnCreatedRoom and OnJoinedRoom or OnCreateRoomFailed.
+ ///
+ ///
+ /// When successful, the client will enter the specified room and callback both OnCreatedRoom and OnJoinedRoom.
+ /// In all error cases, OnCreateRoomFailed gets called.
+ ///
+ /// Creating a room will fail if the room name is already in use or when the RoomOptions clashing
+ /// with one another. Check the EnterRoomParams reference for the various room creation options.
+ ///
+ ///
+ /// This method can only be called while the client is connected to a Master Server so you should
+ /// implement the callback OnConnectedToMaster.
+ /// Check the return value to make sure the operation will be called on the server.
+ /// Note: There will be no callbacks if this method returned false.
+ ///
+ ///
+ /// When you're in the room, this client's State will become ClientState.Joined.
+ ///
+ ///
+ /// When entering a room, this client's Player Custom Properties will be sent to the room.
+ /// Use LocalPlayer.SetCustomProperties to set them, even while not yet in the room.
+ /// Note that the player properties will be cached locally and are not wiped when leaving a room.
+ ///
+ /// You can define an array of expectedUsers, to block player slots in the room for these users.
+ /// The corresponding feature in Photon is called "Slot Reservation" and can be found in the doc pages.
+ ///
+ /// Definition of properties for the room to create.
+ /// If the operation could be sent currently (requires connection to Master Server).
+ public bool OpCreateRoom(EnterRoomParams enterRoomParams)
+ {
+ if (!this.CheckIfOpCanBeSent(OperationCode.CreateGame, this.Server, "CreateGame"))
+ {
+ return false;
+ }
+ bool onGameServer = this.Server == ServerConnection.GameServer;
+ enterRoomParams.OnGameServer = onGameServer;
+ if (!onGameServer)
+ {
+ this.enterRoomParamsCache = enterRoomParams;
+ }
+
+ bool sending = this.LoadBalancingPeer.OpCreateRoom(enterRoomParams);
+ if (sending)
+ {
+ this.lastJoinType = JoinType.CreateRoom;
+ this.State = ClientState.Joining;
+ }
+ return sending;
+ }
+
+
+ ///
+ /// Joins a specific room by name and creates it on demand. Will callback: OnJoinedRoom or OnJoinRoomFailed.
+ ///
+ ///
+ /// Useful when players make up a room name to meet in:
+ /// All involved clients call the same method and whoever is first, also creates the room.
+ ///
+ /// When successful, the client will enter the specified room.
+ /// The client which creates the room, will callback both OnCreatedRoom and OnJoinedRoom.
+ /// Clients that join an existing room will only callback OnJoinedRoom.
+ /// In all error cases, OnJoinRoomFailed gets called.
+ ///
+ /// Joining a room will fail, if the room is full, closed or when the user
+ /// already is present in the room (checked by userId).
+ ///
+ /// To return to a room, use OpRejoinRoom.
+ ///
+ /// This method can only be called while the client is connected to a Master Server so you should
+ /// implement the callback OnConnectedToMaster.
+ /// Check the return value to make sure the operation will be called on the server.
+ /// Note: There will be no callbacks if this method returned false.
+ ///
+ /// This client's State is set to ClientState.Joining immediately, when the operation could
+ /// be called. In the background, the client will switch servers and call various related operations.
+ ///
+ /// When you're in the room, this client's State will become ClientState.Joined.
+ ///
+ ///
+ /// If you set room properties in roomOptions, they get ignored when the room is existing already.
+ /// This avoids changing the room properties by late joining players.
+ ///
+ /// When entering a room, this client's Player Custom Properties will be sent to the room.
+ /// Use LocalPlayer.SetCustomProperties to set them, even while not yet in the room.
+ /// Note that the player properties will be cached locally and are not wiped when leaving a room.
+ ///
+ /// You can define an array of expectedUsers, to block player slots in the room for these users.
+ /// The corresponding feature in Photon is called "Slot Reservation" and can be found in the doc pages.
+ ///
+ /// Definition of properties for the room to create or join.
+ /// If the operation could be sent currently (requires connection to Master Server).
+ public bool OpJoinOrCreateRoom(EnterRoomParams enterRoomParams)
+ {
+ if (!this.CheckIfOpCanBeSent(OperationCode.JoinGame, this.Server, "JoinOrCreateRoom"))
+ {
+ return false;
+ }
+
+ bool onGameServer = this.Server == ServerConnection.GameServer;
+ enterRoomParams.JoinMode = JoinMode.CreateIfNotExists;
+ enterRoomParams.OnGameServer = onGameServer;
+ if (!onGameServer)
+ {
+ this.enterRoomParamsCache = enterRoomParams;
+ }
+
+ bool sending = this.LoadBalancingPeer.OpJoinRoom(enterRoomParams);
+ if (sending)
+ {
+ this.lastJoinType = JoinType.JoinOrCreateRoom;
+ this.State = ClientState.Joining;
+ }
+ return sending;
+ }
+
+
+ ///
+ /// Joins a room by name. Will callback: OnJoinedRoom or OnJoinRoomFailed.
+ ///
+ ///
+ /// Useful when using lobbies or when players follow friends or invite each other.
+ ///
+ /// When successful, the client will enter the specified room and callback via OnJoinedRoom.
+ /// In all error cases, OnJoinRoomFailed gets called.
+ ///
+ /// Joining a room will fail if the room is full, closed, not existing or when the user
+ /// already is present in the room (checked by userId).
+ ///
+ /// To return to a room, use OpRejoinRoom.
+ /// When players invite each other and it's unclear who's first to respond, use OpJoinOrCreateRoom instead.
+ ///
+ /// This method can only be called while the client is connected to a Master Server so you should
+ /// implement the callback OnConnectedToMaster.
+ /// Check the return value to make sure the operation will be called on the server.
+ /// Note: There will be no callbacks if this method returned false.
+ ///
+ /// A room's name has to be unique (per region, appid and gameversion).
+ /// When your title uses a global matchmaking or invitations (e.g. an external solution),
+ /// keep regions and the game versions in mind to join a room.
+ ///
+ ///
+ /// This client's State is set to ClientState.Joining immediately, when the operation could
+ /// be called. In the background, the client will switch servers and call various related operations.
+ ///
+ /// When you're in the room, this client's State will become ClientState.Joined.
+ ///
+ ///
+ /// When entering a room, this client's Player Custom Properties will be sent to the room.
+ /// Use LocalPlayer.SetCustomProperties to set them, even while not yet in the room.
+ /// Note that the player properties will be cached locally and are not wiped when leaving a room.
+ ///
+ /// You can define an array of expectedUsers, to reserve player slots in the room for friends or party members.
+ /// The corresponding feature in Photon is called "Slot Reservation" and can be found in the doc pages.
+ ///
+ /// Definition of properties for the room to join.
+ /// If the operation could be sent currently (requires connection to Master Server).
+ public bool OpJoinRoom(EnterRoomParams enterRoomParams)
+ {
+ if (!this.CheckIfOpCanBeSent(OperationCode.JoinGame, this.Server, "JoinRoom"))
+ {
+ return false;
+ }
+
+ bool onGameServer = this.Server == ServerConnection.GameServer;
+ enterRoomParams.OnGameServer = onGameServer;
+ if (!onGameServer)
+ {
+ this.enterRoomParamsCache = enterRoomParams;
+ }
+
+ bool sending = this.LoadBalancingPeer.OpJoinRoom(enterRoomParams);
+ if (sending)
+ {
+ this.lastJoinType = enterRoomParams.JoinMode == JoinMode.CreateIfNotExists ? JoinType.JoinOrCreateRoom : JoinType.JoinRoom;
+ this.State = ClientState.Joining;
+ }
+ return sending;
+ }
+
+
+ ///
+ /// Rejoins a room by roomName (using the userID internally to return). Will callback: OnJoinedRoom or OnJoinRoomFailed.
+ ///
+ ///
+ /// Used to return to a room, before this user was removed from the players list.
+ /// Internally, the userID will be checked by the server, to make sure this user is in the room (active or inactice).
+ ///
+ /// In contrast to join, this operation never adds a players to a room. It will attempt to retake an existing
+ /// spot in the playerlist or fail. This makes sure the client doean't accidentally join a room when the
+ /// game logic meant to re-activate an existing actor in an existing room.
+ ///
+ /// This method will fail on the server, when the room does not exist, can't be loaded (persistent rooms) or
+ /// when the userId is not in the player list of this room. This will lead to a callback OnJoinRoomFailed.
+ ///
+ /// Rejoining room will not send any player properties. Instead client will receive up-to-date ones from server.
+ /// If you want to set new player properties, do it once rejoined.
+ ///
+ public bool OpRejoinRoom(string roomName)
+ {
+ if (!this.CheckIfOpCanBeSent(OperationCode.JoinGame, this.Server, "RejoinRoom"))
+ {
+ return false;
+ }
+
+ bool onGameServer = this.Server == ServerConnection.GameServer;
+
+ EnterRoomParams opParams = new EnterRoomParams();
+ this.enterRoomParamsCache = opParams;
+ opParams.RoomName = roomName;
+ opParams.OnGameServer = onGameServer;
+ opParams.JoinMode = JoinMode.RejoinOnly;
+
+ bool sending = this.LoadBalancingPeer.OpJoinRoom(opParams);
+ if (sending)
+ {
+ this.lastJoinType = JoinType.JoinRoom;
+ this.State = ClientState.Joining;
+ }
+ return sending;
+ }
+
+
+ ///
+ /// Leaves the current room, optionally telling the server that the user is just becoming inactive. Will callback: OnLeftRoom.
+ ///
+ ///
+ ///
+ /// OpLeaveRoom skips execution when the room is null or the server is not GameServer or the client is disconnecting from GS already.
+ /// OpLeaveRoom returns false in those cases and won't change the state, so check return of this method.
+ ///
+ /// In some cases, this method will skip the OpLeave call and just call Disconnect(),
+ /// which not only leaves the room but also the server. Disconnect also triggers a leave and so that workflow is is quicker.
+ ///
+ /// If true, this player becomes inactive in the game and can return later (if PlayerTTL of the room is != 0).
+ /// WebFlag: Securely transmit the encrypted object AuthCookie to the web service in PathLeave webhook when available
+ /// If the current room could be left (impossible while not in a room).
+ public bool OpLeaveRoom(bool becomeInactive, bool sendAuthCookie = false)
+ {
+ if (!this.CheckIfOpCanBeSent(OperationCode.Leave, this.Server, "LeaveRoom"))
+ {
+ return false;
+ }
+
+ this.State = ClientState.Leaving;
+ this.GameServerAddress = String.Empty;
+ this.enterRoomParamsCache = null;
+ return this.LoadBalancingPeer.OpLeaveRoom(becomeInactive, sendAuthCookie);
+ }
+
+
+ /// Gets a list of rooms matching the (non empty) SQL filter for the given SQL-typed lobby.
+ ///
+ /// Operation is only available for lobbies of type SqlLobby and the filter can not be empty.
+ /// It will check those conditions and fail locally, returning false.
+ ///
+ /// This is an async request which triggers a OnOperationResponse() call.
+ ///
+ ///
+ /// The lobby to query. Has to be of type SqlLobby.
+ /// The sql query statement.
+ /// If the operation could be sent (has to be connected).
+ public bool OpGetGameList(TypedLobby typedLobby, string sqlLobbyFilter)
+ {
+ if (!this.CheckIfOpCanBeSent(OperationCode.GetGameList, this.Server, "GetGameList"))
+ {
+ return false;
+ }
+
+ if (string.IsNullOrEmpty(sqlLobbyFilter))
+ {
+ this.DebugReturn(DebugLevel.ERROR, "Operation GetGameList requires a filter.");
+ return false;
+ }
+ if (typedLobby.Type != LobbyType.SqlLobby)
+ {
+ this.DebugReturn(DebugLevel.ERROR, "Operation GetGameList can only be used for lobbies of type SqlLobby.");
+ return false;
+ }
+
+ return this.LoadBalancingPeer.OpGetGameList(typedLobby, sqlLobbyFilter);
+ }
+
+
+ ///
+ /// Updates and synchronizes a Player's Custom Properties. Optionally, expectedProperties can be provided as condition.
+ ///
+ ///
+ /// Custom Properties are a set of string keys and arbitrary values which is synchronized
+ /// for the players in a Room. They are available when the client enters the room, as
+ /// they are in the response of OpJoin and OpCreate.
+ ///
+ /// Custom Properties either relate to the (current) Room or a Player (in that Room).
+ ///
+ /// Both classes locally cache the current key/values and make them available as
+ /// property: CustomProperties. This is provided only to read them.
+ /// You must use the method SetCustomProperties to set/modify them.
+ ///
+ /// Any client can set any Custom Properties anytime (when in a room).
+ /// It's up to the game logic to organize how they are best used.
+ ///
+ /// You should call SetCustomProperties only with key/values that are new or changed. This reduces
+ /// traffic and performance.
+ ///
+ /// Unless you define some expectedProperties, setting key/values is always permitted.
+ /// In this case, the property-setting client will not receive the new values from the server but
+ /// instead update its local cache in SetCustomProperties.
+ ///
+ /// If you define expectedProperties, the server will skip updates if the server property-cache
+ /// does not contain all expectedProperties with the same values.
+ /// In this case, the property-setting client will get an update from the server and update it's
+ /// cached key/values at about the same time as everyone else.
+ ///
+ /// The benefit of using expectedProperties can be only one client successfully sets a key from
+ /// one known value to another.
+ /// As example: Store who owns an item in a Custom Property "ownedBy". It's 0 initally.
+ /// When multiple players reach the item, they all attempt to change "ownedBy" from 0 to their
+ /// actorNumber. If you use expectedProperties {"ownedBy", 0} as condition, the first player to
+ /// take the item will have it (and the others fail to set the ownership).
+ ///
+ /// Properties get saved with the game state for Turnbased games (which use IsPersistent = true).
+ ///
+ /// Defines which player the Custom Properties belong to. ActorID of a player.
+ /// Hashtable of Custom Properties that changes.
+ /// Provide some keys/values to use as condition for setting the new values. Client must be in room.
+ /// Defines if the set properties should be forwarded to a WebHook. Client must be in room.
+ ///
+ /// False if propertiesToSet is null or empty or have zero string keys.
+ /// If not in a room, returns true if local player and expectedProperties and webFlags are null.
+ /// False if actorNr is lower than or equal to zero.
+ /// Otherwise, returns if the operation could be sent to the server.
+ ///
+ public bool OpSetCustomPropertiesOfActor(int actorNr, Hashtable propertiesToSet, Hashtable expectedProperties = null, WebFlags webFlags = null)
+ {
+ if (propertiesToSet == null || propertiesToSet.Count == 0)
+ {
+ this.DebugReturn(DebugLevel.ERROR, "OpSetCustomPropertiesOfActor() failed. propertiesToSet must not be null nor empty.");
+ return false;
+ }
+
+ if (this.CurrentRoom == null)
+ {
+ // if you attempt to set this player's values without conditions, then fine:
+ if (expectedProperties == null && webFlags == null && this.LocalPlayer != null && this.LocalPlayer.ActorNumber == actorNr)
+ {
+ return this.LocalPlayer.SetCustomProperties(propertiesToSet);
+ }
+
+ if (this.LoadBalancingPeer.DebugOut >= DebugLevel.ERROR)
+ {
+ this.DebugReturn(DebugLevel.ERROR, "OpSetCustomPropertiesOfActor() failed. To use expectedProperties or webForward, you have to be in a room. State: " + this.State);
+ }
+ return false;
+ }
+
+ Hashtable customActorProperties = new Hashtable();
+ customActorProperties.MergeStringKeys(propertiesToSet);
+ if (customActorProperties.Count == 0)
+ {
+ this.DebugReturn(DebugLevel.ERROR, "OpSetCustomPropertiesOfActor() failed. Only string keys allowed for custom properties.");
+ return false;
+ }
+ return this.OpSetPropertiesOfActor(actorNr, customActorProperties, expectedProperties, webFlags);
+ }
+
+
+ /// Internally used to cache and set properties (including well known properties).
+ /// Requires being in a room (because this attempts to send an operation which will fail otherwise).
+ protected internal bool OpSetPropertiesOfActor(int actorNr, Hashtable actorProperties, Hashtable expectedProperties = null, WebFlags webFlags = null)
+ {
+ if (!this.CheckIfOpCanBeSent(OperationCode.SetProperties, this.Server, "SetProperties"))
+ {
+ return false;
+ }
+
+ if (actorProperties == null || actorProperties.Count == 0)
+ {
+ this.DebugReturn(DebugLevel.ERROR, "OpSetPropertiesOfActor() failed. actorProperties must not be null nor empty.");
+ return false;
+ }
+ bool res = this.LoadBalancingPeer.OpSetPropertiesOfActor(actorNr, actorProperties, expectedProperties, webFlags);
+ if (res && !this.CurrentRoom.BroadcastPropertiesChangeToAll && (expectedProperties == null || expectedProperties.Count == 0))
+ {
+ Player target = this.CurrentRoom.GetPlayer(actorNr);
+ if (target != null)
+ {
+ target.InternalCacheProperties(actorProperties);
+ this.InRoomCallbackTargets.OnPlayerPropertiesUpdate(target, actorProperties);
+ }
+ }
+ return res;
+ }
+
+
+ ///
+ /// Updates and synchronizes this Room's Custom Properties. Optionally, expectedProperties can be provided as condition.
+ ///
+ ///
+ /// Custom Properties are a set of string keys and arbitrary values which is synchronized
+ /// for the players in a Room. They are available when the client enters the room, as
+ /// they are in the response of OpJoin and OpCreate.
+ ///
+ /// Custom Properties either relate to the (current) Room or a Player (in that Room).
+ ///
+ /// Both classes locally cache the current key/values and make them available as
+ /// property: CustomProperties. This is provided only to read them.
+ /// You must use the method SetCustomProperties to set/modify them.
+ ///
+ /// Any client can set any Custom Properties anytime (when in a room).
+ /// It's up to the game logic to organize how they are best used.
+ ///
+ /// You should call SetCustomProperties only with key/values that are new or changed. This reduces
+ /// traffic and performance.
+ ///
+ /// Unless you define some expectedProperties, setting key/values is always permitted.
+ /// In this case, the property-setting client will not receive the new values from the server but
+ /// instead update its local cache in SetCustomProperties.
+ ///
+ /// If you define expectedProperties, the server will skip updates if the server property-cache
+ /// does not contain all expectedProperties with the same values.
+ /// In this case, the property-setting client will get an update from the server and update it's
+ /// cached key/values at about the same time as everyone else.
+ ///
+ /// The benefit of using expectedProperties can be only one client successfully sets a key from
+ /// one known value to another.
+ /// As example: Store who owns an item in a Custom Property "ownedBy". It's 0 initally.
+ /// When multiple players reach the item, they all attempt to change "ownedBy" from 0 to their
+ /// actorNumber. If you use expectedProperties {"ownedBy", 0} as condition, the first player to
+ /// take the item will have it (and the others fail to set the ownership).
+ ///
+ /// Properties get saved with the game state for Turnbased games (which use IsPersistent = true).
+ ///
+ /// Hashtable of Custom Properties that changes.
+ /// Provide some keys/values to use as condition for setting the new values.
+ /// Defines web flags for an optional PathProperties webhook.
+ ///
+ /// False if propertiesToSet is null or empty or have zero string keys.
+ /// Otherwise, returns if the operation could be sent to the server.
+ ///
+ public bool OpSetCustomPropertiesOfRoom(Hashtable propertiesToSet, Hashtable expectedProperties = null, WebFlags webFlags = null)
+ {
+ if (propertiesToSet == null || propertiesToSet.Count == 0)
+ {
+ this.DebugReturn(DebugLevel.ERROR, "OpSetCustomPropertiesOfRoom() failed. propertiesToSet must not be null nor empty.");
+ return false;
+ }
+ Hashtable customGameProps = new Hashtable();
+ customGameProps.MergeStringKeys(propertiesToSet);
+ if (customGameProps.Count == 0)
+ {
+ this.DebugReturn(DebugLevel.ERROR, "OpSetCustomPropertiesOfRoom() failed. Only string keys are allowed for custom properties.");
+ return false;
+ }
+ return this.OpSetPropertiesOfRoom(customGameProps, expectedProperties, webFlags);
+ }
+
+
+ protected internal bool OpSetPropertyOfRoom(byte propCode, object value)
+ {
+ Hashtable properties = new Hashtable();
+ properties[propCode] = value;
+ return this.OpSetPropertiesOfRoom(properties);
+ }
+
+ /// Internally used to cache and set properties (including well known properties).
+ /// Requires being in a room (because this attempts to send an operation which will fail otherwise).
+ protected internal bool OpSetPropertiesOfRoom(Hashtable gameProperties, Hashtable expectedProperties = null, WebFlags webFlags = null)
+ {
+ if (!this.CheckIfOpCanBeSent(OperationCode.SetProperties, this.Server, "SetProperties"))
+ {
+ return false;
+ }
+
+ if (gameProperties == null || gameProperties.Count == 0)
+ {
+ this.DebugReturn(DebugLevel.ERROR, "OpSetPropertiesOfRoom() failed. gameProperties must not be null nor empty.");
+ return false;
+ }
+ bool res = this.LoadBalancingPeer.OpSetPropertiesOfRoom(gameProperties, expectedProperties, webFlags);
+ if (res && !this.CurrentRoom.BroadcastPropertiesChangeToAll && (expectedProperties == null || expectedProperties.Count == 0))
+ {
+ this.CurrentRoom.InternalCacheProperties(gameProperties);
+ this.InRoomCallbackTargets.OnRoomPropertiesUpdate(gameProperties);
+ }
+ return res;
+ }
+
+
+ ///
+ /// Send an event with custom code/type and any content to the other players in the same room.
+ ///
+ /// Identifies this type of event (and the content). Your game's event codes can start with 0.
+ /// Any serializable datatype (including Hashtable like the other OpRaiseEvent overloads).
+ /// Contains used send options. If you pass null, the default options will be used.
+ /// Send options for reliable, encryption etc
+ /// If operation could be enqueued for sending. Sent when calling: Service or SendOutgoingCommands.
+ public virtual bool OpRaiseEvent(byte eventCode, object customEventContent, RaiseEventOptions raiseEventOptions, SendOptions sendOptions)
+ {
+ if (!this.CheckIfOpCanBeSent(OperationCode.RaiseEvent, this.Server, "RaiseEvent"))
+ {
+ return false;
+ }
+
+ return this.LoadBalancingPeer.OpRaiseEvent(eventCode, customEventContent, raiseEventOptions, sendOptions);
+ }
+
+
+
+ ///
+ /// Operation to handle this client's interest groups (for events in room).
+ ///
+ ///
+ /// Note the difference between passing null and byte[0]:
+ /// null won't add/remove any groups.
+ /// byte[0] will add/remove all (existing) groups.
+ /// First, removing groups is executed. This way, you could leave all groups and join only the ones provided.
+ ///
+ /// Changes become active not immediately but when the server executes this operation (approximately RTT/2).
+ ///
+ /// Groups to remove from interest. Null will not remove any. A byte[0] will remove all.
+ /// Groups to add to interest. Null will not add any. A byte[0] will add all current.
+ /// If operation could be enqueued for sending. Sent when calling: Service or SendOutgoingCommands.
+ public virtual bool OpChangeGroups(byte[] groupsToRemove, byte[] groupsToAdd)
+ {
+ if (!this.CheckIfOpCanBeSent(OperationCode.ChangeGroups, this.Server, "ChangeGroups"))
+ {
+ return false;
+ }
+
+ return this.LoadBalancingPeer.OpChangeGroups(groupsToRemove, groupsToAdd);
+ }
+
+
+ #endregion
+
+ #region Helpers
+
+ ///
+ /// Privately used to read-out properties coming from the server in events and operation responses (which might be a bit tricky).
+ ///
+ private void ReadoutProperties(Hashtable gameProperties, Hashtable actorProperties, int targetActorNr)
+ {
+ // read game properties and cache them locally
+ if (this.CurrentRoom != null && gameProperties != null)
+ {
+ this.CurrentRoom.InternalCacheProperties(gameProperties);
+ if (this.InRoom)
+ {
+ this.InRoomCallbackTargets.OnRoomPropertiesUpdate(gameProperties);
+ }
+ }
+
+ if (actorProperties != null && actorProperties.Count > 0)
+ {
+ if (targetActorNr > 0)
+ {
+ // we have a single entry in the actorProperties with one user's name
+ // targets MUST exist before you set properties
+ Player target = this.CurrentRoom.GetPlayer(targetActorNr);
+ if (target != null)
+ {
+ Hashtable props = this.ReadoutPropertiesForActorNr(actorProperties, targetActorNr);
+ target.InternalCacheProperties(props);
+ this.InRoomCallbackTargets.OnPlayerPropertiesUpdate(target, props);
+ }
+ }
+ else
+ {
+ // in this case, we've got a key-value pair per actor (each
+ // value is a hashtable with the actor's properties then)
+ int actorNr;
+ Hashtable props;
+ string newName;
+ Player target;
+
+ foreach (object key in actorProperties.Keys)
+ {
+ actorNr = (int)key;
+ if (actorNr == 0)
+ {
+ continue;
+ }
+
+ props = (Hashtable)actorProperties[key];
+ newName = (string)props[ActorProperties.PlayerName];
+
+ target = this.CurrentRoom.GetPlayer(actorNr);
+ if (target == null)
+ {
+ target = this.CreatePlayer(newName, actorNr, false, props);
+ this.CurrentRoom.StorePlayer(target);
+ }
+ target.InternalCacheProperties(props);
+ }
+ }
+ }
+ }
+
+
+ ///
+ /// Privately used only to read properties for a distinct actor (which might be the hashtable OR a key-pair value IN the actorProperties).
+ ///
+ private Hashtable ReadoutPropertiesForActorNr(Hashtable actorProperties, int actorNr)
+ {
+ if (actorProperties.ContainsKey(actorNr))
+ {
+ return (Hashtable)actorProperties[actorNr];
+ }
+
+ return actorProperties;
+ }
+
+ ///
+ /// Internally used to set the LocalPlayer's ID (from -1 to the actual in-room ID).
+ ///
+ /// New actor ID (a.k.a actorNr) assigned when joining a room.
+ public void ChangeLocalID(int newID)
+ {
+ if (this.LocalPlayer == null)
+ {
+ this.DebugReturn(DebugLevel.WARNING, string.Format("Local actor is null or not in mActors! mLocalActor: {0} mActors==null: {1} newID: {2}", this.LocalPlayer, this.CurrentRoom.Players == null, newID));
+ }
+
+ if (this.CurrentRoom == null)
+ {
+ // change to new actor/player ID and make sure the player does not have a room reference left
+ this.LocalPlayer.ChangeLocalID(newID);
+ this.LocalPlayer.RoomReference = null;
+ }
+ else
+ {
+ // remove old actorId from actor list
+ this.CurrentRoom.RemovePlayer(this.LocalPlayer);
+
+ // change to new actor/player ID
+ this.LocalPlayer.ChangeLocalID(newID);
+
+ // update the room's list with the new reference
+ this.CurrentRoom.StorePlayer(this.LocalPlayer);
+ }
+ }
+
+
+
+ ///
+ /// Called internally, when a game was joined or created on the game server successfully.
+ ///
+ ///
+ /// This reads the response, finds out the local player's actorNumber (a.k.a. Player.ID) and applies properties of the room and players.
+ /// Errors for these operations are to be handled before this method is called.
+ ///
+ /// Contains the server's response for an operation called by this peer.
+ private void GameEnteredOnGameServer(OperationResponse operationResponse)
+ {
+ this.CurrentRoom = this.CreateRoom(this.enterRoomParamsCache.RoomName, this.enterRoomParamsCache.RoomOptions);
+ this.CurrentRoom.LoadBalancingClient = this;
+
+ // first change the local id, instead of first updating the actorList since actorList uses ID to update itself
+
+ // the local player's actor-properties are not returned in join-result. add this player to the list
+ int localActorNr = (int)operationResponse[ParameterCode.ActorNr];
+ this.ChangeLocalID(localActorNr);
+
+ if (operationResponse.Parameters.ContainsKey(ParameterCode.ActorList))
+ {
+ int[] actorsInRoom = (int[])operationResponse.Parameters[ParameterCode.ActorList];
+ this.UpdatedActorList(actorsInRoom);
+ }
+
+
+ Hashtable actorProperties = (Hashtable)operationResponse[ParameterCode.PlayerProperties];
+ Hashtable gameProperties = (Hashtable)operationResponse[ParameterCode.GameProperties];
+ this.ReadoutProperties(gameProperties, actorProperties, 0);
+
+ object temp;
+ if (operationResponse.Parameters.TryGetValue(ParameterCode.RoomOptionFlags, out temp))
+ {
+ this.CurrentRoom.InternalCacheRoomFlags((int)temp);
+ }
+
+ this.State = ClientState.Joined;
+
+
+ // the callbacks OnCreatedRoom and OnJoinedRoom are called in the event join. it contains important info about the room and players.
+ // unless there will be no room events (RoomOptions.SuppressRoomEvents = true)
+ if (this.CurrentRoom.SuppressRoomEvents)
+ {
+ if (this.lastJoinType == JoinType.CreateRoom || (this.lastJoinType == JoinType.JoinOrCreateRoom && this.LocalPlayer.ActorNumber == 1))
+ {
+ this.MatchMakingCallbackTargets.OnCreatedRoom();
+ }
+
+ this.MatchMakingCallbackTargets.OnJoinedRoom();
+ }
+ }
+
+
+ private void UpdatedActorList(int[] actorsInGame)
+ {
+ if (actorsInGame != null)
+ {
+ foreach (int actorNumber in actorsInGame)
+ {
+ if (actorNumber == 0)
+ {
+ continue;
+ }
+
+ Player target = this.CurrentRoom.GetPlayer(actorNumber);
+ if (target == null)
+ {
+ this.CurrentRoom.StorePlayer(this.CreatePlayer(string.Empty, actorNumber, false, null));
+ }
+ }
+ }
+ }
+
+ ///
+ /// Factory method to create a player instance - override to get your own player-type with custom features.
+ ///
+ /// The name of the player to be created.
+ /// The player ID (a.k.a. actorNumber) of the player to be created.
+ /// Sets the distinction if the player to be created is your player or if its assigned to someone else.
+ /// The custom properties for this new player
+ /// The newly created player
+ protected internal virtual Player CreatePlayer(string actorName, int actorNumber, bool isLocal, Hashtable actorProperties)
+ {
+ Player newPlayer = new Player(actorName, actorNumber, isLocal, actorProperties);
+ return newPlayer;
+ }
+
+ /// Internal "factory" method to create a room-instance.
+ protected internal virtual Room CreateRoom(string roomName, RoomOptions opt)
+ {
+ Room r = new Room(roomName, opt);
+ return r;
+ }
+
+ private bool CheckIfOpAllowedOnServer(byte opCode, ServerConnection serverConnection)
+ {
+ switch (serverConnection)
+ {
+ case ServerConnection.MasterServer:
+ switch (opCode)
+ {
+ case OperationCode.CreateGame:
+ case OperationCode.Authenticate:
+ case OperationCode.AuthenticateOnce:
+ case OperationCode.FindFriends:
+ case OperationCode.GetGameList:
+ case OperationCode.GetLobbyStats:
+ case OperationCode.JoinGame:
+ case OperationCode.JoinLobby:
+ case OperationCode.LeaveLobby:
+ case OperationCode.WebRpc:
+ case OperationCode.ServerSettings:
+ case OperationCode.JoinRandomGame:
+ return true;
+ }
+ break;
+ case ServerConnection.GameServer:
+ switch (opCode)
+ {
+ case OperationCode.CreateGame:
+ case OperationCode.Authenticate:
+ case OperationCode.AuthenticateOnce:
+ case OperationCode.ChangeGroups:
+ case OperationCode.GetProperties:
+ case OperationCode.JoinGame:
+ case OperationCode.Leave:
+ case OperationCode.WebRpc:
+ case OperationCode.ServerSettings:
+ case OperationCode.SetProperties:
+ case OperationCode.RaiseEvent:
+ return true;
+ }
+ break;
+ case ServerConnection.NameServer:
+ switch (opCode)
+ {
+ case OperationCode.Authenticate:
+ case OperationCode.AuthenticateOnce:
+ case OperationCode.GetRegions:
+ case OperationCode.ServerSettings:
+ return true;
+ }
+ break;
+ default:
+ throw new ArgumentOutOfRangeException("serverConnection", serverConnection, null);
+ }
+ return false;
+ }
+
+ private bool CheckIfOpCanBeSent(byte opCode, ServerConnection serverConnection, string opName)
+ {
+ if (this.LoadBalancingPeer == null)
+ {
+ this.DebugReturn(DebugLevel.ERROR, string.Format("Operation {0} ({1}) can't be sent because peer is null", opName, opCode));
+ return false;
+ }
+
+ if (!this.CheckIfOpAllowedOnServer(opCode, serverConnection))
+ {
+ if (this.LoadBalancingPeer.DebugOut >= DebugLevel.ERROR)
+ {
+ this.DebugReturn(DebugLevel.ERROR, string.Format("Operation {0} ({1}) not allowed on current server ({2})", opName, opCode, serverConnection));
+ }
+ return false;
+ }
+
+ if (!this.CheckIfClientIsReadyToCallOperation(opCode))
+ {
+ DebugLevel levelToReport = DebugLevel.ERROR;
+ if (opCode == OperationCode.RaiseEvent && (this.State == ClientState.Leaving || this.State == ClientState.Disconnecting || this.State == ClientState.DisconnectingFromGameServer))
+ {
+ levelToReport = DebugLevel.INFO;
+ }
+
+ if (this.LoadBalancingPeer.DebugOut >= levelToReport)
+ {
+ this.DebugReturn(levelToReport, string.Format("Operation {0} ({1}) not called because client is not connected or not ready yet, client state: {2}", opName, opCode, Enum.GetName(typeof(ClientState), this.State)));
+ }
+
+ return false;
+ }
+
+ if (this.LoadBalancingPeer.PeerState != PeerStateValue.Connected)
+ {
+ this.DebugReturn(DebugLevel.ERROR, string.Format("Operation {0} ({1}) can't be sent because peer is not connected, peer state: {2}", opName, opCode, this.LoadBalancingPeer.PeerState));
+ return false;
+ }
+ return true;
+ }
+
+ private bool CheckIfClientIsReadyToCallOperation(byte opCode)
+ {
+ switch (opCode)
+ {
+ //case OperationCode.ServerSettings: // ??
+ //case OperationCode.WebRpc: // WebRPC works on MS and GS and I think it does not need the client to be ready
+
+ case OperationCode.Authenticate:
+ case OperationCode.AuthenticateOnce:
+ return this.IsConnectedAndReady ||
+ this.State == ClientState.ConnectingToNameServer || // this is required since we do not set state to ConnectedToNameServer before authentication
+ this.State == ClientState.ConnectingToMasterServer || // this is required since we do not set state to ConnectedToMasterServer before authentication
+ this.State == ClientState.ConnectingToGameServer; // this is required since we do not set state to ConnectedToGameServer before authentication
+
+ case OperationCode.ChangeGroups:
+ case OperationCode.GetProperties:
+ case OperationCode.SetProperties:
+ case OperationCode.RaiseEvent:
+ case OperationCode.Leave:
+ return this.InRoom;
+
+ case OperationCode.JoinGame:
+ case OperationCode.CreateGame:
+ return this.State == ClientState.ConnectedToMasterServer || this.InLobby || this.State == ClientState.ConnectedToGameServer; // CurrentRoom can be not null in case of quick rejoin
+
+ case OperationCode.LeaveLobby:
+ return this.InLobby;
+
+ case OperationCode.JoinRandomGame:
+ case OperationCode.FindFriends:
+ case OperationCode.GetGameList:
+ case OperationCode.GetLobbyStats: // do we need to be inside lobby to call this?
+ case OperationCode.JoinLobby: // You don't have to explicitly leave a lobby to join another (client can be in one max, at any time)
+ return this.State == ClientState.ConnectedToMasterServer || this.InLobby;
+ case OperationCode.GetRegions:
+ return this.State == ClientState.ConnectedToNameServer;
+ }
+ return this.IsConnected;
+ }
+
+ #endregion
+
+ #region Implementation of IPhotonPeerListener
+
+ /// Debug output of low level api (and this client).
+ /// This method is not responsible to keep up the state of a LoadBalancingClient. Calling base.DebugReturn on overrides is optional.
+ public virtual void DebugReturn(DebugLevel level, string message)
+ {
+ if (this.LoadBalancingPeer.DebugOut != DebugLevel.ALL && level > this.LoadBalancingPeer.DebugOut)
+ {
+ return;
+ }
+ #if !SUPPORTED_UNITY
+ Debug.WriteLine(message);
+ #else
+ if (level == DebugLevel.ERROR)
+ {
+ Debug.LogError(message);
+ }
+ else if (level == DebugLevel.WARNING)
+ {
+ Debug.LogWarning(message);
+ }
+ else if (level == DebugLevel.INFO)
+ {
+ Debug.Log(message);
+ }
+ else if (level == DebugLevel.ALL)
+ {
+ Debug.Log(message);
+ }
+ #endif
+ }
+
+ private void CallbackRoomEnterFailed(OperationResponse operationResponse)
+ {
+ if (operationResponse.ReturnCode != 0)
+ {
+ if (operationResponse.OperationCode == OperationCode.JoinGame)
+ {
+ this.MatchMakingCallbackTargets.OnJoinRoomFailed(operationResponse.ReturnCode, operationResponse.DebugMessage);
+ }
+ else if (operationResponse.OperationCode == OperationCode.CreateGame)
+ {
+ this.MatchMakingCallbackTargets.OnCreateRoomFailed(operationResponse.ReturnCode, operationResponse.DebugMessage);
+ }
+ else if (operationResponse.OperationCode == OperationCode.JoinRandomGame)
+ {
+ this.MatchMakingCallbackTargets.OnJoinRandomFailed(operationResponse.ReturnCode, operationResponse.DebugMessage);
+ }
+ }
+ }
+
+ ///
+ /// Uses the OperationResponses provided by the server to advance the internal state and call ops as needed.
+ ///
+ ///
+ /// When this method finishes, it will call your OnOpResponseAction (if any). This way, you can get any
+ /// operation response without overriding this class.
+ ///
+ /// To implement a more complex game/app logic, you should implement your own class that inherits the
+ /// LoadBalancingClient. Override this method to use your own operation-responses easily.
+ ///
+ /// This method is essential to update the internal state of a LoadBalancingClient, so overriding methods
+ /// must call base.OnOperationResponse().
+ ///
+ /// Contains the server's response for an operation called by this peer.
+ public virtual void OnOperationResponse(OperationResponse operationResponse)
+ {
+ // if (operationResponse.ReturnCode != 0) this.DebugReturn(DebugLevel.ERROR, operationResponse.ToStringFull());
+
+ // use the "secret" or "token" whenever we get it. doesn't really matter if it's in AuthResponse.
+ if (operationResponse.Parameters.ContainsKey(ParameterCode.Token))
+ {
+ if (this.AuthValues == null)
+ {
+ this.AuthValues = new AuthenticationValues();
+ //this.DebugReturn(DebugLevel.ERROR, "Server returned secret. Created AuthValues.");
+ }
+
+ this.AuthValues.Token = operationResponse.Parameters[ParameterCode.Token];
+ this.tokenCache = this.AuthValues.Token;
+ }
+
+ // if the operation limit was reached, disconnect (but still execute the operation response).
+ if (operationResponse.ReturnCode == ErrorCode.OperationLimitReached)
+ {
+ this.Disconnect(DisconnectCause.DisconnectByOperationLimit);
+ }
+
+ switch (operationResponse.OperationCode)
+ {
+ case OperationCode.Authenticate:
+ case OperationCode.AuthenticateOnce:
+ {
+ if (operationResponse.ReturnCode != 0)
+ {
+ this.DebugReturn(DebugLevel.ERROR, operationResponse.ToStringFull() + " Server: " + this.Server + " Address: " + this.LoadBalancingPeer.ServerAddress);
+
+ switch (operationResponse.ReturnCode)
+ {
+ case ErrorCode.InvalidAuthentication:
+ this.DisconnectedCause = DisconnectCause.InvalidAuthentication;
+ break;
+ case ErrorCode.CustomAuthenticationFailed:
+ this.DisconnectedCause = DisconnectCause.CustomAuthenticationFailed;
+ this.ConnectionCallbackTargets.OnCustomAuthenticationFailed(operationResponse.DebugMessage);
+ break;
+ case ErrorCode.InvalidRegion:
+ this.DisconnectedCause = DisconnectCause.InvalidRegion;
+ break;
+ case ErrorCode.MaxCcuReached:
+ this.DisconnectedCause = DisconnectCause.MaxCcuReached;
+ break;
+ case ErrorCode.InvalidOperation:
+ case ErrorCode.OperationNotAllowedInCurrentState:
+ this.DisconnectedCause = DisconnectCause.OperationNotAllowedInCurrentState;
+ break;
+ case ErrorCode.AuthenticationTicketExpired:
+ this.DisconnectedCause = DisconnectCause.AuthenticationTicketExpired;
+ break;
+ }
+
+ this.Disconnect(this.DisconnectedCause);
+ break; // if auth didn't succeed, we disconnect (above) and exit this operation's handling
+ }
+
+ if (this.Server == ServerConnection.NameServer || this.Server == ServerConnection.MasterServer)
+ {
+ if (operationResponse.Parameters.ContainsKey(ParameterCode.UserId))
+ {
+ string incomingId = (string)operationResponse.Parameters[ParameterCode.UserId];
+ if (!string.IsNullOrEmpty(incomingId))
+ {
+ this.UserId = incomingId;
+ this.LocalPlayer.UserId = incomingId;
+ this.DebugReturn(DebugLevel.INFO, string.Format("Received your UserID from server. Updating local value to: {0}", this.UserId));
+ }
+ }
+ if (operationResponse.Parameters.ContainsKey(ParameterCode.NickName))
+ {
+ this.NickName = (string)operationResponse.Parameters[ParameterCode.NickName];
+ this.DebugReturn(DebugLevel.INFO, string.Format("Received your NickName from server. Updating local value to: {0}", this.NickName));
+ }
+
+ if (operationResponse.Parameters.ContainsKey(ParameterCode.EncryptionData))
+ {
+ this.SetupEncryption((Dictionary)operationResponse.Parameters[ParameterCode.EncryptionData]);
+ }
+ }
+
+ if (this.Server == ServerConnection.NameServer)
+ {
+ string receivedCluster = operationResponse[ParameterCode.Cluster] as string;
+ if (!string.IsNullOrEmpty(receivedCluster))
+ {
+ this.CurrentCluster = receivedCluster;
+ }
+
+ // on the NameServer, authenticate returns the MasterServer address for a region and we hop off to there
+ this.MasterServerAddress = operationResponse[ParameterCode.Address] as string;
+ if (this.ServerPortOverrides.MasterServerPort != 0)
+ {
+ //Debug.LogWarning("Incoming MasterServer Address: "+this.MasterServerAddress);
+ this.MasterServerAddress = ReplacePortWithAlternative(this.MasterServerAddress, this.ServerPortOverrides.MasterServerPort);
+ //Debug.LogWarning("New MasterServer Address: "+this.MasterServerAddress);
+ }
+
+ if (this.AuthMode == AuthModeOption.AuthOnceWss && this.ExpectedProtocol != null)
+ {
+ this.DebugReturn(DebugLevel.INFO, string.Format("AuthOnceWss mode. Auth response switches TransportProtocol to ExpectedProtocol: {0}.", this.ExpectedProtocol));
+ this.LoadBalancingPeer.TransportProtocol = (ConnectionProtocol)this.ExpectedProtocol;
+ this.ExpectedProtocol = null;
+ }
+ this.DisconnectToReconnect();
+ }
+ else if (this.Server == ServerConnection.MasterServer)
+ {
+ this.State = ClientState.ConnectedToMasterServer;
+ if (this.failedRoomEntryOperation == null)
+ {
+ this.ConnectionCallbackTargets.OnConnectedToMaster();
+ }
+ else
+ {
+ this.CallbackRoomEnterFailed(this.failedRoomEntryOperation);
+ this.failedRoomEntryOperation = null;
+ }
+
+ if (this.AuthMode != AuthModeOption.Auth)
+ {
+ this.LoadBalancingPeer.OpSettings(this.EnableLobbyStatistics);
+ }
+ }
+ else if (this.Server == ServerConnection.GameServer)
+ {
+ this.State = ClientState.Joining;
+
+ if (this.enterRoomParamsCache.JoinMode == JoinMode.RejoinOnly)
+ {
+ this.enterRoomParamsCache.PlayerProperties = null;
+ }
+ else
+ {
+ Hashtable allProps = new Hashtable();
+ allProps.Merge(this.LocalPlayer.CustomProperties);
+
+ if (!string.IsNullOrEmpty(this.LocalPlayer.NickName))
+ {
+ allProps[ActorProperties.PlayerName] = this.LocalPlayer.NickName;
+ }
+
+ this.enterRoomParamsCache.PlayerProperties = allProps;
+ }
+
+ this.enterRoomParamsCache.OnGameServer = true;
+
+ if (this.lastJoinType == JoinType.JoinRoom || this.lastJoinType == JoinType.JoinRandomRoom || this.lastJoinType == JoinType.JoinRandomOrCreateRoom || this.lastJoinType == JoinType.JoinOrCreateRoom)
+ {
+ this.LoadBalancingPeer.OpJoinRoom(this.enterRoomParamsCache);
+ }
+ else if (this.lastJoinType == JoinType.CreateRoom)
+ {
+ this.LoadBalancingPeer.OpCreateRoom(this.enterRoomParamsCache);
+ }
+ break;
+ }
+
+ // optionally, OpAuth may return some data for the client to use. if it's available, call OnCustomAuthenticationResponse
+ Dictionary data = (Dictionary)operationResponse[ParameterCode.Data];
+ if (data != null)
+ {
+ this.ConnectionCallbackTargets.OnCustomAuthenticationResponse(data);
+ }
+ break;
+ }
+
+ case OperationCode.GetRegions:
+ // Debug.Log("GetRegions returned: " + operationResponse.ToStringFull());
+
+ if (operationResponse.ReturnCode == ErrorCode.InvalidAuthentication)
+ {
+ this.DebugReturn(DebugLevel.ERROR, string.Format("GetRegions failed. AppId is unknown on the (cloud) server. "+operationResponse.DebugMessage));
+ this.Disconnect(DisconnectCause.InvalidAuthentication);
+ break;
+ }
+ if (operationResponse.ReturnCode != ErrorCode.Ok)
+ {
+ this.DebugReturn(DebugLevel.ERROR, "GetRegions failed. Can't provide regions list. ReturnCode: " + operationResponse.ReturnCode + ": " + operationResponse.DebugMessage);
+ this.Disconnect(DisconnectCause.InvalidAuthentication);
+ break;
+ }
+ if (this.RegionHandler == null)
+ {
+ this.RegionHandler = new RegionHandler(this.ServerPortOverrides.MasterServerPort);
+ }
+
+ if (this.RegionHandler.IsPinging)
+ {
+ this.DebugReturn(DebugLevel.WARNING, "Received an response for OpGetRegions while the RegionHandler is pinging regions already. Skipping this response in favor of completing the current region-pinging.");
+ return; // in this particular case, we suppress the duplicate GetRegion response. we don't want a callback for this, cause there is a warning already.
+ }
+
+ this.RegionHandler.SetRegions(operationResponse);
+ this.ConnectionCallbackTargets.OnRegionListReceived(this.RegionHandler);
+
+ if (this.connectToBestRegion)
+ {
+ // ping minimal regions (if one is known) and connect
+ this.RegionHandler.PingMinimumOfRegions(this.OnRegionPingCompleted, this.bestRegionSummaryFromStorage);
+ }
+ break;
+
+ case OperationCode.JoinRandomGame: // this happens only on the master server. on gameserver this is a "regular" join
+ case OperationCode.CreateGame:
+ case OperationCode.JoinGame:
+
+ if (operationResponse.ReturnCode != 0)
+ {
+ if (this.Server == ServerConnection.GameServer)
+ {
+ this.failedRoomEntryOperation = operationResponse;
+ this.DisconnectToReconnect();
+ }
+ else
+ {
+ this.State = (this.InLobby) ? ClientState.JoinedLobby : ClientState.ConnectedToMasterServer;
+ this.CallbackRoomEnterFailed(operationResponse);
+ }
+ }
+ else
+ {
+ if (this.Server == ServerConnection.GameServer)
+ {
+ this.GameEnteredOnGameServer(operationResponse);
+ }
+ else
+ {
+ this.GameServerAddress = (string)operationResponse[ParameterCode.Address];
+ if (this.ServerPortOverrides.GameServerPort != 0)
+ {
+ //Debug.LogWarning("Incoming GameServer Address: " + this.GameServerAddress);
+ this.GameServerAddress = ReplacePortWithAlternative(this.GameServerAddress, this.ServerPortOverrides.GameServerPort);
+ //Debug.LogWarning("New GameServer Address: " + this.GameServerAddress);
+ }
+
+ string roomName = operationResponse[ParameterCode.RoomName] as string;
+ if (!string.IsNullOrEmpty(roomName))
+ {
+ this.enterRoomParamsCache.RoomName = roomName;
+ }
+
+ this.DisconnectToReconnect();
+ }
+ }
+ break;
+
+ case OperationCode.GetGameList:
+ if (operationResponse.ReturnCode != 0)
+ {
+ this.DebugReturn(DebugLevel.ERROR, "GetGameList failed: " + operationResponse.ToStringFull());
+ break;
+ }
+
+ List _RoomInfoList = new List();
+
+ Hashtable games = (Hashtable)operationResponse[ParameterCode.GameList];
+ foreach (string gameName in games.Keys)
+ {
+ _RoomInfoList.Add(new RoomInfo(gameName, (Hashtable)games[gameName]));
+ }
+
+ this.LobbyCallbackTargets.OnRoomListUpdate(_RoomInfoList);
+ break;
+
+ case OperationCode.JoinLobby:
+ this.State = ClientState.JoinedLobby;
+ this.LobbyCallbackTargets.OnJoinedLobby();
+ break;
+
+ case OperationCode.LeaveLobby:
+ this.State = ClientState.ConnectedToMasterServer;
+ this.LobbyCallbackTargets.OnLeftLobby();
+ break;
+
+ case OperationCode.Leave:
+ this.DisconnectToReconnect();
+ break;
+
+ case OperationCode.FindFriends:
+ if (operationResponse.ReturnCode != 0)
+ {
+ this.DebugReturn(DebugLevel.ERROR, "OpFindFriends failed: " + operationResponse.ToStringFull());
+ this.friendListRequested = null;
+ break;
+ }
+
+ bool[] onlineList = operationResponse[ParameterCode.FindFriendsResponseOnlineList] as bool[];
+ string[] roomList = operationResponse[ParameterCode.FindFriendsResponseRoomIdList] as string[];
+
+ //if (onlineList == null || roomList == null || this.friendListRequested == null || onlineList.Length != this.friendListRequested.Length)
+ //{
+ // // TODO: Check if we should handle this case better / more extensively
+ // this.DebugReturn(DebugLevel.ERROR, "OpFindFriends failed. Some list is not set. OpResponse: " + operationResponse.ToStringFull());
+ // this.friendListRequested = null;
+ // this.isFetchingFriendList = false;
+ // break;
+ //}
+
+ List friendList = new List(this.friendListRequested.Length);
+ for (int index = 0; index < this.friendListRequested.Length; index++)
+ {
+ FriendInfo friend = new FriendInfo();
+ friend.UserId = this.friendListRequested[index];
+ friend.Room = roomList[index];
+ friend.IsOnline = onlineList[index];
+ friendList.Insert(index, friend);
+ }
+
+ this.friendListRequested = null;
+
+ this.MatchMakingCallbackTargets.OnFriendListUpdate(friendList);
+ break;
+
+ case OperationCode.WebRpc:
+ this.WebRpcCallbackTargets.OnWebRpcResponse(operationResponse);
+ break;
+ }
+
+ if (this.OpResponseReceived != null) this.OpResponseReceived(operationResponse);
+ }
+
+ ///
+ /// Uses the connection's statusCodes to advance the internal state and call operations as needed.
+ ///
+ /// This method is essential to update the internal state of a LoadBalancingClient. Overriding methods must call base.OnStatusChanged.
+ public virtual void OnStatusChanged(StatusCode statusCode)
+ {
+ switch (statusCode)
+ {
+ case StatusCode.Connect:
+ if (this.State == ClientState.ConnectingToNameServer)
+ {
+ if (this.LoadBalancingPeer.DebugOut >= DebugLevel.ALL)
+ {
+ this.DebugReturn(DebugLevel.ALL, "Connected to nameserver.");
+ }
+
+ this.Server = ServerConnection.NameServer;
+ if (this.AuthValues != null)
+ {
+ this.AuthValues.Token = null; // when connecting to NameServer, invalidate the secret (only)
+ }
+ }
+
+ if (this.State == ClientState.ConnectingToGameServer)
+ {
+ if (this.LoadBalancingPeer.DebugOut >= DebugLevel.ALL)
+ {
+ this.DebugReturn(DebugLevel.ALL, "Connected to gameserver.");
+ }
+
+ this.Server = ServerConnection.GameServer;
+ }
+
+ if (this.State == ClientState.ConnectingToMasterServer)
+ {
+ if (this.LoadBalancingPeer.DebugOut >= DebugLevel.ALL)
+ {
+ this.DebugReturn(DebugLevel.ALL, "Connected to masterserver.");
+ }
+
+ this.Server = ServerConnection.MasterServer;
+ this.ConnectionCallbackTargets.OnConnected(); // if initial connect
+ }
+
+
+ if (this.LoadBalancingPeer.TransportProtocol != ConnectionProtocol.WebSocketSecure)
+ {
+ if (this.Server == ServerConnection.NameServer || this.AuthMode == AuthModeOption.Auth)
+ {
+ this.LoadBalancingPeer.EstablishEncryption();
+ }
+ }
+ else
+ {
+ goto case StatusCode.EncryptionEstablished;
+ }
+
+ break;
+
+ case StatusCode.EncryptionEstablished:
+ if (this.Server == ServerConnection.NameServer)
+ {
+ this.State = ClientState.ConnectedToNameServer;
+
+ // if there is no specific region to connect to, get available regions from the Name Server. the result triggers next actions in workflow
+ if (string.IsNullOrEmpty(this.CloudRegion))
+ {
+ this.OpGetRegions();
+ break;
+ }
+ }
+ else
+ {
+ // auth AuthOnce, no explicit authentication is needed on Master Server and Game Server. this is done via token, so: break
+ if (this.AuthMode == AuthModeOption.AuthOnce || this.AuthMode == AuthModeOption.AuthOnceWss)
+ {
+ break;
+ }
+ }
+
+ // authenticate in all other cases (using the CloudRegion, if available)
+ bool authenticating = this.CallAuthenticate();
+ if (authenticating)
+ {
+ this.State = ClientState.Authenticating;
+ }
+ else
+ {
+ this.DebugReturn(DebugLevel.ERROR, "OpAuthenticate failed. Check log output and AuthValues. State: " + this.State);
+ }
+ break;
+
+ case StatusCode.Disconnect:
+ // disconnect due to connection exception is handled below (don't connect to GS or master in that case)
+ this.friendListRequested = null;
+
+ bool wasInRoom = this.CurrentRoom != null;
+ this.CurrentRoom = null; // players get cleaned up inside this, too, except LocalPlayer (which we keep)
+ this.ChangeLocalID(-1); // depends on this.CurrentRoom, so it must be called after updating that
+
+ if (this.Server == ServerConnection.GameServer && wasInRoom)
+ {
+ this.MatchMakingCallbackTargets.OnLeftRoom();
+ }
+
+ if (this.ExpectedProtocol != null && this.LoadBalancingPeer.TransportProtocol != this.ExpectedProtocol)
+ {
+ this.DebugReturn(DebugLevel.INFO, string.Format("On disconnect switches TransportProtocol to ExpectedProtocol: {0}.", this.ExpectedProtocol));
+ this.LoadBalancingPeer.TransportProtocol = (ConnectionProtocol)this.ExpectedProtocol;
+ this.ExpectedProtocol = null;
+ }
+
+ switch (this.State)
+ {
+ case ClientState.ConnectWithFallbackProtocol:
+ this.EnableProtocolFallback = false; // the client does a fallback only one time
+ this.LoadBalancingPeer.TransportProtocol = (this.LoadBalancingPeer.TransportProtocol == ConnectionProtocol.Tcp) ? ConnectionProtocol.Udp : ConnectionProtocol.Tcp;
+ this.NameServerPortInAppSettings = 0; // this does not affect the ServerSettings file, just a variable at runtime
+ this.ServerPortOverrides = new PhotonPortDefinition(); // use default ports for the fallback
+
+ if (!this.LoadBalancingPeer.Connect(this.NameServerAddress, this.ProxyServerAddress, this.AppId, this.TokenForInit))
+ {
+ return;
+ }
+ this.State = ClientState.ConnectingToNameServer;
+ break;
+ case ClientState.PeerCreated:
+ case ClientState.Disconnecting:
+ if (this.AuthValues != null)
+ {
+ this.AuthValues.Token = null; // when leaving the server, invalidate the secret (but not the auth values)
+ }
+ this.State = ClientState.Disconnected;
+ this.ConnectionCallbackTargets.OnDisconnected(this.DisconnectedCause);
+ break;
+
+ case ClientState.DisconnectingFromGameServer:
+ case ClientState.DisconnectingFromNameServer:
+ this.ConnectToMasterServer(); // this gets the client back to the Master Server
+ break;
+
+ case ClientState.DisconnectingFromMasterServer:
+ this.Connect(this.GameServerAddress, this.ProxyServerAddress, ServerConnection.GameServer); // this connects the client with the Game Server (when joining/creating a room)
+ break;
+
+ case ClientState.Disconnected:
+ // this client is already Disconnected, so no further action is needed.
+ // this.DebugReturn(DebugLevel.INFO, "LBC.OnStatusChanged(Disconnect) this.State: " + this.State + ". Server: " + this.Server);
+ break;
+
+ default:
+ string stacktrace = "";
+ #if DEBUG && !NETFX_CORE
+ stacktrace = new System.Diagnostics.StackTrace(true).ToString();
+ #endif
+ this.DebugReturn(DebugLevel.WARNING, "Got a unexpected Disconnect in LoadBalancingClient State: " + this.State + ". Server: " + this.Server + " Trace: " + stacktrace);
+
+ if (this.AuthValues != null)
+ {
+ this.AuthValues.Token = null; // when leaving the server, invalidate the secret (but not the auth values)
+ }
+ this.State = ClientState.Disconnected;
+ this.ConnectionCallbackTargets.OnDisconnected(this.DisconnectedCause);
+ break;
+ }
+ break;
+
+ case StatusCode.DisconnectByServerUserLimit:
+ this.DebugReturn(DebugLevel.ERROR, "This connection was rejected due to the apps CCU limit.");
+ this.DisconnectedCause = DisconnectCause.MaxCcuReached;
+ this.State = ClientState.Disconnecting;
+ break;
+ case StatusCode.DnsExceptionOnConnect:
+ this.DisconnectedCause = DisconnectCause.DnsExceptionOnConnect;
+ this.State = ClientState.Disconnecting;
+ break;
+ case StatusCode.ServerAddressInvalid:
+ this.DisconnectedCause = DisconnectCause.ServerAddressInvalid;
+ this.State = ClientState.Disconnecting;
+ break;
+ case StatusCode.ExceptionOnConnect:
+ case StatusCode.SecurityExceptionOnConnect:
+ case StatusCode.EncryptionFailedToEstablish:
+ this.DisconnectedCause = DisconnectCause.ExceptionOnConnect;
+
+ // if enabled, the client can attempt to connect with another networking-protocol to check if that connects
+ if (this.EnableProtocolFallback && this.State == ClientState.ConnectingToNameServer)
+ {
+ this.State = ClientState.ConnectWithFallbackProtocol;
+ }
+ else
+ {
+ this.State = ClientState.Disconnecting;
+ }
+ break;
+ case StatusCode.Exception:
+ case StatusCode.ExceptionOnReceive:
+ case StatusCode.SendError:
+ this.DisconnectedCause = DisconnectCause.Exception;
+ this.State = ClientState.Disconnecting;
+ break;
+ case StatusCode.DisconnectByServerTimeout:
+ this.DisconnectedCause = DisconnectCause.ServerTimeout;
+ this.State = ClientState.Disconnecting;
+ break;
+ case StatusCode.DisconnectByServerLogic:
+ this.DisconnectedCause = DisconnectCause.DisconnectByServerLogic;
+ this.State = ClientState.Disconnecting;
+ break;
+ case StatusCode.DisconnectByServerReasonUnknown:
+ this.DisconnectedCause = DisconnectCause.DisconnectByServerReasonUnknown;
+ this.State = ClientState.Disconnecting;
+ break;
+ case StatusCode.TimeoutDisconnect:
+ this.DisconnectedCause = DisconnectCause.ClientTimeout;
+
+ // if enabled, the client can attempt to connect with another networking-protocol to check if that connects
+ if (this.EnableProtocolFallback && this.State == ClientState.ConnectingToNameServer)
+ {
+ this.State = ClientState.ConnectWithFallbackProtocol;
+ }
+ else
+ {
+ this.State = ClientState.Disconnecting;
+ }
+ break;
+ }
+ }
+
+
+ ///
+ /// Uses the photonEvent's provided by the server to advance the internal state and call ops as needed.
+ ///
+ /// This method is essential to update the internal state of a LoadBalancingClient. Overriding methods must call base.OnEvent.
+ public virtual void OnEvent(EventData photonEvent)
+ {
+ int actorNr = photonEvent.Sender;
+ Player originatingPlayer = (this.CurrentRoom != null) ? this.CurrentRoom.GetPlayer(actorNr) : null;
+
+ switch (photonEvent.Code)
+ {
+ case EventCode.GameList:
+ case EventCode.GameListUpdate:
+ List _RoomInfoList = new List();
+
+ Hashtable games = (Hashtable)photonEvent[ParameterCode.GameList];
+ foreach (string gameName in games.Keys)
+ {
+ _RoomInfoList.Add(new RoomInfo(gameName, (Hashtable)games[gameName]));
+ }
+
+ this.LobbyCallbackTargets.OnRoomListUpdate(_RoomInfoList);
+
+ break;
+
+ case EventCode.Join:
+ Hashtable actorProperties = (Hashtable)photonEvent[ParameterCode.PlayerProperties];
+
+ if (originatingPlayer == null)
+ {
+ if (actorNr > 0)
+ {
+ originatingPlayer = this.CreatePlayer(string.Empty, actorNr, false, actorProperties);
+ this.CurrentRoom.StorePlayer(originatingPlayer);
+ }
+ }
+ else
+ {
+ originatingPlayer.InternalCacheProperties(actorProperties);
+ originatingPlayer.IsInactive = false;
+ originatingPlayer.HasRejoined = actorNr != this.LocalPlayer.ActorNumber; // event is for non-local player, who is known (by ActorNumber), so it's a returning player
+ }
+
+ if (actorNr == this.LocalPlayer.ActorNumber)
+ {
+ // in this player's own join event, we get a complete list of players in the room, so check if we know each of the
+ int[] actorsInRoom = (int[])photonEvent[ParameterCode.ActorList];
+ this.UpdatedActorList(actorsInRoom);
+
+ // any operation that does a "rejoin" will set this value to true. this can indicate if the local player returns to a room.
+ originatingPlayer.HasRejoined = this.enterRoomParamsCache.JoinMode == JoinMode.RejoinOnly;
+
+ // joinWithCreateOnDemand can turn an OpJoin into creating the room. Then actorNumber is 1 and callback: OnCreatedRoom()
+ if (this.lastJoinType == JoinType.CreateRoom || (this.lastJoinType == JoinType.JoinOrCreateRoom && this.LocalPlayer.ActorNumber == 1))
+ {
+ this.MatchMakingCallbackTargets.OnCreatedRoom();
+ }
+
+ this.MatchMakingCallbackTargets.OnJoinedRoom();
+ }
+ else
+ {
+ this.InRoomCallbackTargets.OnPlayerEnteredRoom(originatingPlayer);
+ }
+ break;
+
+ case EventCode.Leave:
+ if (originatingPlayer != null)
+ {
+ bool isInactive = false;
+ if (photonEvent.Parameters.ContainsKey(ParameterCode.IsInactive))
+ {
+ isInactive = (bool)photonEvent.Parameters[ParameterCode.IsInactive];
+ }
+
+ if (isInactive)
+ {
+ originatingPlayer.IsInactive = true;
+ }
+ else
+ {
+ originatingPlayer.IsInactive = false;
+ this.CurrentRoom.RemovePlayer(actorNr);
+ }
+ }
+
+ if (photonEvent.Parameters.ContainsKey(ParameterCode.MasterClientId))
+ {
+ int newMaster = (int)photonEvent[ParameterCode.MasterClientId];
+ if (newMaster != 0)
+ {
+ this.CurrentRoom.masterClientId = newMaster;
+ this.InRoomCallbackTargets.OnMasterClientSwitched(this.CurrentRoom.GetPlayer(newMaster));
+ }
+ }
+ // finally, send notification that a player left
+ this.InRoomCallbackTargets.OnPlayerLeftRoom(originatingPlayer);
+ break;
+
+ case EventCode.PropertiesChanged:
+ // whenever properties are sent in-room, they can be broadcasted as event (which we handle here)
+ // we get PLAYERproperties if actorNr > 0 or ROOMproperties if actorNumber is not set or 0
+ int targetActorNr = 0;
+ if (photonEvent.Parameters.ContainsKey(ParameterCode.TargetActorNr))
+ {
+ targetActorNr = (int)photonEvent[ParameterCode.TargetActorNr];
+ }
+
+ Hashtable gameProperties = null;
+ Hashtable actorProps = null;
+ if (targetActorNr == 0)
+ {
+ gameProperties = (Hashtable)photonEvent[ParameterCode.Properties];
+ }
+ else
+ {
+ actorProps = (Hashtable)photonEvent[ParameterCode.Properties];
+ }
+
+ this.ReadoutProperties(gameProperties, actorProps, targetActorNr);
+ break;
+
+ case EventCode.AppStats:
+ // only the master server sends these in (1 minute) intervals
+ this.PlayersInRoomsCount = (int)photonEvent[ParameterCode.PeerCount];
+ this.RoomsCount = (int)photonEvent[ParameterCode.GameCount];
+ this.PlayersOnMasterCount = (int)photonEvent[ParameterCode.MasterPeerCount];
+ break;
+
+ case EventCode.LobbyStats:
+ string[] names = photonEvent[ParameterCode.LobbyName] as string[];
+ int[] peers = photonEvent[ParameterCode.PeerCount] as int[];
+ int[] rooms = photonEvent[ParameterCode.GameCount] as int[];
+
+ byte[] types;
+ ByteArraySlice slice = photonEvent[ParameterCode.LobbyType] as ByteArraySlice;
+ bool useByteArraySlice = slice != null;
+
+ if (useByteArraySlice)
+ {
+ types = slice.Buffer;
+ }
+ else
+ {
+ types = photonEvent[ParameterCode.LobbyType] as byte[];
+ }
+
+ this.lobbyStatistics.Clear();
+ for (int i = 0; i < names.Length; i++)
+ {
+ TypedLobbyInfo info = new TypedLobbyInfo();
+ info.Name = names[i];
+ info.Type = (LobbyType)types[i];
+ info.PlayerCount = peers[i];
+ info.RoomCount = rooms[i];
+
+ this.lobbyStatistics.Add(info);
+ }
+
+ if (useByteArraySlice)
+ {
+ slice.Release();
+ }
+
+ this.LobbyCallbackTargets.OnLobbyStatisticsUpdate(this.lobbyStatistics);
+ break;
+
+ case EventCode.ErrorInfo:
+ this.ErrorInfoCallbackTargets.OnErrorInfo(new ErrorInfo(photonEvent));
+ break;
+
+ case EventCode.AuthEvent:
+ if (this.AuthValues == null)
+ {
+ this.AuthValues = new AuthenticationValues();
+ }
+
+ this.AuthValues.Token = photonEvent[ParameterCode.Token];
+ this.tokenCache = this.AuthValues.Token;
+ break;
+
+ }
+
+ this.UpdateCallbackTargets();
+ if (this.EventReceived != null)
+ {
+ this.EventReceived(photonEvent);
+ }
+ }
+
+ /// In Photon 4, "raw messages" will get their own callback method in the interface. Not used yet.
+ public virtual void OnMessage(object message)
+ {
+ this.DebugReturn(DebugLevel.ALL, string.Format("got OnMessage {0}", message));
+ }
+
+ #endregion
+
+
+ private void OnDisconnectMessageReceived(DisconnectMessage obj)
+ {
+ this.DebugReturn(DebugLevel.ERROR, string.Format("Got DisconnectMessage. Code: {0} Msg: \"{1}\". Debug Info: {2}", obj.Code, obj.DebugMessage, obj.Parameters.ToStringFull()));
+ this.Disconnect(DisconnectCause.DisconnectByDisconnectMessage);
+ }
+
+
+ /// A callback of the RegionHandler, provided in OnRegionListReceived.
+ /// The regionHandler wraps up best region and other region relevant info.
+ private void OnRegionPingCompleted(RegionHandler regionHandler)
+ {
+ //Debug.Log("OnRegionPingCompleted " + regionHandler.BestRegion);
+ //Debug.Log("RegionPingSummary: " + regionHandler.SummaryToCache);
+ this.SummaryToCache = regionHandler.SummaryToCache;
+ this.ConnectToRegionMaster(regionHandler.BestRegion.Code);
+ }
+
+
+ protected internal static string ReplacePortWithAlternative(string address, ushort replacementPort)
+ {
+ bool webSocket = address.StartsWith("ws");
+ if (webSocket)
+ {
+ UriBuilder urib = new UriBuilder(address);
+ urib.Port = replacementPort;
+ return urib.ToString();
+ }
+ else
+ {
+ UriBuilder urib = new UriBuilder(string.Format("scheme://{0}", address));
+ return string.Format("{0}:{1}", urib.Host, replacementPort);
+ }
+ }
+
+ private void SetupEncryption(Dictionary encryptionData)
+ {
+ var mode = (EncryptionMode)(byte)encryptionData[EncryptionDataParameters.Mode];
+ switch (mode)
+ {
+ case EncryptionMode.PayloadEncryption:
+ byte[] encryptionSecret = (byte[])encryptionData[EncryptionDataParameters.Secret1];
+ this.LoadBalancingPeer.InitPayloadEncryption(encryptionSecret);
+ break;
+ case EncryptionMode.DatagramEncryption:
+ case EncryptionMode.DatagramEncryptionRandomSequence:
+ {
+ byte[] secret1 = (byte[])encryptionData[EncryptionDataParameters.Secret1];
+ byte[] secret2 = (byte[])encryptionData[EncryptionDataParameters.Secret2];
+ this.LoadBalancingPeer.InitDatagramEncryption(secret1, secret2, mode == EncryptionMode.DatagramEncryptionRandomSequence);
+ }
+ break;
+ case EncryptionMode.DatagramEncryptionGCM:
+ {
+ byte[] secret1 = (byte[])encryptionData[EncryptionDataParameters.Secret1];
+ this.LoadBalancingPeer.InitDatagramEncryption(secret1, null, true, true);
+ }
+ break;
+ default:
+ throw new ArgumentOutOfRangeException();
+ }
+ }
+
+
+
+ ///
+ /// This operation makes Photon call your custom web-service by path/name with the given parameters (converted into Json).
+ /// Use as a callback.
+ ///
+ ///
+ /// A WebRPC calls a custom, http-based function on a server you provide. The uriPath is relative to a "base path"
+ /// which is configured server-side. The sent parameters get converted from C# types to Json. Vice versa, the response
+ /// of the web-service will be converted to C# types and sent back as normal operation response.
+ ///
+ /// To use this feature, you have to setup your server:
+ ///
+ /// For a Photon Cloud application,
+ /// visit the Dashboard and setup "WebHooks". The BaseUrl is used for WebRPCs as well.
+ ///
+ /// The class is a helper-class that extracts the most valuable content from the WebRPC
+ /// response.
+ ///
+ /// The url path to call, relative to the baseUrl configured on Photon's server-side.
+ /// The parameters to send to the web-service method.
+ /// Defines if the authentication cookie gets sent to a WebHook (if setup).
+ public bool OpWebRpc(string uriPath, object parameters, bool sendAuthCookie = false)
+ {
+ if (string.IsNullOrEmpty(uriPath))
+ {
+ this.DebugReturn(DebugLevel.ERROR, "WebRPC method name must not be null nor empty.");
+ return false;
+ }
+ if (!this.CheckIfOpCanBeSent(OperationCode.WebRpc, this.Server, "WebRpc"))
+ {
+ return false;
+ }
+ Dictionary opParameters = new Dictionary();
+ opParameters.Add(ParameterCode.UriPath, uriPath);
+ if (parameters != null)
+ {
+ opParameters.Add(ParameterCode.WebRpcParameters, parameters);
+ }
+ if (sendAuthCookie)
+ {
+ opParameters.Add(ParameterCode.EventForward, WebFlags.SendAuthCookieConst);
+ }
+
+ //return this.LoadBalancingPeer.OpCustom(OperationCode.WebRpc, opParameters, true);
+ return this.LoadBalancingPeer.SendOperation(OperationCode.WebRpc, opParameters, SendOptions.SendReliable);
+ }
+
+
+ ///
+ /// Registers an object for callbacks for the implemented callback-interfaces.
+ ///
+ ///
+ /// Adding and removing callback targets is queued to not mess with callbacks in execution.
+ /// Internally, this means that the addition/removal is done before the LoadBalancingClient
+ /// calls the next callbacks. This detail should not affect a game's workflow.
+ ///
+ /// The covered callback interfaces are: IConnectionCallbacks, IMatchmakingCallbacks,
+ /// ILobbyCallbacks, IInRoomCallbacks, IOnEventCallback and IWebRpcCallback.
+ ///
+ /// See:
+ ///
+ /// The object that registers to get callbacks from this client.
+ public void AddCallbackTarget(object target)
+ {
+ this.callbackTargetChanges.Enqueue(new CallbackTargetChange(target, true));
+ }
+
+ ///
+ /// Unregisters an object from callbacks for the implemented callback-interfaces.
+ ///
+ ///
+ /// Adding and removing callback targets is queued to not mess with callbacks in execution.
+ /// Internally, this means that the addition/removal is done before the LoadBalancingClient
+ /// calls the next callbacks. This detail should not affect a game's workflow.
+ ///
+ /// The covered callback interfaces are: IConnectionCallbacks, IMatchmakingCallbacks,
+ /// ILobbyCallbacks, IInRoomCallbacks, IOnEventCallback and IWebRpcCallback.
+ ///
+ /// See:
+ ///
+ /// The object that unregisters from getting callbacks.
+ public void RemoveCallbackTarget(object target)
+ {
+ this.callbackTargetChanges.Enqueue(new CallbackTargetChange(target, false));
+ }
+
+
+ ///
+ /// Applies queued callback cahnges from a queue to the actual containers. Will cause exceptions if used while callbacks execute.
+ ///
+ ///
+ /// There is no explicit check that this is not called during callbacks, however the implemented, private logic takes care of this.
+ ///
+ protected internal void UpdateCallbackTargets()
+ {
+ while (this.callbackTargetChanges.Count > 0)
+ {
+ CallbackTargetChange change = this.callbackTargetChanges.Dequeue();
+
+ if (change.AddTarget)
+ {
+ if (this.callbackTargets.Contains(change.Target))
+ {
+ //Debug.Log("UpdateCallbackTargets skipped adding a target, as the object is already registered. Target: " + change.Target);
+ continue;
+ }
+
+ this.callbackTargets.Add(change.Target);
+ }
+ else
+ {
+ if (!this.callbackTargets.Contains(change.Target))
+ {
+ //Debug.Log("UpdateCallbackTargets skipped removing a target, as the object is not registered. Target: " + change.Target);
+ continue;
+ }
+
+ this.callbackTargets.Remove(change.Target);
+ }
+
+ this.UpdateCallbackTarget(change, this.InRoomCallbackTargets);
+ this.UpdateCallbackTarget(change, this.ConnectionCallbackTargets);
+ this.UpdateCallbackTarget(change, this.MatchMakingCallbackTargets);
+ this.UpdateCallbackTarget(change, this.LobbyCallbackTargets);
+ this.UpdateCallbackTarget(change, this.WebRpcCallbackTargets);
+ this.UpdateCallbackTarget(change, this.ErrorInfoCallbackTargets);
+
+ IOnEventCallback onEventCallback = change.Target as IOnEventCallback;
+ if (onEventCallback != null)
+ {
+ if (change.AddTarget)
+ {
+ EventReceived += onEventCallback.OnEvent;
+ }
+ else
+ {
+ EventReceived -= onEventCallback.OnEvent;
+ }
+ }
+ }
+ }
+
+ /// Helper method to cast and apply a target per (interface) type.
+ /// Either of the interfaces for callbacks.
+ /// The queued change to apply (add or remove) some target.
+ /// The container that calls callbacks on it's list of targets.
+ private void UpdateCallbackTarget(CallbackTargetChange change, List container) where T : class
+ {
+ T target = change.Target as T;
+ if (target != null)
+ {
+ if (change.AddTarget)
+ {
+ container.Add(target);
+ }
+ else
+ {
+ container.Remove(target);
+ }
+ }
+ }
+ }
+
+
+ ///
+ /// Collection of "organizational" callbacks for the Realtime Api to cover: Connection and Regions.
+ ///
+ ///
+ /// Classes that implement this interface must be registered to get callbacks for various situations.
+ ///
+ /// To register for callbacks, call and pass the class implementing this interface
+ /// To stop getting callbacks, call and pass the class implementing this interface
+ ///
+ ///
+ /// \ingroup callbacks
+ public interface IConnectionCallbacks
+ {
+ ///
+ /// Called to signal that the "low level connection" got established but before the client can call operation on the server.
+ ///
+ ///
+ /// After the (low level transport) connection is established, the client will automatically send
+ /// the Authentication operation, which needs to get a response before the client can call other operations.
+ ///
+ /// Your logic should wait for either: OnRegionListReceived or OnConnectedToMaster.
+ ///
+ /// This callback is useful to detect if the server can be reached at all (technically).
+ /// Most often, it's enough to implement OnDisconnected(DisconnectCause cause) and check for the cause.
+ ///
+ /// This is not called for transitions from the masterserver to game servers.
+ ///
+ void OnConnected();
+
+ ///
+ /// Called when the client is connected to the Master Server and ready for matchmaking and other tasks.
+ ///
+ ///
+ /// The list of available rooms won't become available unless you join a lobby via LoadBalancingClient.OpJoinLobby.
+ /// You can join rooms and create them even without being in a lobby. The default lobby is used in that case.
+ ///
+ void OnConnectedToMaster();
+
+ ///
+ /// Called after disconnecting from the Photon server. It could be a failure or an explicit disconnect call
+ ///
+ ///
+ /// The reason for this disconnect is provided as DisconnectCause.
+ ///
+ void OnDisconnected(DisconnectCause cause);
+
+ ///
+ /// Called when the Name Server provided a list of regions for your title.
+ ///
+ ///
+ /// This callback is called as soon as the list is available. No pings were sent for Best Region selection yet.
+ /// If the client is set to connect to the Best Region (lowest ping), one or more regions get pinged.
+ /// Not all regions are pinged. As soon as the results are final, the client will connect to the best region,
+ /// so you can check the ping results when connected to the Master Server.
+ ///
+ /// Check the RegionHandler class description, to make use of the provided values.
+ ///
+ /// The currently used RegionHandler.
+ void OnRegionListReceived(RegionHandler regionHandler);
+
+
+ ///
+ /// Called when your Custom Authentication service responds with additional data.
+ ///
+ ///
+ /// Custom Authentication services can include some custom data in their response.
+ /// When present, that data is made available in this callback as Dictionary.
+ /// While the keys of your data have to be strings, the values can be either string or a number (in Json).
+ /// You need to make extra sure, that the value type is the one you expect. Numbers become (currently) int64.
+ ///
+ /// Example: void OnCustomAuthenticationResponse(Dictionary<string, object> data) { ... }
+ ///
+ ///
+ void OnCustomAuthenticationResponse(Dictionary data);
+
+ ///
+ /// Called when the custom authentication failed. Followed by disconnect!
+ ///
+ ///
+ /// Custom Authentication can fail due to user-input, bad tokens/secrets.
+ /// If authentication is successful, this method is not called. Implement OnJoinedLobby() or OnConnectedToMaster() (as usual).
+ ///
+ /// During development of a game, it might also fail due to wrong configuration on the server side.
+ /// In those cases, logging the debugMessage is very important.
+ ///
+ /// Unless you setup a custom authentication service for your app (in the [Dashboard](https://dashboard.photonengine.com)),
+ /// this won't be called!
+ ///
+ /// Contains a debug message why authentication failed. This has to be fixed during development.
+ void OnCustomAuthenticationFailed(string debugMessage);
+
+ }
+
+
+ ///
+ /// Collection of "organizational" callbacks for the Realtime Api to cover the Lobby.
+ ///
+ ///
+ /// Classes that implement this interface must be registered to get callbacks for various situations.
+ ///
+ /// To register for callbacks, call and pass the class implementing this interface
+ /// To stop getting callbacks, call and pass the class implementing this interface
+ ///
+ ///
+ /// \ingroup callbacks
+ public interface ILobbyCallbacks
+ {
+
+ ///
+ /// Called on entering a lobby on the Master Server. The actual room-list updates will call OnRoomListUpdate.
+ ///
+ ///
+ /// While in the lobby, the roomlist is automatically updated in fixed intervals (which you can't modify in the public cloud).
+ /// The room list gets available via OnRoomListUpdate.
+ ///
+ void OnJoinedLobby();
+
+ ///
+ /// Called after leaving a lobby.
+ ///
+ ///
+ /// When you leave a lobby, [OpCreateRoom](@ref OpCreateRoom) and [OpJoinRandomRoom](@ref OpJoinRandomRoom)
+ /// automatically refer to the default lobby.
+ ///
+ void OnLeftLobby();
+
+ ///
+ /// Called for any update of the room-listing while in a lobby (InLobby) on the Master Server.
+ ///
+ ///
+ /// Each item is a RoomInfo which might include custom properties (provided you defined those as lobby-listed when creating a room).
+ /// Not all types of lobbies provide a listing of rooms to the client. Some are silent and specialized for server-side matchmaking.
+ ///
+ /// The list is sorted using two criteria: open or closed, full or not. So the list is composed of three groups, in this order:
+ ///
+ /// first group: open and not full (joinable).
+ /// second group: full but not closed (not joinable).
+ /// third group: closed (not joinable, could be full or not).
+ ///
+ /// In each group, entries do not have any particular order (random).
+ ///
+ /// The list of rooms (or rooms' updates) is also limited in number, see Lobby Limits.
+ ///
+ void OnRoomListUpdate(List roomList);
+
+ ///
+ /// Called when the Master Server sent an update for the Lobby Statistics.
+ ///
+ ///
+ /// This callback has two preconditions:
+ /// EnableLobbyStatistics must be set to true, before this client connects.
+ /// And the client has to be connected to the Master Server, which is providing the info about lobbies.
+ ///
+ void OnLobbyStatisticsUpdate(List lobbyStatistics);
+ }
+
+
+ ///
+ /// Collection of "organizational" callbacks for the Realtime Api to cover Matchmaking.
+ ///
+ ///
+ /// Classes that implement this interface must be registered to get callbacks for various situations.
+ ///
+ /// To register for callbacks, call and pass the class implementing this interface
+ /// To stop getting callbacks, call and pass the class implementing this interface
+ ///
+ ///
+ /// \ingroup callbacks
+ public interface IMatchmakingCallbacks
+ {
+
+ ///
+ /// Called when the server sent the response to a FindFriends request.
+ ///
+ ///
+ /// After calling OpFindFriends, the Master Server will cache the friend list and send updates to the friend
+ /// list. The friends includes the name, userId, online state and the room (if any) for each requested user/friend.
+ ///
+ /// Use the friendList to update your UI and store it, if the UI should highlight changes.
+ ///
+ void OnFriendListUpdate(List friendList);
+
+ ///
+ /// Called when this client created a room and entered it. OnJoinedRoom() will be called as well.
+ ///
+ ///
+ /// This callback is only called on the client which created a room (see OpCreateRoom).
+ ///
+ /// As any client might close (or drop connection) anytime, there is a chance that the
+ /// creator of a room does not execute OnCreatedRoom.
+ ///
+ /// If you need specific room properties or a "start signal", implement OnMasterClientSwitched()
+ /// and make each new MasterClient check the room's state.
+ ///
+ void OnCreatedRoom();
+
+ ///
+ /// Called when the server couldn't create a room (OpCreateRoom failed).
+ ///
+ ///
+ /// Creating a room may fail for various reasons. Most often, the room already exists (roomname in use) or
+ /// the RoomOptions clash and it's impossible to create the room.
+ ///
+ /// When creating a room fails on a Game Server:
+ /// The client will cache the failure internally and returns to the Master Server before it calls the fail-callback.
+ /// This way, the client is ready to find/create a room at the moment of the callback.
+ /// In this case, the client skips calling OnConnectedToMaster but returning to the Master Server will still call OnConnected.
+ /// Treat callbacks of OnConnected as pure information that the client could connect.
+ ///
+ /// Operation ReturnCode from the server.
+ /// Debug message for the error.
+ void OnCreateRoomFailed(short returnCode, string message);
+
+ ///
+ /// Called when the LoadBalancingClient entered a room, no matter if this client created it or simply joined.
+ ///
+ ///
+ /// When this is called, you can access the existing players in Room.Players, their custom properties and Room.CustomProperties.
+ ///
+ /// In this callback, you could create player objects. For example in Unity, instantiate a prefab for the player.
+ ///
+ /// If you want a match to be started "actively", enable the user to signal "ready" (using OpRaiseEvent or a Custom Property).
+ ///
+ void OnJoinedRoom();
+
+ ///
+ /// Called when a previous OpJoinRoom call failed on the server.
+ ///
+ ///
+ /// Joining a room may fail for various reasons. Most often, the room is full or does not exist anymore
+ /// (due to someone else being faster or closing the room).
+ ///
+ /// When joining a room fails on a Game Server:
+ /// The client will cache the failure internally and returns to the Master Server before it calls the fail-callback.
+ /// This way, the client is ready to find/create a room at the moment of the callback.
+ /// In this case, the client skips calling OnConnectedToMaster but returning to the Master Server will still call OnConnected.
+ /// Treat callbacks of OnConnected as pure information that the client could connect.
+ ///
+ /// Operation ReturnCode from the server.
+ /// Debug message for the error.
+ void OnJoinRoomFailed(short returnCode, string message);
+
+ ///
+ /// Called when a previous OpJoinRandom call failed on the server.
+ ///
+ ///
+ /// The most common causes are that a room is full or does not exist (due to someone else being faster or closing the room).
+ ///
+ /// This operation is only ever sent to the Master Server. Once a room is found by the Master Server, the client will
+ /// head off to the designated Game Server and use the operation Join on the Game Server.
+ ///
+ /// When using multiple lobbies (via OpJoinLobby or a TypedLobby parameter), another lobby might have more/fitting rooms.
+ ///
+ /// Operation ReturnCode from the server.
+ /// Debug message for the error.
+ void OnJoinRandomFailed(short returnCode, string message);
+
+ ///
+ /// Called when the local user/client left a room, so the game's logic can clean up it's internal state.
+ ///
+ ///
+ /// When leaving a room, the LoadBalancingClient will disconnect the Game Server and connect to the Master Server.
+ /// This wraps up multiple internal actions.
+ ///
+ /// Wait for the callback OnConnectedToMaster, before you use lobbies and join or create rooms.
+ ///
+ /// OnLeftRoom also gets called, when the application quits.
+ /// It makes sense to check static ConnectionHandler.AppQuits before loading scenes in OnLeftRoom().
+ ///
+ void OnLeftRoom();
+ }
+
+ ///
+ /// Collection of "in room" callbacks for the Realtime Api to cover: Players entering or leaving, property updates and Master Client switching.
+ ///
+ ///
+ /// Classes that implement this interface must be registered to get callbacks for various situations.
+ ///
+ /// To register for callbacks, call and pass the class implementing this interface
+ /// To stop getting callbacks, call and pass the class implementing this interface
+ ///
+ ///
+ /// \ingroup callbacks
+ public interface IInRoomCallbacks
+ {
+ ///
+ /// Called when a remote player entered the room. This Player is already added to the playerlist.
+ ///
+ ///
+ /// If your game starts with a certain number of players, this callback can be useful to check the
+ /// Room.playerCount and find out if you can start.
+ ///
+ void OnPlayerEnteredRoom(Player newPlayer);
+
+ ///
+ /// Called when a remote player left the room or became inactive. Check otherPlayer.IsInactive.
+ ///
+ ///
+ /// If another player leaves the room or if the server detects a lost connection, this callback will
+ /// be used to notify your game logic.
+ ///
+ /// Depending on the room's setup, players may become inactive, which means they may return and retake
+ /// their spot in the room. In such cases, the Player stays in the Room.Players dictionary.
+ ///
+ /// If the player is not just inactive, it gets removed from the Room.Players dictionary, before
+ /// the callback is called.
+ ///
+ void OnPlayerLeftRoom(Player otherPlayer);
+
+
+ ///
+ /// Called when room properties changed. The propertiesThatChanged contain only the keys that changed.
+ ///
+ ///
+ /// In most cases, this method gets called when some player changes the Room Properties.
+ /// However, there are also "Well Known Properties" (which use byte keys) and this callback may include them.
+ /// Especially when entering a room, the server will also send the required Well Known Properties and they
+ /// are not filtered out for the OnRoomPropertiesUpdate callback.
+ ///
+ /// You can safely ignore the byte typed keys in propertiesThatChanged.
+ ///
+ /// Changing properties is usually done by Room.SetCustomProperties.
+ ///
+ ///
+ void OnRoomPropertiesUpdate(Hashtable propertiesThatChanged);
+
+ ///
+ /// Called when custom player-properties are changed.
+ ///
+ ///
+ /// Changing properties must be done by Player.SetCustomProperties, which causes this callback locally, too.
+ ///
+ /// Contains Player that changed.
+ /// Contains the properties that changed.
+ void OnPlayerPropertiesUpdate(Player targetPlayer, Hashtable changedProps);
+
+ ///
+ /// Called after switching to a new MasterClient when the current one leaves.
+ ///
+ ///
+ /// This is not called when this client enters a room.
+ /// The former MasterClient is still in the player list when this method get called.
+ ///
+ void OnMasterClientSwitched(Player newMasterClient);
+ }
+
+
+ ///
+ /// Event callback for the Realtime Api. Covers events from the server and those sent by clients via OpRaiseEvent.
+ ///
+ ///
+ /// Classes that implement this interface must be registered to get callbacks for various situations.
+ ///
+ /// To register for callbacks, call and pass the class implementing this interface
+ /// To stop getting callbacks, call and pass the class implementing this interface
+ ///
+ ///
+ /// \ingroup callbacks
+ public interface IOnEventCallback
+ {
+ /// Called for any incoming events.
+ ///
+ /// To receive events, implement IOnEventCallback in any class and register it via AddCallbackTarget
+ /// (either in LoadBalancingClient or PhotonNetwork).
+ ///
+ /// With the EventData.Sender you can look up the Player who sent the event.
+ ///
+ /// It is best practice to assign an eventCode for each different type of content and action, so the Code
+ /// will be essential to read the incoming events.
+ ///
+ void OnEvent(EventData photonEvent);
+ }
+
+ ///
+ /// Interface for "WebRpc" callbacks for the Realtime Api. Currently includes only responses for Web RPCs.
+ ///
+ ///
+ /// Classes that implement this interface must be registered to get callbacks for various situations.
+ ///
+ /// To register for callbacks, call and pass the class implementing this interface
+ /// To stop getting callbacks, call and pass the class implementing this interface
+ ///
+ ///
+ /// \ingroup callbacks
+ public interface IWebRpcCallback
+ {
+ ///
+ /// Called when the response to a WebRPC is available. See .
+ ///
+ ///
+ /// Important: The response.ReturnCode is 0 if Photon was able to reach your web-service.
+ /// The content of the response is what your web-service sent. You can create a WebRpcResponse from it.
+ /// Example: WebRpcResponse webResponse = new WebRpcResponse(operationResponse);
+ ///
+ /// Please note: Class OperationResponse is in a namespace which needs to be "used":
+ /// using ExitGames.Client.Photon; // includes OperationResponse (and other classes)
+ ///
+ ///
+ /// public void OnWebRpcResponse(OperationResponse response)
+ /// {
+ /// Debug.LogFormat("WebRPC operation response {0}", response.ToStringFull());
+ /// switch (response.ReturnCode)
+ /// {
+ /// case ErrorCode.Ok:
+ /// WebRpcResponse webRpcResponse = new WebRpcResponse(response);
+ /// Debug.LogFormat("Parsed WebRPC response {0}", response.ToStringFull());
+ /// if (string.IsNullOrEmpty(webRpcResponse.Name))
+ /// {
+ /// Debug.LogError("Unexpected: WebRPC response did not contain WebRPC method name");
+ /// }
+ /// if (webRpcResponse.ResultCode == 0) // success
+ /// {
+ /// switch (webRpcResponse.Name)
+ /// {
+ /// // todo: add your code here
+ /// case GetGameListWebRpcMethodName: // example
+ /// // ...
+ /// break;
+ /// }
+ /// }
+ /// else if (webRpcResponse.ResultCode == -1)
+ /// {
+ /// Debug.LogErrorFormat("Web server did not return ResultCode for WebRPC method=\"{0}\", Message={1}", webRpcResponse.Name, webRpcResponse.Message);
+ /// }
+ /// else
+ /// {
+ /// Debug.LogErrorFormat("Web server returned ResultCode={0} for WebRPC method=\"{1}\", Message={2}", webRpcResponse.ResultCode, webRpcResponse.Name, webRpcResponse.Message);
+ /// }
+ /// break;
+ /// case ErrorCode.ExternalHttpCallFailed: // web service unreachable
+ /// Debug.LogErrorFormat("WebRPC call failed as request could not be sent to the server. {0}", response.DebugMessage);
+ /// break;
+ /// case ErrorCode.HttpLimitReached: // too many WebRPCs in a short period of time
+ /// // the debug message should contain the limit exceeded
+ /// Debug.LogErrorFormat("WebRPCs rate limit exceeded: {0}", response.DebugMessage);
+ /// break;
+ /// case ErrorCode.InvalidOperation: // WebRPC not configured at all OR not configured properly OR trying to send on name server
+ /// if (PhotonNetwork.Server == ServerConnection.NameServer)
+ /// {
+ /// Debug.LogErrorFormat("WebRPC not supported on NameServer. {0}", response.DebugMessage);
+ /// }
+ /// else
+ /// {
+ /// Debug.LogErrorFormat("WebRPC not properly configured or not configured at all. {0}", response.DebugMessage);
+ /// }
+ /// break;
+ /// default:
+ /// // other unknown error, unexpected
+ /// Debug.LogErrorFormat("Unexpected error, {0} {1}", response.ReturnCode, response.DebugMessage);
+ /// break;
+ /// }
+ /// }
+ ///
+ ///
+ void OnWebRpcResponse(OperationResponse response);
+ }
+
+ ///
+ /// Interface for event callback for the Realtime Api.
+ ///
+ ///
+ /// Classes that implement this interface must be registered to get callbacks for various situations.
+ ///
+ /// To register for callbacks, call and pass the class implementing this interface
+ /// To stop getting callbacks, call and pass the class implementing this interface
+ ///
+ ///
+ /// \ingroup callbacks
+ public interface IErrorInfoCallback
+ {
+ ///
+ /// Called when the client receives an event from the server indicating that an error happened there.
+ ///
+ ///
+ /// In most cases this could be either:
+ /// 1. an error from webhooks plugin (if HasErrorInfo is enabled), read more here:
+ /// https://doc.photonengine.com/en-us/realtime/current/gameplay/web-extensions/webhooks#options
+ /// 2. an error sent from a custom server plugin via PluginHost.BroadcastErrorInfoEvent, see example here:
+ /// https://doc.photonengine.com/en-us/server/current/plugins/manual#handling_http_response
+ /// 3. an error sent from the server, for example, when the limit of cached events has been exceeded in the room
+ /// (all clients will be disconnected and the room will be closed in this case)
+ /// read more here: https://doc.photonengine.com/en-us/realtime/current/gameplay/cached-events#special_considerations
+ ///
+ /// If you implement or you will also get this event.
+ ///
+ /// Object containing information about the error
+ void OnErrorInfo(ErrorInfo errorInfo);
+ }
+
+ ///
+ /// Container type for callbacks defined by IConnectionCallbacks. See LoadBalancingCallbackTargets.
+ ///
+ ///
+ /// While the interfaces of callbacks wrap up the methods that will be called,
+ /// the container classes implement a simple way to call a method on all registered objects.
+ ///
+ public class ConnectionCallbacksContainer : List, IConnectionCallbacks
+ {
+ private readonly LoadBalancingClient client;
+
+ public ConnectionCallbacksContainer(LoadBalancingClient client)
+ {
+ this.client = client;
+ }
+
+ public void OnConnected()
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (IConnectionCallbacks target in this)
+ {
+ target.OnConnected();
+ }
+ }
+
+ public void OnConnectedToMaster()
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (IConnectionCallbacks target in this)
+ {
+ target.OnConnectedToMaster();
+ }
+ }
+
+ public void OnRegionListReceived(RegionHandler regionHandler)
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (IConnectionCallbacks target in this)
+ {
+ target.OnRegionListReceived(regionHandler);
+ }
+ }
+
+ public void OnDisconnected(DisconnectCause cause)
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (IConnectionCallbacks target in this)
+ {
+ target.OnDisconnected(cause);
+ }
+ }
+
+ public void OnCustomAuthenticationResponse(Dictionary data)
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (IConnectionCallbacks target in this)
+ {
+ target.OnCustomAuthenticationResponse(data);
+ }
+ }
+
+ public void OnCustomAuthenticationFailed(string debugMessage)
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (IConnectionCallbacks target in this)
+ {
+ target.OnCustomAuthenticationFailed(debugMessage);
+ }
+ }
+ }
+
+ ///
+ /// Container type for callbacks defined by IMatchmakingCallbacks. See MatchMakingCallbackTargets.
+ ///
+ ///
+ /// While the interfaces of callbacks wrap up the methods that will be called,
+ /// the container classes implement a simple way to call a method on all registered objects.
+ ///
+ public class MatchMakingCallbacksContainer : List, IMatchmakingCallbacks
+ {
+ private readonly LoadBalancingClient client;
+
+ public MatchMakingCallbacksContainer(LoadBalancingClient client)
+ {
+ this.client = client;
+ }
+
+ public void OnCreatedRoom()
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (IMatchmakingCallbacks target in this)
+ {
+ target.OnCreatedRoom();
+ }
+ }
+
+ public void OnJoinedRoom()
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (IMatchmakingCallbacks target in this)
+ {
+ target.OnJoinedRoom();
+ }
+ }
+
+ public void OnCreateRoomFailed(short returnCode, string message)
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (IMatchmakingCallbacks target in this)
+ {
+ target.OnCreateRoomFailed(returnCode, message);
+ }
+ }
+
+ public void OnJoinRandomFailed(short returnCode, string message)
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (IMatchmakingCallbacks target in this)
+ {
+ target.OnJoinRandomFailed(returnCode, message);
+ }
+ }
+
+ public void OnJoinRoomFailed(short returnCode, string message)
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (IMatchmakingCallbacks target in this)
+ {
+ target.OnJoinRoomFailed(returnCode, message);
+ }
+ }
+
+ public void OnLeftRoom()
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (IMatchmakingCallbacks target in this)
+ {
+ target.OnLeftRoom();
+ }
+ }
+
+ public void OnFriendListUpdate(List friendList)
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (IMatchmakingCallbacks target in this)
+ {
+ target.OnFriendListUpdate(friendList);
+ }
+ }
+ }
+
+
+ ///
+ /// Container type for callbacks defined by IInRoomCallbacks. See InRoomCallbackTargets.
+ ///
+ ///
+ /// While the interfaces of callbacks wrap up the methods that will be called,
+ /// the container classes implement a simple way to call a method on all registered objects.
+ ///
+ internal class InRoomCallbacksContainer : List, IInRoomCallbacks
+ {
+ private readonly LoadBalancingClient client;
+
+ public InRoomCallbacksContainer(LoadBalancingClient client)
+ {
+ this.client = client;
+ }
+
+ public void OnPlayerEnteredRoom(Player newPlayer)
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (IInRoomCallbacks target in this)
+ {
+ target.OnPlayerEnteredRoom(newPlayer);
+ }
+ }
+
+ public void OnPlayerLeftRoom(Player otherPlayer)
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (IInRoomCallbacks target in this)
+ {
+ target.OnPlayerLeftRoom(otherPlayer);
+ }
+ }
+
+ public void OnRoomPropertiesUpdate(Hashtable propertiesThatChanged)
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (IInRoomCallbacks target in this)
+ {
+ target.OnRoomPropertiesUpdate(propertiesThatChanged);
+ }
+ }
+
+ public void OnPlayerPropertiesUpdate(Player targetPlayer, Hashtable changedProp)
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (IInRoomCallbacks target in this)
+ {
+ target.OnPlayerPropertiesUpdate(targetPlayer, changedProp);
+ }
+ }
+
+ public void OnMasterClientSwitched(Player newMasterClient)
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (IInRoomCallbacks target in this)
+ {
+ target.OnMasterClientSwitched(newMasterClient);
+ }
+ }
+ }
+
+ ///
+ /// Container type for callbacks defined by ILobbyCallbacks. See LobbyCallbackTargets.
+ ///
+ ///
+ /// While the interfaces of callbacks wrap up the methods that will be called,
+ /// the container classes implement a simple way to call a method on all registered objects.
+ ///
+ internal class LobbyCallbacksContainer : List, ILobbyCallbacks
+ {
+ private readonly LoadBalancingClient client;
+
+ public LobbyCallbacksContainer(LoadBalancingClient client)
+ {
+ this.client = client;
+ }
+
+ public void OnJoinedLobby()
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (ILobbyCallbacks target in this)
+ {
+ target.OnJoinedLobby();
+ }
+ }
+
+ public void OnLeftLobby()
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (ILobbyCallbacks target in this)
+ {
+ target.OnLeftLobby();
+ }
+ }
+
+ public void OnRoomListUpdate(List roomList)
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (ILobbyCallbacks target in this)
+ {
+ target.OnRoomListUpdate(roomList);
+ }
+ }
+
+ public void OnLobbyStatisticsUpdate(List lobbyStatistics)
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (ILobbyCallbacks target in this)
+ {
+ target.OnLobbyStatisticsUpdate(lobbyStatistics);
+ }
+ }
+ }
+
+ ///
+ /// Container type for callbacks defined by IWebRpcCallback. See WebRpcCallbackTargets.
+ ///
+ ///
+ /// While the interfaces of callbacks wrap up the methods that will be called,
+ /// the container classes implement a simple way to call a method on all registered objects.
+ ///
+ internal class WebRpcCallbacksContainer : List, IWebRpcCallback
+ {
+ private LoadBalancingClient client;
+
+ public WebRpcCallbacksContainer(LoadBalancingClient client)
+ {
+ this.client = client;
+ }
+
+ public void OnWebRpcResponse(OperationResponse response)
+ {
+ this.client.UpdateCallbackTargets();
+
+ foreach (IWebRpcCallback target in this)
+ {
+ target.OnWebRpcResponse(response);
+ }
+ }
+ }
+
+
+ ///
+ /// Container type for callbacks defined by . See .
+ ///
+ ///
+ /// While the interfaces of callbacks wrap up the methods that will be called,
+ /// the container classes implement a simple way to call a method on all registered objects.
+ ///
+ internal class ErrorInfoCallbacksContainer : List, IErrorInfoCallback
+ {
+ private LoadBalancingClient client;
+
+ public ErrorInfoCallbacksContainer(LoadBalancingClient client)
+ {
+ this.client = client;
+ }
+
+ public void OnErrorInfo(ErrorInfo errorInfo)
+ {
+ this.client.UpdateCallbackTargets();
+ foreach (IErrorInfoCallback target in this)
+ {
+ target.OnErrorInfo(errorInfo);
+ }
+ }
+ }
+
+ ///
+ /// Class wrapping the received event.
+ ///
+ ///
+ /// This is passed inside callback.
+ /// If you implement or you will also get but not parsed.
+ ///
+ /// In most cases this could be either:
+ /// 1. an error from webhooks plugin (if HasErrorInfo is enabled), read more here:
+ /// https://doc.photonengine.com/en-us/realtime/current/gameplay/web-extensions/webhooks#options
+ /// 2. an error sent from a custom server plugin via PluginHost.BroadcastErrorInfoEvent, see example here:
+ /// https://doc.photonengine.com/en-us/server/current/plugins/manual#handling_http_response
+ /// 3. an error sent from the server, for example, when the limit of cached events has been exceeded in the room
+ /// (all clients will be disconnected and the room will be closed in this case)
+ /// read more here: https://doc.photonengine.com/en-us/realtime/current/gameplay/cached-events#special_considerations
+ ///
+ public class ErrorInfo
+ {
+ ///
+ /// String containing information about the error.
+ ///
+ public readonly string Info;
+
+ public ErrorInfo(EventData eventData)
+ {
+ this.Info = eventData[ParameterCode.Info] as string;
+ }
+
+ public override string ToString()
+ {
+ return string.Format("ErrorInfo: {0}", this.Info);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs.meta b/Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs.meta
new file mode 100644
index 00000000..91a2d99b
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f4e65968c7102bf42a77b6a5cade8743
+timeCreated: 1497614756
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonRealtime/Code/LoadbalancingPeer.cs b/Assets/Photon/PhotonRealtime/Code/LoadbalancingPeer.cs
new file mode 100644
index 00000000..89688c51
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/LoadbalancingPeer.cs
@@ -0,0 +1,2242 @@
+// ----------------------------------------------------------------------------
+//
+// Loadbalancing Framework for Photon - Copyright (C) 2018 Exit Games GmbH
+//
+//
+// Provides operations to use the LoadBalancing and Cloud photon servers.
+// No logic is implemented here.
+//
+// developer@photonengine.com
+// ----------------------------------------------------------------------------
+
+#if UNITY_4_7 || UNITY_5 || UNITY_5_3_OR_NEWER
+#define SUPPORTED_UNITY
+#endif
+
+
+namespace Photon.Realtime
+{
+ using System;
+ using System.Collections;
+ using System.Collections.Generic;
+ using ExitGames.Client.Photon;
+
+ #if SUPPORTED_UNITY
+ using UnityEngine;
+ using Debug = UnityEngine.Debug;
+ #endif
+ #if SUPPORTED_UNITY || NETFX_CORE
+ using Hashtable = ExitGames.Client.Photon.Hashtable;
+ using SupportClass = ExitGames.Client.Photon.SupportClass;
+ #endif
+
+
+ ///
+ /// A LoadBalancingPeer provides the operations and enum definitions needed to use the LoadBalancing server application which is also used in Photon Cloud.
+ ///
+ ///
+ /// This class is internally used.
+ /// The LoadBalancingPeer does not keep a state, instead this is done by a LoadBalancingClient.
+ ///
+ public class LoadBalancingPeer : PhotonPeer
+ {
+ /// Obsolete accessor to the RegionHandler.PingImplementation.
+ [Obsolete("Use RegionHandler.PingImplementation directly.")]
+ protected internal static Type PingImplementation
+ {
+ get { return RegionHandler.PingImplementation; }
+ set { RegionHandler.PingImplementation = value; }
+ }
+
+
+ private readonly Pool paramDictionaryPool = new Pool(
+ () => new ParameterDictionary(),
+ x => x.Clear(),
+ 1); // used in OpRaiseEvent() (avoids lots of new Dictionary() calls)
+
+
+ ///
+ /// Creates a Peer with specified connection protocol. You need to set the Listener before using the peer.
+ ///
+ /// Each connection protocol has it's own default networking ports for Photon.
+ /// The preferred option is UDP.
+ public LoadBalancingPeer(ConnectionProtocol protocolType) : base(protocolType)
+ {
+ // this does not require a Listener, so:
+ // make sure to set this.Listener before using a peer!
+
+ this.ConfigUnitySockets();
+ }
+
+ ///
+ /// Creates a Peer with specified connection protocol and a Listener for callbacks.
+ ///
+ public LoadBalancingPeer(IPhotonPeerListener listener, ConnectionProtocol protocolType) : this(protocolType)
+ {
+ this.Listener = listener;
+ }
+
+
+ // Sets up the socket implementations to use, depending on platform
+ [System.Diagnostics.Conditional("SUPPORTED_UNITY")]
+ private void ConfigUnitySockets()
+ {
+ Type websocketType = null;
+ #if (UNITY_XBOXONE || UNITY_GAMECORE) && !UNITY_EDITOR
+ websocketType = Type.GetType("ExitGames.Client.Photon.SocketNativeSource, Assembly-CSharp", false);
+ if (websocketType == null)
+ {
+ websocketType = Type.GetType("ExitGames.Client.Photon.SocketNativeSource, Assembly-CSharp-firstpass", false);
+ }
+ if (websocketType == null)
+ {
+ websocketType = Type.GetType("ExitGames.Client.Photon.SocketNativeSource, PhotonRealtime", false);
+ }
+ if (websocketType != null)
+ {
+ this.SocketImplementationConfig[ConnectionProtocol.Udp] = websocketType; // on Xbox, the native socket plugin supports UDP as well
+ }
+ #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);
+ }
+ #if UNITY_WEBGL
+ if (websocketType == null && this.DebugOut >= DebugLevel.WARNING)
+ {
+ this.Listener.DebugReturn(DebugLevel.WARNING, "SocketWebTcp type not found in the usual Assemblies. This is required as wrapper for the browser WebSocket API. Make sure to make the PhotonLibs\\WebSocket code available.");
+ }
+ #endif
+ #endif
+
+ if (websocketType != null)
+ {
+ this.SocketImplementationConfig[ConnectionProtocol.WebSocket] = websocketType;
+ this.SocketImplementationConfig[ConnectionProtocol.WebSocketSecure] = websocketType;
+ }
+
+ #if NET_4_6 && (UNITY_EDITOR || !ENABLE_IL2CPP) && !NETFX_CORE
+ this.SocketImplementationConfig[ConnectionProtocol.Udp] = typeof(SocketUdpAsync);
+ this.SocketImplementationConfig[ConnectionProtocol.Tcp] = typeof(SocketTcpAsync);
+ #endif
+ }
+
+
+ public virtual bool OpGetRegions(string appId)
+ {
+ Dictionary parameters = new Dictionary(1);
+ parameters[(byte)ParameterCode.ApplicationId] = appId;
+
+ return this.SendOperation(OperationCode.GetRegions, parameters, new SendOptions() { Reliability = true, Encrypt = true });
+ }
+
+ ///
+ /// Joins the lobby on the Master Server, where you get a list of RoomInfos of currently open rooms.
+ /// This is an async request which triggers a OnOperationResponse() call.
+ ///
+ /// The lobby join to.
+ /// If the operation could be sent (has to be connected).
+ public virtual bool OpJoinLobby(TypedLobby lobby = null)
+ {
+ if (this.DebugOut >= DebugLevel.INFO)
+ {
+ this.Listener.DebugReturn(DebugLevel.INFO, "OpJoinLobby()");
+ }
+
+ Dictionary parameters = null;
+ if (lobby != null && !lobby.IsDefault)
+ {
+ parameters = new Dictionary();
+ parameters[(byte)ParameterCode.LobbyName] = lobby.Name;
+ parameters[(byte)ParameterCode.LobbyType] = (byte)lobby.Type;
+ }
+
+ return this.SendOperation(OperationCode.JoinLobby, parameters, SendOptions.SendReliable);
+ }
+
+
+ ///
+ /// Leaves the lobby on the Master Server.
+ /// This is an async request which triggers a OnOperationResponse() call.
+ ///
+ /// If the operation could be sent (requires connection).
+ public virtual bool OpLeaveLobby()
+ {
+ if (this.DebugOut >= DebugLevel.INFO)
+ {
+ this.Listener.DebugReturn(DebugLevel.INFO, "OpLeaveLobby()");
+ }
+
+ return this.SendOperation(OperationCode.LeaveLobby, (Dictionary)null, SendOptions.SendReliable);
+ }
+
+
+ /// Used by OpJoinRoom and by OpCreateRoom alike.
+ private void RoomOptionsToOpParameters(Dictionary op, RoomOptions roomOptions, bool usePropertiesKey = false)
+ {
+ if (roomOptions == null)
+ {
+ roomOptions = new RoomOptions();
+ }
+
+ Hashtable gameProperties = new Hashtable();
+ gameProperties[GamePropertyKey.IsOpen] = roomOptions.IsOpen;
+ gameProperties[GamePropertyKey.IsVisible] = roomOptions.IsVisible;
+ gameProperties[GamePropertyKey.PropsListedInLobby] = (roomOptions.CustomRoomPropertiesForLobby == null) ? new string[0] : roomOptions.CustomRoomPropertiesForLobby;
+ gameProperties.MergeStringKeys(roomOptions.CustomRoomProperties);
+ if (roomOptions.MaxPlayers > 0)
+ {
+ gameProperties[GamePropertyKey.MaxPlayers] = roomOptions.MaxPlayers;
+ }
+
+ if (!usePropertiesKey)
+ {
+ op[ParameterCode.GameProperties] = gameProperties; // typically, the key for game props is 248
+ }
+ else
+ {
+ op[ParameterCode.Properties] = gameProperties; // when an op uses 248 as filter, the "create room" props can be set as 251
+ }
+
+
+ int flags = 0; // a new way to send the room options as bitwise-flags
+
+ if (roomOptions.CleanupCacheOnLeave)
+ {
+ op[ParameterCode.CleanupCacheOnLeave] = true; // this defines the server's room settings and logic
+ flags = flags | (int)RoomOptionBit.DeleteCacheOnLeave; // this defines the server's room settings and logic (for servers that support flags)
+ }
+ else
+ {
+ op[ParameterCode.CleanupCacheOnLeave] = false; // this defines the server's room settings and logic
+ gameProperties[GamePropertyKey.CleanupCacheOnLeave] = false; // this is only informational for the clients which join
+ }
+
+ #if SERVERSDK
+ op[ParameterCode.CheckUserOnJoin] = roomOptions.CheckUserOnJoin;
+ if (roomOptions.CheckUserOnJoin)
+ {
+ flags = flags | (int) RoomOptionBit.CheckUserOnJoin;
+ }
+ #else
+ // in PUN v1.88 and PUN 2, CheckUserOnJoin is set by default:
+ flags = flags | (int) RoomOptionBit.CheckUserOnJoin;
+ op[ParameterCode.CheckUserOnJoin] = true;
+ #endif
+
+ if (roomOptions.PlayerTtl > 0 || roomOptions.PlayerTtl == -1)
+ {
+ op[ParameterCode.PlayerTTL] = roomOptions.PlayerTtl; // TURNBASED
+ }
+
+ if (roomOptions.EmptyRoomTtl > 0)
+ {
+ op[ParameterCode.EmptyRoomTTL] = roomOptions.EmptyRoomTtl; //TURNBASED
+ }
+
+ if (roomOptions.SuppressRoomEvents)
+ {
+ flags = flags | (int)RoomOptionBit.SuppressRoomEvents;
+ op[ParameterCode.SuppressRoomEvents] = true;
+ }
+ if (roomOptions.SuppressPlayerInfo)
+ {
+ flags = flags | (int)RoomOptionBit.SuppressPlayerInfo;
+ }
+
+ if (roomOptions.Plugins != null)
+ {
+ op[ParameterCode.Plugins] = roomOptions.Plugins;
+ }
+ if (roomOptions.PublishUserId)
+ {
+ flags = flags | (int)RoomOptionBit.PublishUserId;
+ op[ParameterCode.PublishUserId] = true;
+ }
+ if (roomOptions.DeleteNullProperties)
+ {
+ flags = flags | (int)RoomOptionBit.DeleteNullProps; // this is only settable as flag
+ }
+ if (roomOptions.BroadcastPropsChangeToAll)
+ {
+ flags = flags | (int)RoomOptionBit.BroadcastPropsChangeToAll; // this is only settable as flag
+ }
+
+ op[ParameterCode.RoomOptionFlags] = flags;
+ }
+
+
+ ///
+ /// Creates a room (on either Master or Game Server).
+ /// The OperationResponse depends on the server the peer is connected to:
+ /// Master will return a Game Server to connect to.
+ /// Game Server will return the joined Room's data.
+ /// This is an async request which triggers a OnOperationResponse() call.
+ ///
+ ///
+ /// If the room is already existing, the OperationResponse will have a returnCode of ErrorCode.GameAlreadyExists.
+ ///
+ public virtual bool OpCreateRoom(EnterRoomParams opParams)
+ {
+ if (this.DebugOut >= DebugLevel.INFO)
+ {
+ this.Listener.DebugReturn(DebugLevel.INFO, "OpCreateRoom()");
+ }
+
+ Dictionary op = new Dictionary();
+
+ if (!string.IsNullOrEmpty(opParams.RoomName))
+ {
+ op[ParameterCode.RoomName] = opParams.RoomName;
+ }
+ if (opParams.Lobby != null && !opParams.Lobby.IsDefault)
+ {
+ op[ParameterCode.LobbyName] = opParams.Lobby.Name;
+ op[ParameterCode.LobbyType] = (byte)opParams.Lobby.Type;
+ }
+
+ if (opParams.ExpectedUsers != null && opParams.ExpectedUsers.Length > 0)
+ {
+ op[ParameterCode.Add] = opParams.ExpectedUsers;
+ }
+ if (opParams.OnGameServer)
+ {
+ if (opParams.PlayerProperties != null && opParams.PlayerProperties.Count > 0)
+ {
+ op[ParameterCode.PlayerProperties] = opParams.PlayerProperties;
+ }
+ op[ParameterCode.Broadcast] = true; // broadcast actor properties
+
+ this.RoomOptionsToOpParameters(op, opParams.RoomOptions);
+ }
+
+ //this.Listener.DebugReturn(DebugLevel.INFO, "OpCreateRoom: " + SupportClass.DictionaryToString(op));
+ return this.SendOperation(OperationCode.CreateGame, op, SendOptions.SendReliable);
+ }
+
+ ///
+ /// Joins a room by name or creates new room if room with given name not exists.
+ /// The OperationResponse depends on the server the peer is connected to:
+ /// Master will return a Game Server to connect to.
+ /// Game Server will return the joined Room's data.
+ /// This is an async request which triggers a OnOperationResponse() call.
+ ///
+ ///
+ /// If the room is not existing (anymore), the OperationResponse will have a returnCode of ErrorCode.GameDoesNotExist.
+ /// Other possible ErrorCodes are: GameClosed, GameFull.
+ ///
+ /// If the operation could be sent (requires connection).
+ public virtual bool OpJoinRoom(EnterRoomParams opParams)
+ {
+ if (this.DebugOut >= DebugLevel.INFO)
+ {
+ this.Listener.DebugReturn(DebugLevel.INFO, "OpJoinRoom()");
+ }
+ Dictionary op = new Dictionary();
+
+ if (!string.IsNullOrEmpty(opParams.RoomName))
+ {
+ op[ParameterCode.RoomName] = opParams.RoomName;
+ }
+
+ if (opParams.JoinMode == JoinMode.CreateIfNotExists)
+ {
+ op[ParameterCode.JoinMode] = (byte)JoinMode.CreateIfNotExists;
+ if (opParams.Lobby != null && !opParams.Lobby.IsDefault)
+ {
+ op[ParameterCode.LobbyName] = opParams.Lobby.Name;
+ op[ParameterCode.LobbyType] = (byte)opParams.Lobby.Type;
+ }
+ }
+ else if (opParams.JoinMode == JoinMode.RejoinOnly)
+ {
+ op[ParameterCode.JoinMode] = (byte)JoinMode.RejoinOnly; // changed from JoinMode.JoinOrRejoin
+ }
+
+ if (opParams.ExpectedUsers != null && opParams.ExpectedUsers.Length > 0)
+ {
+ op[ParameterCode.Add] = opParams.ExpectedUsers;
+ }
+
+ if (opParams.OnGameServer)
+ {
+ if (opParams.PlayerProperties != null && opParams.PlayerProperties.Count > 0)
+ {
+ op[ParameterCode.PlayerProperties] = opParams.PlayerProperties;
+ }
+ op[ParameterCode.Broadcast] = true; // broadcast actor properties
+ }
+
+ if (opParams.OnGameServer || opParams.JoinMode == JoinMode.CreateIfNotExists)
+ {
+ this.RoomOptionsToOpParameters(op, opParams.RoomOptions);
+ }
+
+ //this.Listener.DebugReturn(DebugLevel.INFO, "OpJoinRoom: " + SupportClass.DictionaryToString(op));
+ return this.SendOperation(OperationCode.JoinGame, op, SendOptions.SendReliable);
+ }
+
+
+ ///
+ /// Operation to join a random, available room. Overloads take additional player properties.
+ /// This is an async request which triggers a OnOperationResponse() call.
+ /// If all rooms are closed or full, the OperationResponse will have a returnCode of ErrorCode.NoRandomMatchFound.
+ /// If successful, the OperationResponse contains a gameserver address and the name of some room.
+ ///
+ /// If the operation could be sent currently (requires connection).
+ public virtual bool OpJoinRandomRoom(OpJoinRandomRoomParams opJoinRandomRoomParams)
+ {
+ if (this.DebugOut >= DebugLevel.INFO)
+ {
+ this.Listener.DebugReturn(DebugLevel.INFO, "OpJoinRandomRoom()");
+ }
+
+ Hashtable expectedRoomProperties = new Hashtable();
+ expectedRoomProperties.MergeStringKeys(opJoinRandomRoomParams.ExpectedCustomRoomProperties);
+ if (opJoinRandomRoomParams.ExpectedMaxPlayers > 0)
+ {
+ expectedRoomProperties[GamePropertyKey.MaxPlayers] = opJoinRandomRoomParams.ExpectedMaxPlayers;
+ }
+
+ Dictionary opParameters = new Dictionary();
+ if (expectedRoomProperties.Count > 0)
+ {
+ opParameters[ParameterCode.GameProperties] = expectedRoomProperties;
+ }
+
+ if (opJoinRandomRoomParams.MatchingType != MatchmakingMode.FillRoom)
+ {
+ opParameters[ParameterCode.MatchMakingType] = (byte)opJoinRandomRoomParams.MatchingType;
+ }
+
+ if (opJoinRandomRoomParams.TypedLobby != null && !opJoinRandomRoomParams.TypedLobby.IsDefault)
+ {
+ opParameters[ParameterCode.LobbyName] = opJoinRandomRoomParams.TypedLobby.Name;
+ opParameters[ParameterCode.LobbyType] = (byte)opJoinRandomRoomParams.TypedLobby.Type;
+ }
+
+ if (!string.IsNullOrEmpty(opJoinRandomRoomParams.SqlLobbyFilter))
+ {
+ opParameters[ParameterCode.Data] = opJoinRandomRoomParams.SqlLobbyFilter;
+ }
+
+ if (opJoinRandomRoomParams.ExpectedUsers != null && opJoinRandomRoomParams.ExpectedUsers.Length > 0)
+ {
+ opParameters[ParameterCode.Add] = opJoinRandomRoomParams.ExpectedUsers;
+ }
+
+ //this.Listener.DebugReturn(DebugLevel.INFO, "OpJoinRandomRoom: " + SupportClass.DictionaryToString(opParameters));
+ return this.SendOperation(OperationCode.JoinRandomGame, opParameters, SendOptions.SendReliable);
+ }
+
+ ///
+ /// Only used on the Master Server. It will assign a game server and room to join-or-create.
+ /// On the Game Server, the OpJoin is used with option "create if not exists".
+ ///
+ public virtual bool OpJoinRandomOrCreateRoom(OpJoinRandomRoomParams opJoinRandomRoomParams, EnterRoomParams createRoomParams)
+ {
+ if (this.DebugOut >= DebugLevel.INFO)
+ {
+ this.Listener.DebugReturn(DebugLevel.INFO, "OpJoinRandomOrCreateRoom()");
+ }
+
+ // join random room parameters:
+
+ Hashtable expectedRoomProperties = new Hashtable();
+ expectedRoomProperties.MergeStringKeys(opJoinRandomRoomParams.ExpectedCustomRoomProperties);
+ if (opJoinRandomRoomParams.ExpectedMaxPlayers > 0)
+ {
+ expectedRoomProperties[GamePropertyKey.MaxPlayers] = opJoinRandomRoomParams.ExpectedMaxPlayers;
+ }
+
+ Dictionary opParameters = new Dictionary();
+ if (expectedRoomProperties.Count > 0)
+ {
+ opParameters[ParameterCode.GameProperties] = expectedRoomProperties; // used as filter. below, RoomOptionsToOpParameters has usePropertiesKey = true
+ }
+
+ if (opJoinRandomRoomParams.MatchingType != MatchmakingMode.FillRoom)
+ {
+ opParameters[ParameterCode.MatchMakingType] = (byte)opJoinRandomRoomParams.MatchingType;
+ }
+
+ if (opJoinRandomRoomParams.TypedLobby != null && !opJoinRandomRoomParams.TypedLobby.IsDefault)
+ {
+ opParameters[ParameterCode.LobbyName] = opJoinRandomRoomParams.TypedLobby.Name;
+ opParameters[ParameterCode.LobbyType] = (byte)opJoinRandomRoomParams.TypedLobby.Type;
+ }
+
+ if (!string.IsNullOrEmpty(opJoinRandomRoomParams.SqlLobbyFilter))
+ {
+ opParameters[ParameterCode.Data] = opJoinRandomRoomParams.SqlLobbyFilter;
+ }
+
+ if (opJoinRandomRoomParams.ExpectedUsers != null && opJoinRandomRoomParams.ExpectedUsers.Length > 0)
+ {
+ opParameters[ParameterCode.Add] = opJoinRandomRoomParams.ExpectedUsers;
+ }
+
+
+ // parameters for creating a room if needed ("or create" part of the operation)
+ // partial copy of OpCreateRoom
+
+ opParameters[ParameterCode.JoinMode] = (byte)JoinMode.CreateIfNotExists;
+
+ if (createRoomParams != null)
+ {
+ if (!string.IsNullOrEmpty(createRoomParams.RoomName))
+ {
+ opParameters[ParameterCode.RoomName] = createRoomParams.RoomName;
+ }
+
+ this.RoomOptionsToOpParameters(opParameters, createRoomParams.RoomOptions, true);
+ }
+
+ //this.Listener.DebugReturn(DebugLevel.INFO, "OpJoinRandomOrCreateRoom: " + SupportClass.DictionaryToString(opParameters, false));
+ return this.SendOperation(OperationCode.JoinRandomGame, opParameters, SendOptions.SendReliable);
+ }
+
+
+ ///
+ /// Leaves a room with option to come back later or "for good".
+ ///
+ /// Async games can be re-joined (loaded) later on. Set to false, if you want to abandon a game entirely.
+ /// WebFlag: Securely transmit the encrypted object AuthCookie to the web service in PathLeave webhook when available
+ /// If the opteration can be send currently.
+ public virtual bool OpLeaveRoom(bool becomeInactive, bool sendAuthCookie = false)
+ {
+ Dictionary opParameters = new Dictionary();
+ if (becomeInactive)
+ {
+ opParameters[ParameterCode.IsInactive] = true;
+ }
+ if (sendAuthCookie)
+ {
+ opParameters[ParameterCode.EventForward] = WebFlags.SendAuthCookieConst;
+ }
+ return this.SendOperation(OperationCode.Leave, opParameters, SendOptions.SendReliable);
+ }
+
+ /// Gets a list of games matching a SQL-like where clause.
+ ///
+ /// Operation is only available in lobbies of type SqlLobby.
+ /// This is an async request which triggers a OnOperationResponse() call.
+ /// Returned game list is stored in RoomInfoList.
+ ///
+ ///
+ /// The lobby to query. Has to be of type SqlLobby.
+ /// The sql query statement.
+ /// If the operation could be sent (has to be connected).
+ public virtual bool OpGetGameList(TypedLobby lobby, string queryData)
+ {
+ if (this.DebugOut >= DebugLevel.INFO)
+ {
+ this.Listener.DebugReturn(DebugLevel.INFO, "OpGetGameList()");
+ }
+
+ if (lobby == null)
+ {
+ if (this.DebugOut >= DebugLevel.INFO)
+ {
+ this.Listener.DebugReturn(DebugLevel.INFO, "OpGetGameList not sent. Lobby cannot be null.");
+ }
+ return false;
+ }
+
+ if (lobby.Type != LobbyType.SqlLobby)
+ {
+ if (this.DebugOut >= DebugLevel.INFO)
+ {
+ this.Listener.DebugReturn(DebugLevel.INFO, "OpGetGameList not sent. LobbyType must be SqlLobby.");
+ }
+ return false;
+ }
+
+ if (lobby.IsDefault)
+ {
+ if (this.DebugOut >= DebugLevel.INFO)
+ {
+ this.Listener.DebugReturn(DebugLevel.INFO, "OpGetGameList not sent. LobbyName must be not null and not empty.");
+ }
+ return false;
+ }
+
+ if (string.IsNullOrEmpty(queryData))
+ {
+ if (this.DebugOut >= DebugLevel.INFO)
+ {
+ this.Listener.DebugReturn(DebugLevel.INFO, "OpGetGameList not sent. queryData must be not null and not empty.");
+ }
+ return false;
+ }
+
+ Dictionary opParameters = new Dictionary();
+ opParameters[(byte)ParameterCode.LobbyName] = lobby.Name;
+ opParameters[(byte)ParameterCode.LobbyType] = (byte)lobby.Type;
+ opParameters[(byte)ParameterCode.Data] = queryData;
+
+ return this.SendOperation(OperationCode.GetGameList, opParameters, SendOptions.SendReliable);
+ }
+
+ ///
+ /// Request the rooms and online status for a list of friends (each client must set a unique username via OpAuthenticate).
+ ///
+ ///
+ /// Used on Master Server to find the rooms played by a selected list of users.
+ /// Users identify themselves by using OpAuthenticate with a unique user ID.
+ /// The list of user IDs must be fetched from some other source (not provided by Photon).
+ ///
+ /// The server response includes 2 arrays of info (each index matching a friend from the request):
+ /// ParameterCode.FindFriendsResponseOnlineList = bool[] of online states
+ /// ParameterCode.FindFriendsResponseRoomIdList = string[] of room names (empty string if not in a room)
+ ///
+ /// The options may be used to define which state a room must match to be returned.
+ ///
+ /// Array of friend's names (make sure they are unique).
+ /// Options that affect the result of the FindFriends operation.
+ /// If the operation could be sent (requires connection).
+ public virtual bool OpFindFriends(string[] friendsToFind, FindFriendsOptions options = null)
+ {
+ Dictionary opParameters = new Dictionary();
+ if (friendsToFind != null && friendsToFind.Length > 0)
+ {
+ opParameters[ParameterCode.FindFriendsRequestList] = friendsToFind;
+ }
+
+ if (options != null)
+ {
+ opParameters[ParameterCode.FindFriendsOptions] = options.ToIntFlags();
+ }
+
+ return this.SendOperation(OperationCode.FindFriends, opParameters, SendOptions.SendReliable);
+ }
+
+ public bool OpSetCustomPropertiesOfActor(int actorNr, Hashtable actorProperties)
+ {
+ return this.OpSetPropertiesOfActor(actorNr, actorProperties.StripToStringKeys(), null);
+ }
+
+ ///
+ /// Sets properties of a player / actor.
+ /// Internally this uses OpSetProperties, which can be used to either set room or player properties.
+ ///
+ /// The payer ID (a.k.a. actorNumber) of the player to attach these properties to.
+ /// The properties to add or update.
+ /// If set, these must be in the current properties-set (on the server) to set actorProperties: CAS.
+ /// Set these to forward the properties to a WebHook as defined for this app (in Dashboard).
+ /// If the operation could be sent (requires connection).
+ protected internal bool OpSetPropertiesOfActor(int actorNr, Hashtable actorProperties, Hashtable expectedProperties = null, WebFlags webflags = null)
+ {
+ if (this.DebugOut >= DebugLevel.INFO)
+ {
+ this.Listener.DebugReturn(DebugLevel.INFO, "OpSetPropertiesOfActor()");
+ }
+
+ if (actorNr <= 0 || actorProperties == null || actorProperties.Count == 0)
+ {
+ if (this.DebugOut >= DebugLevel.INFO)
+ {
+ this.Listener.DebugReturn(DebugLevel.INFO, "OpSetPropertiesOfActor not sent. ActorNr must be > 0 and actorProperties must be not null nor empty.");
+ }
+ return false;
+ }
+
+ Dictionary opParameters = new Dictionary();
+ opParameters.Add(ParameterCode.Properties, actorProperties);
+ opParameters.Add(ParameterCode.ActorNr, actorNr);
+ opParameters.Add(ParameterCode.Broadcast, true);
+ if (expectedProperties != null && expectedProperties.Count != 0)
+ {
+ opParameters.Add(ParameterCode.ExpectedValues, expectedProperties);
+ }
+
+ if (webflags != null && webflags.HttpForward)
+ {
+ opParameters[ParameterCode.EventForward] = webflags.WebhookFlags;
+ }
+
+ return this.SendOperation(OperationCode.SetProperties, opParameters, SendOptions.SendReliable);
+ }
+
+
+ protected bool OpSetPropertyOfRoom(byte propCode, object value)
+ {
+ Hashtable properties = new Hashtable();
+ properties[propCode] = value;
+ return this.OpSetPropertiesOfRoom(properties);
+ }
+
+ public bool OpSetCustomPropertiesOfRoom(Hashtable gameProperties)
+ {
+ return this.OpSetPropertiesOfRoom(gameProperties.StripToStringKeys());
+ }
+
+ ///
+ /// Sets properties of a room.
+ /// Internally this uses OpSetProperties, which can be used to either set room or player properties.
+ ///
+ /// The properties to add or update.
+ /// The properties expected when update occurs. (CAS : "Check And Swap")
+ /// WebFlag to indicate if request should be forwarded as "PathProperties" webhook or not.
+ /// If the operation could be sent (has to be connected).
+ protected internal bool OpSetPropertiesOfRoom(Hashtable gameProperties, Hashtable expectedProperties = null, WebFlags webflags = null)
+ {
+ if (this.DebugOut >= DebugLevel.INFO)
+ {
+ this.Listener.DebugReturn(DebugLevel.INFO, "OpSetPropertiesOfRoom()");
+ }
+ if (gameProperties == null || gameProperties.Count == 0)
+ {
+ if (this.DebugOut >= DebugLevel.INFO)
+ {
+ this.Listener.DebugReturn(DebugLevel.INFO, "OpSetPropertiesOfRoom not sent. gameProperties must be not null nor empty.");
+ }
+ return false;
+ }
+
+ Dictionary opParameters = new Dictionary();
+ opParameters.Add(ParameterCode.Properties, gameProperties);
+ opParameters.Add(ParameterCode.Broadcast, true);
+ if (expectedProperties != null && expectedProperties.Count != 0)
+ {
+ opParameters.Add(ParameterCode.ExpectedValues, expectedProperties);
+ }
+
+ if (webflags!=null && webflags.HttpForward)
+ {
+ opParameters[ParameterCode.EventForward] = webflags.WebhookFlags;
+ }
+
+ return this.SendOperation(OperationCode.SetProperties, opParameters, SendOptions.SendReliable);
+ }
+
+ ///
+ /// Sends this app's appId and appVersion to identify this application server side.
+ /// This is an async request which triggers a OnOperationResponse() call.
+ ///
+ ///
+ /// This operation makes use of encryption, if that is established before.
+ /// See: EstablishEncryption(). Check encryption with IsEncryptionAvailable.
+ /// This operation is allowed only once per connection (multiple calls will have ErrorCode != Ok).
+ ///
+ /// Your application's name or ID to authenticate. This is assigned by Photon Cloud (webpage).
+ /// The client's version (clients with differing client appVersions are separated and players don't meet).
+ /// Contains all values relevant for authentication. Even without account system (external Custom Auth), the clients are allowed to identify themselves.
+ /// Optional region code, if the client should connect to a specific Photon Cloud Region.
+ /// Set to true on Master Server to receive "Lobby Statistics" events.
+ /// If the operation could be sent (has to be connected).
+ public virtual bool OpAuthenticate(string appId, string appVersion, AuthenticationValues authValues, string regionCode, bool getLobbyStatistics)
+ {
+ if (this.DebugOut >= DebugLevel.INFO)
+ {
+ this.Listener.DebugReturn(DebugLevel.INFO, "OpAuthenticate()");
+ }
+
+ Dictionary opParameters = new Dictionary();
+ if (getLobbyStatistics)
+ {
+ // must be sent in operation, even if a Token is available
+ opParameters[ParameterCode.LobbyStats] = true;
+ }
+
+ // shortcut, if we have a Token
+ if (authValues != null && authValues.Token != null)
+ {
+ opParameters[ParameterCode.Token] = authValues.Token;
+ return this.SendOperation(OperationCode.Authenticate, opParameters, SendOptions.SendReliable); // we don't have to encrypt, when we have a token (which is encrypted)
+ }
+
+
+ // without a token, we send a complete op auth
+
+ opParameters[ParameterCode.AppVersion] = appVersion;
+ opParameters[ParameterCode.ApplicationId] = appId;
+
+ if (!string.IsNullOrEmpty(regionCode))
+ {
+ opParameters[ParameterCode.Region] = regionCode;
+ }
+
+ if (authValues != null)
+ {
+
+ if (!string.IsNullOrEmpty(authValues.UserId))
+ {
+ opParameters[ParameterCode.UserId] = authValues.UserId;
+ }
+
+ if (authValues.AuthType != CustomAuthenticationType.None)
+ {
+ opParameters[ParameterCode.ClientAuthenticationType] = (byte)authValues.AuthType;
+ // if we had a token, the code above would use it. here, we send parameters:
+ if (!string.IsNullOrEmpty(authValues.AuthGetParameters))
+ {
+ opParameters[ParameterCode.ClientAuthenticationParams] = authValues.AuthGetParameters;
+ }
+ if (authValues.AuthPostData != null)
+ {
+ opParameters[ParameterCode.ClientAuthenticationData] = authValues.AuthPostData;
+ }
+ }
+ }
+
+ return this.SendOperation(OperationCode.Authenticate, opParameters, new SendOptions() { Reliability = true, Encrypt = true });
+ }
+
+
+ ///
+ /// Sends this app's appId and appVersion to identify this application server side.
+ /// This is an async request which triggers a OnOperationResponse() call.
+ ///
+ ///
+ /// This operation makes use of encryption, if that is established before.
+ /// See: EstablishEncryption(). Check encryption with IsEncryptionAvailable.
+ /// This operation is allowed only once per connection (multiple calls will have ErrorCode != Ok).
+ ///
+ /// Your application's name or ID to authenticate. This is assigned by Photon Cloud (webpage).
+ /// The client's version (clients with differing client appVersions are separated and players don't meet).
+ /// Optional authentication values. The client can set no values or a UserId or some parameters for Custom Authentication by a server.
+ /// Optional region code, if the client should connect to a specific Photon Cloud Region.
+ ///
+ ///
+ /// If the operation could be sent (has to be connected).
+ public virtual bool OpAuthenticateOnce(string appId, string appVersion, AuthenticationValues authValues, string regionCode, EncryptionMode encryptionMode, ConnectionProtocol expectedProtocol)
+ {
+ if (this.DebugOut >= DebugLevel.INFO)
+ {
+ this.Listener.DebugReturn(DebugLevel.INFO, "OpAuthenticateOnce(): authValues = " + authValues + ", region = " + regionCode + ", encryption = " + encryptionMode);
+ }
+
+ var opParameters = new Dictionary();
+
+ // shortcut, if we have a Token
+ if (authValues != null && authValues.Token != null)
+ {
+ opParameters[ParameterCode.Token] = authValues.Token;
+ return this.SendOperation(OperationCode.AuthenticateOnce, opParameters, SendOptions.SendReliable); // we don't have to encrypt, when we have a token (which is encrypted)
+ }
+
+ if (encryptionMode == EncryptionMode.DatagramEncryption && expectedProtocol != ConnectionProtocol.Udp)
+ {
+ // TODO disconnect?!
+ throw new NotSupportedException("Expected protocol set to UDP, due to encryption mode DatagramEncryption."); // TODO use some other form of callback?!
+ }
+
+ opParameters[ParameterCode.ExpectedProtocol] = (byte)expectedProtocol;
+ opParameters[ParameterCode.EncryptionMode] = (byte)encryptionMode;
+
+ opParameters[ParameterCode.AppVersion] = appVersion;
+ opParameters[ParameterCode.ApplicationId] = appId;
+
+ if (!string.IsNullOrEmpty(regionCode))
+ {
+ opParameters[ParameterCode.Region] = regionCode;
+ }
+
+ if (authValues != null)
+ {
+ if (!string.IsNullOrEmpty(authValues.UserId))
+ {
+ opParameters[ParameterCode.UserId] = authValues.UserId;
+ }
+
+ if (authValues.AuthType != CustomAuthenticationType.None)
+ {
+ opParameters[ParameterCode.ClientAuthenticationType] = (byte)authValues.AuthType;
+ if (authValues.Token != null)
+ {
+ opParameters[ParameterCode.Token] = 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(OperationCode.AuthenticateOnce, opParameters, new SendOptions() { Reliability = true, Encrypt = true });
+ }
+
+ ///
+ /// Operation to handle this client's interest groups (for events in room).
+ ///
+ ///
+ /// Note the difference between passing null and byte[0]:
+ /// null won't add/remove any groups.
+ /// byte[0] will add/remove all (existing) groups.
+ /// First, removing groups is executed. This way, you could leave all groups and join only the ones provided.
+ ///
+ /// Changes become active not immediately but when the server executes this operation (approximately RTT/2).
+ ///
+ /// Groups to remove from interest. Null will not remove any. A byte[0] will remove all.
+ /// Groups to add to interest. Null will not add any. A byte[0] will add all current.
+ /// If operation could be enqueued for sending. Sent when calling: Service or SendOutgoingCommands.
+ public virtual bool OpChangeGroups(byte[] groupsToRemove, byte[] groupsToAdd)
+ {
+ if (this.DebugOut >= DebugLevel.ALL)
+ {
+ this.Listener.DebugReturn(DebugLevel.ALL, "OpChangeGroups()");
+ }
+
+ Dictionary opParameters = new Dictionary();
+ if (groupsToRemove != null)
+ {
+ opParameters[(byte)ParameterCode.Remove] = groupsToRemove;
+ }
+ if (groupsToAdd != null)
+ {
+ opParameters[(byte)ParameterCode.Add] = groupsToAdd;
+ }
+
+ return this.SendOperation(OperationCode.ChangeGroups, opParameters, SendOptions.SendReliable);
+ }
+
+
+ ///
+ /// Send an event with custom code/type and any content to the other players in the same room.
+ ///
+ /// This override explicitly uses another parameter order to not mix it up with the implementation for Hashtable only.
+ /// Identifies this type of event (and the content). Your game's event codes can start with 0.
+ /// Any serializable datatype (including Hashtable like the other OpRaiseEvent overloads).
+ /// Contains (slightly) less often used options. If you pass null, the default options will be used.
+ /// Send options for reliable, encryption etc
+ /// If operation could be enqueued for sending. Sent when calling: Service or SendOutgoingCommands.
+ public virtual bool OpRaiseEvent(byte eventCode, object customEventContent, RaiseEventOptions raiseEventOptions, SendOptions sendOptions)
+ {
+ var paramDict = this.paramDictionaryPool.Acquire();
+ try
+ {
+ if (raiseEventOptions != null)
+ {
+ if (raiseEventOptions.CachingOption != EventCaching.DoNotCache)
+ {
+ paramDict.Add(ParameterCode.Cache, (byte)raiseEventOptions.CachingOption);
+ }
+ switch (raiseEventOptions.CachingOption)
+ {
+ case EventCaching.SliceSetIndex:
+ case EventCaching.SlicePurgeIndex:
+ case EventCaching.SlicePurgeUpToIndex:
+ //this.opParameters[(byte) ParameterCode.CacheSliceIndex] =
+ // (byte) raiseEventOptions.CacheSliceIndex;
+ return this.SendOperation(OperationCode.RaiseEvent, paramDict, sendOptions);
+ case EventCaching.SliceIncreaseIndex:
+ case EventCaching.RemoveFromRoomCacheForActorsLeft:
+ return this.SendOperation(OperationCode.RaiseEvent, paramDict, sendOptions);
+ case EventCaching.RemoveFromRoomCache:
+ if (raiseEventOptions.TargetActors != null)
+ {
+ paramDict.Add(ParameterCode.ActorList, raiseEventOptions.TargetActors);
+ }
+ break;
+ default:
+ if (raiseEventOptions.TargetActors != null)
+ {
+ paramDict.Add(ParameterCode.ActorList, raiseEventOptions.TargetActors);
+ }
+ else if (raiseEventOptions.InterestGroup != 0)
+ {
+ paramDict.Add(ParameterCode.Group, (byte)raiseEventOptions.InterestGroup);
+ }
+ else if (raiseEventOptions.Receivers != ReceiverGroup.Others)
+ {
+ paramDict.Add(ParameterCode.ReceiverGroup, (byte)raiseEventOptions.Receivers);
+ }
+ if (raiseEventOptions.Flags.HttpForward)
+ {
+ paramDict.Add(ParameterCode.EventForward, (byte)raiseEventOptions.Flags.WebhookFlags);
+ }
+ break;
+ }
+ }
+ paramDict.Add(ParameterCode.Code, (byte)eventCode);
+ if (customEventContent != null)
+ {
+ paramDict.Add(ParameterCode.Data, (object)customEventContent);
+ }
+ return this.SendOperation(OperationCode.RaiseEvent, paramDict, sendOptions);
+ }
+ finally
+ {
+ this.paramDictionaryPool.Release(paramDict);
+ }
+ }
+
+
+ ///
+ /// Internally used operation to set some "per server" settings. This is for the Master Server.
+ ///
+ /// Set to true, to get Lobby Statistics (lists of existing lobbies).
+ /// False if the operation could not be sent.
+ public virtual bool OpSettings(bool receiveLobbyStats)
+ {
+ if (this.DebugOut >= DebugLevel.ALL)
+ {
+ this.Listener.DebugReturn(DebugLevel.ALL, "OpSettings()");
+ }
+
+ Dictionary opParameters = new Dictionary();
+
+ // implementation for Master Server:
+ if (receiveLobbyStats)
+ {
+ opParameters[(byte)0] = receiveLobbyStats;
+ }
+
+ if (opParameters.Count == 0)
+ {
+ // no need to send op in case we set the default values
+ return true;
+ }
+
+ return this.SendOperation(OperationCode.ServerSettings, opParameters, SendOptions.SendReliable);
+ }
+ }
+
+ /// Used in the RoomOptionFlags parameter, this bitmask toggles options in the room.
+ internal enum RoomOptionBit : int
+ {
+ CheckUserOnJoin = 0x01, // toggles a check of the UserId when joining (enabling returning to a game)
+ DeleteCacheOnLeave = 0x02, // deletes cache on leave
+ SuppressRoomEvents = 0x04, // suppresses all room events
+ PublishUserId = 0x08, // signals that we should publish userId
+ DeleteNullProps = 0x10, // signals that we should remove property if its value was set to null. see RoomOption to Delete Null Properties
+ BroadcastPropsChangeToAll = 0x20, // signals that we should send PropertyChanged event to all room players including initiator
+ SuppressPlayerInfo = 0x40, // disables events join and leave from the server as well as property broadcasts in a room (to minimize traffic)
+ }
+
+ ///
+ /// Options for OpFindFriends can be combined to filter which rooms of friends are returned.
+ ///
+ public class FindFriendsOptions
+ {
+ /// Include a friend's room only if it is created and confirmed by the game server.
+ public bool CreatedOnGs = false; //flag: 0x01
+ /// Include a friend's room only if it is visible (using Room.IsVisible).
+ public bool Visible = false; //flag: 0x02
+ /// Include a friend's room only if it is open (using Room.IsOpen).
+ public bool Open = false; //flag: 0x04
+
+ /// Turns the bool options into an integer, which is sent as option flags for Op FindFriends.
+ /// The options applied to bits of an integer.
+ internal int ToIntFlags()
+ {
+ int optionFlags = 0;
+ if (this.CreatedOnGs)
+ {
+ optionFlags = optionFlags | 0x1;
+ }
+ if (this.Visible)
+ {
+ optionFlags = optionFlags | 0x2;
+ }
+ if (this.Open)
+ {
+ optionFlags = optionFlags | 0x4;
+ }
+ return optionFlags;
+ }
+ }
+
+
+ ///
+ /// Parameters for the matchmaking of JoinRandomRoom and JoinRandomOrCreateRoom.
+ ///
+ ///
+ /// More about matchmaking: .
+ ///
+ public class OpJoinRandomRoomParams
+ {
+ /// The custom room properties a room must have to fit. All key-values must be present to match. In SQL Lobby, use SqlLobbyFilter instead.
+ public Hashtable ExpectedCustomRoomProperties;
+ /// Filters by the MaxPlayers value of rooms.
+ public byte ExpectedMaxPlayers;
+ /// The MatchmakingMode affects how rooms get filled. By default, the server fills rooms.
+ public MatchmakingMode MatchingType;
+ /// The lobby in which to match. The type affects how filters are applied.
+ public TypedLobby TypedLobby;
+ /// SQL query to filter room matches. For default-typed lobbies, use ExpectedCustomRoomProperties instead.
+ public string SqlLobbyFilter;
+ /// The expected users list blocks player slots for your friends or team mates to join the room, too.
+ /// See: https://doc.photonengine.com/en-us/pun/v2/lobby-and-matchmaking/matchmaking-and-lobby#matchmaking_slot_reservation
+ public string[] ExpectedUsers;
+ }
+
+ /// Parameters for creating rooms.
+ public class EnterRoomParams
+ {
+ /// The name of the room to create. If null, the server generates a unique name. If not null, it must be unique and new or will cause an error.
+ public string RoomName;
+ /// The RoomOptions define the optional behaviour of rooms.
+ public RoomOptions RoomOptions;
+ /// A lobby to attach the new room to. If set, this overrides a joined lobby (if any).
+ public TypedLobby Lobby;
+ /// The custom player properties that describe this client / user. Keys must be strings.
+ public Hashtable PlayerProperties;
+ /// Internally used value to skip some values when the operation is sent to the Master Server.
+ protected internal bool OnGameServer = true; // defaults to true! better send more parameter than too few (GS needs all)
+ /// Internally used value to check which join mode we should call.
+ protected internal JoinMode JoinMode;
+ /// A list of users who are expected to join the room along with this client. Reserves slots for rooms with MaxPlayers value.
+ public string[] ExpectedUsers;
+ }
+
+
+ ///
+ /// ErrorCode defines the default codes associated with Photon client/server communication.
+ ///
+ public class ErrorCode
+ {
+ /// (0) is always "OK", anything else an error or specific situation.
+ public const int Ok = 0;
+
+ // server - Photon low(er) level: <= 0
+
+ ///
+ /// (-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).
+ ///
+ ///
+ /// Before you call any operations on the Cloud servers, the automated client workflow must complete its authorization.
+ /// Wait until State is: JoinedLobby or ConnectedToMasterServer
+ ///
+ public const int OperationNotAllowedInCurrentState = -3;
+
+ /// (-2) The operation you called is not implemented on the server (application) you connect to. Make sure you run the fitting applications.
+ [Obsolete("Use InvalidOperation.")]
+ public const int InvalidOperationCode = -2;
+
+ /// (-2) The operation you called could not be executed on the server.
+ ///
+ /// Make sure you are connected to the server you expect.
+ ///
+ /// This code is used in several cases:
+ /// The arguments/parameters of the operation might be out of range, missing entirely or conflicting.
+ /// The operation you called is not implemented on the server (application). Server-side plugins affect the available operations.
+ ///
+ public const int InvalidOperation = -2;
+
+ /// (-1) Something went wrong in the server. Try to reproduce and contact Exit Games.
+ public const int InternalServerError = -1;
+
+ // server - client: 0x7FFF and down
+ // logic-level error codes start with short.max
+
+ /// (32767) Authentication failed. Possible cause: AppId is unknown to Photon (in cloud service).
+ public const int InvalidAuthentication = 0x7FFF;
+
+ /// (32766) GameId (name) already in use (can't create another). Change name.
+ public const int GameIdAlreadyExists = 0x7FFF - 1;
+
+ /// (32765) Game is full. This rarely happens when some player joined the room before your join completed.
+ public const int GameFull = 0x7FFF - 2;
+
+ /// (32764) Game is closed and can't be joined. Join another game.
+ public const int GameClosed = 0x7FFF - 3;
+
+ [Obsolete("No longer used, cause random matchmaking is no longer a process.")]
+ public const int AlreadyMatched = 0x7FFF - 4;
+
+ /// (32762) All servers are busy. This is a temporary issue and the game logic should try again after a brief wait time.
+ ///
+ /// This error may happen for all operations that create rooms. The operation response will contain this error code.
+ ///
+ /// This error is very unlikely to happen as we monitor load on all servers and add them on demand.
+ /// However, it's good to be prepared for a shortage of machines or surge in CCUs.
+ ///
+ public const int ServerFull = 0x7FFF - 5;
+
+ /// (32761) Not in use currently.
+ public const int UserBlocked = 0x7FFF - 6;
+
+ /// (32760) Random matchmaking only succeeds if a room exists thats neither closed nor full. Repeat in a few seconds or create a new room.
+ public const int NoRandomMatchFound = 0x7FFF - 7;
+
+ /// (32758) Join can fail if the room (name) is not existing (anymore). This can happen when players leave while you join.
+ public const int GameDoesNotExist = 0x7FFF - 9;
+
+ /// (32757) Authorization on the Photon Cloud failed because the concurrent users (CCU) limit of the app's subscription is reached.
+ ///
+ /// 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.
+ ///
+ public const int MaxCcuReached = 0x7FFF - 10;
+
+ /// (32756) Authorization on the Photon Cloud failed because the app's subscription does not allow to use a particular region's server.
+ ///
+ /// 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://dashboard.photonengine.com
+ ///
+ /// 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.
+ ///
+ public const int InvalidRegion = 0x7FFF - 11;
+
+ ///
+ /// (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.
+ ///
+ public const int CustomAuthenticationFailed = 0x7FFF - 12;
+
+ /// (32753) The Authentication ticket expired. Usually, this is refreshed behind the scenes. Connect (and authorize) again.
+ public const int AuthenticationTicketExpired = 0x7FF1;
+
+ ///
+ /// (32752) A server-side plugin (or webhook) failed to execute and reported an error. Check the OperationResponse.DebugMessage.
+ ///
+ public const int PluginReportedError = 0x7FFF - 15;
+
+ ///
+ /// (32751) CreateGame/JoinGame/Join operation fails if expected plugin does not correspond to loaded one.
+ ///
+ public const int PluginMismatch = 0x7FFF - 16;
+
+ ///
+ /// (32750) for join requests. Indicates the current peer already called join and is joined to the room.
+ ///
+ public const int JoinFailedPeerAlreadyJoined = 32750; // 0x7FFF - 17,
+
+ ///
+ /// (32749) for join requests. Indicates the list of InactiveActors already contains an actor with the requested ActorNr or UserId.
+ ///
+ public const int JoinFailedFoundInactiveJoiner = 32749; // 0x7FFF - 18,
+
+ ///
+ /// (32748) for join requests. Indicates the list of Actors (active and inactive) did not contain an actor with the requested ActorNr or UserId.
+ ///
+ public const int JoinFailedWithRejoinerNotFound = 32748; // 0x7FFF - 19,
+
+ ///
+ /// (32747) for join requests. Note: for future use - Indicates the requested UserId was found in the ExcludedList.
+ ///
+ public const int JoinFailedFoundExcludedUserId = 32747; // 0x7FFF - 20,
+
+ ///
+ /// (32746) for join requests. Indicates the list of ActiveActors already contains an actor with the requested ActorNr or UserId.
+ ///
+ public const int JoinFailedFoundActiveJoiner = 32746; // 0x7FFF - 21,
+
+ ///
+ /// (32745) for SetProperties and RaiseEvent (if flag HttpForward is true) requests. Indicates the maximum allowed http requests per minute was reached.
+ ///
+ public const int HttpLimitReached = 32745; // 0x7FFF - 22,
+
+ ///
+ /// (32744) for WebRpc requests. Indicates the the call to the external service failed.
+ ///
+ public const int ExternalHttpCallFailed = 32744; // 0x7FFF - 23,
+
+ ///
+ /// (32743) for operations with defined limits (as in calls per second, content count or size).
+ ///
+ public const int OperationLimitReached = 32743; // 0x7FFF - 24,
+
+ ///
+ /// (32742) Server error during matchmaking with slot reservation. E.g. the reserved slots can not exceed MaxPlayers.
+ ///
+ public const int SlotError = 32742; // 0x7FFF - 25,
+
+ ///
+ /// (32741) Server will react with this error if invalid encryption parameters provided by token
+ ///
+ public const int InvalidEncryptionParameters = 32741; // 0x7FFF - 24,
+
+}
+
+
+ ///
+ /// Class for constants. These (byte) values define "well known" properties for an Actor / Player.
+ ///
+ ///
+ /// These constants are used internally.
+ /// "Custom properties" have to use a string-type as key. They can be assigned at will.
+ ///
+ public class ActorProperties
+ {
+ /// (255) Name of a player/actor.
+ public const byte PlayerName = 255; // was: 1
+
+ /// (254) Tells you if the player is currently in this game (getting events live).
+ /// A server-set value for async games, where players can leave the game and return later.
+ public const byte IsInactive = 254;
+
+ /// (253) UserId of the player. Sent when room gets created with RoomOptions.PublishUserId = true.
+ public const byte UserId = 253;
+ }
+
+
+ ///
+ /// Class for constants. These (byte) values are for "well known" room/game properties used in Photon LoadBalancing.
+ ///
+ ///
+ /// These constants are used internally.
+ /// "Custom properties" have to use a string-type as key. They can be assigned at will.
+ ///
+ public class GamePropertyKey
+ {
+ /// (255) Max number of players that "fit" into this room. 0 is for "unlimited".
+ public const byte MaxPlayers = 255;
+
+ /// (254) Makes this room listed or not in the lobby on master.
+ public const byte IsVisible = 254;
+
+ /// (253) Allows more players to join a room (or not).
+ public const byte IsOpen = 253;
+
+ /// (252) Current count of players in the room. Used only in the lobby on master.
+ public const byte PlayerCount = 252;
+
+ /// (251) True if the room is to be removed from room listing (used in update to room list in lobby on master)
+ public const byte Removed = 251;
+
+ /// (250) A list of the room properties to pass to the RoomInfo list in a lobby. This is used in CreateRoom, which defines this list once per room.
+ public const byte PropsListedInLobby = 250;
+
+ /// (249) Equivalent of Operation Join parameter CleanupCacheOnLeave.
+ public const byte CleanupCacheOnLeave = 249;
+
+ /// (248) Code for MasterClientId, which is synced by server. When sent as op-parameter this is (byte)203. As room property this is (byte)248.
+ /// Tightly related to ParameterCode.MasterClientId.
+ public const byte MasterClientId = (byte)248;
+
+ /// (247) Code for ExpectedUsers in a room. Matchmaking keeps a slot open for the players with these userIDs.
+ public const byte ExpectedUsers = (byte)247;
+
+ /// (246) Player Time To Live. How long any player can be inactive (due to disconnect or leave) before the user gets removed from the playerlist (freeing a slot).
+ public const byte PlayerTtl = (byte)246;
+
+ /// (245) Room Time To Live. How long a room stays available (and in server-memory), after the last player becomes inactive. After this time, the room gets persisted or destroyed.
+ public const byte EmptyRoomTtl = (byte)245;
+ }
+
+
+ ///
+ /// Class for constants. These values are for events defined by Photon LoadBalancing.
+ ///
+ /// They start at 255 and go DOWN. Your own in-game events can start at 0. These constants are used internally.
+ public class EventCode
+ {
+ /// (230) Initial list of RoomInfos (in lobby on Master)
+ public const byte GameList = 230;
+
+ /// (229) Update of RoomInfos to be merged into "initial" list (in lobby on Master)
+ public const byte GameListUpdate = 229;
+
+ /// (228) Currently not used. State of queueing in case of server-full
+ public const byte QueueState = 228;
+
+ /// (227) Currently not used. Event for matchmaking
+ public const byte Match = 227;
+
+ /// (226) Event with stats about this application (players, rooms, etc)
+ public const byte AppStats = 226;
+
+ /// (224) This event provides a list of lobbies with their player and game counts.
+ public const byte LobbyStats = 224;
+
+ /// (210) Internally used in case of hosting by Azure
+ [Obsolete("TCP routing was removed after becoming obsolete.")]
+ public const byte AzureNodeInfo = 210;
+
+ /// (255) Event Join: someone joined the game. The new actorNumber is provided as well as the properties of that actor (if set in OpJoin).
+ public const byte Join = (byte)255;
+
+ /// (254) Event Leave: The player who left the game can be identified by the actorNumber.
+ public const byte Leave = (byte)254;
+
+ /// (253) When you call OpSetProperties with the broadcast option "on", this event is fired. It contains the properties being set.
+ public const byte PropertiesChanged = (byte)253;
+
+ /// (253) When you call OpSetProperties with the broadcast option "on", this event is fired. It contains the properties being set.
+ [Obsolete("Use PropertiesChanged now.")]
+ public const byte SetProperties = (byte)253;
+
+ /// (252) When player left game unexpected and the room has a playerTtl != 0, this event is fired to let everyone know about the timeout.
+ /// Obsolete. Replaced by Leave. public const byte Disconnect = LiteEventCode.Disconnect;
+
+ /// (251) Sent by Photon Cloud when a plugin-call or webhook-call failed or events cache limit exceeded. Usually, the execution on the server continues, despite the issue. Contains: ParameterCode.Info.
+ ///
+ public const byte ErrorInfo = 251;
+
+ /// (250) Sent by Photon whent he event cache slice was changed. Done by OpRaiseEvent.
+ public const byte CacheSliceChanged = 250;
+
+ /// (223) Sent by Photon to update a token before it times out.
+ public const byte AuthEvent = 223;
+ }
+
+
+ /// Class for constants. Codes for parameters of Operations and Events.
+ /// These constants are used internally.
+ public class ParameterCode
+ {
+ /// (237) A bool parameter for creating games. If set to true, no room events are sent to the clients on join and leave. Default: false (and not sent).
+ public const byte SuppressRoomEvents = 237;
+
+ /// (236) Time To Live (TTL) for a room when the last player leaves. Keeps room in memory for case a player re-joins soon. In milliseconds.
+ public const byte EmptyRoomTTL = 236;
+
+ /// (235) Time To Live (TTL) for an 'actor' in a room. If a client disconnects, this actor is inactive first and removed after this timeout. In milliseconds.
+ public const byte PlayerTTL = 235;
+
+ /// (234) Optional parameter of OpRaiseEvent and OpSetCustomProperties to forward the event/operation to a web-service.
+ public const byte EventForward = 234;
+
+ /// (233) Optional parameter of OpLeave in async games. If false, the player does abandons the game (forever). By default players become inactive and can re-join.
+ [Obsolete("Use: IsInactive")]
+ public const byte IsComingBack = (byte)233;
+
+ /// (233) Used in EvLeave to describe if a user is inactive (and might come back) or not. In rooms with PlayerTTL, becoming inactive is the default case.
+ public const byte IsInactive = (byte)233;
+
+ /// (232) Used when creating rooms to define if any userid can join the room only once.
+ public const byte CheckUserOnJoin = (byte)232;
+
+ /// (231) Code for "Check And Swap" (CAS) when changing properties.
+ public const byte ExpectedValues = (byte)231;
+
+ /// (230) Address of a (game) server to use.
+ public const byte Address = 230;
+
+ /// (229) Count of players in this application in a rooms (used in stats event)
+ public const byte PeerCount = 229;
+
+ /// (228) Count of games in this application (used in stats event)
+ public const byte GameCount = 228;
+
+ /// (227) Count of players on the master server (in this app, looking for rooms)
+ public const byte MasterPeerCount = 227;
+
+ /// (225) User's ID
+ public const byte UserId = 225;
+
+ /// (224) Your application's ID: a name on your own Photon or a GUID on the Photon Cloud
+ public const byte ApplicationId = 224;
+
+ /// (223) Not used currently (as "Position"). If you get queued before connect, this is your position
+ public const byte Position = 223;
+
+ /// (223) Modifies the matchmaking algorithm used for OpJoinRandom. Allowed parameter values are defined in enum MatchmakingMode.
+ public const byte MatchMakingType = 223;
+
+ /// (222) List of RoomInfos about open / listed rooms
+ public const byte GameList = 222;
+
+ /// (221) Internally used to establish encryption
+ public const byte Token = 221;
+
+ /// (220) Version of your application
+ public const byte AppVersion = 220;
+
+ /// (210) Internally used in case of hosting by Azure
+ [Obsolete("TCP routing was removed after becoming obsolete.")]
+ public const byte AzureNodeInfo = 210; // only used within events, so use: EventCode.AzureNodeInfo
+
+ /// (209) Internally used in case of hosting by Azure
+ [Obsolete("TCP routing was removed after becoming obsolete.")]
+ public const byte AzureLocalNodeId = 209;
+
+ /// (208) Internally used in case of hosting by Azure
+ [Obsolete("TCP routing was removed after becoming obsolete.")]
+ public const byte AzureMasterNodeId = 208;
+
+ /// (255) Code for the gameId/roomName (a unique name per room). Used in OpJoin and similar.
+ public const byte RoomName = (byte)255;
+
+ /// (250) Code for broadcast parameter of OpSetProperties method.
+ public const byte Broadcast = (byte)250;
+
+ /// (252) Code for list of players in a room.
+ public const byte ActorList = (byte)252;
+
+ /// (254) Code of the Actor of an operation. Used for property get and set.
+ public const byte ActorNr = (byte)254;
+
+ /// (249) Code for property set (Hashtable).
+ public const byte PlayerProperties = (byte)249;
+
+ /// (245) Code of data/custom content of an event. Used in OpRaiseEvent.
+ public const byte CustomEventContent = (byte)245;
+
+ /// (245) Code of data of an event. Used in OpRaiseEvent.
+ public const byte Data = (byte)245;
+
+ /// (244) Code used when sending some code-related parameter, like OpRaiseEvent's event-code.
+ /// This is not the same as the Operation's code, which is no longer sent as part of the parameter Dictionary in Photon 3.
+ public const byte Code = (byte)244;
+
+ /// (248) Code for property set (Hashtable).
+ public const byte GameProperties = (byte)248;
+
+ ///
+ /// (251) Code for property-set (Hashtable). This key is used when sending only one set of properties.
+ /// If either ActorProperties or GameProperties are used (or both), check those keys.
+ ///
+ public const byte Properties = (byte)251;
+
+ /// (253) Code of the target Actor of an operation. Used for property set. Is 0 for game
+ public const byte TargetActorNr = (byte)253;
+
+ /// (246) Code to select the receivers of events (used in Lite, Operation RaiseEvent).
+ public const byte ReceiverGroup = (byte)246;
+
+ /// (247) Code for caching events while raising them.
+ public const byte Cache = (byte)247;
+
+ /// (241) Bool parameter of CreateGame Operation. If true, server cleans up roomcache of leaving players (their cached events get removed).
+ public const byte CleanupCacheOnLeave = (byte)241;
+
+ /// (240) Code for "group" operation-parameter (as used in Op RaiseEvent).
+ public const byte Group = 240;
+
+ /// (239) The "Remove" operation-parameter can be used to remove something from a list. E.g. remove groups from player's interest groups.
+ public const byte Remove = 239;
+
+ /// (239) Used in Op Join to define if UserIds of the players are broadcast in the room. Useful for FindFriends and reserving slots for expected users.
+ public const byte PublishUserId = 239;
+
+ /// (238) The "Add" operation-parameter can be used to add something to some list or set. E.g. add groups to player's interest groups.
+ public const byte Add = 238;
+
+ /// (218) Content for EventCode.ErrorInfo and internal debug operations.
+ public const byte Info = 218;
+
+ /// (217) This key's (byte) value defines the target custom authentication type/service the client connects with. Used in OpAuthenticate
+ public const byte ClientAuthenticationType = 217;
+
+ /// (216) This key's (string) value provides parameters sent to the custom authentication type/service the client connects with. Used in OpAuthenticate
+ public const byte ClientAuthenticationParams = 216;
+
+ /// (215) Makes the server create a room if it doesn't exist. OpJoin uses this to always enter a room, unless it exists and is full/closed.
+ // public const byte CreateIfNotExists = 215;
+
+ /// (215) The JoinMode enum defines which variant of joining a room will be executed: Join only if available, create if not exists or re-join.
+ /// Replaces CreateIfNotExists which was only a bool-value.
+ public const byte JoinMode = 215;
+
+ /// (214) This key's (string or byte[]) value provides parameters sent to the custom authentication service setup in Photon Dashboard. Used in OpAuthenticate
+ public const byte ClientAuthenticationData = 214;
+
+ /// (203) Code for MasterClientId, which is synced by server. When sent as op-parameter this is code 203.
+ /// Tightly related to GamePropertyKey.MasterClientId.
+ public const byte MasterClientId = (byte)203;
+
+ /// (1) Used in Op FindFriends request. Value must be string[] of friends to look up.
+ public const byte FindFriendsRequestList = (byte)1;
+
+ /// (2) Used in Op FindFriends request. An integer containing option-flags to filter the results.
+ public const byte FindFriendsOptions = (byte)2;
+
+ /// (1) Used in Op FindFriends response. Contains bool[] list of online states (false if not online).
+ public const byte FindFriendsResponseOnlineList = (byte)1;
+
+ /// (2) Used in Op FindFriends response. Contains string[] of room names ("" where not known or no room joined).
+ public const byte FindFriendsResponseRoomIdList = (byte)2;
+
+ /// (213) Used in matchmaking-related methods and when creating a room to name a lobby (to join or to attach a room to).
+ public const byte LobbyName = (byte)213;
+
+ /// (212) Used in matchmaking-related methods and when creating a room to define the type of a lobby. Combined with the lobby name this identifies the lobby.
+ public const byte LobbyType = (byte)212;
+
+ /// (211) This (optional) parameter can be sent in Op Authenticate to turn on Lobby Stats (info about lobby names and their user- and game-counts).
+ public const byte LobbyStats = (byte)211;
+
+ /// (210) Used for region values in OpAuth and OpGetRegions.
+ public const byte Region = (byte)210;
+
+ /// (209) Path of the WebRPC that got called. Also known as "WebRpc Name". Type: string.
+ public const byte UriPath = 209;
+
+ /// (208) Parameters for a WebRPC as: Dictionary<string, object>. This will get serialized to JSon.
+ public const byte WebRpcParameters = 208;
+
+ /// (207) ReturnCode for the WebRPC, as sent by the web service (not by Photon, which uses ErrorCode). Type: byte.
+ public const byte WebRpcReturnCode = 207;
+
+ /// (206) Message returned by WebRPC server. Analog to Photon's debug message. Type: string.
+ public const byte WebRpcReturnMessage = 206;
+
+ /// (205) Used to define a "slice" for cached events. Slices can easily be removed from cache. Type: int.
+ public const byte CacheSliceIndex = 205;
+
+ /// (204) Informs the server of the expected plugin setup.
+ ///
+ /// The operation will fail in case of a plugin mismatch returning error code PluginMismatch 32751(0x7FFF - 16).
+ /// Setting string[]{} means the client expects no plugin to be setup.
+ /// Note: for backwards compatibility null omits any check.
+ ///
+ public const byte Plugins = 204;
+
+ /// (202) Used by the server in Operation Responses, when it sends the nickname of the client (the user's nickname).
+ public const byte NickName = 202;
+
+ /// (201) Informs user about name of plugin load to game
+ public const byte PluginName = 201;
+
+ /// (200) Informs user about version of plugin load to game
+ public const byte PluginVersion = 200;
+
+ /// (196) Cluster info provided in OpAuthenticate/OpAuthenticateOnce responses.
+ public const byte Cluster = 196;
+
+ /// (195) Protocol which will be used by client to connect master/game servers. Used for nameserver.
+ public const byte ExpectedProtocol = 195;
+
+ /// (194) Set of custom parameters which are sent in auth request.
+ public const byte CustomInitData = 194;
+
+ /// (193) How are we going to encrypt data.
+ public const byte EncryptionMode = 193;
+
+ /// (192) Parameter of Authentication, which contains encryption keys (depends on AuthMode and EncryptionMode).
+ public const byte EncryptionData = 192;
+
+ /// (191) An int parameter summarizing several boolean room-options with bit-flags.
+ public const byte RoomOptionFlags = 191;
+ }
+
+
+ ///
+ /// Class for constants. Contains operation codes.
+ ///
+ /// These constants are used internally.
+ public class OperationCode
+ {
+ [Obsolete("Exchanging encrpytion keys is done internally in the lib now. Don't expect this operation-result.")]
+ public const byte ExchangeKeysForEncryption = 250;
+
+ /// (255) Code for OpJoin, to get into a room.
+ [Obsolete]
+ public const byte Join = 255;
+
+ /// (231) Authenticates this peer and connects to a virtual application
+ public const byte AuthenticateOnce = 231;
+
+ /// (230) Authenticates this peer and connects to a virtual application
+ public const byte Authenticate = 230;
+
+ /// (229) Joins lobby (on master)
+ public const byte JoinLobby = 229;
+
+ /// (228) Leaves lobby (on master)
+ public const byte LeaveLobby = 228;
+
+ /// (227) Creates a game (or fails if name exists)
+ public const byte CreateGame = 227;
+
+ /// (226) Join game (by name)
+ public const byte JoinGame = 226;
+
+ /// (225) Joins random game (on master)
+ public const byte JoinRandomGame = 225;
+
+ // public const byte CancelJoinRandom = 224; // obsolete, cause JoinRandom no longer is a "process". now provides result immediately
+
+ /// (254) Code for OpLeave, to get out of a room.
+ public const byte Leave = (byte)254;
+
+ /// (253) Raise event (in a room, for other actors/players)
+ public const byte RaiseEvent = (byte)253;
+
+ /// (252) Set Properties (of room or actor/player)
+ public const byte SetProperties = (byte)252;
+
+ /// (251) Get Properties
+ public const byte GetProperties = (byte)251;
+
+ /// (248) Operation code to change interest groups in Rooms (Lite application and extending ones).
+ public const byte ChangeGroups = (byte)248;
+
+ /// (222) Request the rooms and online status for a list of friends (by name, which should be unique).
+ public const byte FindFriends = 222;
+
+ /// (221) Request statistics about a specific list of lobbies (their user and game count).
+ public const byte GetLobbyStats = 221;
+
+ /// (220) Get list of regional servers from a NameServer.
+ public const byte GetRegions = 220;
+
+ /// (219) WebRpc Operation.
+ public const byte WebRpc = 219;
+
+ /// (218) Operation to set some server settings. Used with different parameters on various servers.
+ public const byte ServerSettings = 218;
+
+ /// (217) Get the game list matching a supplied sql filter (SqlListLobby only)
+ public const byte GetGameList = 217;
+ }
+
+ /// Defines possible values for OpJoinRoom and OpJoinOrCreate. It tells the server if the room can be only be joined normally, created implicitly or found on a web-service for Turnbased games.
+ /// These values are not directly used by a game but implicitly set.
+ public enum JoinMode : byte
+ {
+ /// Regular join. The room must exist.
+ Default = 0,
+
+ /// Join or create the room if it's not existing. Used for OpJoinOrCreate for example.
+ CreateIfNotExists = 1,
+
+ /// The room might be out of memory and should be loaded (if possible) from a Turnbased web-service.
+ JoinOrRejoin = 2,
+
+ /// Only re-join will be allowed. If the user is not yet in the room, this will fail.
+ RejoinOnly = 3,
+ }
+
+ ///
+ /// Options for matchmaking rules for OpJoinRandom.
+ ///
+ public enum MatchmakingMode : byte
+ {
+ /// Fills up rooms (oldest first) to get players together as fast as possible. Default.
+ /// Makes most sense with MaxPlayers > 0 and games that can only start with more players.
+ FillRoom = 0,
+
+ /// Distributes players across available rooms sequentially but takes filter into account. Without filter, rooms get players evenly distributed.
+ SerialMatching = 1,
+
+ /// Joins a (fully) random room. Expected properties must match but aside from this, any available room might be selected.
+ RandomMatching = 2
+ }
+
+
+ ///
+ /// Lite - OpRaiseEvent lets you chose which actors in the room should receive events.
+ /// By default, events are sent to "Others" but you can overrule this.
+ ///
+ public enum ReceiverGroup : byte
+ {
+ /// Default value (not sent). Anyone else gets my event.
+ Others = 0,
+
+ /// Everyone in the current room (including this peer) will get this event.
+ All = 1,
+
+ /// The server sends this event only to the actor with the lowest actorNumber.
+ /// The "master client" does not have special rights but is the one who is in this room the longest time.
+ MasterClient = 2,
+ }
+
+ ///
+ /// Lite - OpRaiseEvent allows you to cache events and automatically send them to joining players in a room.
+ /// Events are cached per event code and player: Event 100 (example!) can be stored once per player.
+ /// Cached events can be modified, replaced and removed.
+ ///
+ ///
+ /// Caching works only combination with ReceiverGroup options Others and All.
+ ///
+ public enum EventCaching : byte
+ {
+ /// Default value (not sent).
+ DoNotCache = 0,
+
+ /// Will merge this event's keys with those already cached.
+ [Obsolete]
+ MergeCache = 1,
+
+ /// Replaces the event cache for this eventCode with this event's content.
+ [Obsolete]
+ ReplaceCache = 2,
+
+ /// Removes this event (by eventCode) from the cache.
+ [Obsolete]
+ RemoveCache = 3,
+
+ /// Adds an event to the room's cache
+ AddToRoomCache = 4,
+
+ /// Adds this event to the cache for actor 0 (becoming a "globally owned" event in the cache).
+ AddToRoomCacheGlobal = 5,
+
+ /// Remove fitting event from the room's cache.
+ RemoveFromRoomCache = 6,
+
+ /// Removes events of players who already left the room (cleaning up).
+ RemoveFromRoomCacheForActorsLeft = 7,
+
+ /// Increase the index of the sliced cache.
+ SliceIncreaseIndex = 10,
+
+ /// Set the index of the sliced cache. You must set RaiseEventOptions.CacheSliceIndex for this.
+ SliceSetIndex = 11,
+
+ /// Purge cache slice with index. Exactly one slice is removed from cache. You must set RaiseEventOptions.CacheSliceIndex for this.
+ SlicePurgeIndex = 12,
+
+ /// Purge cache slices with specified index and anything lower than that. You must set RaiseEventOptions.CacheSliceIndex for this.
+ SlicePurgeUpToIndex = 13,
+ }
+
+ ///
+ /// Flags for "types of properties", being used as filter in OpGetProperties.
+ ///
+ [Flags]
+ public enum PropertyTypeFlag : byte
+ {
+ /// (0x00) Flag type for no property type.
+ None = 0x00,
+
+ /// (0x01) Flag type for game-attached properties.
+ Game = 0x01,
+
+ /// (0x02) Flag type for actor related propeties.
+ Actor = 0x02,
+
+ /// (0x01) Flag type for game AND actor properties. Equal to 'Game'
+ GameAndActor = Game | Actor
+ }
+
+
+ /// Wraps up common room properties needed when you create rooms. Read the individual entries for more details.
+ /// This directly maps to the fields in the Room class.
+ public class RoomOptions
+ {
+ /// Defines if this room is listed in the lobby. If not, it also is not joined randomly.
+ ///
+ /// A room that is not visible will be excluded from the room lists that are sent to the clients in lobbies.
+ /// An invisible room can be joined by name but is excluded from random matchmaking.
+ ///
+ /// Use this to "hide" a room and simulate "private rooms". Players can exchange a roomname and create it
+ /// invisble to avoid anyone else joining it.
+ ///
+ public bool IsVisible { get { return this.isVisible; } set { this.isVisible = value; } }
+ private bool isVisible = true;
+
+ /// Defines if this room can be joined at all.
+ ///
+ /// If a room is closed, no player can join this. As example this makes sense when 3 of 4 possible players
+ /// start their gameplay early and don't want anyone to join during the game.
+ /// The room can still be listed in the lobby (set isVisible to control lobby-visibility).
+ ///
+ public bool IsOpen { get { return this.isOpen; } set { this.isOpen = value; } }
+ private bool isOpen = true;
+
+ /// Max number of players that can be in the room at any time. 0 means "no limit".
+ public byte MaxPlayers;
+
+ /// Time To Live (TTL) for an 'actor' in a room. If a client disconnects, this actor is inactive first and removed after this timeout. In milliseconds.
+ public int PlayerTtl;
+
+ /// Time To Live (TTL) for a room when the last player leaves. Keeps room in memory for case a player re-joins soon. In milliseconds.
+ public int EmptyRoomTtl;
+
+ /// Removes a user's events and properties from the room when a user leaves.
+ ///
+ /// This makes sense when in rooms where players can't place items in the room and just vanish entirely.
+ /// When you disable this, the event history can become too long to load if the room stays in use indefinitely.
+ /// Default: true. Cleans up the cache and props of leaving users.
+ ///
+ public bool CleanupCacheOnLeave { get { return this.cleanupCacheOnLeave; } set { this.cleanupCacheOnLeave = value; } }
+ private bool cleanupCacheOnLeave = true;
+
+ /// The room's custom properties to set. Use string keys!
+ ///
+ /// Custom room properties are any key-values you need to define the game's setup.
+ /// The shorter your keys are, the better.
+ /// Example: Map, Mode (could be "m" when used with "Map"), TileSet (could be "t").
+ ///
+ public Hashtable CustomRoomProperties;
+
+ /// Defines the custom room properties that get listed in the lobby.
+ ///
+ /// Name the custom room properties that should be available to clients that are in a lobby.
+ /// Use with care. Unless a custom property is essential for matchmaking or user info, it should
+ /// not be sent to the lobby, which causes traffic and delays for clients in the lobby.
+ ///
+ /// Default: No custom properties are sent to the lobby.
+ ///
+ public string[] CustomRoomPropertiesForLobby = new string[0];
+
+ /// Informs the server of the expected plugin setup.
+ ///
+ /// The operation will fail in case of a plugin missmatch returning error code PluginMismatch 32757(0x7FFF - 10).
+ /// Setting string[]{} means the client expects no plugin to be setup.
+ /// Note: for backwards compatibility null omits any check.
+ ///
+ public string[] Plugins;
+
+ ///
+ /// Tells the server to skip room events for joining and leaving players.
+ ///
+ ///
+ /// Using this makes the client unaware of the other players in a room.
+ /// That can save some traffic if you have some server logic that updates players
+ /// but it can also limit the client's usability.
+ ///
+ public bool SuppressRoomEvents { get; set; }
+
+ /// Disables events join and leave from the server as well as property broadcasts in a room (to minimize traffic)
+ public bool SuppressPlayerInfo { get; set; }
+
+ ///
+ /// Defines if the UserIds of players get "published" in the room. Useful for FindFriends, if players want to play another game together.
+ ///
+ ///
+ /// When you set this to true, Photon will publish the UserIds of the players in that room.
+ /// In that case, you can use PhotonPlayer.userId, to access any player's userID.
+ /// This is useful for FindFriends and to set "expected users" to reserve slots in a room.
+ ///
+ public bool PublishUserId { get; set; }
+
+ /// Optionally, properties get deleted, when null gets assigned as value. Defaults to off / false.
+ ///
+ /// When Op SetProperties is setting a key's value to null, the server and clients should remove the key/value from the Custom Properties.
+ /// By default, the server keeps the keys (and null values) and sends them to joining players.
+ ///
+ /// Important: Only when SetProperties does a "broadcast", the change (key, value = null) is sent to clients to update accordingly.
+ /// This applies to Custom Properties for rooms and actors/players.
+ ///
+ public bool DeleteNullProperties { get; set; }
+
+ /// By default, property changes are sent back to the client that's setting them to avoid de-sync when properties are set concurrently.
+ ///
+ /// This option is enables by default to fix this scenario:
+ ///
+ /// 1) On server, room property ABC is set to value FOO, which triggers notifications to all the clients telling them that the property changed.
+ /// 2) While that notification is in flight, a client sets the ABC property to value BAR.
+ /// 3) Client receives notification from the server and changes it�s local copy of ABC to FOO.
+ /// 4) Server receives the set operation and changes the official value of ABC to BAR, but never notifies the client that sent the set operation that the value is now BAR.
+ ///
+ /// Without this option, the client that set the value to BAR never hears from the server that the official copy has been updated to BAR, and thus gets stuck with a value of FOO.
+ ///
+ public bool BroadcastPropsChangeToAll { get { return this.broadcastPropsChangeToAll; } set { this.broadcastPropsChangeToAll = value; } }
+ private bool broadcastPropsChangeToAll = true;
+
+ #if SERVERSDK
+ public bool CheckUserOnJoin { get; set; }
+ #endif
+ }
+
+
+ /// Aggregates several less-often used options for operation RaiseEvent. See field descriptions for usage details.
+ public class RaiseEventOptions
+ {
+ /// Default options: CachingOption: DoNotCache, InterestGroup: 0, targetActors: null, receivers: Others, sequenceChannel: 0.
+ public readonly static RaiseEventOptions Default = new RaiseEventOptions();
+
+ /// Defines if the server should simply send the event, put it in the cache or remove events that are like this one.
+ ///
+ /// When using option: SliceSetIndex, SlicePurgeIndex or SlicePurgeUpToIndex, set a CacheSliceIndex. All other options except SequenceChannel get ignored.
+ ///
+ public EventCaching CachingOption;
+
+ /// The number of the Interest Group to send this to. 0 goes to all users but to get 1 and up, clients must subscribe to the group first.
+ public byte InterestGroup;
+
+ /// A list of Player.ActorNumbers to send this event to. You can implement events that just go to specific users this way.
+ public int[] TargetActors;
+
+ /// Sends the event to All, MasterClient or Others (default). Be careful with MasterClient, as the client might disconnect before it got the event and it gets lost.
+ public ReceiverGroup Receivers;
+
+ /// Events are ordered per "channel". If you have events that are independent of others, they can go into another sequence or channel.
+ [Obsolete("Not used where SendOptions are a parameter too. Use SendOptions.Channel instead.")]
+ public byte SequenceChannel;
+
+ /// Optional flags to be used in Photon client SDKs with Op RaiseEvent and Op SetProperties.
+ /// Introduced mainly for webhooks 1.2 to control behavior of forwarded HTTP requests.
+ public WebFlags Flags = WebFlags.Default;
+
+ ///// Used along with CachingOption SliceSetIndex, SlicePurgeIndex or SlicePurgeUpToIndex if you want to set or purge a specific cache-slice.
+ //public int CacheSliceIndex;
+ }
+
+ /// Types of lobbies define their behaviour and capabilities. Check each value for details.
+ /// Values of this enum must be matched by the server.
+ public enum LobbyType :byte
+ {
+ /// Standard type and behaviour: While joined to this lobby clients get room-lists and JoinRandomRoom can use a simple filter to match properties (perfectly).
+ Default = 0,
+ /// This lobby type lists rooms like Default but JoinRandom has a parameter for SQL-like "where" clauses for filtering. This allows bigger, less, or and and combinations.
+ SqlLobby = 2,
+ /// This lobby does not send lists of games. It is only used for OpJoinRandomRoom. It keeps rooms available for a while when there are only inactive users left.
+ AsyncRandomLobby = 3
+ }
+
+ /// Refers to a specific lobby on the server.
+ ///
+ /// Name and Type combined are the unique identifier for a lobby.
+ /// The server will create lobbies "on demand", so no registration or setup is required.
+ /// An empty or null Name always points to the "default lobby" as special case.
+ ///
+ public class TypedLobby
+ {
+ ///
+ /// Name of the lobby. Default: null, pointing to the "default lobby".
+ ///
+ ///
+ /// If Name is null or empty, a TypedLobby will point to the "default lobby". This ignores the Type value and always acts as .
+ ///
+ public string Name;
+
+ ///
+ /// Type (and behaviour) of the lobby.
+ ///
+ ///
+ /// An empty or null Name always points to the "default lobby" as special case.
+ ///
+ public LobbyType Type;
+
+ ///
+ /// A reference to the default lobby which is the unique lobby that uses null as name and is of type .
+ ///
+ ///
+ /// There is only a single lobby with an empty name on the server. It is always of type .
+ /// On the other hand, this is a shortcut and reusable reference to the default lobby.
+ /// Do not change Name or Type.
+ ///
+ public static readonly TypedLobby Default = new TypedLobby();
+
+ ///
+ /// Returns whether or not this instance points to the "default lobby" ( ).
+ ///
+ ///
+ /// This comes up to checking if the Name is null or empty.
+ /// is not the same thing as the "default lobby" ( ).
+ ///
+ public bool IsDefault { get { return string.IsNullOrEmpty(this.Name); } }
+
+
+ ///
+ /// Creates a TypedLobby instance. Unless Name is changed, this points to the "default lobby" ( ).
+ ///
+ internal TypedLobby()
+ {
+ }
+
+ ///
+ /// Sets Name and Type of the new instance. Make sure name is not empty or null, as that always points to the "default lobby" ( ).
+ ///
+ /// Some string to identify a lobby.
+ /// The type of a lobby defines it's capabilities and behaviour.
+ public TypedLobby(string name, LobbyType type)
+ {
+ this.Name = name;
+ this.Type = type;
+ }
+
+ public override string ToString()
+ {
+ return string.Format("lobby '{0}'[{1}]", this.Name, this.Type);
+ }
+ }
+
+
+ ///
+ /// Info for a lobby on the server. Used when is true.
+ ///
+ public class TypedLobbyInfo : TypedLobby
+ {
+ /// Count of players that currently joined this lobby.
+ public int PlayerCount;
+
+ /// Count of rooms currently associated with this lobby.
+ public int RoomCount;
+
+ public override string ToString()
+ {
+ return string.Format("TypedLobbyInfo '{0}'[{1}] rooms: {2} players: {3}", this.Name, this.Type, this.RoomCount, this.PlayerCount);
+ }
+ }
+
+
+ ///
+ /// Options for authentication modes. From "classic" auth on each server to AuthOnce (on NameServer).
+ ///
+ public enum AuthModeOption { Auth, AuthOnce, AuthOnceWss }
+
+
+ ///
+ /// Options for optional "Custom Authentication" services used with Photon. Used by OpAuthenticate after connecting to Photon.
+ ///
+ public enum CustomAuthenticationType : byte
+ {
+ /// Use a custom authentication service. Currently the only implemented option.
+ Custom = 0,
+
+ /// Authenticates users by their Steam Account. Set Steam's ticket as "ticket" via AddAuthParameter().
+ Steam = 1,
+
+ /// Authenticates users by their Facebook Account. Set Facebooks's tocken as "token" via AddAuthParameter().
+ Facebook = 2,
+
+ /// Authenticates users by their Oculus Account and token. Set Oculus' userid as "userid" and nonce as "nonce" via AddAuthParameter().
+ Oculus = 3,
+
+ /// Authenticates users by their PSN Account and token on PS4. Set token as "token", env as "env" and userName as "userName" via AddAuthParameter().
+ PlayStation4 = 4,
+ [Obsolete("Use PlayStation4 or PlayStation5 as needed")]
+ PlayStation = 4,
+
+ /// Authenticates users by their Xbox Account. Pass the XSTS token via SetAuthPostData().
+ Xbox = 5,
+
+ /// Authenticates users by their HTC Viveport Account. Set userToken as "userToken" via AddAuthParameter().
+ Viveport = 10,
+
+ /// Authenticates users by their NSA ID. Set token as "token" and appversion as "appversion" via AddAuthParameter(). The appversion is optional.
+ NintendoSwitch = 11,
+
+ /// Authenticates users by their PSN Account and token on PS5. Set token as "token", env as "env" and userName as "userName" via AddAuthParameter().
+ PlayStation5 = 12,
+ [Obsolete("Use PlayStation4 or PlayStation5 as needed")]
+ Playstation5 = 12,
+
+ /// Authenticates users with Epic Online Services (EOS). Set token as "token" and ownershipToken as "ownershipToken" via AddAuthParameter(). The ownershipToken is optional.
+ Epic = 13,
+
+ /// Authenticates users with Facebook Gaming api. Set token as "token" via AddAuthParameter().
+ FacebookGaming = 15,
+
+ /// Disables custom authentication. Same as not providing any AuthenticationValues for connect (more precisely for: OpAuthenticate).
+ None = byte.MaxValue
+ }
+
+
+ ///
+ /// Container for user authentication in Photon. Set AuthValues before you connect - all else is handled.
+ ///
+ ///
+ /// 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 authentication: 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 AuthValues are sent in OpAuthenticate when you connect, so they must be set before you connect.
+ /// If the AuthValues.UserId is null or empty when it's sent to the server, then the Photon Server assigns a UserId!
+ ///
+ /// The Photon Cloud Dashboard will let you enable this feature and set important server values for it.
+ /// https://dashboard.photonengine.com
+ ///
+ public class AuthenticationValues
+ {
+ /// See AuthType.
+ private CustomAuthenticationType authType = CustomAuthenticationType.None;
+
+ /// The type of authentication provider that should be used. Defaults to None (no auth whatsoever).
+ /// Several auth providers are available and CustomAuthenticationType.Custom can be used if you build your own service.
+ public CustomAuthenticationType AuthType
+ {
+ get { return authType; }
+ set { authType = value; }
+ }
+
+ /// This string must contain any (http get) parameters expected by the used authentication service. By default, username and token.
+ ///
+ /// 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).
+ ///
+ public string AuthGetParameters { get; set; }
+
+ /// Data to be passed-on to the auth service via POST. Default: null (not sent). Either string or byte[] (see setters).
+ /// Maps to operation parameter 214.
+ public object AuthPostData { get; private set; }
+
+ /// Internal Photon token . After initial authentication, Photon provides a token for this client, subsequently used as (cached) validation.
+ /// Any token for custom authentication should be set via SetAuthPostData or AddAuthParameter.
+ public object Token { get; protected internal set; }
+
+ /// The UserId should be a unique identifier per user. This is for finding friends, etc..
+ /// See remarks of AuthValues for info about how this is set and used.
+ public string UserId { get; set; }
+
+
+ /// Creates empty auth values without any info.
+ public AuthenticationValues()
+ {
+ }
+
+ /// Creates minimal info about the user. If this is authenticated or not, depends on the set AuthType.
+ /// Some UserId to set in Photon.
+ public AuthenticationValues(string userId)
+ {
+ this.UserId = userId;
+ }
+
+ /// Sets the data to be passed-on to the auth service via POST.
+ /// AuthPostData is just one value. Each SetAuthPostData replaces any previous value. It can be either a string, a byte[] or a dictionary.
+ /// String data to be used in the body of the POST request. Null or empty string will set AuthPostData to null.
+ public virtual void SetAuthPostData(string stringData)
+ {
+ this.AuthPostData = (string.IsNullOrEmpty(stringData)) ? null : stringData;
+ }
+
+ /// Sets the data to be passed-on to the auth service via POST.
+ /// AuthPostData is just one value. Each SetAuthPostData replaces any previous value. It can be either a string, a byte[] or a dictionary.
+ /// Binary token / auth-data to pass on.
+ public virtual void SetAuthPostData(byte[] byteData)
+ {
+ this.AuthPostData = byteData;
+ }
+
+ /// Sets data to be passed-on to the auth service as Json (Content-Type: "application/json") via Post.
+ /// AuthPostData is just one value. Each SetAuthPostData replaces any previous value. It can be either a string, a byte[] or a dictionary.
+ /// A authentication-data dictionary will be converted to Json and passed to the Auth webservice via HTTP Post.
+ public virtual void SetAuthPostData(Dictionary dictData)
+ {
+ this.AuthPostData = dictData;
+ }
+
+ /// Adds a key-value pair to the get-parameters used for Custom Auth (AuthGetParameters).
+ /// This method does uri-encoding for you.
+ /// Key for the value to set.
+ /// Some value relevant for Custom Authentication.
+ public virtual void AddAuthParameter(string key, string value)
+ {
+ string ampersand = string.IsNullOrEmpty(this.AuthGetParameters) ? "" : "&";
+ this.AuthGetParameters = string.Format("{0}{1}{2}={3}", this.AuthGetParameters, ampersand, System.Uri.EscapeDataString(key), System.Uri.EscapeDataString(value));
+ }
+
+ ///
+ /// Transform this object into string.
+ ///
+ /// String info about this object's values.
+ public override string ToString()
+ {
+ return string.Format("AuthenticationValues = AuthType: {0} UserId: {1}{2}{3}{4}",
+ this.AuthType,
+ this.UserId,
+ string.IsNullOrEmpty(this.AuthGetParameters) ? " GetParameters: yes" : "",
+ this.AuthPostData == null ? "" : " PostData: yes",
+ this.Token == null ? "" : " Token: yes");
+ }
+
+ ///
+ /// Make a copy of the current object.
+ ///
+ /// The object to be copied into.
+ /// The copied object.
+ public AuthenticationValues CopyTo(AuthenticationValues copy)
+ {
+ copy.AuthType = this.AuthType;
+ copy.AuthGetParameters = this.AuthGetParameters;
+ copy.AuthPostData = this.AuthPostData;
+ copy.UserId = this.UserId;
+ return copy;
+ }
+ }
+}
diff --git a/Assets/Photon/PhotonRealtime/Code/LoadbalancingPeer.cs.meta b/Assets/Photon/PhotonRealtime/Code/LoadbalancingPeer.cs.meta
new file mode 100644
index 00000000..989f399e
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/LoadbalancingPeer.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 35c989013c977244186e524a4c90dcee
+labels:
+- ExitGames
+- PUN
+- Photon
+- Networking
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
diff --git a/Assets/Photon/PhotonRealtime/Code/PhotonPing.cs b/Assets/Photon/PhotonRealtime/Code/PhotonPing.cs
new file mode 100644
index 00000000..5ac5c879
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/PhotonPing.cs
@@ -0,0 +1,481 @@
+// ----------------------------------------------------------------------------
+//
+// PhotonNetwork Framework for Unity - Copyright (C) 2018 Exit Games GmbH
+//
+//
+// This file includes various PhotonPing implementations for different APIs,
+// platforms and protocols.
+// The RegionPinger class is the instance which selects the Ping implementation
+// to use.
+//
+// developer@exitgames.com
+// ----------------------------------------------------------------------------
+
+
+namespace Photon.Realtime
+{
+ using System;
+ using System.Collections;
+ using System.Threading;
+
+ #if NETFX_CORE
+ using System.Diagnostics;
+ using Windows.Foundation;
+ using Windows.Networking;
+ using Windows.Networking.Sockets;
+ using Windows.Storage.Streams;
+ #endif
+
+ #if !NO_SOCKET && !NETFX_CORE
+ using System.Collections.Generic;
+ using System.Diagnostics;
+ using System.Net.Sockets;
+ #endif
+
+ #if UNITY_WEBGL
+ // import UnityWebRequest
+ using UnityEngine.Networking;
+ #endif
+
+ ///
+ /// Abstract implementation of PhotonPing, ase for pinging servers to find the "Best Region".
+ ///
+ public abstract class PhotonPing : IDisposable
+ {
+ public string DebugString = "";
+
+ public bool Successful;
+
+ protected internal bool GotResult;
+
+ protected internal int PingLength = 13;
+
+ protected internal byte[] PingBytes = new byte[] { 0x7d, 0x7d, 0x7d, 0x7d, 0x7d, 0x7d, 0x7d, 0x7d, 0x7d, 0x7d, 0x7d, 0x7d, 0x00 };
+
+ protected internal byte PingId;
+
+ private static readonly System.Random RandomIdProvider = new System.Random();
+
+ public virtual bool StartPing(string ip)
+ {
+ throw new NotImplementedException();
+ }
+
+ public virtual bool Done()
+ {
+ throw new NotImplementedException();
+ }
+
+ public virtual void Dispose()
+ {
+ throw new NotImplementedException();
+ }
+
+ protected internal void Init()
+ {
+ this.GotResult = false;
+ this.Successful = false;
+ this.PingId = (byte)(RandomIdProvider.Next(255));
+ }
+ }
+
+
+ #if !NETFX_CORE && !NO_SOCKET
+ /// Uses C# Socket class from System.Net.Sockets (as Unity usually does).
+ /// Incompatible with Windows 8 Store/Phone API.
+ public class PingMono : PhotonPing
+ {
+ private Socket sock;
+
+ ///
+ /// Sends a "Photon Ping" to a server.
+ ///
+ /// Address in IPv4 or IPv6 format. An address containing a '.' will be interpreted as IPv4.
+ /// True if the Photon Ping could be sent.
+ public override bool StartPing(string ip)
+ {
+ this.Init();
+
+ try
+ {
+ if (this.sock == null)
+ {
+ if (ip.Contains("."))
+ {
+ this.sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
+ }
+ else
+ {
+ this.sock = new Socket(AddressFamily.InterNetworkV6, SocketType.Dgram, ProtocolType.Udp);
+ }
+
+ this.sock.ReceiveTimeout = 5000;
+ int port = (RegionHandler.PortToPingOverride != 0) ? RegionHandler.PortToPingOverride : 5055;
+ this.sock.Connect(ip, port);
+ }
+
+
+ this.PingBytes[this.PingBytes.Length - 1] = this.PingId;
+ this.sock.Send(this.PingBytes);
+ this.PingBytes[this.PingBytes.Length - 1] = (byte)(this.PingId+1); // this buffer is re-used for the result/receive. invalidate the result now.
+ }
+ catch (Exception e)
+ {
+ this.sock = null;
+ Console.WriteLine(e);
+ }
+
+ return false;
+ }
+
+ public override bool Done()
+ {
+ if (this.GotResult || this.sock == null)
+ {
+ return true; // this just indicates the ping is no longer waiting. this.Successful value defines if the roundtrip completed
+ }
+
+ int read = 0;
+ try
+ {
+ if (!this.sock.Poll(0, SelectMode.SelectRead))
+ {
+ return false;
+ }
+
+ read = this.sock.Receive(this.PingBytes, SocketFlags.None);
+ }
+ catch (Exception ex)
+ {
+ if (this.sock != null)
+ {
+ this.sock.Close();
+ this.sock = null;
+ }
+ this.DebugString += " Exception of socket! " + ex.GetType() + " ";
+ return true; // this just indicates the ping is no longer waiting. this.Successful value defines if the roundtrip completed
+ }
+
+ bool replyMatch = this.PingBytes[this.PingBytes.Length - 1] == this.PingId && read == this.PingLength;
+ if (!replyMatch)
+ {
+ this.DebugString += " ReplyMatch is false! ";
+ }
+
+
+ this.Successful = replyMatch;
+ this.GotResult = true;
+ return true;
+ }
+
+ public override void Dispose()
+ {
+ try
+ {
+ this.sock.Close();
+ }
+ catch
+ {
+ }
+
+ this.sock = null;
+ }
+
+ }
+ #endif
+
+
+ #if NETFX_CORE
+ /// Windows store API implementation of PhotonPing, based on DatagramSocket for UDP.
+ public class PingWindowsStore : PhotonPing
+ {
+ private DatagramSocket sock;
+ private readonly object syncer = new object();
+
+ public override bool StartPing(string host)
+ {
+ lock (this.syncer)
+ {
+ this.Init();
+
+ int port = (RegionHandler.PortToPingOverride != 0) ? RegionHandler.PortToPingOverride : 5055;
+ EndpointPair endPoint = new EndpointPair(null, string.Empty, new HostName(host), port.ToString());
+ this.sock = new DatagramSocket();
+ this.sock.MessageReceived += this.OnMessageReceived;
+
+ IAsyncAction result = this.sock.ConnectAsync(endPoint);
+ result.Completed = this.OnConnected;
+ this.DebugString += " End StartPing";
+ return true;
+ }
+ }
+
+ public override bool Done()
+ {
+ lock (this.syncer)
+ {
+ return this.GotResult || this.sock == null; // this just indicates the ping is no longer waiting. this.Successful value defines if the roundtrip completed
+ }
+ }
+
+ public override void Dispose()
+ {
+ lock (this.syncer)
+ {
+ this.sock = null;
+ }
+ }
+
+ private void OnConnected(IAsyncAction asyncinfo, AsyncStatus asyncstatus)
+ {
+ lock (this.syncer)
+ {
+ if (asyncinfo.AsTask().IsCompleted && !asyncinfo.AsTask().IsFaulted && this.sock != null && this.sock.Information.RemoteAddress != null)
+ {
+ this.PingBytes[this.PingBytes.Length - 1] = this.PingId;
+
+ DataWriter writer;
+ writer = new DataWriter(this.sock.OutputStream);
+ writer.WriteBytes(this.PingBytes);
+ DataWriterStoreOperation res = writer.StoreAsync();
+ res.AsTask().Wait(100);
+
+ this.PingBytes[this.PingBytes.Length - 1] = (byte)(this.PingId + 1); // this buffer is re-used for the result/receive. invalidate the result now.
+
+ writer.DetachStream();
+ writer.Dispose();
+ }
+ else
+ {
+ this.sock = null; // will cause Done() to return true but this.Successful defines if the roundtrip completed
+ }
+ }
+ }
+
+ private void OnMessageReceived(DatagramSocket sender, DatagramSocketMessageReceivedEventArgs args)
+ {
+ lock (this.syncer)
+ {
+ DataReader reader = null;
+ try
+ {
+ reader = args.GetDataReader();
+ uint receivedByteCount = reader.UnconsumedBufferLength;
+ if (receivedByteCount > 0)
+ {
+ byte[] resultBytes = new byte[receivedByteCount];
+ reader.ReadBytes(resultBytes);
+
+ //TODO: check result bytes!
+
+
+ this.Successful = receivedByteCount == this.PingLength && resultBytes[resultBytes.Length - 1] == this.PingId;
+ this.GotResult = true;
+ }
+ }
+ catch
+ {
+ // TODO: handle error
+ }
+ }
+ }
+ }
+ #endif
+
+
+ #if NATIVE_SOCKETS
+ /// Abstract base class to provide proper resource management for the below native ping implementations
+ public abstract class PingNative : PhotonPing
+ {
+ // Native socket states - according to EnetConnect.h state definitions
+ protected enum NativeSocketState : byte
+ {
+ Disconnected = 0,
+ Connecting = 1,
+ Connected = 2,
+ ConnectionError = 3,
+ SendError = 4,
+ ReceiveError = 5,
+ Disconnecting = 6
+ }
+
+ protected IntPtr pConnectionHandler = IntPtr.Zero;
+
+ ~PingNative()
+ {
+ Dispose();
+ }
+ }
+
+ /// Uses dynamic linked native Photon socket library via DllImport("PhotonSocketPlugin") attribute (as done by Unity Android and Unity PS3).
+ public class PingNativeDynamic : PingNative
+ {
+ public override bool StartPing(string ip)
+ {
+ lock (SocketUdpNativeDynamic.syncer)
+ {
+ base.Init();
+
+ if(pConnectionHandler == IntPtr.Zero)
+ {
+ pConnectionHandler = SocketUdpNativeDynamic.egconnect(ip);
+ SocketUdpNativeDynamic.egservice(pConnectionHandler);
+ byte state = SocketUdpNativeDynamic.eggetState(pConnectionHandler);
+ while (state == (byte) NativeSocketState.Connecting)
+ {
+ SocketUdpNativeDynamic.egservice(pConnectionHandler);
+ state = SocketUdpNativeDynamic.eggetState(pConnectionHandler);
+ }
+ }
+
+ PingBytes[PingBytes.Length - 1] = PingId;
+ SocketUdpNativeDynamic.egsend(pConnectionHandler, PingBytes, PingBytes.Length);
+ SocketUdpNativeDynamic.egservice(pConnectionHandler);
+
+ PingBytes[PingBytes.Length - 1] = (byte) (PingId - 1);
+ return true;
+ }
+ }
+
+ public override bool Done()
+ {
+ lock (SocketUdpNativeDynamic.syncer)
+ {
+ if (this.GotResult || pConnectionHandler == IntPtr.Zero)
+ {
+ return true;
+ }
+
+ int available = SocketUdpNativeDynamic.egservice(pConnectionHandler);
+ if (available < PingLength)
+ {
+ return false;
+ }
+
+ int pingBytesLength = PingBytes.Length;
+ int bytesInRemainginDatagrams = SocketUdpNativeDynamic.egread(pConnectionHandler, PingBytes, ref pingBytesLength);
+ this.Successful = (PingBytes != null && PingBytes[PingBytes.Length - 1] == PingId);
+ //Debug.Log("Successful: " + this.Successful + " bytesInRemainginDatagrams: " + bytesInRemainginDatagrams + " PingId: " + PingId);
+
+ this.GotResult = true;
+ return true;
+ }
+ }
+
+ public override void Dispose()
+ {
+ lock (SocketUdpNativeDynamic.syncer)
+ {
+ if (this.pConnectionHandler != IntPtr.Zero)
+ SocketUdpNativeDynamic.egdisconnect(this.pConnectionHandler);
+ this.pConnectionHandler = IntPtr.Zero;
+ }
+ GC.SuppressFinalize(this);
+ }
+ }
+
+ #if NATIVE_SOCKETS && NATIVE_SOCKETS_STATIC
+ /// Uses static linked native Photon socket library via DllImport("__Internal") attribute (as done by Unity iOS and Unity Switch).
+ public class PingNativeStatic : PingNative
+ {
+ public override bool StartPing(string ip)
+ {
+ base.Init();
+
+ lock (SocketUdpNativeStatic.syncer)
+ {
+ if(pConnectionHandler == IntPtr.Zero)
+ {
+ pConnectionHandler = SocketUdpNativeStatic.egconnect(ip);
+ SocketUdpNativeStatic.egservice(pConnectionHandler);
+ byte state = SocketUdpNativeStatic.eggetState(pConnectionHandler);
+ while (state == (byte) NativeSocketState.Connecting)
+ {
+ SocketUdpNativeStatic.egservice(pConnectionHandler);
+ state = SocketUdpNativeStatic.eggetState(pConnectionHandler);
+ Thread.Sleep(0); // suspending execution for a moment is critical on Switch for the OS to update the socket
+ }
+ }
+
+ PingBytes[PingBytes.Length - 1] = PingId;
+ SocketUdpNativeStatic.egsend(pConnectionHandler, PingBytes, PingBytes.Length);
+ SocketUdpNativeStatic.egservice(pConnectionHandler);
+
+ PingBytes[PingBytes.Length - 1] = (byte) (PingId - 1);
+ return true;
+ }
+ }
+
+ public override bool Done()
+ {
+ lock (SocketUdpNativeStatic.syncer)
+ {
+ if (this.GotResult || pConnectionHandler == IntPtr.Zero)
+ {
+ return true;
+ }
+
+ int available = SocketUdpNativeStatic.egservice(pConnectionHandler);
+ if (available < PingLength)
+ {
+ return false;
+ }
+
+ int pingBytesLength = PingBytes.Length;
+ int bytesInRemainginDatagrams = SocketUdpNativeStatic.egread(pConnectionHandler, PingBytes, ref pingBytesLength);
+ this.Successful = (PingBytes != null && PingBytes[PingBytes.Length - 1] == PingId);
+ //Debug.Log("Successful: " + this.Successful + " bytesInRemainginDatagrams: " + bytesInRemainginDatagrams + " PingId: " + PingId);
+
+ this.GotResult = true;
+ return true;
+ }
+ }
+
+ public override void Dispose()
+ {
+ lock (SocketUdpNativeStatic.syncer)
+ {
+ if (pConnectionHandler != IntPtr.Zero)
+ SocketUdpNativeStatic.egdisconnect(pConnectionHandler);
+ pConnectionHandler = IntPtr.Zero;
+ }
+ GC.SuppressFinalize(this);
+ }
+ }
+ #endif
+ #endif
+
+
+ #if UNITY_WEBGL
+ public class PingHttp : PhotonPing
+ {
+ private UnityWebRequest webRequest;
+
+ public override bool StartPing(string address)
+ {
+ base.Init();
+
+ address = "https://" + address + "/photon/m/?ping&r=" + UnityEngine.Random.Range(0, 10000);
+ this.webRequest = UnityWebRequest.Get(address);
+ this.webRequest.SendWebRequest();
+ return true;
+ }
+
+ public override bool Done()
+ {
+ if (this.webRequest.isDone)
+ {
+ Successful = true;
+ return true;
+ }
+
+ return false;
+ }
+
+ public override void Dispose()
+ {
+ this.webRequest.Dispose();
+ }
+ }
+ #endif
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonRealtime/Code/PhotonPing.cs.meta b/Assets/Photon/PhotonRealtime/Code/PhotonPing.cs.meta
new file mode 100644
index 00000000..060b0063
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/PhotonPing.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 5a2f6055139b44142954461627d344bc
+timeCreated: 1524653911
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonRealtime/Code/PhotonPingClasses.cs b/Assets/Photon/PhotonRealtime/Code/PhotonPingClasses.cs
new file mode 100644
index 00000000..70f03374
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/PhotonPingClasses.cs
@@ -0,0 +1 @@
+// this file is no longer used. it can be deleted safely.
\ No newline at end of file
diff --git a/Assets/Photon/PhotonRealtime/Code/PhotonPingClasses.cs.meta b/Assets/Photon/PhotonRealtime/Code/PhotonPingClasses.cs.meta
new file mode 100644
index 00000000..a60b48a6
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/PhotonPingClasses.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d93148764d7961d4a8b8112bd166cf35
+timeCreated: 1494420905
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonRealtime/Code/PhotonRealtime.asmdef b/Assets/Photon/PhotonRealtime/Code/PhotonRealtime.asmdef
new file mode 100644
index 00000000..b472f01b
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/PhotonRealtime.asmdef
@@ -0,0 +1,6 @@
+{
+ "name": "PhotonRealtime",
+ "references": [],
+ "includePlatforms": [],
+ "excludePlatforms": []
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonRealtime/Code/PhotonRealtime.asmdef.meta b/Assets/Photon/PhotonRealtime/Code/PhotonRealtime.asmdef.meta
new file mode 100644
index 00000000..dff23ae8
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/PhotonRealtime.asmdef.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 831409e8f9d13b5479a3baef9822ad34
+timeCreated: 1537459565
+licenseType: Store
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonRealtime/Code/Player.cs b/Assets/Photon/PhotonRealtime/Code/Player.cs
new file mode 100644
index 00000000..40588890
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/Player.cs
@@ -0,0 +1,452 @@
+// ----------------------------------------------------------------------------
+//
+// Loadbalancing Framework for Photon - Copyright (C) 2018 Exit Games GmbH
+//
+//
+// Per client in a room, a Player is created. This client's Player is also
+// known as PhotonClient.LocalPlayer and the only one you might change
+// properties for.
+//
+// developer@photonengine.com
+// ----------------------------------------------------------------------------
+
+#if UNITY_4_7 || UNITY_5 || UNITY_5_3_OR_NEWER
+#define SUPPORTED_UNITY
+#endif
+
+
+namespace Photon.Realtime
+{
+ using System;
+ using System.Collections;
+ using System.Collections.Generic;
+ using ExitGames.Client.Photon;
+
+ #if SUPPORTED_UNITY
+ using UnityEngine;
+ #endif
+ #if SUPPORTED_UNITY || NETFX_CORE
+ using Hashtable = ExitGames.Client.Photon.Hashtable;
+ using SupportClass = ExitGames.Client.Photon.SupportClass;
+ #endif
+
+
+ ///
+ /// Summarizes a "player" within a room, identified (in that room) by ID (or "actorNumber").
+ ///
+ ///
+ /// Each player has a actorNumber, valid for that room. It's -1 until assigned by server (and client logic).
+ ///
+ public class Player
+ {
+ ///
+ /// Used internally to identify the masterclient of a room.
+ ///
+ protected internal Room RoomReference { get; set; }
+
+
+ /// Backing field for property.
+ private int actorNumber = -1;
+
+ /// Identifier of this player in current room. Also known as: actorNumber or actorNumber. It's -1 outside of rooms.
+ /// The ID is assigned per room and only valid in that context. It will change even on leave and re-join. IDs are never re-used per room.
+ public int ActorNumber
+ {
+ get { return this.actorNumber; }
+ }
+
+
+ /// Only one player is controlled by each client. Others are not local.
+ public readonly bool IsLocal;
+
+
+ public bool HasRejoined
+ {
+ get; internal set;
+ }
+
+
+ /// Background field for nickName.
+ private string nickName = string.Empty;
+
+ /// Non-unique nickname of this player. Synced automatically in a room.
+ ///
+ /// A player might change his own playername in a room (it's only a property).
+ /// Setting this value updates the server and other players (using an operation).
+ ///
+ public string NickName
+ {
+ get
+ {
+ return this.nickName;
+ }
+ set
+ {
+ if (!string.IsNullOrEmpty(this.nickName) && this.nickName.Equals(value))
+ {
+ return;
+ }
+
+ this.nickName = value;
+
+ // update a room, if we changed our nickName locally
+ if (this.IsLocal)
+ {
+ this.SetPlayerNameProperty();
+ }
+ }
+ }
+
+ /// UserId of the player, available when the room got created with RoomOptions.PublishUserId = true.
+ /// Useful for and blocking slots in a room for expected players (e.g. in ).
+ public string UserId { get; internal set; }
+
+ ///
+ /// True if this player is the Master Client of the current room.
+ ///
+ public bool IsMasterClient
+ {
+ get
+ {
+ if (this.RoomReference == null)
+ {
+ return false;
+ }
+
+ return this.ActorNumber == this.RoomReference.MasterClientId;
+ }
+ }
+
+ /// If this player is active in the room (and getting events which are currently being sent).
+ ///
+ /// Inactive players keep their spot in a room but otherwise behave as if offline (no matter what their actual connection status is).
+ /// The room needs a PlayerTTL != 0. If a player is inactive for longer than PlayerTTL, the server will remove this player from the room.
+ /// For a client "rejoining" a room, is the same as joining it: It gets properties, cached events and then the live events.
+ ///
+ public bool IsInactive { get; protected internal set; }
+
+ /// Read-only cache for custom properties of player. Set via Player.SetCustomProperties.
+ ///
+ /// Don't modify the content of this Hashtable. Use SetCustomProperties and the
+ /// properties of this class to modify values. When you use those, the client will
+ /// sync values with the server.
+ ///
+ ///
+ public Hashtable CustomProperties { get; set; }
+
+ /// Can be used to store a reference that's useful to know "by player".
+ /// Example: Set a player's character as Tag by assigning the GameObject on Instantiate.
+ public object TagObject;
+
+
+ ///
+ /// Creates a player instance.
+ /// To extend and replace this Player, override LoadBalancingPeer.CreatePlayer().
+ ///
+ /// NickName of the player (a "well known property").
+ /// ID or ActorNumber of this player in the current room (a shortcut to identify each player in room)
+ /// If this is the local peer's player (or a remote one).
+ protected internal Player(string nickName, int actorNumber, bool isLocal) : this(nickName, actorNumber, isLocal, null)
+ {
+ }
+
+ ///
+ /// Creates a player instance.
+ /// To extend and replace this Player, override LoadBalancingPeer.CreatePlayer().
+ ///
+ /// NickName of the player (a "well known property").
+ /// ID or ActorNumber of this player in the current room (a shortcut to identify each player in room)
+ /// If this is the local peer's player (or a remote one).
+ /// A Hashtable of custom properties to be synced. Must use String-typed keys and serializable datatypes as values.
+ protected internal Player(string nickName, int actorNumber, bool isLocal, Hashtable playerProperties)
+ {
+ this.IsLocal = isLocal;
+ this.actorNumber = actorNumber;
+ this.NickName = nickName;
+
+ this.CustomProperties = new Hashtable();
+ this.InternalCacheProperties(playerProperties);
+ }
+
+
+ ///
+ /// Get a Player by ActorNumber (Player.ID).
+ ///
+ /// ActorNumber of the a player in this room.
+ /// Player or null.
+ public Player Get(int id)
+ {
+ if (this.RoomReference == null)
+ {
+ return null;
+ }
+
+ return this.RoomReference.GetPlayer(id);
+ }
+
+ /// Gets this Player's next Player, as sorted by ActorNumber (Player.ID). Wraps around.
+ /// Player or null.
+ public Player GetNext()
+ {
+ return GetNextFor(this.ActorNumber);
+ }
+
+ /// Gets a Player's next Player, as sorted by ActorNumber (Player.ID). Wraps around.
+ /// Useful when you pass something to the next player. For example: passing the turn to the next player.
+ /// The Player for which the next is being needed.
+ /// Player or null.
+ public Player GetNextFor(Player currentPlayer)
+ {
+ if (currentPlayer == null)
+ {
+ return null;
+ }
+ return GetNextFor(currentPlayer.ActorNumber);
+ }
+
+ /// Gets a Player's next Player, as sorted by ActorNumber (Player.ID). Wraps around.
+ /// Useful when you pass something to the next player. For example: passing the turn to the next player.
+ /// The ActorNumber (Player.ID) for which the next is being needed.
+ /// Player or null.
+ public Player GetNextFor(int currentPlayerId)
+ {
+ if (this.RoomReference == null || this.RoomReference.Players == null || this.RoomReference.Players.Count < 2)
+ {
+ return null;
+ }
+
+ Dictionary players = this.RoomReference.Players;
+ int nextHigherId = int.MaxValue; // we look for the next higher ID
+ int lowestId = currentPlayerId; // if we are the player with the highest ID, there is no higher and we return to the lowest player's id
+
+ foreach (int playerid in players.Keys)
+ {
+ if (playerid < lowestId)
+ {
+ lowestId = playerid; // less than any other ID (which must be at least less than this player's id).
+ }
+ else if (playerid > currentPlayerId && playerid < nextHigherId)
+ {
+ nextHigherId = playerid; // more than our ID and less than those found so far.
+ }
+ }
+
+ //UnityEngine.Debug.LogWarning("Debug. " + currentPlayerId + " lower: " + lowestId + " higher: " + nextHigherId + " ");
+ //UnityEngine.Debug.LogWarning(this.RoomReference.GetPlayer(currentPlayerId));
+ //UnityEngine.Debug.LogWarning(this.RoomReference.GetPlayer(lowestId));
+ //if (nextHigherId != int.MaxValue) UnityEngine.Debug.LogWarning(this.RoomReference.GetPlayer(nextHigherId));
+ return (nextHigherId != int.MaxValue) ? players[nextHigherId] : players[lowestId];
+ }
+
+
+ /// Caches properties for new Players or when updates of remote players are received. Use SetCustomProperties() for a synced update.
+ ///
+ /// This only updates the CustomProperties and doesn't send them to the server.
+ /// Mostly used when creating new remote players, where the server sends their properties.
+ ///
+ protected internal virtual void InternalCacheProperties(Hashtable properties)
+ {
+ if (properties == null || properties.Count == 0 || this.CustomProperties.Equals(properties))
+ {
+ return;
+ }
+
+ if (properties.ContainsKey(ActorProperties.PlayerName))
+ {
+ string nameInServersProperties = (string)properties[ActorProperties.PlayerName];
+ if (nameInServersProperties != null)
+ {
+ if (this.IsLocal)
+ {
+ // the local playername is different than in the properties coming from the server
+ // so the local nickName was changed and the server is outdated -> update server
+ // update property instead of using the outdated nickName coming from server
+ if (!nameInServersProperties.Equals(this.nickName))
+ {
+ this.SetPlayerNameProperty();
+ }
+ }
+ else
+ {
+ this.NickName = nameInServersProperties;
+ }
+ }
+ }
+ if (properties.ContainsKey(ActorProperties.UserId))
+ {
+ this.UserId = (string)properties[ActorProperties.UserId];
+ }
+ if (properties.ContainsKey(ActorProperties.IsInactive))
+ {
+ this.IsInactive = (bool)properties[ActorProperties.IsInactive]; //TURNBASED new well-known propery for players
+ }
+
+ this.CustomProperties.MergeStringKeys(properties);
+ this.CustomProperties.StripKeysWithNullValues();
+ }
+
+
+ ///
+ /// Brief summary string of the Player: ActorNumber and NickName
+ ///
+ public override string ToString()
+ {
+ return string.Format("#{0:00} '{1}'",this.ActorNumber, this.NickName);
+ }
+
+ ///
+ /// String summary of the Player: player.ID, name and all custom properties of this user.
+ ///
+ ///
+ /// Use with care and not every frame!
+ /// Converts the customProperties to a String on every single call.
+ ///
+ public string ToStringFull()
+ {
+ return string.Format("#{0:00} '{1}'{2} {3}", this.ActorNumber, this.NickName, this.IsInactive ? " (inactive)" : "", this.CustomProperties.ToStringFull());
+ }
+
+ ///
+ /// If players are equal (by GetHasCode, which returns this.ID).
+ ///
+ public override bool Equals(object p)
+ {
+ Player pp = p as Player;
+ return (pp != null && this.GetHashCode() == pp.GetHashCode());
+ }
+
+ ///
+ /// Accompanies Equals, using the ID (actorNumber) as HashCode to return.
+ ///
+ public override int GetHashCode()
+ {
+ return this.ActorNumber;
+ }
+
+ ///
+ /// Used internally, to update this client's playerID when assigned (doesn't change after assignment).
+ ///
+ protected internal void ChangeLocalID(int newID)
+ {
+ if (!this.IsLocal)
+ {
+ //Debug.LogError("ERROR You should never change Player IDs!");
+ return;
+ }
+
+ this.actorNumber = newID;
+ }
+
+
+
+ ///
+ /// Updates and synchronizes this Player's Custom Properties. Optionally, expectedProperties can be provided as condition.
+ ///
+ ///
+ /// Custom Properties are a set of string keys and arbitrary values which is synchronized
+ /// for the players in a Room. They are available when the client enters the room, as
+ /// they are in the response of OpJoin and OpCreate.
+ ///
+ /// Custom Properties either relate to the (current) Room or a Player (in that Room).
+ ///
+ /// Both classes locally cache the current key/values and make them available as
+ /// property: CustomProperties. This is provided only to read them.
+ /// You must use the method SetCustomProperties to set/modify them.
+ ///
+ /// Any client can set any Custom Properties anytime (when in a room).
+ /// It's up to the game logic to organize how they are best used.
+ ///
+ /// You should call SetCustomProperties only with key/values that are new or changed. This reduces
+ /// traffic and performance.
+ ///
+ /// Unless you define some expectedProperties, setting key/values is always permitted.
+ /// In this case, the property-setting client will not receive the new values from the server but
+ /// instead update its local cache in SetCustomProperties.
+ ///
+ /// If you define expectedProperties, the server will skip updates if the server property-cache
+ /// does not contain all expectedProperties with the same values.
+ /// In this case, the property-setting client will get an update from the server and update it's
+ /// cached key/values at about the same time as everyone else.
+ ///
+ /// The benefit of using expectedProperties can be only one client successfully sets a key from
+ /// one known value to another.
+ /// As example: Store who owns an item in a Custom Property "ownedBy". It's 0 initally.
+ /// When multiple players reach the item, they all attempt to change "ownedBy" from 0 to their
+ /// actorNumber. If you use expectedProperties {"ownedBy", 0} as condition, the first player to
+ /// take the item will have it (and the others fail to set the ownership).
+ ///
+ /// Properties get saved with the game state for Turnbased games (which use IsPersistent = true).
+ ///
+ /// Hashtable of Custom Properties to be set.
+ /// If non-null, these are the property-values the server will check as condition for this update.
+ /// Defines if this SetCustomProperties-operation gets forwarded to your WebHooks. Client must be in room.
+ ///
+ /// False if propertiesToSet is null or empty or have zero string keys.
+ /// True in offline mode even if expectedProperties or webFlags are used.
+ /// If not in a room, returns true if local player and expectedValues and webFlags are null.
+ /// (Use this to cache properties to be sent when joining a room).
+ /// Otherwise, returns if this operation could be sent to the server.
+ ///
+ public bool SetCustomProperties(Hashtable propertiesToSet, Hashtable expectedValues = null, WebFlags webFlags = null)
+ {
+ if (propertiesToSet == null || propertiesToSet.Count == 0)
+ {
+ return false;
+ }
+
+ Hashtable customProps = propertiesToSet.StripToStringKeys() as Hashtable;
+
+ if (this.RoomReference != null)
+ {
+ if (this.RoomReference.IsOffline)
+ {
+ if (customProps.Count == 0)
+ {
+ return false;
+ }
+ this.CustomProperties.Merge(customProps);
+ this.CustomProperties.StripKeysWithNullValues();
+ // invoking callbacks
+ this.RoomReference.LoadBalancingClient.InRoomCallbackTargets.OnPlayerPropertiesUpdate(this, customProps);
+ return true;
+ }
+ else
+ {
+ Hashtable customPropsToCheck = expectedValues.StripToStringKeys() as Hashtable;
+
+ // send (sync) these new values if in online room
+ return this.RoomReference.LoadBalancingClient.OpSetPropertiesOfActor(this.actorNumber, customProps, customPropsToCheck, webFlags);
+ }
+ }
+ if (this.IsLocal)
+ {
+ if (customProps.Count == 0)
+ {
+ return false;
+ }
+ if (expectedValues == null && webFlags == null)
+ {
+ this.CustomProperties.Merge(customProps);
+ this.CustomProperties.StripKeysWithNullValues();
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+
+ /// Uses OpSetPropertiesOfActor to sync this player's NickName (server is being updated with this.NickName).
+ private bool SetPlayerNameProperty()
+ {
+ if (this.RoomReference != null && !this.RoomReference.IsOffline)
+ {
+ Hashtable properties = new Hashtable();
+ properties[ActorProperties.PlayerName] = this.nickName;
+ return this.RoomReference.LoadBalancingClient.OpSetPropertiesOfActor(this.ActorNumber, properties);
+ }
+
+ return false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonRealtime/Code/Player.cs.meta b/Assets/Photon/PhotonRealtime/Code/Player.cs.meta
new file mode 100644
index 00000000..d494ca76
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/Player.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: e3e4b5bebc687044b9c6c2803c36be3d
+labels:
+- ExitGames
+- PUN
+- Photon
+- Networking
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
diff --git a/Assets/Photon/PhotonRealtime/Code/Region.cs b/Assets/Photon/PhotonRealtime/Code/Region.cs
new file mode 100644
index 00000000..94ec853e
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/Region.cs
@@ -0,0 +1,95 @@
+// ----------------------------------------------------------------------------
+//
+// Loadbalancing Framework for Photon - Copyright (C) 2018 Exit Games GmbH
+//
+//
+// Represents regions in the Photon Cloud.
+//
+// developer@photonengine.com
+// ----------------------------------------------------------------------------
+
+#if UNITY_4_7 || UNITY_5 || UNITY_5_3_OR_NEWER
+#define SUPPORTED_UNITY
+#endif
+
+
+namespace Photon.Realtime
+{
+ using ExitGames.Client.Photon;
+
+ #if SUPPORTED_UNITY || NETFX_CORE
+ using Hashtable = ExitGames.Client.Photon.Hashtable;
+ using SupportClass = ExitGames.Client.Photon.SupportClass;
+ #endif
+
+
+ public class Region
+ {
+ public string Code { get; private set; }
+
+ /// Unlike the CloudRegionCode, this may contain cluster information.
+ public string Cluster { get; private set; }
+
+ public string HostAndPort { get; protected internal set; }
+
+ /// Weighted ping time.
+ ///
+ /// Regions gets pinged 5 times (RegionPinger.Attempts).
+ /// Out of those, the worst rtt is discarded and the best will be counted two times for a weighted average.
+ ///
+ public int Ping { get; set; }
+
+ public bool WasPinged { get { return this.Ping != int.MaxValue; } }
+
+ public Region(string code, string address)
+ {
+ this.SetCodeAndCluster(code);
+ this.HostAndPort = address;
+ this.Ping = int.MaxValue;
+ }
+
+ public Region(string code, int ping)
+ {
+ this.SetCodeAndCluster(code);
+ this.Ping = ping;
+ }
+
+ private void SetCodeAndCluster(string codeAsString)
+ {
+ if (codeAsString == null)
+ {
+ this.Code = "";
+ this.Cluster = "";
+ return;
+ }
+
+ codeAsString = codeAsString.ToLower();
+ int slash = codeAsString.IndexOf('/');
+ this.Code = slash <= 0 ? codeAsString : codeAsString.Substring(0, slash);
+ this.Cluster = slash <= 0 ? "" : codeAsString.Substring(slash+1, codeAsString.Length-slash-1);
+ }
+
+ public override string ToString()
+ {
+ return this.ToString(false);
+ }
+
+ public string ToString(bool compact = false)
+ {
+ string regionCluster = this.Code;
+ if (!string.IsNullOrEmpty(this.Cluster))
+ {
+ regionCluster += "/" + this.Cluster;
+ }
+
+ if (compact)
+ {
+ return string.Format("{0}:{1}", regionCluster, this.Ping);
+ }
+ else
+ {
+ return string.Format("{0}[{2}]: {1}ms", regionCluster, this.Ping, this.HostAndPort);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonRealtime/Code/Region.cs.meta b/Assets/Photon/PhotonRealtime/Code/Region.cs.meta
new file mode 100644
index 00000000..49030f54
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/Region.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: bddf4f4bde2f8dd46927411229ce1302
+timeCreated: 1494420905
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonRealtime/Code/RegionHandler.cs b/Assets/Photon/PhotonRealtime/Code/RegionHandler.cs
new file mode 100644
index 00000000..237d959a
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/RegionHandler.cs
@@ -0,0 +1,714 @@
+// ----------------------------------------------------------------------------
+//
+// Loadbalancing Framework for Photon - Copyright (C) 2018 Exit Games GmbH
+//
+//
+// The RegionHandler class provides methods to ping a list of regions,
+// to find the one with best ping.
+//
+// developer@photonengine.com
+// ----------------------------------------------------------------------------
+
+
+#if UNITY_4_7 || UNITY_5 || UNITY_5_3_OR_NEWER
+#define SUPPORTED_UNITY
+#endif
+
+#if UNITY_WEBGL
+#define PING_VIA_COROUTINE
+#endif
+
+namespace Photon.Realtime
+{
+ using System;
+ using System.Text;
+ using System.Threading;
+ using System.Net;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Diagnostics;
+ using ExitGames.Client.Photon;
+ using System.Linq;
+
+ #if SUPPORTED_UNITY
+ using UnityEngine;
+ using Debug = UnityEngine.Debug;
+ #endif
+ #if SUPPORTED_UNITY || NETFX_CORE
+ using Hashtable = ExitGames.Client.Photon.Hashtable;
+ using SupportClass = ExitGames.Client.Photon.SupportClass;
+ #endif
+
+ ///
+ /// Provides methods to work with Photon's regions (Photon Cloud) and can be use to find the one with best ping.
+ ///
+ ///
+ /// When a client uses a Name Server to fetch the list of available regions, the LoadBalancingClient will create a RegionHandler
+ /// and provide it via the OnRegionListReceived callback, as soon as the list is available. No pings were sent for Best Region selection yet.
+ ///
+ /// Your logic can decide to either connect to one of those regional servers, or it may use PingMinimumOfRegions to test
+ /// which region provides the best ping. Alternatively the client may be set to connect to the Best Region (lowest ping), one or
+ /// more regions get pinged.
+ /// Not all regions will be pinged. As soon as the results are final, the client will connect to the best region,
+ /// so you can check the ping results when connected to the Master Server.
+ ///
+ /// Regions gets pinged 5 times (RegionPinger.Attempts).
+ /// Out of those, the worst rtt is discarded and the best will be counted two times for a weighted average.
+ ///
+ /// Usually UDP will be used to ping the Master Servers. In WebGL, WSS is used instead.
+ ///
+ /// It makes sense to make clients "sticky" to a region when one gets selected.
+ /// This can be achieved by storing the SummaryToCache value, once pinging was done.
+ /// When the client connects again, the previous SummaryToCache helps limiting the number of regions to ping.
+ /// In best case, only the previously selected region gets re-pinged and if the current ping is not much worse, this one region is used again.
+ ///
+ public class RegionHandler
+ {
+ /// The implementation of PhotonPing to use for region pinging (Best Region detection).
+ /// Defaults to null, which means the Type is set automatically.
+ public static Type PingImplementation;
+
+ /// A list of region names for the Photon Cloud. Set by the result of OpGetRegions().
+ ///
+ /// Implement ILoadBalancingCallbacks and register for the callbacks to get OnRegionListReceived(RegionHandler regionHandler).
+ /// You can also put a "case OperationCode.GetRegions:" into your OnOperationResponse method to notice when the result is available.
+ ///
+ public List EnabledRegions { get; protected internal set; }
+
+ private string availableRegionCodes;
+
+ private Region bestRegionCache;
+
+ ///
+ /// When PingMinimumOfRegions was called and completed, the BestRegion is identified by best ping.
+ ///
+ public Region BestRegion
+ {
+ get
+ {
+ if (this.EnabledRegions == null)
+ {
+ return null;
+ }
+ if (this.bestRegionCache != null)
+ {
+ return this.bestRegionCache;
+ }
+
+ this.EnabledRegions.Sort((a, b) => a.Ping.CompareTo(b.Ping) );
+
+ this.bestRegionCache = this.EnabledRegions[0];
+ return this.bestRegionCache;
+ }
+ }
+
+ ///
+ /// This value summarizes the results of pinging currently available regions (after PingMinimumOfRegions finished).
+ ///
+ ///
+ /// This value should be stored in the client by the game logic.
+ /// When connecting again, use it as previous summary to speed up pinging regions and to make the best region sticky for the client.
+ ///
+ public string SummaryToCache
+ {
+ get
+ {
+ if (this.BestRegion != null) {
+ return this.BestRegion.Code + ";" + this.BestRegion.Ping + ";" + this.availableRegionCodes;
+ }
+
+ return this.availableRegionCodes;
+ }
+ }
+
+ public string GetResults()
+ {
+ StringBuilder sb = new StringBuilder();
+
+ sb.AppendFormat("Region Pinging Result: {0}\n", this.BestRegion.ToString());
+ foreach (RegionPinger region in this.pingerList)
+ {
+ sb.AppendFormat(region.GetResults() + "\n");
+ }
+ sb.AppendFormat("Previous summary: {0}", this.previousSummaryProvided);
+
+ return sb.ToString();
+ }
+
+ public void SetRegions(OperationResponse opGetRegions)
+ {
+ if (opGetRegions.OperationCode != OperationCode.GetRegions)
+ {
+ return;
+ }
+ if (opGetRegions.ReturnCode != ErrorCode.Ok)
+ {
+ return;
+ }
+
+ string[] regions = opGetRegions[ParameterCode.Region] as string[];
+ string[] servers = opGetRegions[ParameterCode.Address] as string[];
+ if (regions == null || servers == null || regions.Length != servers.Length)
+ {
+ //TODO: log error
+ //Debug.LogError("The region arrays from Name Server are not ok. Must be non-null and same length. " + (regions == null) + " " + (servers == null) + "\n" + opGetRegions.ToStringFull());
+ return;
+ }
+
+ this.bestRegionCache = null;
+ this.EnabledRegions = new List(regions.Length);
+
+ for (int i = 0; i < regions.Length; i++)
+ {
+ string server = servers[i];
+ if (PortToPingOverride != 0)
+ {
+ server = LoadBalancingClient.ReplacePortWithAlternative(servers[i], PortToPingOverride);
+ }
+
+ Region tmp = new Region(regions[i], server);
+ if (string.IsNullOrEmpty(tmp.Code))
+ {
+ continue;
+ }
+
+ this.EnabledRegions.Add(tmp);
+ }
+
+ Array.Sort(regions);
+ this.availableRegionCodes = string.Join(",", regions);
+ }
+
+ private List pingerList = new List();
+ private Action onCompleteCall;
+ private int previousPing;
+ public bool IsPinging { get; private set; }
+ private string previousSummaryProvided;
+
+ protected internal static ushort PortToPingOverride;
+
+
+ public RegionHandler(ushort masterServerPortOverride = 0)
+ {
+ PortToPingOverride = masterServerPortOverride;
+ }
+
+
+ public bool PingMinimumOfRegions(Action onCompleteCallback, string previousSummary)
+ {
+ if (this.EnabledRegions == null || this.EnabledRegions.Count == 0)
+ {
+ //TODO: log error
+ //Debug.LogError("No regions available. Maybe all got filtered out or the AppId is not correctly configured.");
+ return false;
+ }
+
+ if (this.IsPinging)
+ {
+ //TODO: log warning
+ //Debug.LogWarning("PingMinimumOfRegions() skipped, because this RegionHandler is already pinging some regions.");
+ return false;
+ }
+
+ this.IsPinging = true;
+ this.onCompleteCall = onCompleteCallback;
+ this.previousSummaryProvided = previousSummary;
+
+ if (string.IsNullOrEmpty(previousSummary))
+ {
+ return this.PingEnabledRegions();
+ }
+
+ string[] values = previousSummary.Split(';');
+ if (values.Length < 3)
+ {
+ return this.PingEnabledRegions();
+ }
+
+ int prevBestRegionPing;
+ bool secondValueIsInt = Int32.TryParse(values[1], out prevBestRegionPing);
+ if (!secondValueIsInt)
+ {
+ return this.PingEnabledRegions();
+ }
+
+ string prevBestRegionCode = values[0];
+ string prevAvailableRegionCodes = values[2];
+
+
+ if (string.IsNullOrEmpty(prevBestRegionCode))
+ {
+ return this.PingEnabledRegions();
+ }
+ if (string.IsNullOrEmpty(prevAvailableRegionCodes))
+ {
+ return this.PingEnabledRegions();
+ }
+ if (!this.availableRegionCodes.Equals(prevAvailableRegionCodes) || !this.availableRegionCodes.Contains(prevBestRegionCode))
+ {
+ return this.PingEnabledRegions();
+ }
+ if (prevBestRegionPing >= RegionPinger.PingWhenFailed)
+ {
+ return this.PingEnabledRegions();
+ }
+
+ // let's check only the preferred region to detect if it's still "good enough"
+ this.previousPing = prevBestRegionPing;
+
+
+ Region preferred = this.EnabledRegions.Find(r => r.Code.Equals(prevBestRegionCode));
+ RegionPinger singlePinger = new RegionPinger(preferred, this.OnPreferredRegionPinged);
+
+ lock (this.pingerList)
+ {
+ this.pingerList.Add(singlePinger);
+ }
+
+ singlePinger.Start();
+ return true;
+ }
+
+ private void OnPreferredRegionPinged(Region preferredRegion)
+ {
+ if (preferredRegion.Ping > this.previousPing * 1.50f)
+ {
+ this.PingEnabledRegions();
+ }
+ else
+ {
+ this.IsPinging = false;
+ this.onCompleteCall(this);
+ #if PING_VIA_COROUTINE
+ MonoBehaviourEmpty.SelfDestroy();
+ #endif
+ }
+ }
+
+
+ private bool PingEnabledRegions()
+ {
+ if (this.EnabledRegions == null || this.EnabledRegions.Count == 0)
+ {
+ //TODO: log
+ //Debug.LogError("No regions available. Maybe all got filtered out or the AppId is not correctly configured.");
+ return false;
+ }
+
+ lock (this.pingerList)
+ {
+ this.pingerList.Clear();
+
+ foreach (Region region in this.EnabledRegions)
+ {
+ RegionPinger rp = new RegionPinger(region, this.OnRegionDone);
+ this.pingerList.Add(rp);
+ rp.Start(); // TODO: check return value
+ }
+ }
+
+ return true;
+ }
+
+ private void OnRegionDone(Region region)
+ {
+ lock (this.pingerList)
+ {
+ if (this.IsPinging == false)
+ {
+ return;
+ }
+
+ this.bestRegionCache = null;
+ foreach (RegionPinger pinger in this.pingerList)
+ {
+ if (!pinger.Done)
+ {
+ return;
+ }
+ }
+
+ this.IsPinging = false;
+ }
+
+ this.onCompleteCall(this);
+ #if PING_VIA_COROUTINE
+ MonoBehaviourEmpty.SelfDestroy();
+ #endif
+ }
+ }
+
+ public class RegionPinger
+ {
+ public static int Attempts = 5;
+ public static int MaxMilliseconsPerPing = 800; // enter a value you're sure some server can beat (have a lower rtt)
+ public static int PingWhenFailed = Attempts * MaxMilliseconsPerPing;
+
+ private Region region;
+ private string regionAddress;
+ public int CurrentAttempt = 0;
+
+ public bool Done { get; private set; }
+ private Action onDoneCall;
+
+ private PhotonPing ping;
+
+ private List rttResults;
+
+ public RegionPinger(Region region, Action onDoneCallback)
+ {
+ this.region = region;
+ this.region.Ping = PingWhenFailed;
+ this.Done = false;
+ this.onDoneCall = onDoneCallback;
+ }
+
+ /// Selects the best fitting ping implementation or uses the one set in RegionHandler.PingImplementation.
+ /// PhotonPing instance to use.
+ private PhotonPing GetPingImplementation()
+ {
+ PhotonPing ping = null;
+
+ // using each type explicitly in the conditional code, makes sure Unity doesn't strip the class / constructor.
+
+ #if !UNITY_EDITOR && NETFX_CORE
+ if (RegionHandler.PingImplementation == null || RegionHandler.PingImplementation == typeof(PingWindowsStore))
+ {
+ ping = new PingWindowsStore();
+ }
+ #elif NATIVE_SOCKETS || NO_SOCKET
+ if (RegionHandler.PingImplementation == null || RegionHandler.PingImplementation == typeof(PingNativeDynamic))
+ {
+ ping = new PingNativeDynamic();
+ }
+ #elif UNITY_WEBGL
+ if (RegionHandler.PingImplementation == null || RegionHandler.PingImplementation == typeof(PingHttp))
+ {
+ ping = new PingHttp();
+ }
+ #else
+ if (RegionHandler.PingImplementation == null || RegionHandler.PingImplementation == typeof(PingMono))
+ {
+ ping = new PingMono();
+ }
+ #endif
+
+ if (ping == null)
+ {
+ if (RegionHandler.PingImplementation != null)
+ {
+ ping = (PhotonPing)Activator.CreateInstance(RegionHandler.PingImplementation);
+ }
+ }
+
+ return ping;
+ }
+
+
+ ///
+ /// Starts the ping routine for the assigned region.
+ ///
+ ///
+ /// Pinging runs in a ThreadPool worker item or (if needed) in a Thread.
+ /// WebGL runs pinging on the Main Thread as coroutine.
+ ///
+ /// Always true.
+ public bool Start()
+ {
+ // all addresses for Photon region servers will contain a :port ending. this needs to be removed first.
+ // PhotonPing.StartPing() requires a plain (IP) address without port or protocol-prefix (on all but Windows 8.1 and WebGL platforms).
+ string address = this.region.HostAndPort;
+ int indexOfColon = address.LastIndexOf(':');
+ if (indexOfColon > 1)
+ {
+ address = address.Substring(0, indexOfColon);
+ }
+ this.regionAddress = ResolveHost(address);
+
+
+ this.ping = this.GetPingImplementation();
+
+
+ this.Done = false;
+ this.CurrentAttempt = 0;
+ this.rttResults = new List(Attempts);
+
+
+ #if PING_VIA_COROUTINE
+ MonoBehaviourEmpty.Instance.StartCoroutine(this.RegionPingCoroutine());
+ #else
+ bool queued = false;
+ #if !NETFX_CORE
+ try
+ {
+ queued = ThreadPool.QueueUserWorkItem(o => this.RegionPingThreaded());
+ }
+ catch
+ {
+ queued = false;
+ }
+ #endif
+ if (!queued)
+ {
+ SupportClass.StartBackgroundCalls(this.RegionPingThreaded, 0, "RegionPing_" + this.region.Code + "_" + this.region.Cluster);
+ }
+ #endif
+
+
+ return true;
+ }
+
+
+ protected internal bool RegionPingThreaded()
+ {
+ this.region.Ping = PingWhenFailed;
+
+ int rttSum = 0;
+ int replyCount = 0;
+
+
+ Stopwatch sw = new Stopwatch();
+ for (this.CurrentAttempt = 0; this.CurrentAttempt < Attempts; this.CurrentAttempt++)
+ {
+ bool overtime = false;
+ sw.Reset();
+ sw.Start();
+
+ try
+ {
+ this.ping.StartPing(this.regionAddress);
+ }
+ catch (Exception e)
+ {
+ System.Diagnostics.Debug.WriteLine("RegionPinger.RegionPingThreaded() caught exception for ping.StartPing(). Exception: " + e + " Source: " + e.Source + " Message: " + e.Message);
+ break;
+ }
+
+
+ while (!this.ping.Done())
+ {
+ if (sw.ElapsedMilliseconds >= MaxMilliseconsPerPing)
+ {
+ overtime = true;
+ break;
+ }
+ #if !NETFX_CORE
+ System.Threading.Thread.Sleep(1);
+ #endif
+ }
+
+
+ sw.Stop();
+ int rtt = this.ping.Successful ? (int)sw.ElapsedMilliseconds : MaxMilliseconsPerPing; // if the reply didn't match the sent ping
+ this.rttResults.Add(rtt);
+
+ rttSum += rtt;
+ replyCount++;
+ this.region.Ping = (int)((rttSum) / replyCount);
+
+ #if !NETFX_CORE
+ int i = 4;
+ while (!this.ping.Done() && i > 0)
+ {
+ i--;
+ System.Threading.Thread.Sleep(100);
+ }
+ System.Threading.Thread.Sleep(10);
+ #endif
+ }
+
+
+ //Debug.Log("Done: "+ this.region.Code);
+ this.Done = true;
+ this.ping.Dispose();
+
+ int bestRtt = this.rttResults.Min();
+ int worstRtt = this.rttResults.Max();
+ int weighedRttSum = rttSum - worstRtt + bestRtt;
+ this.region.Ping = (int)(weighedRttSum / replyCount); // now, we can create a weighted ping value
+
+ this.onDoneCall(this.region);
+ return false;
+ }
+
+
+ #if SUPPORTED_UNITY
+
+ ///
+ /// Affected by frame-rate of app, as this Coroutine checks the socket for a result once per frame.
+ ///
+ protected internal IEnumerator RegionPingCoroutine()
+ {
+ this.region.Ping = PingWhenFailed;
+
+ int rttSum = 0;
+ int replyCount = 0;
+
+
+ Stopwatch sw = new Stopwatch();
+ for (this.CurrentAttempt = 0; this.CurrentAttempt < Attempts; this.CurrentAttempt++)
+ {
+ bool overtime = false;
+ sw.Reset();
+ sw.Start();
+
+ try
+ {
+ this.ping.StartPing(this.regionAddress);
+ }
+ catch (Exception e)
+ {
+ Debug.Log("RegionPinger.RegionPingCoroutine() caught exception for ping.StartPing(). Exception: " + e + " Source: " + e.Source + " Message: " + e.Message);
+ break;
+ }
+
+
+ while (!this.ping.Done())
+ {
+ if (sw.ElapsedMilliseconds >= MaxMilliseconsPerPing)
+ {
+ overtime = true;
+ break;
+ }
+
+ yield return new WaitForSecondsRealtime(0.01f); // keep this loop tight, to avoid adding local lag to rtt.
+ }
+
+
+ sw.Stop();
+ int rtt = this.ping.Successful ? (int)sw.ElapsedMilliseconds : MaxMilliseconsPerPing; // if the reply didn't match the sent ping
+ this.rttResults.Add(rtt);
+
+
+ rttSum += rtt;
+ replyCount++;
+ this.region.Ping = (int)((rttSum) / replyCount);
+
+ int i = 4;
+ while (!this.ping.Done() && i > 0)
+ {
+ i--;
+ yield return new WaitForSeconds(0.1f);
+ }
+
+ yield return new WaitForSeconds(0.1f);
+ }
+
+
+ //Debug.Log("Done: "+ this.region.Code);
+ this.Done = true;
+ this.ping.Dispose();
+ int bestRtt = this.rttResults.Min();
+ int worstRtt = this.rttResults.Max();
+ int weighedRttSum = rttSum - worstRtt + bestRtt;
+ this.region.Ping = (int)(weighedRttSum / replyCount); // now, we can create a weighted ping value
+ this.onDoneCall(this.region);
+ yield return null;
+ }
+
+ #endif
+
+
+
+ public string GetResults()
+ {
+ return string.Format("{0}: {1} ({2})", this.region.Code, this.region.Ping, this.rttResults.ToStringFull());
+ }
+
+ ///
+ /// Attempts to resolve a hostname into an IP string or returns empty string if that fails.
+ ///
+ ///
+ /// To be compatible with most platforms, the address family is checked like this:
+ /// if (ipAddress.AddressFamily.ToString().Contains("6")) // ipv6...
+ ///
+ /// Hostname to resolve.
+ /// IP string or empty string if resolution fails
+ public static string ResolveHost(string hostName)
+ {
+
+ if (hostName.StartsWith("wss://"))
+ {
+ hostName = hostName.Substring(6);
+ }
+ if (hostName.StartsWith("ws://"))
+ {
+ hostName = hostName.Substring(5);
+ }
+
+ string ipv4Address = string.Empty;
+
+ try
+ {
+ #if UNITY_WSA || NETFX_CORE || UNITY_WEBGL
+ return hostName;
+ #else
+
+ IPAddress[] address = Dns.GetHostAddresses(hostName);
+ if (address.Length == 1)
+ {
+ return address[0].ToString();
+ }
+
+ // if we got more addresses, try to pick a IPv6 one
+ // checking ipAddress.ToString() means we don't have to import System.Net.Sockets, which is not available on some platforms (Metro)
+ for (int index = 0; index < address.Length; index++)
+ {
+ IPAddress ipAddress = address[index];
+ if (ipAddress != null)
+ {
+ if (ipAddress.ToString().Contains(":"))
+ {
+ return ipAddress.ToString();
+ }
+ if (string.IsNullOrEmpty(ipv4Address))
+ {
+ ipv4Address = address.ToString();
+ }
+ }
+ }
+ #endif
+ }
+ catch (System.Exception e)
+ {
+ System.Diagnostics.Debug.WriteLine("RegionPinger.ResolveHost() caught an exception for Dns.GetHostAddresses(). Exception: " + e + " Source: " + e.Source + " Message: " + e.Message);
+ }
+
+ return ipv4Address;
+ }
+ }
+
+ #if PING_VIA_COROUTINE
+ internal class MonoBehaviourEmpty : MonoBehaviour
+ {
+ private static bool instanceSet; // to avoid instance null check which may be incorrect
+ private static MonoBehaviourEmpty instance;
+
+ public static MonoBehaviourEmpty Instance
+ {
+ get
+ {
+ if (instanceSet)
+ {
+ return instance;
+ }
+ GameObject go = new GameObject();
+ DontDestroyOnLoad(go);
+ go.name = "RegionPinger";
+ instance = go.AddComponent();
+ instanceSet = true;
+ return instance;
+ }
+ }
+
+ public static void SelfDestroy()
+ {
+ if (instanceSet)
+ {
+ instanceSet = false;
+ Destroy(instance.gameObject);
+ }
+ }
+ }
+ #endif
+}
diff --git a/Assets/Photon/PhotonRealtime/Code/RegionHandler.cs.meta b/Assets/Photon/PhotonRealtime/Code/RegionHandler.cs.meta
new file mode 100644
index 00000000..2e900019
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/RegionHandler.cs.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 207807222df026f40ac3688a3a051e38
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
diff --git a/Assets/Photon/PhotonRealtime/Code/Room.cs b/Assets/Photon/PhotonRealtime/Code/Room.cs
new file mode 100644
index 00000000..5f4036f5
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/Room.cs
@@ -0,0 +1,630 @@
+// ----------------------------------------------------------------------------
+//
+// Loadbalancing Framework for Photon - Copyright (C) 2018 Exit Games GmbH
+//
+//
+// The Room class resembles the properties known about the room in which
+// a game/match happens.
+//
+// developer@photonengine.com
+// ----------------------------------------------------------------------------
+
+#if UNITY_4_7 || UNITY_5 || UNITY_5_3_OR_NEWER
+#define SUPPORTED_UNITY
+#endif
+
+
+namespace Photon.Realtime
+{
+ using System;
+ using System.Collections;
+ 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
+
+
+ ///
+ /// This class represents a room a client joins/joined.
+ ///
+ ///
+ /// Contains a list of current players, their properties and those of this room, too.
+ /// A room instance has a number of "well known" properties like IsOpen, MaxPlayers which can be changed.
+ /// Your own, custom properties can be set via SetCustomProperties() while being in the room.
+ ///
+ /// Typically, this class should be extended by a game-specific implementation with logic and extra features.
+ ///
+ public class Room : RoomInfo
+ {
+ ///
+ /// A reference to the LoadBalancingClient which is currently keeping the connection and state.
+ ///
+ public LoadBalancingClient LoadBalancingClient { get; set; }
+
+ /// The name of a room. Unique identifier (per region and virtual appid) for a room/match.
+ /// The name can't be changed once it's set by the server.
+ public new string Name
+ {
+ get
+ {
+ return this.name;
+ }
+
+ internal set
+ {
+ this.name = value;
+ }
+ }
+
+ private bool isOffline;
+
+ public bool IsOffline
+ {
+ get
+ {
+ return isOffline;
+ }
+
+ private set
+ {
+ isOffline = value;
+ }
+ }
+
+ ///
+ /// Defines if the room can be joined.
+ ///
+ ///
+ /// This does not affect listing in a lobby but joining the room will fail if not open.
+ /// If not open, the room is excluded from random matchmaking.
+ /// Due to racing conditions, found matches might become closed while users are trying to join.
+ /// Simply re-connect to master and find another.
+ /// Use property "IsVisible" to not list the room.
+ ///
+ /// As part of RoomInfo this can't be set.
+ /// As part of a Room (which the player joined), the setter will update the server and all clients.
+ ///
+ public new bool IsOpen
+ {
+ get
+ {
+ return this.isOpen;
+ }
+
+ set
+ {
+ if (value != this.isOpen)
+ {
+ if (!this.isOffline)
+ {
+ this.LoadBalancingClient.OpSetPropertiesOfRoom(new Hashtable() { { GamePropertyKey.IsOpen, value } });
+ }
+ }
+
+ this.isOpen = value;
+ }
+ }
+
+ ///
+ /// Defines if the room is listed in its lobby.
+ ///
+ ///
+ /// Rooms can be created invisible, or changed to invisible.
+ /// To change if a room can be joined, use property: open.
+ ///
+ /// As part of RoomInfo this can't be set.
+ /// As part of a Room (which the player joined), the setter will update the server and all clients.
+ ///
+ public new bool IsVisible
+ {
+ get
+ {
+ return this.isVisible;
+ }
+
+ set
+ {
+ if (value != this.isVisible)
+ {
+ if (!this.isOffline)
+ {
+ this.LoadBalancingClient.OpSetPropertiesOfRoom(new Hashtable() { { GamePropertyKey.IsVisible, value } });
+ }
+ }
+
+ this.isVisible = value;
+ }
+ }
+
+ ///
+ /// Sets a limit of players to this room. This property is synced and shown in lobby, too.
+ /// If the room is full (players count == maxplayers), joining this room will fail.
+ ///
+ ///
+ /// As part of RoomInfo this can't be set.
+ /// As part of a Room (which the player joined), the setter will update the server and all clients.
+ ///
+ public new byte MaxPlayers
+ {
+ get
+ {
+ return this.maxPlayers;
+ }
+
+ set
+ {
+ if (value != this.maxPlayers)
+ {
+ if (!this.isOffline)
+ {
+ this.LoadBalancingClient.OpSetPropertiesOfRoom(new Hashtable() { { GamePropertyKey.MaxPlayers, value } });
+ }
+ }
+
+ this.maxPlayers = value;
+ }
+ }
+
+ /// The count of players in this Room (using this.Players.Count).
+ public new byte PlayerCount
+ {
+ get
+ {
+ if (this.Players == null)
+ {
+ return 0;
+ }
+
+ return (byte)this.Players.Count;
+ }
+ }
+
+ /// While inside a Room, this is the list of players who are also in that room.
+ private Dictionary players = new Dictionary();
+
+ /// While inside a Room, this is the list of players who are also in that room.
+ public Dictionary Players
+ {
+ get
+ {
+ return this.players;
+ }
+
+ private set
+ {
+ this.players = value;
+ }
+ }
+
+ ///
+ /// List of users who are expected to join this room. In matchmaking, Photon blocks a slot for each of these UserIDs out of the MaxPlayers.
+ ///
+ ///
+ /// The corresponding feature in Photon is called "Slot Reservation" and can be found in the doc pages.
+ /// Define expected players in the methods: , and .
+ ///
+ public string[] ExpectedUsers
+ {
+ get { return this.expectedUsers; }
+ }
+
+ /// Player Time To Live. How long any player can be inactive (due to disconnect or leave) before the user gets removed from the playerlist (freeing a slot).
+ public int PlayerTtl
+ {
+ get { return this.playerTtl; }
+
+ set
+ {
+ if (value != this.playerTtl)
+ {
+ if (!this.isOffline)
+ {
+ this.LoadBalancingClient.OpSetPropertyOfRoom(GamePropertyKey.PlayerTtl, value); // TODO: implement Offline Mode
+ }
+ }
+
+ this.playerTtl = value;
+ }
+ }
+
+ /// Room Time To Live. How long a room stays available (and in server-memory), after the last player becomes inactive. After this time, the room gets persisted or destroyed.
+ public int EmptyRoomTtl
+ {
+ get { return this.emptyRoomTtl; }
+
+ set
+ {
+ if (value != this.emptyRoomTtl)
+ {
+ if (!this.isOffline)
+ {
+ this.LoadBalancingClient.OpSetPropertyOfRoom(GamePropertyKey.EmptyRoomTtl, value); // TODO: implement Offline Mode
+ }
+ }
+
+ this.emptyRoomTtl = value;
+ }
+ }
+
+ ///
+ /// The ID (actorNumber, actorNumber) of the player who's the master of this Room.
+ /// Note: This changes when the current master leaves the room.
+ ///
+ public int MasterClientId { get { return this.masterClientId; } }
+
+ ///
+ /// Gets a list of custom properties that are in the RoomInfo of the Lobby.
+ /// This list is defined when creating the room and can't be changed afterwards. Compare: LoadBalancingClient.OpCreateRoom()
+ ///
+ /// You could name properties that are not set from the beginning. Those will be synced with the lobby when added later on.
+ public string[] PropertiesListedInLobby
+ {
+ get
+ {
+ return this.propertiesListedInLobby;
+ }
+
+ private set
+ {
+ this.propertiesListedInLobby = value;
+ }
+ }
+
+ ///
+ /// Gets if this room cleans up the event cache when a player (actor) leaves.
+ ///
+ ///
+ /// This affects which events joining players get.
+ ///
+ /// Set in room creation via RoomOptions.CleanupCacheOnLeave.
+ ///
+ /// Within PUN, auto cleanup of events means that cached RPCs and instantiated networked objects are deleted from the room.
+ ///
+ public bool AutoCleanUp
+ {
+ get
+ {
+ return this.autoCleanUp;
+ }
+ }
+
+ /// Define if the client who calls SetProperties should receive the properties update event or not.
+ public bool BroadcastPropertiesChangeToAll { get; private set; }
+ /// Define if Join and Leave events should not be sent to clients in the room.
+ public bool SuppressRoomEvents { get; private set; }
+ /// Extends SuppressRoomEvents: Define if Join and Leave events but also the actors' list and their respective properties should not be sent to clients.
+ public bool SuppressPlayerInfo { get; private set; }
+ /// Define if UserIds of the players are broadcast in the room. Useful for FindFriends and reserving slots for expected users.
+ public bool PublishUserId { get; private set; }
+ /// Define if actor or room properties with null values are removed on the server or kept.
+ public bool DeleteNullProperties { get; private set; }
+
+ #if SERVERSDK
+ /// Define if rooms should have unique UserId per actor and that UserIds are used instead of actor number in rejoin.
+ public bool CheckUserOnJoin { get; private set; }
+ #endif
+
+
+ /// Creates a Room (representation) with given name and properties and the "listing options" as provided by parameters.
+ /// Name of the room (can be null until it's actually created on server).
+ /// Room options.
+ public Room(string roomName, RoomOptions options, bool isOffline = false) : base(roomName, options != null ? options.CustomRoomProperties : null)
+ {
+ // base() sets name and (custom)properties. here we set "well known" properties
+ if (options != null)
+ {
+ this.isVisible = options.IsVisible;
+ this.isOpen = options.IsOpen;
+ this.maxPlayers = options.MaxPlayers;
+ this.propertiesListedInLobby = options.CustomRoomPropertiesForLobby;
+ //this.playerTtl = options.PlayerTtl; // set via well known properties
+ //this.emptyRoomTtl = options.EmptyRoomTtl; // set via well known properties
+ }
+
+ this.isOffline = isOffline;
+ }
+
+
+ /// Read (received) room option flags into related bool parameters.
+ /// This is for internal use. The operation response for join and create room operations is read this way.
+ ///
+ internal void InternalCacheRoomFlags(int roomFlags)
+ {
+ this.BroadcastPropertiesChangeToAll = (roomFlags & (int)RoomOptionBit.BroadcastPropsChangeToAll) != 0;
+ this.SuppressRoomEvents = (roomFlags & (int)RoomOptionBit.SuppressRoomEvents) != 0;
+ this.SuppressPlayerInfo = (roomFlags & (int)RoomOptionBit.SuppressPlayerInfo) != 0;
+ this.PublishUserId = (roomFlags & (int)RoomOptionBit.PublishUserId) != 0;
+ this.DeleteNullProperties = (roomFlags & (int)RoomOptionBit.DeleteNullProps) != 0;
+ #if SERVERSDK
+ this.CheckUserOnJoin = (roomFlags & (int)RoomOptionBit.CheckUserOnJoin) != 0;
+ #endif
+ this.autoCleanUp = (roomFlags & (int)RoomOptionBit.DeleteCacheOnLeave) != 0;
+ }
+
+ protected internal override void InternalCacheProperties(Hashtable propertiesToCache)
+ {
+ int oldMasterId = this.masterClientId;
+
+ base.InternalCacheProperties(propertiesToCache); // important: updating the properties fields has no way to do callbacks on change
+
+ if (oldMasterId != 0 && this.masterClientId != oldMasterId)
+ {
+ this.LoadBalancingClient.InRoomCallbackTargets.OnMasterClientSwitched(this.GetPlayer(this.masterClientId));
+ }
+ }
+
+ ///
+ /// Updates and synchronizes this Room's Custom Properties. Optionally, expectedProperties can be provided as condition.
+ ///
+ ///
+ /// Custom Properties are a set of string keys and arbitrary values which is synchronized
+ /// for the players in a Room. They are available when the client enters the room, as
+ /// they are in the response of OpJoin and OpCreate.
+ ///
+ /// Custom Properties either relate to the (current) Room or a Player (in that Room).
+ ///
+ /// Both classes locally cache the current key/values and make them available as
+ /// property: CustomProperties. This is provided only to read them.
+ /// You must use the method SetCustomProperties to set/modify them.
+ ///
+ /// Any client can set any Custom Properties anytime (when in a room).
+ /// It's up to the game logic to organize how they are best used.
+ ///
+ /// You should call SetCustomProperties only with key/values that are new or changed. This reduces
+ /// traffic and performance.
+ ///
+ /// Unless you define some expectedProperties, setting key/values is always permitted.
+ /// In this case, the property-setting client will not receive the new values from the server but
+ /// instead update its local cache in SetCustomProperties.
+ ///
+ /// If you define expectedProperties, the server will skip updates if the server property-cache
+ /// does not contain all expectedProperties with the same values.
+ /// In this case, the property-setting client will get an update from the server and update it's
+ /// cached key/values at about the same time as everyone else.
+ ///
+ /// The benefit of using expectedProperties can be only one client successfully sets a key from
+ /// one known value to another.
+ /// As example: Store who owns an item in a Custom Property "ownedBy". It's 0 initally.
+ /// When multiple players reach the item, they all attempt to change "ownedBy" from 0 to their
+ /// actorNumber. If you use expectedProperties {"ownedBy", 0} as condition, the first player to
+ /// take the item will have it (and the others fail to set the ownership).
+ ///
+ /// Properties get saved with the game state for Turnbased games (which use IsPersistent = true).
+ ///
+ /// Hashtable of Custom Properties that changes.
+ /// Provide some keys/values to use as condition for setting the new values. Client must be in room.
+ /// Defines if this SetCustomProperties-operation gets forwarded to your WebHooks. Client must be in room.
+ ///
+ /// False if propertiesToSet is null or empty or have zero string keys.
+ /// True in offline mode even if expectedProperties or webFlags are used.
+ /// Otherwise, returns if this operation could be sent to the server.
+ ///
+ public virtual bool SetCustomProperties(Hashtable propertiesToSet, Hashtable expectedProperties = null, WebFlags webFlags = null)
+ {
+ if (propertiesToSet == null || propertiesToSet.Count == 0)
+ {
+ return false;
+ }
+ Hashtable customProps = propertiesToSet.StripToStringKeys() as Hashtable;
+
+ if (this.isOffline)
+ {
+ if (customProps.Count == 0)
+ {
+ return false;
+ }
+ // Merge and delete values.
+ this.CustomProperties.Merge(customProps);
+ this.CustomProperties.StripKeysWithNullValues();
+
+ // invoking callbacks
+ this.LoadBalancingClient.InRoomCallbackTargets.OnRoomPropertiesUpdate(propertiesToSet);
+
+ }
+ else
+ {
+ // send (sync) these new values if in online room
+ return this.LoadBalancingClient.OpSetPropertiesOfRoom(customProps, expectedProperties, webFlags);
+ }
+
+ return true;
+ }
+
+ ///
+ /// Enables you to define the properties available in the lobby if not all properties are needed to pick a room.
+ ///
+ ///
+ /// Limit the amount of properties sent to users in the lobby to improve speed and stability.
+ ///
+ /// An array of custom room property names to forward to the lobby.
+ /// If the operation could be sent to the server.
+ public bool SetPropertiesListedInLobby(string[] lobbyProps)
+ {
+ if (this.isOffline)
+ {
+ return false;
+ }
+ Hashtable customProps = new Hashtable();
+ customProps[GamePropertyKey.PropsListedInLobby] = lobbyProps;
+ return this.LoadBalancingClient.OpSetPropertiesOfRoom(customProps);
+ }
+
+
+ ///
+ /// Removes a player from this room's Players Dictionary.
+ /// This is internally used by the LoadBalancing API. There is usually no need to remove players yourself.
+ /// This is not a way to "kick" players.
+ ///
+ protected internal virtual void RemovePlayer(Player player)
+ {
+ this.Players.Remove(player.ActorNumber);
+ player.RoomReference = null;
+ }
+
+ ///
+ /// Removes a player from this room's Players Dictionary.
+ ///
+ protected internal virtual void RemovePlayer(int id)
+ {
+ this.RemovePlayer(this.GetPlayer(id));
+ }
+
+ ///
+ /// Asks the server to assign another player as Master Client of your current room.
+ ///
+ ///
+ /// RaiseEvent has the option to send messages only to the Master Client of a room.
+ /// SetMasterClient affects which client gets those messages.
+ ///
+ /// This method calls an operation on the server to set a new Master Client, which takes a roundtrip.
+ /// In case of success, this client and the others get the new Master Client from the server.
+ ///
+ /// SetMasterClient tells the server which current Master Client should be replaced with the new one.
+ /// It will fail, if anything switches the Master Client moments earlier. There is no callback for this
+ /// error. All clients should get the new Master Client assigned by the server anyways.
+ ///
+ /// See also: MasterClientId
+ ///
+ /// The player to become the next Master Client.
+ /// False when this operation couldn't be done currently. Requires a v4 Photon Server.
+ public bool SetMasterClient(Player masterClientPlayer)
+ {
+ if (this.isOffline)
+ {
+ return false;
+ }
+ Hashtable newProps = new Hashtable() { { GamePropertyKey.MasterClientId, masterClientPlayer.ActorNumber } };
+ Hashtable prevProps = new Hashtable() { { GamePropertyKey.MasterClientId, this.MasterClientId } };
+ return this.LoadBalancingClient.OpSetPropertiesOfRoom(newProps, prevProps);
+ }
+
+ ///
+ /// Checks if the player is in the room's list already and calls StorePlayer() if not.
+ ///
+ /// The new player - identified by ID.
+ /// False if the player could not be added (cause it was in the list already).
+ public virtual bool AddPlayer(Player player)
+ {
+ if (!this.Players.ContainsKey(player.ActorNumber))
+ {
+ this.StorePlayer(player);
+ return true;
+ }
+
+ return false;
+ }
+
+ ///
+ /// Updates a player reference in the Players dictionary (no matter if it existed before or not).
+ ///
+ /// The Player instance to insert into the room.
+ public virtual Player StorePlayer(Player player)
+ {
+ this.Players[player.ActorNumber] = player;
+ player.RoomReference = this;
+
+ //// while initializing the room, the players are not guaranteed to be added in-order
+ //if (this.MasterClientId == 0 || player.ActorNumber < this.MasterClientId)
+ //{
+ // this.masterClientId = player.ActorNumber;
+ //}
+
+ return player;
+ }
+
+ ///
+ /// Tries to find the player with given actorNumber (a.k.a. ID).
+ /// Only useful when in a Room, as IDs are only valid per Room.
+ ///
+ /// ID to look for.
+ /// If true, the Master Client is returned for ID == 0.
+ /// The player with the ID or null.
+ public virtual Player GetPlayer(int id, bool findMaster = false)
+ {
+ int idToFind = (findMaster && id == 0) ? this.MasterClientId : id;
+
+ Player result = null;
+ this.Players.TryGetValue(idToFind, out result);
+
+ return result;
+ }
+
+ ///
+ /// Attempts to remove all current expected users from the server's Slot Reservation list.
+ ///
+ ///
+ /// Note that this operation can conflict with new/other users joining. They might be
+ /// adding users to the list of expected users before or after this client called ClearExpectedUsers.
+ ///
+ /// This room's expectedUsers value will update, when the server sends a successful update.
+ ///
+ /// Internals: This methods wraps up setting the ExpectedUsers property of a room.
+ ///
+ /// If the operation could be sent to the server.
+ public bool ClearExpectedUsers()
+ {
+ if (this.ExpectedUsers == null || this.ExpectedUsers.Length == 0)
+ {
+ return false;
+ }
+ return this.SetExpectedUsers(new string[0], this.ExpectedUsers);
+ }
+
+ ///
+ /// Attempts to update the expected users from the server's Slot Reservation list.
+ ///
+ ///
+ /// Note that this operation can conflict with new/other users joining. They might be
+ /// adding users to the list of expected users before or after this client called SetExpectedUsers.
+ ///
+ /// This room's expectedUsers value will update, when the server sends a successful update.
+ ///
+ /// Internals: This methods wraps up setting the ExpectedUsers property of a room.
+ ///
+ /// The new array of UserIDs to be reserved in the room.
+ /// If the operation could be sent to the server.
+ public bool SetExpectedUsers(string[] newExpectedUsers)
+ {
+ if (newExpectedUsers == null || newExpectedUsers.Length == 0)
+ {
+ this.LoadBalancingClient.DebugReturn(DebugLevel.ERROR, "newExpectedUsers array is null or empty, call Room.ClearExpectedUsers() instead if this is what you want.");
+ return false;
+ }
+ return this.SetExpectedUsers(newExpectedUsers, this.ExpectedUsers);
+ }
+
+ private bool SetExpectedUsers(string[] newExpectedUsers, string[] oldExpectedUsers)
+ {
+ if (this.isOffline)
+ {
+ return false;
+ }
+ Hashtable gameProperties = new Hashtable(1);
+ gameProperties.Add(GamePropertyKey.ExpectedUsers, newExpectedUsers);
+ Hashtable expectedProperties = null;
+ if (oldExpectedUsers != null)
+ {
+ expectedProperties = new Hashtable(1);
+ expectedProperties.Add(GamePropertyKey.ExpectedUsers, oldExpectedUsers);
+ }
+ return this.LoadBalancingClient.OpSetPropertiesOfRoom(gameProperties, expectedProperties);
+ }
+
+ /// Returns a summary of this Room instance as string.
+ /// Summary of this Room instance.
+ public override string ToString()
+ {
+ return string.Format("Room: '{0}' {1},{2} {4}/{3} players.", this.name, this.isVisible ? "visible" : "hidden", this.isOpen ? "open" : "closed", this.maxPlayers, this.PlayerCount);
+ }
+
+ /// Returns a summary of this Room instance as longer string, including Custom Properties.
+ /// Summary of this Room instance.
+ public new string ToStringFull()
+ {
+ return string.Format("Room: '{0}' {1},{2} {4}/{3} players.\ncustomProps: {5}", this.name, this.isVisible ? "visible" : "hidden", this.isOpen ? "open" : "closed", this.maxPlayers, this.PlayerCount, this.CustomProperties.ToStringFull());
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonRealtime/Code/Room.cs.meta b/Assets/Photon/PhotonRealtime/Code/Room.cs.meta
new file mode 100644
index 00000000..66ccb6ca
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/Room.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 17568a7a5552c09428dd48e73548b8b8
+labels:
+- ExitGames
+- PUN
+- Photon
+- Networking
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
diff --git a/Assets/Photon/PhotonRealtime/Code/RoomInfo.cs b/Assets/Photon/PhotonRealtime/Code/RoomInfo.cs
new file mode 100644
index 00000000..6d775452
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/RoomInfo.cs
@@ -0,0 +1,274 @@
+// ----------------------------------------------------------------------------
+//
+// Loadbalancing Framework for Photon - Copyright (C) 2018 Exit Games GmbH
+//
+//
+// This class resembles info about available rooms, as sent by the Master
+// server's lobby. Consider all values as readonly.
+//
+// developer@photonengine.com
+// ----------------------------------------------------------------------------
+
+#if UNITY_4_7 || UNITY_5 || UNITY_5_3_OR_NEWER
+#define SUPPORTED_UNITY
+#endif
+
+
+namespace Photon.Realtime
+{
+ using System.Collections;
+ using ExitGames.Client.Photon;
+
+ #if SUPPORTED_UNITY || NETFX_CORE
+ using Hashtable = ExitGames.Client.Photon.Hashtable;
+ using SupportClass = ExitGames.Client.Photon.SupportClass;
+ #endif
+
+
+ ///
+ /// A simplified room with just the info required to list and join, used for the room listing in the lobby.
+ /// The properties are not settable (IsOpen, MaxPlayers, etc).
+ ///
+ ///
+ /// This class resembles info about available rooms, as sent by the Master server's lobby.
+ /// Consider all values as readonly. None are synced (only updated by events by server).
+ ///
+ public class RoomInfo
+ {
+ /// Used in lobby, to mark rooms that are no longer listed (for being full, closed or hidden).
+ public bool RemovedFromList;
+
+ /// Backing field for property.
+ private Hashtable customProperties = new Hashtable();
+
+ /// Backing field for property.
+ protected byte maxPlayers = 0;
+
+ /// Backing field for property.
+ protected int emptyRoomTtl = 0;
+
+ /// Backing field for property.
+ protected int playerTtl = 0;
+
+ /// Backing field for property.
+ protected string[] expectedUsers;
+
+ /// Backing field for property.
+ protected bool isOpen = true;
+
+ /// Backing field for property.
+ protected bool isVisible = true;
+
+ /// Backing field for property. False unless the GameProperty is set to true (else it's not sent).
+ protected bool autoCleanUp = true;
+
+ /// Backing field for property.
+ protected string name;
+
+ /// Backing field for master client id (actorNumber). defined by server in room props and ev leave.
+ public int masterClientId;
+
+ /// Backing field for property.
+ protected string[] propertiesListedInLobby;
+
+ /// Read-only "cache" of custom properties of a room. Set via Room.SetCustomProperties (not available for RoomInfo class!).
+ /// All keys are string-typed and the values depend on the game/application.
+ ///
+ public Hashtable CustomProperties
+ {
+ get
+ {
+ return this.customProperties;
+ }
+ }
+
+ /// The name of a room. Unique identifier for a room/match (per AppId + game-Version).
+ public string Name
+ {
+ get
+ {
+ return this.name;
+ }
+ }
+
+ ///
+ /// Count of players currently in room. This property is overwritten by the Room class (used when you're in a Room).
+ ///
+ public int PlayerCount { get; private set; }
+
+ ///
+ /// The limit of players for this room. This property is shown in lobby, too.
+ /// If the room is full (players count == maxplayers), joining this room will fail.
+ ///
+ ///
+ /// As part of RoomInfo this can't be set.
+ /// As part of a Room (which the player joined), the setter will update the server and all clients.
+ ///
+ public byte MaxPlayers
+ {
+ get
+ {
+ return this.maxPlayers;
+ }
+ }
+
+ ///
+ /// Defines if the room can be joined.
+ /// This does not affect listing in a lobby but joining the room will fail if not open.
+ /// If not open, the room is excluded from random matchmaking.
+ /// Due to racing conditions, found matches might become closed even while you join them.
+ /// Simply re-connect to master and find another.
+ /// Use property "IsVisible" to not list the room.
+ ///
+ ///
+ /// As part of RoomInfo this can't be set.
+ /// As part of a Room (which the player joined), the setter will update the server and all clients.
+ ///
+ public bool IsOpen
+ {
+ get
+ {
+ return this.isOpen;
+ }
+ }
+
+ ///
+ /// Defines if the room is listed in its lobby.
+ /// Rooms can be created invisible, or changed to invisible.
+ /// To change if a room can be joined, use property: open.
+ ///
+ ///
+ /// As part of RoomInfo this can't be set.
+ /// As part of a Room (which the player joined), the setter will update the server and all clients.
+ ///
+ public bool IsVisible
+ {
+ get
+ {
+ return this.isVisible;
+ }
+ }
+
+ ///
+ /// Constructs a RoomInfo to be used in room listings in lobby.
+ ///
+ /// Name of the room and unique ID at the same time.
+ /// Properties for this room.
+ protected internal RoomInfo(string roomName, Hashtable roomProperties)
+ {
+ this.InternalCacheProperties(roomProperties);
+
+ this.name = roomName;
+ }
+
+ ///
+ /// Makes RoomInfo comparable (by name).
+ ///
+ public override bool Equals(object other)
+ {
+ RoomInfo otherRoomInfo = other as RoomInfo;
+ return (otherRoomInfo != null && this.Name.Equals(otherRoomInfo.name));
+ }
+
+ ///
+ /// Accompanies Equals, using the name's HashCode as return.
+ ///
+ ///
+ public override int GetHashCode()
+ {
+ return this.name.GetHashCode();
+ }
+
+
+ /// Returns most interesting room values as string.
+ /// Summary of this RoomInfo instance.
+ public override string ToString()
+ {
+ return string.Format("Room: '{0}' {1},{2} {4}/{3} players.", this.name, this.isVisible ? "visible" : "hidden", this.isOpen ? "open" : "closed", this.maxPlayers, this.PlayerCount);
+ }
+
+ /// Returns most interesting room values as string, including custom properties.
+ /// Summary of this RoomInfo instance.
+ public string ToStringFull()
+ {
+ return string.Format("Room: '{0}' {1},{2} {4}/{3} players.\ncustomProps: {5}", this.name, this.isVisible ? "visible" : "hidden", this.isOpen ? "open" : "closed", this.maxPlayers, this.PlayerCount, this.customProperties.ToStringFull());
+ }
+
+ /// Copies "well known" properties to fields (IsVisible, etc) and caches the custom properties (string-keys only) in a local hashtable.
+ /// New or updated properties to store in this RoomInfo.
+ protected internal virtual void InternalCacheProperties(Hashtable propertiesToCache)
+ {
+ if (propertiesToCache == null || propertiesToCache.Count == 0 || this.customProperties.Equals(propertiesToCache))
+ {
+ return;
+ }
+
+ // check of this game was removed from the list. in that case, we don't
+ // need to read any further properties
+ // list updates will remove this game from the game listing
+ if (propertiesToCache.ContainsKey(GamePropertyKey.Removed))
+ {
+ this.RemovedFromList = (bool)propertiesToCache[GamePropertyKey.Removed];
+ if (this.RemovedFromList)
+ {
+ return;
+ }
+ }
+
+ // fetch the "well known" properties of the room, if available
+ if (propertiesToCache.ContainsKey(GamePropertyKey.MaxPlayers))
+ {
+ this.maxPlayers = (byte)propertiesToCache[GamePropertyKey.MaxPlayers];
+ }
+
+ if (propertiesToCache.ContainsKey(GamePropertyKey.IsOpen))
+ {
+ this.isOpen = (bool)propertiesToCache[GamePropertyKey.IsOpen];
+ }
+
+ if (propertiesToCache.ContainsKey(GamePropertyKey.IsVisible))
+ {
+ this.isVisible = (bool)propertiesToCache[GamePropertyKey.IsVisible];
+ }
+
+ if (propertiesToCache.ContainsKey(GamePropertyKey.PlayerCount))
+ {
+ this.PlayerCount = (int)((byte)propertiesToCache[GamePropertyKey.PlayerCount]);
+ }
+
+ if (propertiesToCache.ContainsKey(GamePropertyKey.CleanupCacheOnLeave))
+ {
+ this.autoCleanUp = (bool)propertiesToCache[GamePropertyKey.CleanupCacheOnLeave];
+ }
+
+ if (propertiesToCache.ContainsKey(GamePropertyKey.MasterClientId))
+ {
+ this.masterClientId = (int)propertiesToCache[GamePropertyKey.MasterClientId];
+ }
+
+ if (propertiesToCache.ContainsKey(GamePropertyKey.PropsListedInLobby))
+ {
+ this.propertiesListedInLobby = propertiesToCache[GamePropertyKey.PropsListedInLobby] as string[];
+ }
+
+ if (propertiesToCache.ContainsKey((byte)GamePropertyKey.ExpectedUsers))
+ {
+ this.expectedUsers = (string[])propertiesToCache[GamePropertyKey.ExpectedUsers];
+ }
+
+ if (propertiesToCache.ContainsKey((byte)GamePropertyKey.EmptyRoomTtl))
+ {
+ this.emptyRoomTtl = (int)propertiesToCache[GamePropertyKey.EmptyRoomTtl];
+ }
+
+ if (propertiesToCache.ContainsKey((byte)GamePropertyKey.PlayerTtl))
+ {
+ this.playerTtl = (int)propertiesToCache[GamePropertyKey.PlayerTtl];
+ }
+
+ // merge the custom properties (from your application) to the cache (only string-typed keys will be kept)
+ this.customProperties.MergeStringKeys(propertiesToCache);
+ this.customProperties.StripKeysWithNullValues();
+ }
+ }
+}
diff --git a/Assets/Photon/PhotonRealtime/Code/RoomInfo.cs.meta b/Assets/Photon/PhotonRealtime/Code/RoomInfo.cs.meta
new file mode 100644
index 00000000..a1188f0c
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/RoomInfo.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 71760b65ad7d5b842942c797a0366fa7
+labels:
+- ExitGames
+- PUN
+- Photon
+- Networking
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
diff --git a/Assets/Photon/PhotonRealtime/Code/SupportLogger.cs b/Assets/Photon/PhotonRealtime/Code/SupportLogger.cs
new file mode 100644
index 00000000..36fb0dd0
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/SupportLogger.cs
@@ -0,0 +1,434 @@
+// ----------------------------------------------------------------------------
+//
+// Loadbalancing Framework for Photon - Copyright (C) 2018 Exit Games GmbH
+//
+//
+// Implements callbacks of the Realtime API to logs selected information
+// for support cases.
+//
+// developer@photonengine.com
+// ----------------------------------------------------------------------------
+
+
+
+#if UNITY_4_7 || UNITY_5 || UNITY_5_3_OR_NEWER
+#define SUPPORTED_UNITY
+#endif
+
+
+namespace Photon.Realtime
+{
+ using System;
+ using System.Text;
+ using System.Collections;
+ using System.Collections.Generic;
+
+ using Stopwatch = System.Diagnostics.Stopwatch;
+
+ using ExitGames.Client.Photon;
+
+ #if SUPPORTED_UNITY
+ using UnityEngine;
+ #endif
+
+ #if SUPPORTED_UNITY || NETFX_CORE
+ using Hashtable = ExitGames.Client.Photon.Hashtable;
+ using SupportClass = ExitGames.Client.Photon.SupportClass;
+ #endif
+
+ ///
+ /// Helper class to debug log basic information about Photon client and vital traffic statistics.
+ ///
+ ///
+ /// Set SupportLogger.Client for this to work.
+ ///
+ #if SUPPORTED_UNITY
+ [DisallowMultipleComponent]
+ #if PUN_2_OR_NEWER || FUSION_UNITY
+ [AddComponentMenu("")] // hide from Unity Menus and searches
+ #endif
+ public class SupportLogger : MonoBehaviour, IConnectionCallbacks , IMatchmakingCallbacks , IInRoomCallbacks, ILobbyCallbacks, IErrorInfoCallback
+ #else
+ public class SupportLogger : IConnectionCallbacks, IInRoomCallbacks, IMatchmakingCallbacks , ILobbyCallbacks
+ #endif
+ {
+ ///
+ /// Toggle to enable or disable traffic statistics logging.
+ ///
+ public bool LogTrafficStats = true;
+ //private bool loggedStillOfflineMessage;
+
+ private LoadBalancingClient client;
+
+ private Stopwatch startStopwatch;
+
+ /// helps skip the initial OnApplicationPause call, which is not really of interest on start
+ private bool initialOnApplicationPauseSkipped = false;
+
+ private int pingMax;
+ private int pingMin;
+
+ ///
+ /// Photon client to log information and statistics from.
+ ///
+ public LoadBalancingClient Client
+ {
+ get { return this.client; }
+ set
+ {
+ if (this.client != value)
+ {
+ if (this.client != null)
+ {
+ this.client.RemoveCallbackTarget(this);
+ }
+ this.client = value;
+ if (this.client != null)
+ {
+ this.client.AddCallbackTarget(this);
+ }
+ }
+ }
+ }
+
+
+ #if SUPPORTED_UNITY
+ protected void Start()
+ {
+ this.LogBasics();
+
+ if (this.startStopwatch == null)
+ {
+ this.startStopwatch = new Stopwatch();
+ this.startStopwatch.Start();
+ }
+ }
+
+ protected void OnDestroy()
+ {
+ this.Client = null; // will remove this SupportLogger as callback target
+ }
+
+ protected void OnApplicationPause(bool pause)
+ {
+ if (!this.initialOnApplicationPauseSkipped)
+ {
+ this.initialOnApplicationPauseSkipped = true;
+ return;
+ }
+
+ Debug.Log(string.Format("{0} SupportLogger OnApplicationPause({1}). Client: {2}.", this.GetFormattedTimestamp(), pause, this.client == null ? "null" : this.client.State.ToString()));
+ }
+
+ protected void OnApplicationQuit()
+ {
+ this.CancelInvoke();
+ }
+ #endif
+
+ public void StartLogStats()
+ {
+ #if SUPPORTED_UNITY
+ this.InvokeRepeating("LogStats", 10, 10);
+ #else
+ Debug.Log("Not implemented for non-Unity projects.");
+ #endif
+ }
+
+ public void StopLogStats()
+ {
+ #if SUPPORTED_UNITY
+ this.CancelInvoke("LogStats");
+ #else
+ Debug.Log("Not implemented for non-Unity projects.");
+ #endif
+ }
+
+ private void StartTrackValues()
+ {
+ #if SUPPORTED_UNITY
+ this.InvokeRepeating("TrackValues", 0.5f, 0.5f);
+ #else
+ Debug.Log("Not implemented for non-Unity projects.");
+ #endif
+ }
+
+ private void StopTrackValues()
+ {
+ #if SUPPORTED_UNITY
+ this.CancelInvoke("TrackValues");
+ #else
+ Debug.Log("Not implemented for non-Unity projects.");
+ #endif
+ }
+
+ private string GetFormattedTimestamp()
+ {
+ if (this.startStopwatch == null)
+ {
+ this.startStopwatch = new Stopwatch();
+ this.startStopwatch.Start();
+ }
+
+ TimeSpan span = this.startStopwatch.Elapsed;
+ if (span.Minutes > 0)
+ {
+ return string.Format("[{0}:{1}.{1}]", span.Minutes, span.Seconds, span.Milliseconds);
+ }
+
+ return string.Format("[{0}.{1}]", span.Seconds, span.Milliseconds);
+ }
+
+
+ // called via InvokeRepeatedly
+ private void TrackValues()
+ {
+ if (this.client != null)
+ {
+ int currentRtt = this.client.LoadBalancingPeer.RoundTripTime;
+ if (currentRtt > this.pingMax)
+ {
+ this.pingMax = currentRtt;
+ }
+ if (currentRtt < this.pingMin)
+ {
+ this.pingMin = currentRtt;
+ }
+ }
+ }
+
+
+ ///
+ /// Debug logs vital traffic statistics about the attached Photon Client.
+ ///
+ public void LogStats()
+ {
+ if (this.client == null || this.client.State == ClientState.PeerCreated)
+ {
+ return;
+ }
+
+ if (this.LogTrafficStats)
+ {
+ Debug.Log(string.Format("{0} SupportLogger {1} Ping min/max: {2}/{3}", this.GetFormattedTimestamp() , this.client.LoadBalancingPeer.VitalStatsToString(false) , this.pingMin , this.pingMax));
+ }
+ }
+
+ ///
+ /// Debug logs basic information (AppId, AppVersion, PeerID, Server address, Region) about the attached Photon Client.
+ ///
+ private void LogBasics()
+ {
+ if (this.client != null)
+ {
+ List buildProperties = new List(10);
+ #if SUPPORTED_UNITY
+ buildProperties.Add(Application.unityVersion);
+ buildProperties.Add(Application.platform.ToString());
+ #endif
+ #if ENABLE_IL2CPP
+ buildProperties.Add("ENABLE_IL2CPP");
+ #endif
+ #if ENABLE_MONO
+ buildProperties.Add("ENABLE_MONO");
+ #endif
+ #if DEBUG
+ buildProperties.Add("DEBUG");
+ #endif
+ #if MASTER
+ buildProperties.Add("MASTER");
+ #endif
+ #if NET_4_6
+ buildProperties.Add("NET_4_6");
+ #endif
+ #if NET_STANDARD_2_0
+ buildProperties.Add("NET_STANDARD_2_0");
+ #endif
+ #if NETFX_CORE
+ buildProperties.Add("NETFX_CORE");
+ #endif
+ #if NET_LEGACY
+ buildProperties.Add("NET_LEGACY");
+ #endif
+ #if UNITY_64
+ buildProperties.Add("UNITY_64");
+ #endif
+ #if UNITY_FUSION
+ buildProperties.Add("UNITY_FUSION");
+ #endif
+
+
+ StringBuilder sb = new StringBuilder();
+
+ string appIdShort = string.IsNullOrEmpty(this.client.AppId) || this.client.AppId.Length < 8 ? this.client.AppId : string.Concat(this.client.AppId.Substring(0, 8), "***");
+
+ sb.AppendFormat("{0} SupportLogger Info: ", this.GetFormattedTimestamp());
+ sb.AppendFormat("AppID: \"{0}\" AppVersion: \"{1}\" Client: v{2} ({4}) Build: {3} ", appIdShort, this.client.AppVersion, PhotonPeer.Version, string.Join(", ", buildProperties.ToArray()), this.client.LoadBalancingPeer.TargetFramework);
+ if (this.client != null && this.client.LoadBalancingPeer != null && this.client.LoadBalancingPeer.SocketImplementation != null)
+ {
+ sb.AppendFormat("Socket: {0} ", this.client.LoadBalancingPeer.SocketImplementation.Name);
+ }
+
+ sb.AppendFormat("UserId: \"{0}\" AuthType: {1} AuthMode: {2} {3} ", this.client.UserId, (this.client.AuthValues != null) ? this.client.AuthValues.AuthType.ToString() : "N/A", this.client.AuthMode, this.client.EncryptionMode);
+
+ sb.AppendFormat("State: {0} ", this.client.State);
+ sb.AppendFormat("PeerID: {0} ", this.client.LoadBalancingPeer.PeerID);
+ sb.AppendFormat("NameServer: {0} Current Server: {1} IP: {2} Region: {3} ", this.client.NameServerHost, this.client.CurrentServerAddress, this.client.LoadBalancingPeer.ServerIpAddress, this.client.CloudRegion);
+
+ Debug.LogWarning(sb.ToString());
+ }
+ }
+
+
+ public void OnConnected()
+ {
+ Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnConnected().");
+ this.pingMax = 0;
+ this.pingMin = this.client.LoadBalancingPeer.RoundTripTime;
+ this.LogBasics();
+
+ if (this.LogTrafficStats)
+ {
+ this.client.LoadBalancingPeer.TrafficStatsEnabled = false;
+ this.client.LoadBalancingPeer.TrafficStatsEnabled = true;
+ this.StartLogStats();
+ }
+
+ this.StartTrackValues();
+ }
+
+ public void OnConnectedToMaster()
+ {
+ Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnConnectedToMaster().");
+ }
+
+ public void OnFriendListUpdate(List friendList)
+ {
+ Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnFriendListUpdate(friendList).");
+ }
+
+ public void OnJoinedLobby()
+ {
+ Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnJoinedLobby(" + this.client.CurrentLobby + ").");
+ }
+
+ public void OnLeftLobby()
+ {
+ Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnLeftLobby().");
+ }
+
+ public void OnCreateRoomFailed(short returnCode, string message)
+ {
+ Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnCreateRoomFailed(" + returnCode+","+message+").");
+ }
+
+ public void OnJoinedRoom()
+ {
+ Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnJoinedRoom(" + this.client.CurrentRoom + "). " + this.client.CurrentLobby + " GameServer:" + this.client.GameServerAddress);
+ }
+
+ public void OnJoinRoomFailed(short returnCode, string message)
+ {
+ Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnJoinRoomFailed(" + returnCode+","+message+").");
+ }
+
+ public void OnJoinRandomFailed(short returnCode, string message)
+ {
+ Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnJoinRandomFailed(" + returnCode+","+message+").");
+ }
+
+ public void OnCreatedRoom()
+ {
+ Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnCreatedRoom(" + this.client.CurrentRoom + "). " + this.client.CurrentLobby + " GameServer:" + this.client.GameServerAddress);
+ }
+
+ public void OnLeftRoom()
+ {
+ Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnLeftRoom().");
+ }
+
+ public void OnDisconnected(DisconnectCause cause)
+ {
+ this.StopLogStats();
+ this.StopTrackValues();
+
+ Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnDisconnected(" + cause + ").");
+ this.LogBasics();
+ this.LogStats();
+ }
+
+ public void OnRegionListReceived(RegionHandler regionHandler)
+ {
+ Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnRegionListReceived(regionHandler).");
+ }
+
+ public void OnRoomListUpdate(List roomList)
+ {
+ Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnRoomListUpdate(roomList). roomList.Count: " + roomList.Count);
+ }
+
+ public void OnPlayerEnteredRoom(Player newPlayer)
+ {
+ Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnPlayerEnteredRoom(" + newPlayer+").");
+ }
+
+ public void OnPlayerLeftRoom(Player otherPlayer)
+ {
+ Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnPlayerLeftRoom(" + otherPlayer+").");
+ }
+
+ public void OnRoomPropertiesUpdate(Hashtable propertiesThatChanged)
+ {
+ Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnRoomPropertiesUpdate(propertiesThatChanged).");
+ }
+
+ public void OnPlayerPropertiesUpdate(Player targetPlayer, Hashtable changedProps)
+ {
+ Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnPlayerPropertiesUpdate(targetPlayer,changedProps).");
+ }
+
+ public void OnMasterClientSwitched(Player newMasterClient)
+ {
+ Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnMasterClientSwitched(" + newMasterClient+").");
+ }
+
+ public void OnCustomAuthenticationResponse(Dictionary data)
+ {
+ Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnCustomAuthenticationResponse(" + data.ToStringFull()+").");
+ }
+
+ public void OnCustomAuthenticationFailed (string debugMessage)
+ {
+ Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnCustomAuthenticationFailed(" + debugMessage+").");
+ }
+
+ public void OnLobbyStatisticsUpdate(List lobbyStatistics)
+ {
+ Debug.Log(this.GetFormattedTimestamp() + " SupportLogger OnLobbyStatisticsUpdate(lobbyStatistics).");
+ }
+
+
+ #if !SUPPORTED_UNITY
+ private static class Debug
+ {
+ public static void Log(string msg)
+ {
+ System.Diagnostics.Debug.WriteLine(msg);
+ }
+ public static void LogWarning(string msg)
+ {
+ System.Diagnostics.Debug.WriteLine(msg);
+ }
+ public static void LogError(string msg)
+ {
+ System.Diagnostics.Debug.WriteLine(msg);
+ }
+ }
+ #endif
+
+ public void OnErrorInfo(ErrorInfo errorInfo)
+ {
+ Debug.LogError(errorInfo.ToString());
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/Photon/PhotonRealtime/Code/SupportLogger.cs.meta b/Assets/Photon/PhotonRealtime/Code/SupportLogger.cs.meta
new file mode 100644
index 00000000..7e8b7ccb
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/SupportLogger.cs.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 9b61c60d38639484ebbd7f2100dd3d08
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
diff --git a/Assets/Photon/PhotonRealtime/Code/Unity.meta b/Assets/Photon/PhotonRealtime/Code/Unity.meta
new file mode 100644
index 00000000..96bf0eed
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/Unity.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: fa14aa576f7e18f4bb6c4c93368a235d
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonRealtime/Code/Unity/Editor.meta b/Assets/Photon/PhotonRealtime/Code/Unity/Editor.meta
new file mode 100644
index 00000000..4d10118c
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/Unity/Editor.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: a02814c0303a60f488813e6111993aaa
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Photon/PhotonRealtime/Code/Unity/Editor/AccountService.cs b/Assets/Photon/PhotonRealtime/Code/Unity/Editor/AccountService.cs
new file mode 100644
index 00000000..e3f2397b
--- /dev/null
+++ b/Assets/Photon/PhotonRealtime/Code/Unity/Editor/AccountService.cs
@@ -0,0 +1,260 @@
+// ----------------------------------------------------------------------------
+//
+// Photon Cloud Account Service - Copyright (C) 2012 Exit Games GmbH
+//
+//
+// Provides methods to register a new user-account for the Photon Cloud and
+// get the resulting appId.
+//
+// developer@exitgames.com
+// ----------------------------------------------------------------------------
+
+#if UNITY_2017_4_OR_NEWER
+#define SUPPORTED_UNITY
+#endif
+
+
+#if UNITY_EDITOR
+
+namespace Photon.Realtime
+{
+ using System;
+ using UnityEngine;
+ using System.Collections.Generic;
+ using System.Text.RegularExpressions;
+ using ExitGames.Client.Photon;
+
+
+ ///
+ /// Creates a instance of the Account Service to register Photon Cloud accounts.
+ ///
+ public class AccountService
+ {
+ private const string ServiceUrl = "https://partner.photonengine.com/api/{0}/User/RegisterEx";
+
+ private readonly Dictionary RequestHeaders = new Dictionary
+ {
+ { "Content-Type", "application/json" },
+ { "x-functions-key", "" }
+ };
+
+ private const string DefaultContext = "Unity";
+
+ private const string DefaultToken = "VQ920wVUieLHT9c3v1ZCbytaLXpXbktUztKb3iYLCdiRKjUagcl6eg==";
+
+ ///
+ /// third parties custom context, if null, defaults to DefaultContext property value
+ ///
+ public string CustomContext = null; // "PartnerCode" on the server
+
+ ///
+ /// third parties custom token. If null, defaults to DefaultToken property value
+ ///
+ public string CustomToken = null;
+
+ ///
+ /// If this AccountService instance is currently waiting for a response. While pending, RegisterByEmail is blocked.
+ ///
+ public bool RequestPendingResult = false;
+
+ ///
+ /// Attempts to create a Photon Cloud Account asynchronously. Blocked while RequestPendingResult is true.
+ ///
+ ///
+ /// Once your callback is called, check ReturnCode, Message and AppId to get the result of this attempt.
+ ///
+ /// Email of the account.
+ /// Defines which type of Photon-service is being requested.
+ /// Called when the result is available.
+ /// Called when the request failed.
+ /// Can be used to identify the origin of the registration (which package is being used).
+ public bool RegisterByEmail(string email, List serviceTypes, Action callback = null, Action errorCallback = null, string origin = null)
+ {
+ if (this.RequestPendingResult)
+ {
+ Debug.LogError("Registration request pending result. Not sending another.");
+ return false;
+ }
+
+ if (!IsValidEmail(email))
+ {
+ Debug.LogErrorFormat("Email \"{0}\" is not valid", email);
+ return false;
+ }
+
+ string serviceTypeString = GetServiceTypesFromList(serviceTypes);
+ if (string.IsNullOrEmpty(serviceTypeString))
+ {
+ Debug.LogError("serviceTypes string is null or empty");
+ return false;
+ }
+
+ string fullUrl = GetUrlWithQueryStringEscaped(email, serviceTypeString, origin);
+
+ RequestHeaders["x-functions-key"] = string.IsNullOrEmpty(CustomToken) ? DefaultToken : CustomToken;
+
+
+ this.RequestPendingResult = true;
+
+ PhotonEditorUtils.StartCoroutine(
+ PhotonEditorUtils.HttpPost(fullUrl,
+ RequestHeaders,
+ null,
+ s =>
+ {
+ this.RequestPendingResult = false;
+ //Debug.LogWarningFormat("received response {0}", s);
+ if (string.IsNullOrEmpty(s))
+ {
+ if (errorCallback != null)
+ {
+ errorCallback("Server's response was empty. Please register through account website during this service interruption.");
+ }
+ }
+ else
+ {
+ AccountServiceResponse ase = this.ParseResult(s);
+ if (ase == null)
+ {
+ if (errorCallback != null)
+ {
+ errorCallback("Error parsing registration response. Please try registering from account website");
+ }
+ }
+ else if (callback != null)
+ {
+ callback(ase);
+ }
+ }
+ },
+ e =>
+ {
+ this.RequestPendingResult = false;
+ if (errorCallback != null)
+ {
+ errorCallback(e);
+ }
+ })
+ );
+ return true;
+ }
+
+
+ private string GetUrlWithQueryStringEscaped(string email, string serviceTypes, string originAv)
+ {
+ string emailEscaped = UnityEngine.Networking.UnityWebRequest.EscapeURL(email);
+ string st = UnityEngine.Networking.UnityWebRequest.EscapeURL(serviceTypes);
+ string uv = UnityEngine.Networking.UnityWebRequest.EscapeURL(Application.unityVersion);
+ string serviceUrl = string.Format(ServiceUrl, string.IsNullOrEmpty(CustomContext) ? DefaultContext : CustomContext );
+
+ return string.Format("{0}?email={1}&st={2}&uv={3}&av={4}", serviceUrl, emailEscaped, st, uv, originAv);
+ }
+
+ ///
+ /// Reads the Json response and applies it to local properties.
+ ///
+ ///
+ private AccountServiceResponse ParseResult(string result)
+ {
+ try
+ {
+ AccountServiceResponse res = JsonUtility.FromJson(result);
+ // Unity's JsonUtility does not support deserializing Dictionary, we manually parse it, dirty & ugly af, better then using a 3rd party lib
+ if (res.ReturnCode == AccountServiceReturnCodes.Success)
+ {
+ string[] parts = result.Split(new[] { "\"ApplicationIds\":{" }, StringSplitOptions.RemoveEmptyEntries);
+ parts = parts[1].Split('}');
+ string applicationIds = parts[0];
+ if (!string.IsNullOrEmpty(applicationIds))
+ {
+ parts = applicationIds.Split(new[] { ',', '"', ':' }, StringSplitOptions.RemoveEmptyEntries);
+ res.ApplicationIds = new Dictionary(parts.Length / 2);
+ for (int i = 0; i < parts.Length; i = i + 2)
+ {
+ res.ApplicationIds.Add(parts[i], parts[i + 1]);
+ }
+ }
+ else
+ {
+ Debug.LogError("The server did not return any AppId, ApplicationIds was empty in the response.");
+ return null;
+ }
+ }
+ return res;
+ }
+ catch (Exception ex) // probably JSON parsing exception, check if returned string is valid JSON
+ {
+ Debug.LogException(ex);
+ return null;
+ }
+ }
+
+ ///
+ /// Turns the list items to a comma separated string. Returns null if list is null or empty.
+ ///
+ /// List of service types.
+ /// Returns null if list is null or empty.
+ private static string GetServiceTypesFromList(List appTypes)
+ {
+ if (appTypes == null || appTypes.Count <= 0)
+ {
+ return null;
+ }
+
+ string serviceTypes = ((int)appTypes[0]).ToString();
+ for (int i = 1; i < appTypes.Count; i++)
+ {
+ int appType = (int)appTypes[i];
+ serviceTypes = string.Format("{0},{1}", serviceTypes, appType);
+ }
+
+ return serviceTypes;
+ }
+
+ // RFC2822 compliant matching 99.9% of all email addresses in actual use today
+ // according to http://www.regular-expressions.info/email.html [22.02.2012]
+ private static Regex reg = new Regex("^((?>[a-zA-Z\\d!#$%&'*+\\-/=?^_{|}~]+\\x20*|\"((?=[\\x01-\\x7f])[^\"\\]|\\[\\x01-\\x7f])*\"\\x20*)*(?<))?((?!\\.)(?>\\.?[a-zA-Z\\d!#$%&'*+\\-/=?^_{|}~]+)+|\"((?=[\\x01-\\x7f])[^\"\\]|\\[\\x01-\\x7f])*\")@(((?!-)[a-zA-Z\\d\\-]+(?)$",
+ RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
+ public static bool IsValidEmail(string mailAddress)
+ {
+ if (string.IsNullOrEmpty(mailAddress))
+ {
+ return false;
+ }
+ var result = reg.Match(mailAddress);
+ return result.Success;
+ }
+ }
+
+ [Serializable]
+ public class AccountServiceResponse
+ {
+ public int ReturnCode;
+ public string Message;
+ public Dictionary