Example #1
0
    void Awake()
    {
        // Prevent multiple instances of Lumos from existing.
        // Necessary because DontDestroyOnLoad keeps the object between scenes.
        if (instance != null)
        {
            LumosUnity.Debug.Log("Destroying duplicate game object instance.");
            Destroy(gameObject);
            return;
        }

        credentials = LumosCredentials.Load();

        if (credentials == null || credentials.apiKey == null || credentials.apiKey == "")
        {
            LumosUnity.Debug.LogError("The Lumos API key is not set. Do this in the Lumos pane in Unity's preferences.", true);
            Destroy(gameObject);
            return;
        }

        instance = this;

        // Shorten the timer interval while developers are testing
        if (runWhileInEditor && Application.isEditor)
        {
            timerInterval = 3;
        }

        DontDestroyOnLoad(this);
    }
    void CheckLumosInstall()
    {
        var credentials = LumosCredentials.Load();

        if (credentials.apiKey.Length != 36)
        {
            errorMessage = apiKeyMissing;
        }
    }
Example #3
0
    /// <summary>
    /// Gets the user's Lumos credentials, creating a new object if necessary.
    /// </summary>
    /// <returns>Lumos credentials.</returns>
    public static LumosCredentials GetCredentials()
    {
        if (credentials == null)
        {
            credentials = LumosCredentials.Load();

            if (credentials == null)
            {
                credentials = CreateCredentials();
            }
        }

        return(credentials);
    }
Example #4
0
 public static bool HasCredentialsFile()
 {
     credentials = LumosCredentials.Load();
     return(credentials != null);
 }