// ----------------------------------------------------------------------- // // 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_4_7 || UNITY_5 || UNITY_5_3_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 the Chat Api. public string AppIdChat; /// AppId for use in the Voice Api. 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; /// 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 network level protocol to use. public ConnectionProtocol Protocol = ConnectionProtocol.Udp; /// 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("IsBestRegion: {0} IsDefaultNameServer: {1} IsDefaultPort: {2}", this.IsBestRegion, this.IsDefaultNameServer, this.IsDefaultPort); } } }