public static void Initialize()
 {
     if (_instance == null)
     {
         GameObject ActionHandler = new GameObject();
         _instance = ActionHandler.AddComponent<MainThread>();
         ActionHandler.name = "StormancerActionHandler";
         DontDestroyOnLoad(ActionHandler);
     }
 }
Ejemplo n.º 2
0
        public void Log(Stormancer.Diagnostics.LogLevel logLevel, string category, string message, object context = null)
        {
            MainThread.Post(() => {
                switch (logLevel)
                {
                case Diagnostics.LogLevel.Fatal:
                case Diagnostics.LogLevel.Error:
                    UnityEngine.Debug.LogError(logLevel.ToString() + ": " + category + ": " + message);
                    break;

                case Diagnostics.LogLevel.Warn:
                    UnityEngine.Debug.LogWarning(logLevel.ToString() + ": " + category + ": " + message);
                    break;

                default:
                    UnityEngine.Debug.Log(logLevel.ToString() + ": " + category + ": " + message);
                    break;
                }
            });
        }
Ejemplo n.º 3
0
        void Awake()
        {
            ClientProvider.SetAccountId(AccountId);
            ClientProvider.SetApplicationName(ApplicationName);

            if (ServerEndpoints.Any())
            {
                ClientProvider.SetServerEndpoint(ServerEndpoints);
            }

            if (AuthenticationPlugin)
            {
                ClientProvider.ActivateAuthenticationPlugin();
            }
            if (MatchmakingPlugin)
            {
                ClientProvider.ActivateMatchmakingPlugin();
            }
            if (TransactionBrokerPlugin)
            {
                ClientProvider.ActivateTransactionBrokerPlugin();
            }

            if (ServerClockPlugin)
            {
                ClientProvider.ActivateServerClockPlugin();
            }

            if (LeaderboardPlugin)
            {
                ClientProvider.ActivateLeaderboardPlugin();
            }

            if (ChatPlugin)
            {
                ClientProvider.ActivateChatPlugin();
            }

            if (FriendsPlugin)
            {
                ClientProvider.ActivateFriendsPlugin();
            }

            if (ClientSettings)
            {
                ClientProvider.ActivateClientSettingsPlugin();
            }

            if (GameVersion)
            {
                ClientProvider.ActivateGameVersionPlugin();
            }

            if (DebugLog)
            {
                ClientProvider.ActivateDebugLog();
            }

            if (OnDisconnected != null)
            {
                ClientProvider.OnDisconnected += (s => MainThread.Post(() => OnDisconnected.Invoke(s)));
            }
        }